org.apache.jackrabbit.rmi.client
Class ClientRepositoryFactory

java.lang.Object
  extended by org.apache.jackrabbit.rmi.client.ClientRepositoryFactory
All Implemented Interfaces:
ObjectFactory

public class ClientRepositoryFactory
extends Object
implements ObjectFactory

Object factory for JCR-RMI clients. This factory can be used either directly or as a JNDI object factory.

See Also:
ClientRepository

Field Summary
static String URL_PARAMETER
          The JNDI parameter name for configuring the RMI URL of a remote repository.
 
Constructor Summary
ClientRepositoryFactory()
          Creates a JCR-RMI client factory with the default adapter factory.
ClientRepositoryFactory(LocalAdapterFactory factory)
          Creates a JCR-RMI client factory with the given adapter factory.
 
Method Summary
 Object getObjectInstance(Object object, Name name, Context context, Hashtable environment)
          JNDI factory method for creating JCR-RMI clients.
 Repository getRepository(String url)
          Returns a client wrapper for a remote content repository.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

URL_PARAMETER

public static final String URL_PARAMETER
The JNDI parameter name for configuring the RMI URL of a remote repository.

See Also:
Constant Field Values
Constructor Detail

ClientRepositoryFactory

public ClientRepositoryFactory()
Creates a JCR-RMI client factory with the default adapter factory.


ClientRepositoryFactory

public ClientRepositoryFactory(LocalAdapterFactory factory)
Creates a JCR-RMI client factory with the given adapter factory.

Parameters:
factory - local adapter factory
Method Detail

getRepository

public Repository getRepository(String url)
                         throws MalformedURLException,
                                NotBoundException,
                                ClassCastException,
                                RemoteException
Returns a client wrapper for a remote content repository. The remote repository is looked up from the RMI registry using the given URL by the returned SafeClientRepository instance.

The current implementation of this method will not throw any of the declared exceptions (because of the SafeClientRepository being used), but the throws clauses are kept for backwards compatibility and potential future use. Clients should be prepared to handle exceptions from this method.

Parameters:
url - the RMI URL of the remote repository
Returns:
repository client
Throws:
MalformedURLException - if the given URL is malfored
NotBoundException - if the given URL points to nothing
ClassCastException - if the given URL points to something unknown
RemoteException - if the remote repository can not be accessed

getObjectInstance

public Object getObjectInstance(Object object,
                                Name name,
                                Context context,
                                Hashtable environment)
JNDI factory method for creating JCR-RMI clients. Creates a lazy client repository instance that uses the reference parameter "url" as the RMI URL where the remote repository is looked up when accessed.

Specified by:
getObjectInstance in interface ObjectFactory
Parameters:
object - reference parameters
name - unused
context - unused
environment - unused
Returns:
repository client


Copyright © 2004-2010 The Apache Software Foundation. All Rights Reserved.