You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by hsp <pi...@ibest.com.br> on 2006/04/06 19:09:37 UTC

jcr-rmi / jcr-server

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?
Using the jcr-rmi I have to implement the stubs, .....? I am new in such configuration.
Thankx
Helio.

Re: jcr-rmi / jcr-server

Posted by Jukka Zitting <ju...@gmail.com>.
Hi,

On 4/6/06, hsp <pi...@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
JCR-RMI.

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
choise.

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.

BR,

Jukka Zitting

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