2.1.2. JCR configuration persister

Warning

You are looking at documentation for an older release. Not what you want? See the current release documentation.

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>
(1)    <description>working-conf</description>
(2)    <property name="persister-class-name" value="org.exoplatform.services.jcr.impl.config.JDBCConfigurationPersister" />
(3)    <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>

1

persister-class-name - Class name of ConfigurationPersister interface implementation.

2

source-name: JNDI source name configured in InitialContextInitializer component. Find more in database configuration.

3

dialect: SQL dialect which will be used with database fromsource-name. Find more in database configuration.

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;
  
Copyright ©. All rights reserved. eXo Platform SAS
blog comments powered byDisqus