JBoss.orgCommunity Documentation
eXo JCR supports J2EE Connector Architecture 1.5, thus If you would like to delegate the JCR Session lifecycle to your application server, you can use the JCA Resource Adapter for eXo JCR if your application server supports JCA 1.5. This adapter only supports XA Transaction, in other words you cannot use it for local transactions. Since the JCR Sessions have not been designed to be shareable, the session pooling is simply not covered by the adapter.
The equivalent of the javax.resource.cci.ConnectionFactory in JCA terminology is org.exoplatform.connectors.jcr.adapter.SessionFactory in the context of eXo JCR, the resource that you will get thanks to a JNDI lookup is of type SessionFactory and provides the following methods:
/** * Get a JCR session corresponding to the repository * defined in the configuration and the default workspace. * @return a JCR session corresponding to the criteria * @throws RepositoryException if the session could not be created */ Session getSession() throws RepositoryException; /** * Get a JCR session corresponding to the repository * defined in the configuration and the default workspace, using * the given user name and password. * @param userName the user name to use for the authentication * @param password the password to use for the authentication * @return a JCR session corresponding to the criteria * @throws RepositoryException if the session could not be created */ Session getSession(String userName, String password) throws RepositoryException; /** * Get a JCR session corresponding to the repository * defined in the configuration and the given workspace. * @param workspace the name of the expected workspace * @return a JCR session corresponding to the criteria * @throws RepositoryException if the session could not be created */ Session getSession(String workspace) throws RepositoryException; /** * Get a JCR session corresponding to the repository * defined in the configuration and the given workspace, using * the given user name and password. * @param workspace the name of the expected workspace * @param userName the user name to use for the authentication * @param password the password to use for the authentication * @return a JCR session corresponding to the criteria * @throws RepositoryException if the session could not be created */ Session getSession(String workspace, String userName, String password) throws RepositoryException;
Table 42.1. Configuration Properties
PortalContainer | In case of the portal mode, if no portal container can be found in the context of the request, the adapter will use the value of this parameter to get the name of the expected portal container to create the JCR sessions. In case of a standalone mode, this parameter is not used. This parameter is optional, by default the default portal container will be used. |
Repository | The repository name used to create JCR sessions. This parameter is optional, by default the current repository will be used. |
In case of the standalone mode where the JCR and its dependencies are not provided, you will need to deploy the whole ear file corresponding to the artifactId exo.jcr.ear and groupId org.exoplatform.jcr, the rar file is embedded into the ear file. In case the JCR and its dependencies are provided like when you use it with gateIn for example, you will need to deploy only the rar file corresponding to the artifactId exo.jcr.connectors.jca and groupId org.exoplatform.jcr.
Then you will need to configure the connector itself, for example for JBoss AS, you need to create in your deploy directory a file of type *-ds.xml (jcr-ds.xml for example) with the following content:
<connection-factories> <tx-connection-factory> <jndi-name>jcr/repository</jndi-name> <xa-transaction/> <!-- The rar name will be exo.jcr.connectors.jca.X.Y.Z.rar in case you deploy only the rar file --> <rar-name>exo.jcr.ear.ear#exo-jcr.rar</rar-name> <adapter-display-name>eXo JCR Adapter</adapter-display-name> <connection-definition>org.exoplatform.connectors.jcr.adapter.SessionFactory</connection-definition> <!-- <config-property name="PortalContainer" type="java.lang.String">portal</config-property> --> <config-property name="Repository" type="java.lang.String">repository</config-property> </tx-connection-factory> </connection-factories>