Now you can add new JCR repositories or workspaces thanks to an external plugin, the configuration of your JCR Repositories will be merged knowing that the merge algorithm will:
Add missing Repository Definitions and/or Workspace Definitions.
Change the properties of a Repository Definition if it has already been defined.
Replace the Workspace Definition if it has already been defined.
See an example of jcr-configuration.xml below:
<?xml version="1.0" encoding="ISO-8859-1"?>
<configuration
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.exoplatform.org/xml/ns/kernel_1_2.xsd http://www.exoplatform.org/xml/ns/kernel_1_2.xsd"
xmlns="http://www.exoplatform.org/xml/ns/kernel_1_2.xsd">
<external-component-plugins>
<!-- The full qualified name of the RepositoryServiceConfiguration -->
<target-component>org.exoplatform.services.jcr.config.RepositoryServiceConfiguration</target-component>
<component-plugin>
<!-- The name of the plugin -->
<name>Sample RepositoryServiceConfiguration Plugin</name>
<!-- The name of the method to call on the RepositoryServiceConfiguration in order to add the RepositoryServiceConfigurations -->
<set-method>addConfig</set-method>
<!-- The full qualified name of the RepositoryServiceConfigurationPlugin -->
<type>org.exoplatform.services.jcr.impl.config.RepositoryServiceConfigurationPlugin</type>
<init-params>
<value-param>
<name>conf-path</name>
<description>JCR configuration file</description>
<value>war:/conf/sample-ext/jcr/repository-configuration.xml</value>
</value-param>
</init-params>
</component-plugin>
</external-component-plugins>
</configuration>
See an example of repository-configuration.xml below:
<repository-service default-repository="repository">
<repositories>
<repository name="repository" system-workspace="system" default-workspace="portal-system">
<security-domain>exo-domain</security-domain>
<access-control>optional</access-control>
<authentication-policy>org.exoplatform.services.jcr.impl.core.access.JAASAuthenticator</authentication-policy>
<workspaces>
<workspace name="sample-ws">
<container class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
<properties>
<property name="source-name" value="jdbcexo${container.name.suffix}" />
<property name="dialect" value="hsqldb" />
<property name="multi-db" value="false" />
<property name="update-storage" value="true" />
<property name="max-buffer-size" value="204800" />
<property name="swap-directory" value="../temp/swap/sample-ws${container.name.suffix}" />
</properties>
<value-storages>
<value-storage id="sample-ws" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
<properties>
<property name="path" value="../temp/values/sample-ws${container.name.suffix}" />
</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">
<properties>
<property name="max-size" value="20000" />
<property name="live-time" value="30000" />
</properties>
</cache>
<query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
<properties>
<property name="index-dir" value="../temp/jcrlucenedb/sample-ws${container.name.suffix}" />
</properties>
</query-handler>
<lock-manager>
<time-out>15m</time-out><!-- 15min -->
<persister class="org.exoplatform.services.jcr.impl.core.lock.FileSystemLockPersister">
<properties>
<property name="path" value="../temp/lock/sample-ws${container.name.suffix}" />
</properties>
</persister>
</lock-manager>
</workspace>
</workspaces>
</repository>
</repositories>
</repository-service>
If you have to change the default repository or the default workspace, please be careful since it could cause side effects as you could be incompatible with some portal configuration files that refer explicitly to portal-system and/or to repository. To solve this problem you can either redefine the configuration file in a portal extension to change the workspace name and/or the repository name or you could also add your own repository instead of your own workspace.