org.jboss.dna.jcr
Class JcrRepository

java.lang.Object
  extended by org.jboss.dna.jcr.JcrRepository
All Implemented Interfaces:
javax.jcr.Repository

@ThreadSafe
public class JcrRepository
extends Object
implements javax.jcr.Repository

Creates JCR sessions to an underlying repository (which may be a federated repository).

This JCR repository must be configured with the ability to connect to a repository via a supplied repository connection factory and repository source name. An execution context must also be supplied to enable working with the underlying DNA graph implementation to which this JCR implementation delegates.

If credentials are used to login, implementations must also implement one of the following methods:

 public AccessControlContext getAccessControlContext();
 public LoginContext getLoginContext();
 
Note, attributes on credentials are not supported. JCR SimpleCredentials are also not supported.


Nested Class Summary
static class JcrRepository.DefaultOption
          The default values for each of the JcrRepository.Option.
static class JcrRepository.Option
          The available options for the JcrRepository.
 
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
JcrRepository(ExecutionContext executionContext, RepositoryConnectionFactory connectionFactory, String repositorySourceName)
          Creates a JCR repository that uses the supplied repository connection factory to establish sessions to the underlying repository source upon login.
JcrRepository(ExecutionContext executionContext, RepositoryConnectionFactory connectionFactory, String repositorySourceName, Map<String,String> descriptors, Map<JcrRepository.Option,String> options)
          Creates a JCR repository that uses the supplied repository connection factory to establish sessions to the underlying repository source upon login.
 
Method Summary
 String getDescriptor(String key)
          
 String[] getDescriptorKeys()
          
 Map<JcrRepository.Option,String> getOptions()
          Get the options as configured for this repository.
 javax.jcr.Session login()
          
 javax.jcr.Session login(javax.jcr.Credentials credentials)
          
 javax.jcr.Session login(javax.jcr.Credentials credentials, String workspaceName)
          
 javax.jcr.Session login(String workspaceName)
          
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JcrRepository

public JcrRepository(ExecutionContext executionContext,
                     RepositoryConnectionFactory connectionFactory,
                     String repositorySourceName)
Creates a JCR repository that uses the supplied repository connection factory to establish sessions to the underlying repository source upon login.

Parameters:
executionContext - An execution context.
connectionFactory - A repository connection factory.
repositorySourceName - the name of the repository source (in the connection factory) that should be used
Throws:
IllegalArgumentException - If executionContextFactory or connectionFactory is null.

JcrRepository

public JcrRepository(ExecutionContext executionContext,
                     RepositoryConnectionFactory connectionFactory,
                     String repositorySourceName,
                     Map<String,String> descriptors,
                     Map<JcrRepository.Option,String> options)
Creates a JCR repository that uses the supplied repository connection factory to establish sessions to the underlying repository source upon login.

Parameters:
executionContext - the execution context in which this repository is to operate
connectionFactory - the factory for repository connections
repositorySourceName - the name of the repository source (in the connection factory) that should be used
descriptors - the descriptors for this repository; may be null.
options - the optional settings for this repository; may be null
Throws:
IllegalArgumentException - If executionContextFactory or connectionFactory is null.
Method Detail

getOptions

public Map<JcrRepository.Option,String> getOptions()
Get the options as configured for this repository.

Returns:
the unmodifiable options; never null

getDescriptor

public String getDescriptor(String key)

Specified by:
getDescriptor in interface javax.jcr.Repository
Throws:
IllegalArgumentException - if key is null.
See Also:
Repository.getDescriptor(java.lang.String)

getDescriptorKeys

public String[] getDescriptorKeys()

Specified by:
getDescriptorKeys in interface javax.jcr.Repository
See Also:
Repository.getDescriptorKeys()

login

public javax.jcr.Session login()
                        throws javax.jcr.RepositoryException

Specified by:
login in interface javax.jcr.Repository
Throws:
javax.jcr.RepositoryException
See Also:
Repository.login()

login

public javax.jcr.Session login(javax.jcr.Credentials credentials)
                        throws javax.jcr.RepositoryException

Specified by:
login in interface javax.jcr.Repository
Throws:
javax.jcr.RepositoryException
See Also:
Repository.login(javax.jcr.Credentials)

login

public javax.jcr.Session login(String workspaceName)
                        throws javax.jcr.RepositoryException

Specified by:
login in interface javax.jcr.Repository
Throws:
javax.jcr.RepositoryException
See Also:
Repository.login(java.lang.String)

login

public javax.jcr.Session login(javax.jcr.Credentials credentials,
                               String workspaceName)
                        throws javax.jcr.RepositoryException

Specified by:
login in interface javax.jcr.Repository
Throws:
IllegalArgumentException - if credentials is not null but:
  • provides neither a getLoginContext() nor a getAccessControlContext() method and is not an instance of SimpleCredentials.
  • provides a getLoginContext() method that doesn't return a LoginContext.
  • provides a getLoginContext() method that returns a null LoginContext.
  • does not provide a getLoginContext() method, but provides a getAccessControlContext() method that doesn't return an AccessControlContext.
  • does not provide a getLoginContext() method, but provides a getAccessControlContext() method that returns a null AccessControlContext.
javax.jcr.RepositoryException
See Also:
Repository.login(javax.jcr.Credentials, java.lang.String)


Copyright © 2008-2009 JBoss, a division of Red Hat. All Rights Reserved.