JCR allows using persister to store configuration. In this section, you will understand how to use and configure JCR persister.
On startup RepositoryServiceConfiguration
component checks if a configuration persister was configured. In that
case, it uses the provided ConfigurationPersister
implementation class to instantiate the persister object.
The configuration file is located in
portal/WEB-INF/conf/jcr/jcr-configuration.xml
in the portal web application.
Configuration with persister:
<component>
<key>org.exoplatform.services.jcr.config.RepositoryServiceConfiguration</key>
<type>org.exoplatform.services.jcr.impl.config.RepositoryServiceConfigurationImpl</type>
<init-params>
<value-param>
<name>conf-path</name>
<description>JCR configuration file</description>
<value>war:/conf/jcr/repository-configuration.xml</value>
</value-param>
<properties-param>
<name>working-conf</name>
<description>working-conf</description>
<property name="persister-class-name" value="org.exoplatform.services.jcr.impl.config.JDBCConfigurationPersister" />
<property name="source-name" value="${gatein.jcr.datasource.name}${container.name.suffix}"/>
<property name="dialect" value="${gatein.jcr.datasource.dialect}"/>
</properties-param>
</init-params>
</component>
| |
| |
|
If you want to customize, you can implement ConfigurationPersister
interface as follows:
/**
* Init persister.
* Used by RepositoryServiceConfiguration on init.
* @return - config data stream
*/
void init(PropertiesParam params) throws RepositoryConfigurationException;
/**
* Read config data.
* @return - config data stream
*/
InputStream read() throws RepositoryConfigurationException;
/**
* Create table, write data.
* @param confData - config data stream
*/
void write(InputStream confData) throws RepositoryConfigurationException;
/**
* Tell if the config exists.
* @return - flag
*/
boolean hasConfig() throws RepositoryConfigurationException;