<!--

    Copyright (C) 2020 eXo Platform SAS.

    This is free software; you can redistribute it and/or modify it
    under the terms of the GNU Lesser General Public License as
    published by the Free Software Foundation; either version 2.1 of
    the License, or (at your option) any later version.

    This software is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public
    License along with this software; if not, write to the Free
    Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
    02110-1301 USA, or see the FSF site: http://www.fsf.org.

-->
<repository-service default-repository="${gatein.jcr.repository.default:repository}">
	<repositories>
		<repository name="${gatein.jcr.repository.default:repository}" system-workspace="${gatein.jcr.workspace.system:system}" default-workspace="${gatein.jcr.workspace.default:collaboration}">
			<security-domain>${portal.container.realm}</security-domain>
			<access-control>optional</access-control>
			<session-max-age>${gatein.jcr.sessionregistry.sessionmaxage:300}</session-max-age>
			<authentication-policy>org.exoplatform.services.jcr.impl.core.access.JAASAuthenticator</authentication-policy>
			<workspaces>
				<!-- System -->
				<workspace name="system">
					<container class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.CQJDBCWorkspaceDataContainer">
						<properties>
							<property name="source-name" value="${gatein.jcr.datasource.name}${container.name.suffix}"/>
							<property name="dialect" value="${gatein.jcr.datasource.dialect}"/>
							<property name="db-structure-type" value="${gatein.jcr.db-structure-type}"/>
							<property name="update-storage" value="true"/>
							<property name="max-buffer-size" value="204800"/>
							<property name="swap-directory" value="${gatein.jcr.data.dir}/swap/system${container.name.suffix}"/>
							<property name="acl-bloomfilter-enabled" value="${gatein.jcr.bloomfilter.system.enabled:true}"/>
						</properties>
						<value-storages>
							<value-storage id="system" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
								<properties>
									<property name="path" value="${gatein.jcr.storage.data.dir}/system${container.name.suffix}"/>
									<property name="enabled" value="${gatein.jcr.storage.enabled:true}"/>
								</properties>
								<filters>
									<filter property-type="Binary"/>
								</filters>
							</value-storage>
						</value-storages>
					</container>
					<initializer class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
						<properties>
							<property name="root-nodetype" value="nt:unstructured"/>
							<property name="root-permissions" value="*:/platform/administrators read;*:/platform/administrators add_node;*:/platform/administrators set_property;*:/platform/administrators remove"/>
						</properties>
					</initializer>
					<cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.infinispan.ISPNCacheWorkspaceStorageCache">
						<properties>
							<property name="infinispan-configuration" value="${gatein.jcr.cache.config}"/>
							<property name="jgroups-configuration" value="${gatein.jcr.jgroups.config}"/>
							<property name="infinispan-cluster-name" value="jcr${container.name.suffix}"/>
						</properties>
					</cache>
					<query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
						<properties>
							<property name="index-dir" value="${exo.jcr.index.rsync-entry-path}/repository/system${container.name.suffix}"/>
							<property name="index-recovery-strategy" value="${exo.jcr.index.rsync-strategy:rsync-with-delete}"/>
							<property name="changesfilter-class" value="${gatein.jcr.index.changefilterclass}"/>
							<property name="infinispan-configuration" value="${gatein.jcr.index.cache.config}"/>
							<property name="jgroups-configuration" value="${gatein.jcr.jgroups.config}"/>
							<property name="infinispan-cluster-name" value="jcrindexer${container.name.suffix}"/>
							<property name="max-volatile-time" value="60"/>
              <property name="indexing-configuration-path" value="jar:/conf/jcr/indexing/system-indexing-configuration.xml" />
              <property name="reindexing-page-size" value="1000"/>
							<property name="rsync-entry-name" value="${exo.jcr.index.rsync-entry-name:index}" />
							<property name="rsync-entry-path" value="${exo.jcr.index.rsync-entry-path}" />
							<property name="rsync-port" value="${exo.jcr.index.rsync-port:8085}" />
							<property name="rsync-user" value="${exo.jcr.index.rsync-user}" />
							<property name="rsync-password" value="${exo.jcr.index.rsync-password}" />
							<property name="rsync-offline" value="${exo.jcr.index.rsync-offline:true}" />
						</properties>
					</query-handler>
					<lock-manager class="org.exoplatform.services.jcr.impl.core.lock.infinispan.ISPNCacheableLockManagerImpl">
						<properties>
							<property name="time-out" value="15m"/>
							<property name="infinispan-configuration" value="${gatein.jcr.lock.cache.config}"/>
							<property name="jgroups-configuration" value="${gatein.jcr.jgroups.config}"/>
							<property name="infinispan-cluster-name" value="jcrlock${container.name.suffix}"/>
							<property name="infinispan-cl-cache.jdbc.table.name" value="lk"/>
							<property name="infinispan-cl-cache.jdbc.table.create" value="true"/>
							<property name="infinispan-cl-cache.jdbc.table.drop" value="false"/>
							<property name="infinispan-cl-cache.jdbc.id.column" value="id" />
							<property name="infinispan-cl-cache.jdbc.data.column" value="data" />
							<property name="infinispan-cl-cache.jdbc.timestamp.column" value="timestamp" />
							<property name="infinispan-cl-cache.jdbc.datasource" value="${gatein.jcr.datasource.name}${container.name.suffix}"/>
							<property name="infinispan-cl-cache.jdbc.connectionFactory" value="org.infinispan.loaders.jdbc.connectionfactory.ManagedConnectionFactory" />
							<property name="infinispan-cl-cache.jdbc.dialect" value="${gatein.jcr.datasource.dialect}" />
						</properties>
					</lock-manager>
				</workspace>
        <!-- Collboation -->
        <workspace name="collaboration">
          <container class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.CQJDBCWorkspaceDataContainer">
            <properties>
              <property name="source-name" value="${gatein.jcr.datasource.name}${container.name.suffix}"/>
              <property name="dialect" value="${gatein.jcr.datasource.dialect}"/>
              <property name="db-structure-type" value="${gatein.jcr.db-structure-type}"/>
              <property name="update-storage" value="true"/>
              <property name="max-buffer-size" value="204800"/>
              <property name="swap-directory" value="${gatein.jcr.data.dir}/swap/collaboration${container.name.suffix}"/>
              <property name="db-tablename-suffix" value="COLLAB"/>
              <property name="acl-bloomfilter-enabled" value="${gatein.jcr.bloomfilter.collaboration.enabled:true}"/>
            </properties>
            <value-storages>
              <value-storage id="collaboration" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
                <properties>
                  <property name="path" value="${gatein.jcr.storage.data.dir}/collaboration${container.name.suffix}"/>
                  <property name="enabled" value="${gatein.jcr.storage.enabled:true}"/>
                </properties>
                <filters>
                  <filter property-type="Binary"/>
                </filters>
              </value-storage>
            </value-storages>
          </container>
          <initializer class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
            <properties>
              <property name="root-nodetype" value="nt:unstructured"/>
              <property name="root-permissions" value="any read;*:/platform/administrators read;*:/platform/administrators add_node;*:/platform/administrators set_property;*:/platform/administrators remove"/>
            </properties>
          </initializer>
          <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.infinispan.ISPNCacheWorkspaceStorageCache">
            <properties>
              <property name="infinispan-configuration" value="${gatein.jcr.cache.config}"/>
              <property name="jgroups-configuration" value="${gatein.jcr.jgroups.config}"/>
              <property name="infinispan-cluster-name" value="jcr${container.name.suffix}"/>
            </properties>
          </cache>
          <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
            <properties>
              <property name="index-dir" value="${exo.jcr.index.rsync-entry-path}/repository/collaboration${container.name.suffix}"/>
              <property name="index-recovery-strategy" value="${exo.jcr.index.rsync-strategy:rsync-with-delete}"/>
              <property name="changesfilter-class" value="${gatein.jcr.index.changefilterclass}"/>
              <property name="infinispan-configuration" value="${gatein.jcr.index.cache.config}"/>
              <property name="jgroups-configuration" value="${gatein.jcr.jgroups.config}"/>
              <property name="infinispan-cluster-name" value="jcrindexer${container.name.suffix}"/>
              <property name="max-volatile-time" value="60"/>
              <property name="support-highlighting" value="true"/>
              <property name="excerptprovider-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.DefaultHTMLExcerpt"/>
              <property name="analyzer" value="org.exoplatform.services.jcr.analyzer.IgnoreAccentAnalyzer"/>
              <property name="indexing-configuration-path" value="jar:/conf/jcr/indexing/collaboration-indexing-configuration.xml" />
              <property name="reindexing-page-size" value="1000"/>
              <property name="rsync-entry-name" value="${exo.jcr.index.rsync-entry-name:index}"/>
              <property name="rsync-entry-path" value="${exo.jcr.index.rsync-entry-path}"/>
              <property name="rsync-port" value="${exo.jcr.index.rsync-port:8085}"/>
              <property name="rsync-user" value="${exo.jcr.index.rsync-user}"/>
              <property name="rsync-password" value="${exo.jcr.index.rsync-password}"/>
              <property name="rsync-offline" value="${exo.jcr.index.rsync-offline:true}"/>
            </properties>
          </query-handler>
          <lock-manager class="org.exoplatform.services.jcr.impl.core.lock.infinispan.ISPNCacheableLockManagerImpl">
            <properties>
              <property name="time-out" value="15m"/>
              <property name="infinispan-configuration" value="${gatein.jcr.lock.cache.config}"/>
              <property name="jgroups-configuration" value="${gatein.jcr.jgroups.config}"/>
              <property name="infinispan-cluster-name" value="jcrlock${container.name.suffix}"/>
              <property name="infinispan-cl-cache.jdbc.table.name" value="lk"/>
              <property name="infinispan-cl-cache.jdbc.table.create" value="true"/>
              <property name="infinispan-cl-cache.jdbc.table.drop" value="false"/>
              <property name="infinispan-cl-cache.jdbc.id.column" value="id"/>
              <property name="infinispan-cl-cache.jdbc.data.column" value="data"/>
              <property name="infinispan-cl-cache.jdbc.timestamp.column" value="timestamp"/>
              <property name="infinispan-cl-cache.jdbc.datasource" value="${gatein.jcr.datasource.name}${container.name.suffix}"/>
              <property name="infinispan-cl-cache.jdbc.connectionFactory" value="org.infinispan.loaders.jdbc.connectionfactory.ManagedConnectionFactory"/>
              <property name="infinispan-cl-cache.jdbc.dialect" value="${gatein.jcr.datasource.dialect}"/>
            </properties>
          </lock-manager>
        </workspace>
			</workspaces>
		</repository>
	</repositories>
</repository-service>
