org.apache.jackrabbit.commons.repository
Class ProxyRepository

java.lang.Object
  extended by org.apache.jackrabbit.commons.AbstractRepository
      extended by org.apache.jackrabbit.commons.repository.ProxyRepository
All Implemented Interfaces:
Repository
Direct Known Subclasses:
JNDIRemoteRepository, JNDIRepository, RMIRemoteRepository, ServletRepository, URLRemoteRepository

public class ProxyRepository
extends AbstractRepository

Repository that proxies all method calls to another repository. The other repository is accessed lazily using a repository factory.

Since:
1.4

Field Summary
 
Fields inherited from interface javax.jcr.Repository
LEVEL_1_SUPPORTED, LEVEL_2_SUPPORTED, OPTION_LOCKING_SUPPORTED, OPTION_OBSERVATION_SUPPORTED, OPTION_QUERY_SQL_SUPPORTED, OPTION_TRANSACTIONS_SUPPORTED, OPTION_VERSIONING_SUPPORTED, QUERY_XPATH_DOC_ORDER, QUERY_XPATH_POS_INDEX, REP_NAME_DESC, REP_VENDOR_DESC, REP_VENDOR_URL_DESC, REP_VERSION_DESC, SPEC_NAME_DESC, SPEC_VERSION_DESC
 
Constructor Summary
ProxyRepository(RepositoryFactory factory)
          Creates a proxy for the repository (or repositories) accessible through the given factory.
 
Method Summary
 String getDescriptor(String key)
          Returns the descriptor with the given key from the proxied repository.
 String[] getDescriptorKeys()
          Returns the descriptor keys of the proxied repository, or an empty array if the proxied repository can not be accessed.
 Session login(Credentials credentials, String workspace)
          Logs in to the proxied repository and returns the resulting session.
 
Methods inherited from class org.apache.jackrabbit.commons.AbstractRepository
login, login, login
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProxyRepository

public ProxyRepository(RepositoryFactory factory)
Creates a proxy for the repository (or repositories) accessible through the given factory.

Parameters:
factory - repository factory
Method Detail

getDescriptorKeys

public String[] getDescriptorKeys()
Returns the descriptor keys of the proxied repository, or an empty array if the proxied repository can not be accessed.

Returns:
descriptor keys (possibly empty)

getDescriptor

public String getDescriptor(String key)
Returns the descriptor with the given key from the proxied repository. Returns null if the descriptor does not exist or if the proxied repository can not be accessed.

Returns:
descriptor value, or null

login

public Session login(Credentials credentials,
                     String workspace)
              throws RepositoryException
Logs in to the proxied repository and returns the resulting session.

Note that the Session.getRepository() method of the resulting session will return the proxied repository, not this repository proxy!

Throws:
RepositoryException - if the proxied repository can not be accessed, or if the login in the proxied repository fails


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