JBoss Community Archive (Read Only)

ModeShape 5

Introduction

Java Connector Architecture (JCA) or J2EE JCA is a generic architecture based on Java technology that is used for connecting and integrating the legacy systems including databases,the EIS (Enterprise Information Systems) and JCA standard compliant application servers as part of EAI (Enterprise Application Integration) solutions.

As a analogy, just as the Java Database Connectivity (JDBC) is a database connectivity standard that is specifically used to connect Java EE applications to databases(generally relational based), the JCA is a generic architecture that provides a standardized legacy system-independent way to communicate with the different backend systems for J2EE including any type of databases and applications to be integrated for the software project.

Modeshape's JCA adapter implements Java Connector Architecture and mediates communication between the Java EE server and ModeShape repository. It provides seemless access to the repository through the same JCR API.

Connection factory interface

javax.jcr.Repository

Connection interface

javax.jcr.Session

Resource adaptor configuration properties

Modeshape's JCA resource adapter defines the following configuration properties

Property name

Property type

Description

repositoryURL

java.lang.String

Defines path to the configuration of the Modeshape repository. Can be an URL or an absolute path

Installing Resource adapter

To use this connector, it must be configured and deployed  on the application server.  The connector is packaged as a RAR file (resource adapter archive) and contain a ra.xml which  describes its deployment characteristics. However the actual name of the resource is specified when it is deploed by application server. The deployment process is quite specific for application server, so please refer to the documentation for your application server to get more details about JCA connector installation process. Basically it is enough to deploy RAR archive alongside with datasource descriptor, however additional step with class loading tuning might be required.

Bellow is an example how to get deployed JCA adaptor  in JBoss 5.

Datasource descriptor:

<connection-factories>
  <tx-connection-factory>
    <jndi-name>/jcr/datastore</jndi-name>
    <xa-transaction/>
    <rar-name>modeshape-jca-3.3-SNAPSHOT.rar</rar-name>
    <connection-definition>javax.jcr.Repository</connection-definition>
    <config-property name="repositoryURL" type="java.lang.String">file:/d:/Temp/modeshapecfg.json</config-property>
    <max-pool-size>9</max-pool-size>
  </tx-connection-factory>
</connection-factories>

And class loading tuning

<classloading xmlns="urn:jboss:classloading:1.0"
              name="modeshape-datastore.ear"
              parent-domain="NoHibernateNoJBLoggingDomain"
              domain="modeshape-datastore.ear"
              import-all="true"
              export-all="NON_EMPTY"
              parent-first="false"
              excluded="javax.transaction,javax.transaction.xa">
</classloading>

Access example

To access it within the application, simply fetch the factory by its JNDI name.

//lookup repository using JNDI name (JCA connection factory)
Repository repository = (Repository)ic.lookup(location);

//Get the session (JCA connection) just by login to the repository
session = repository.login();
JBoss.org Content Archive (Read Only), exported from JBoss Community Documentation Editor at 2020-03-11 12:12:49 UTC, last content change 2016-04-07 07:04:34 UTC.