JBoss.orgCommunity Documentation

Chapter 3. eXo JCR configuration

3.1. Related documents
3.2. Portal and Standalone configuration
3.2.1. JCR Configuration
3.2.2. Repository service configuration

Like other eXo services eXo JCR can be configured and used in portal or embedded mode (as a service embedded in eXo Portal) and in standalone mode.

In Embedded mode, JCR services are registered in the Portal container and the second option is to use a Standalone container. The main difference between these container types is that the first one is intended to be used in a Portal (Web) environment, while the second one can be used standalone (TODO see the comprehensive page Service Configuration for Beginners for more details).

The following setup procedure is used to obtain a Standalone configuration (TODO find more in Container configuration):

JCR service configuration looks like:

<component>
    <key>org.exoplatform.services.jcr.RepositoryService</key>
    <type>org.exoplatform.services.jcr.impl.RepositoryServiceImpl</type>
  </component>
  <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 repositories configuration file</description>
        <value>jar:/conf/standalone/exo-jcr-config.xml</value>
      </value-param>
      <properties-param>
        <name>working-conf</name>
        <description>working-conf</description>
        <property name="source-name" value="jdbcjcr" />
        <property name="dialect" value="hsqldb" />
        <property name="persister-class-name" value="org.exoplatform.services.jcr.impl.config.JDBCConfigurationPersister" />
      </properties-param>
    </init-params>
  </component>

conf-path : a path to a RepositoryService JCR Configuration

working-conf : optional; JCR configuration persister configuration. If there isn't a working-conf the persister will be disabled

Default configuration of the Repository Service located in jar:/conf/portal/exo-jcr-config.xml, it will be available for portal and standalone modes.

In portal mode it is overriden and located in the portal web application portal/WEB-INF/conf/jcr/repository-configuration.xml.

Example of Repository Service configuration for standalone mode:

<repository-service default-repository="repository">
   <repositories>
      <repository name="db1" system-workspace="ws" default-workspace="ws">
         <security-domain>exo-domain</security-domain>
         <access-control>optional</access-control>
         <session-max-age>1h</session-max-age>
         <authentication-policy>org.exoplatform.services.jcr.impl.core.access.JAASAuthenticator</authentication-policy>
         <workspaces>
            <workspace name="production">
               <!-- for system storage -->
               <container class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.CQJDBCWorkspaceDataContainer">
                  <properties>
                     <property name="source-name" value="jdbcjcr" />
                     <property name="multi-db" value="false" />
                     <property name="update-storage" value="false" />
                     <property name="max-buffer-size" value="200k" />
                     <property name="swap-directory" value="../temp/swap/production" />
                  </properties>
                  <value-storages>
                     <value-storage id="system" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
                        <properties>
                           <property name="path" value="../temp/values/production" />
                        </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" />
                  </properties>
               </initializer>
               <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl">
                  <properties>
                     <property name="max-size" value="10k" />
                     <property name="live-time" value="1h" />
                  </properties>
               </cache>
               <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
                  <properties>
                     <property name="index-dir" value="../temp/jcrlucenedb/production" />
                  </properties>
               </query-handler>
               <lock-manager>
                  <time-out>15m</time-out>
                  <persister class="org.exoplatform.services.jcr.impl.core.lock.FileSystemLockPersister">
                     <properties>
                        <property name="path" value="../temp/lock/system" />
                     </properties>
                  </persister>
               </lock-manager>
            </workspace>

            <workspace name="backup">
               <container class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.CQJDBCWorkspaceDataContainer">
                  <properties>
                     <property name="source-name" value="jdbcjcr" />
                     <property name="multi-db" value="false" />
                     <property name="update-storage" value="false" />
                     <property name="max-buffer-size" value="200k" />
                     <property name="swap-directory" value="../temp/swap/backup" />
                  </properties>
                  <value-storages>
                     <value-storage id="draft" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
                        <properties>
                           <property name="path" value="../temp/values/backup" />
                        </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" />
                  </properties>
               </initializer>
               <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl">
                  <properties>
                     <property name="max-size" value="10k" />
                     <property name="live-time" value="1h" />
                  </properties>
               </cache>
               <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
                  <properties>
                     <property name="index-dir" value="../temp/jcrlucenedb/backup" />
                  </properties>
               </query-handler>
            </workspace>
          </workspaces>
       </repository>
   </repositories>
</repository-service>

Repository Service configuration:

default-repository - the name of a default repository (one returned by RepositoryService.getRepository())

repositories - the list of repositories

Repository configuration:

name - the name of a repository

default-workspace - the name of a workspace obtained using Session's login() or login(Credentials) methods (ones without an explicit workspace name)

system-workspace - name of workspace where /jcr:system node is placed

security-domain - the name of a security domain for JAAS authentication

access-control - the name of an access control policy. There can be 3 types: optional - ACL is created on-demand(default), disable - no access control, mandatory - an ACL is created for each added node(not supported yet)

authentication-policy - the name of an authentication policy class

workspaces - the list of workspaces

session-max-age - the time after which an idle session will be removed (called logout). If not set, the idle session will never be removed.

Workspace configuration:

name - the name of a workspace

auto-init-root-nodetype - DEPRECATED in JCR 1.9 (use initializer). The node type for root node initialization

container - workspace data container (physical storage) configuration

initializer - workspace initializer configuration

cache - workspace storage cache configuration

query-handler - query handler configuration

Workspace data container configuration:

class - A workspace data container class name

properties - the list of properties (name-value pairs) for the concrete Workspace data container

value-storages - the list of value storage plugins

Value Storage plugin configuration (optional feature):

value-storage - Optional value Storage plugin definition

class- a value storage plugin class name (attribute)

properties - the list of properties (name-value pairs) for a concrete Value Storage plugin

filters - the list of filters defining conditions when this plugin is applicable

Initializer configuration (optional):

class - initializer implementation class.

properties - the list of properties (name-value pairs). Properties are supported:

root-nodetype - The node type for root node initialization

root-permissions - Default permissions of the root node. It is defined as a set of semicolon-delimited permissions containing a group of space-delimited identities (user, group etc, see Organization service documentation for details) and the type of permission. For example any read;:/admin read;:/admin add_node;:/admin set_property;:/admin remove means that users from group admin have all permissions and other users have only a 'read' permission.

Configurable initializer adds a capability to override workspace initial startup procedure.

Cache configuration:

enabled - if workspace cache is enabled

class - cache implementation class, optional from 1.9. Default value is org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl.

Cache can be configured to use concrete implementation of WorkspaceStorageCache interface. JCR core has two implementation to use: * LinkedWorkspaceStorageCacheImpl - default, with configurable read behavior and statistic. * WorkspaceStorageCacheImpl - pre 1.9, still can be used.

properties - the list of properties (name-value pairs) for Workspace cache:

max-size - cache maximum size.

live-time - cached item live time.

LinkedWorkspaceStorageCacheImpl supports additional optional parameters TODO

Query Handler configuration:

class - A Query Handler class name

properties - the list of properties (name-value pairs) for a Query Handler (indexDir) properties and advanced features described in *Search Configuration*

Lock Manager configuration:

time-out - time after which the unused global lock will be removed.

persister - a class for storing lock information for future use. For example, remove lock after jcr restart.

path - a lock folder, each workspace has its own.

Configuration definition:

<!ELEMENT repository-service (repositories)>
  <!ATTLIST repository-service default-repository NMTOKEN #REQUIRED>
  <!ELEMENT repositories (repository)>
  <!ELEMENT repository (security-domain,access-control,session-max-age,authentication-policy,workspaces)>
  <!ATTLIST repository
	default-workspace NMTOKEN #REQUIRED
	name NMTOKEN #REQUIRED
	system-workspace NMTOKEN #REQUIRED
  >
  <!ELEMENT security-domain (#PCDATA)>
  <!ELEMENT access-control (#PCDATA)>
  <!ELEMENT session-max-age (#PCDATA)>
  <!ELEMENT authentication-policy (#PCDATA)>
  <!ELEMENT workspaces (workspace+)>
  <!ELEMENT workspace (container,initializer,cache,query-handler)>
  <!ATTLIST workspace name NMTOKEN #REQUIRED>
  <!ELEMENT container (properties,value-storages)>
  <!ATTLIST container class NMTOKEN #REQUIRED>
  <!ELEMENT value-storages (value-storage+)>
  <!ELEMENT value-storage (properties,filters)>
  <!ATTLIST value-storage class NMTOKEN #REQUIRED>
  <!ELEMENT filters (filter+)>
  <!ELEMENT filter EMPTY>
  <!ATTLIST filter property-type NMTOKEN #REQUIRED>
  <!ELEMENT initializer (properties)>
  <!ATTLIST initializer class NMTOKEN #REQUIRED>
  <!ELEMENT cache (properties)>
  <!ATTLIST cache 
        enabled NMTOKEN #REQUIRED
        class NMTOKEN #REQUIRED
  >
  <!ELEMENT query-handler (properties)>
  <!ATTLIST query-handler class NMTOKEN #REQUIRED>
  <!ELEMENT access-manager (properties)>
  <!ATTLIST access-manager class NMTOKEN #REQUIRED>
  <!ELEMENT lock-manager (time-out,persister)>
  <!ELEMENT time-out (#PCDATA)>
  <!ELEMENT persister (properties)>
  <!ELEMENT properties (property+)>
  <!ELEMENT property EMPTY>