This is the JCR-RMI component of the Apache Jackrabbit project. JCR-RMI is a transparent Remote Method Invocation (RMI) layer for the Content Repository for Java Technology API (JCR). The layer makes it possible to remotely access JCR content repositories and is compatible with all JCR implementations.
Setting up the server part of the JCR-RMI layer is quite straightforward. After instantiating a local JCR repository you need to wrap it into a remote adapter and create an RMI binding for the repository. A variation of the following code is usually all that is needed in addition to the standard RMI setup (starting rmiregistry, etc.):
The ClientRepositoryFactory class provides a convenient mechanism for looking up a remote JCR-RMI repository. The factory can be used either directly or as a JNDI object factory.
The following example shows how to use the ClientRepositoryFactory directly:
The ClientRepositoryFactory can also be used via JNDI. The following example settings and code demonstrate how to configure and use the transparent JCR-RMI layer in a Tomcat 5.5 web application:
Note that in the example above only the context.xml configuration file contains a direct references to the JCR-RMI layer. All other parts of the web application can be implemented using the standard JCR interfaces.