org.modeshape.jcr
Class JcrRepository

java.lang.Object
  extended by org.modeshape.jcr.JcrRepository
All Implemented Interfaces:
Repository

@ThreadSafe
public class JcrRepository
extends Object
implements 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 ModeShape 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.
protected  class JcrRepository.DelegatingConnectionFactory
           
protected  class JcrRepository.FederatedRepositoryContext
           
static class JcrRepository.Option
          The available options for the JcrRepository.
static class JcrRepository.QueryLanguage
          The set of supported query language string constants.
protected  class JcrRepository.RepositoryObservationManager
           
protected static class JcrRepository.SourceWorkspacePair
           
 
Field Summary
protected static Map<JcrRepository.Option,String> DEFAULT_OPTIONS
          The static unmodifiable map of default options, which are initialized in the static initializer.
 
Fields inherited from interface org.modeshape.jcr.api.Repository
IDENTIFIER_STABILITY, IDENTIFIER_STABILITY_INDEFINITE_DURATION, IDENTIFIER_STABILITY_METHOD_DURATION, IDENTIFIER_STABILITY_SAVE_DURATION, IDENTIFIER_STABILITY_SESSION_DURATION, NODE_TYPE_MANAGEMENT_AUTOCREATED_DEFINITIONS_SUPPORTED, NODE_TYPE_MANAGEMENT_INHERITANCE, NODE_TYPE_MANAGEMENT_INHERITANCE_MINIMAL, NODE_TYPE_MANAGEMENT_INHERITANCE_MULTIPLE, NODE_TYPE_MANAGEMENT_INHERITANCE_SINGLE, NODE_TYPE_MANAGEMENT_MULTIPLE_BINARY_PROPERTIES_SUPPORTED, NODE_TYPE_MANAGEMENT_MULTIVALUED_PROPERTIES_SUPPORTED, NODE_TYPE_MANAGEMENT_ORDERABLE_CHILD_NODES_SUPPORTED, NODE_TYPE_MANAGEMENT_OVERRIDES_SUPPORTED, NODE_TYPE_MANAGEMENT_PRIMARY_ITEM_NAME_SUPPORTED, NODE_TYPE_MANAGEMENT_PROPERTY_TYPES, NODE_TYPE_MANAGEMENT_RESIDUAL_DEFINITIONS_SUPPORTED, NODE_TYPE_MANAGEMENT_SAME_NAME_SIBLINGS_SUPPORTED, NODE_TYPE_MANAGEMENT_UPDATE_IN_USE_SUPORTED, NODE_TYPE_MANAGEMENT_VALUE_CONSTRAINTS_SUPPORTED, OPTION_ACCESS_CONTROL_SUPPORTED, OPTION_ACTIVITIES_SUPPORTED, OPTION_BASELINES_SUPPORTED, OPTION_JOURNALED_OBSERVATION_SUPPORTED, OPTION_LIFECYCLE_SUPPORTED, OPTION_NODE_AND_PROPERTY_WITH_SAME_NAME_SUPPORTED, OPTION_NODE_TYPE_MANAGEMENT_SUPPORTED, OPTION_RETENTION_SUPPORTED, OPTION_SHAREABLE_NODES_SUPPORTED, OPTION_SIMPLE_VERSIONING_SUPPORTED, OPTION_UNFILED_CONTENT_SUPPORTED, OPTION_UPDATE_MIXIN_NODE_TYPES_SUPPORTED, OPTION_UPDATE_PRIMARY_NODE_TYPE_SUPPORTED, OPTION_VERSIONING_SUPPORTED, OPTION_WORKSPACE_MANAGEMENT_SUPPORTED, OPTION_XML_EXPORT_SUPPORTED, OPTION_XML_IMPORT_SUPPORTED, QUERY_FULL_TEXT_SEARCH_SUPPORTED, QUERY_JOINS, QUERY_JOINS_INNER, QUERY_JOINS_INNER_OUTER, QUERY_JOINS_NONE, QUERY_LANGUAGES, QUERY_STORED_QUERIES_SUPPORTED, STANDARD_DESCRIPTORS, WRITE_SUPPORTED
 
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, 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
 
Method Summary
protected static Properties getBundleProperties()
           
protected static String getBundleProperty(String propertyName, boolean required)
           
 String getDescriptor(String key)
          
 String[] getDescriptorKeys()
          Returns a string array holding all descriptor keys available for this implementation, both the standard descriptors defined by the string constants in this interface and any implementation-specific descriptors.
 org.modeshape.jcr.JcrValue getDescriptorValue(String key)
          The value of a single-value descriptor is found by passing the key for that descriptor to this method.
 org.modeshape.jcr.JcrValue[] getDescriptorValues(String key)
          The value array of a multi-value descriptor is found by passing the key for that descriptor to this method.
 Map<JcrRepository.Option,String> getOptions()
          Get the options as configured for this repository.
protected  void initializeSystemContent(Graph systemGraph)
           
 boolean isSingleValueDescriptor(String key)
          Returns true if key is a valid single-value descriptor; otherwise returns false.
 boolean isStandardDescriptor(String key)
          Returns true if key is a standard descriptor defined by the string constants in this interface and false if it is either a valid implementation-specific key or not a valid key.
 Session login()
          
 Session login(Credentials credentials)
          
 Session login(Credentials credentials, String workspaceName)
          
 Session login(String workspaceName)
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_OPTIONS

protected static final Map<JcrRepository.Option,String> DEFAULT_OPTIONS
The static unmodifiable map of default options, which are initialized in the static initializer.

Method Detail

initializeSystemContent

protected void initializeSystemContent(Graph systemGraph)

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 Repository
Throws:
IllegalArgumentException - if key is null.
See Also:
Repository.getDescriptor(java.lang.String)

getDescriptorValue

public org.modeshape.jcr.JcrValue getDescriptorValue(String key)
The value of a single-value descriptor is found by passing the key for that descriptor to this method. If key is the key of a multi-value descriptor or not a valid key this method returns null.

Parameters:
key - a descriptor key.
Returns:
The value of the indicated descriptor
Throws:
IllegalArgumentException - if key is null or empty
See Also:
Repository.getDescriptorValue(String)

getDescriptorValues

public org.modeshape.jcr.JcrValue[] getDescriptorValues(String key)
The value array of a multi-value descriptor is found by passing the key for that descriptor to this method. If key is the key of a single-value descriptor then this method returns that value as an array of size one. If key is not a valid key this method returns null.

Parameters:
key - a descriptor key.
Returns:
the value array for the indicated descriptor
Throws:
IllegalArgumentException - if key is null or empty
See Also:
Repository.getDescriptorValues(String)

isSingleValueDescriptor

public boolean isSingleValueDescriptor(String key)
Returns true if key is a valid single-value descriptor; otherwise returns false.

Parameters:
key - a descriptor key.
Returns:
whether the specified desdfriptor is multi-valued.
Throws:
IllegalArgumentException - if key is null or empty
See Also:
Repository.isSingleValueDescriptor(String)

isStandardDescriptor

public boolean isStandardDescriptor(String key)
Returns true if key is a standard descriptor defined by the string constants in this interface and false if it is either a valid implementation-specific key or not a valid key.

Parameters:
key - a descriptor key.
Returns:
whether key is a standard descriptor.
Throws:
IllegalArgumentException - if key is null or empty
See Also:
Repository.isStandardDescriptor(String)

getDescriptorKeys

public String[] getDescriptorKeys()
Returns a string array holding all descriptor keys available for this implementation, both the standard descriptors defined by the string constants in this interface and any implementation-specific descriptors. Used in conjunction with Repository.getDescriptorValue(String key) and Repository.getDescriptorValues(String key) to query information about this repository implementation.

Specified by:
getDescriptorKeys in interface Repository
Returns:
a string array holding all descriptor keys.
See Also:
Repository.getDescriptorKeys()

login

public Session login()
              throws RepositoryException

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

login

public Session login(Credentials credentials)
              throws RepositoryException

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

login

public Session login(String workspaceName)
              throws RepositoryException

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

login

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

Specified by:
login in interface 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.
RepositoryException
See Also:
Repository.login(javax.jcr.Credentials, java.lang.String)

getBundleProperties

protected static Properties getBundleProperties()

getBundleProperty

protected static String getBundleProperty(String propertyName,
                                          boolean required)


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