jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Jackrabbit Wiki] Update of "RemoteAccess" by JukkaZitting
Date Wed, 20 Jan 2010 17:01:56 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Jackrabbit Wiki" for change notification.

The "RemoteAccess" page has been changed by JukkaZitting.
The comment on this change is: Update RMI connection instructions.
http://wiki.apache.org/jackrabbit/RemoteAccess?action=diff&rev1=5&rev2=6

--------------------------------------------------

  
  Jackrabbit 2.0 supports the !DavEx protocol through the Jackrabbit WebDAV server included
in the Jackrabbit web application and the [[http://jackrabbit.apache.org/standalone-server.html|Standalone
Server]]. The web application exposes the !DavEx interface at http://<server>/<context>/server
and the standalone server by default at http://localhost:8080/server.
  
- On the client side, you need the following Maven dependencies (note that jackrabbit-jcr2dav
is not yet available in an official Jackrabbit release, but it will be included in Jackrabbit
2.0.0):
+ On the client side, you need the following Maven dependencies:
  
  {{{
  <!-- JCR API -->
@@ -27, +27 @@

  <dependency>
    <groupId>org.apache.jackrabbit</groupId>
    <artifactId>jackrabbit-jcr2dav</artifactId>
-   <version>2.0-SNAPSHOT</version>
+   <version>2.0-beta6</version>
  </dependency>
  <!-- The SFL4J logging implementation you prefer -->
  <dependency>
@@ -54, +54 @@

  
  The JCR API can be accessed over RMI. Limitations: Jackrabbit over RMI is slow. The JCR
2.0 API is only partially supported in Jackrabbit 2.0 (most of the new JCR 2.0 methods simply
throw UnsupportedRepositoryOperationExceptions).
  
- To start a standalone RMI server, use:
+ The easiest way to access a Jackrabbit repository over RMI is to use the RMI endpoint that
the Jackrabbit standalone jar exposes at http://localhost:8080/rmi. You need the following
code snippet and the jackrabbit-jcr-rmi and jackrabbit-jcr-commons dependencies to connect
to this endpoint:
  
  {{{
- Repository repository = new TransientRepository();
+ import javax.jcr.Repository;
+ import org.apache.jackrabbit.commons.JcrUtils;
+ 
+ Repository repository = JcrUtils.getRepository("http://localhost:8080/rmi");
+ }}}
+ 
+ If you use Jackrabbit in embedded mode, you can expose your repository to remote clients
by starting the RMI registry (if one is not already running) and binding the remote reference
there:
+ 
+ {{{
+ // Start the RMI registry
+ Registry reg = LocateRegistry.createRegistry(1100);
+ 
+ // Bind the repository reference to the registry
+ Repository repository = ...;
  ServerAdapterFactory factory = new ServerAdapterFactory();
  RemoteRepository remote = factory.getRemoteRepository(repository);
- Registry reg = LocateRegistry.createRegistry(1100);
  reg.rebind("jackrabbit", remote);
  }}}
  
+ Note that you need to keep an explicit local reference to the RemoteRepository object above
to prevent the garbage collector from claiming it.
+ 
- To connect to the server, use:
+ To connect to such a server, use:
  
  {{{
- ClientRepositoryFactory factory = new ClientRepositoryFactory();
+ import javax.jcr.Repository;
+ import org.apache.jackrabbit.commons.JcrUtils;
+ 
- Repository repository = factory.getRepository("rmi://localhost:1100/jackrabbit");
+ Repository repository = JcrUtils.getRepository("rmi://localhost:1100/jackrabbit");
  }}}
  

Mime
View raw message