jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jukka Zitting" <jukka.zitt...@gmail.com>
Subject Re: jcr-rmi / jcr-server
Date Thu, 06 Apr 2006 17:33:56 GMT

On 4/6/06, hsp <piccinatto@ibest.com.br> wrote:
> Which would be more appropriate to use? Is it enough to use only jcr-rmi to do a
> client to call the methods available in the application looked by JNDI? Must I use
> jcr-server together?

JCR-RMI is a mostly transparent network layer for the JCR API (it
allows you to access a remote JCR compliant repository using local JCR
calls). Jcr-server on the other hand contains (among others) a
deployable server web application, that exports an embedded Jackrabbit
repository for remote access through WebDAV and optionally through

So if you are looking for an easily deployable Jackrabbbit "server"
with WebDAV support for use in a "Model 3" deployment, then jcr-server
is a good choise for you. If you already have an repository instance
embedded in your application or in a custom daemon process and you
want to allow remote access to it, then JCR-RMI is probably the best

Implementing a custom JCR-RMI server requires the following code in
addition to adding the jcr-rmi jar file in the class path:

    Repository repository = ...; // The local repository
    String name = ...; // The RMI URL for the repository

    RemoteAdapterFactory factory = new ServerAdapterFactory();
    RemoteRepository remote = factory.getRemoteRepository(repository);
    Naming.bind(name, remote);  // Make the RMI binding using java.rmi.Naming

See the org.apache.jackrabbit.rmi.server javadocs in the JCR-RMI
package for more details.

> Using the jcr-rmi I have to implement the stubs, .....?

No, almost all of the RMI details are all hidden by the adapter layers
included in JCR-RMI. The custom client code required to access a
JCR-RMI repository is:

    String name = ...; // The RMI URL of the repository
    ClientRepositoryFactory factory = new ClientRepositoryFactory();
    Repository repository = factory.getRepository(name);

See the org.apache.jackrabbit.rmi.client javadocs in the JCR-RMI
package for more details.

You should also be able to bind the RMI reference in JNDI to make the
client truly independent of the deployment mechanism.


Jukka Zitting

Yukatan - http://yukatan.fi/ - info@yukatan.fi
Software craftsmanship, JCR consulting, and Java development
View raw message