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
           
 class JcrRepository.Metrics
          This component is used internally to expose the metrics of a repository, and should not be used outside of the ModeShape codebase, as it will almost certainly change or be replaced in upcoming releases.
static class JcrRepository.Option
          The available options for the JcrRepository.
static class JcrRepository.QueryLanguage
          The set of supported query language string constants.
static class JcrRepository.RebuildQueryIndexOnStartupOption
          The possible values for the JcrRepository.Option.REBUILD_QUERY_INDEX_ON_STARTUP option.
protected  class JcrRepository.RepositoryObservationManager
           
protected static class JcrRepository.SourceWorkspacePair
           
static class JcrRepository.VersionHistoryOption
          The possible values for the JcrRepository.Option.VERSION_HISTORY_STRUCTURE option.
 
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
REPOSITORY_NAME, REPOSITORY_WORKSPACES, STANDARD_DESCRIPTORS
 
Fields inherited from interface javax.jcr.Repository
IDENTIFIER_STABILITY, IDENTIFIER_STABILITY_INDEFINITE_DURATION, IDENTIFIER_STABILITY_METHOD_DURATION, IDENTIFIER_STABILITY_SAVE_DURATION, IDENTIFIER_STABILITY_SESSION_DURATION, LEVEL_1_SUPPORTED, LEVEL_2_SUPPORTED, 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_LOCKING_SUPPORTED, OPTION_NODE_AND_PROPERTY_WITH_SAME_NAME_SUPPORTED, OPTION_NODE_TYPE_MANAGEMENT_SUPPORTED, OPTION_OBSERVATION_SUPPORTED, OPTION_QUERY_SQL_SUPPORTED, OPTION_RETENTION_SUPPORTED, OPTION_SHAREABLE_NODES_SUPPORTED, OPTION_SIMPLE_VERSIONING_SUPPORTED, OPTION_TRANSACTIONS_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, 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, WRITE_SUPPORTED
 
Method Summary
protected  void addWorkspace(String workspaceName, boolean isDefault)
           
protected  ExecutorService backgroundService()
           
protected  void createWorkspace(String workspaceName, String clonedFromWorkspaceNamed)
          Create a new workspace with the supplied name.
protected  void destroyWorkspace(String workspaceName, org.modeshape.jcr.JcrWorkspace currentWorkspace)
          Destroy the workspace with the supplied name.
protected static Properties getBundleProperties()
           
protected static String getBundleProperty(String propertyName, boolean required)
           
 String getDescriptor(String key)
          
 String[] getDescriptorKeys()
          
 org.modeshape.jcr.JcrValue getDescriptorValue(String key)
          
 org.modeshape.jcr.JcrValue[] getDescriptorValues(String key)
          
 JcrRepository.Metrics getMetrics()
          Get the component that exposes the metrics of a repository, which is for internal use only.
 Map<JcrRepository.Option,String> getOptions()
          Get the options as configured for this repository.
protected  void initializeSystemContent(Graph systemGraph)
           
protected  boolean isQueryExecutionEnabled()
           
 boolean isSingleValueDescriptor(String key)
          
 boolean isStandardDescriptor(String key)
          
 Session login()
          
 Session login(Credentials credentials)
          
 Session login(Credentials credentials, String workspaceName)
          
 Session login(String workspaceName)
          
protected  String repositoryName()
           
protected  void updateWorkspaceNames()
           
 
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

backgroundService

protected ExecutorService backgroundService()

repositoryName

protected String repositoryName()

updateWorkspaceNames

protected void updateWorkspaceNames()

addWorkspace

protected void addWorkspace(String workspaceName,
                            boolean isDefault)

createWorkspace

protected void createWorkspace(String workspaceName,
                               String clonedFromWorkspaceNamed)
                        throws InvalidWorkspaceException,
                               UnsupportedRepositoryOperationException
Create a new workspace with the supplied name.

Parameters:
workspaceName - the name of the workspace to be destroyed; may not be null
clonedFromWorkspaceNamed - the name of the workspace that is to be cloned, or null if the new workspace is to be empty
Throws:
InvalidWorkspaceException - if the workspace cannot be created because one already exists
UnsupportedRepositoryOperationException - if this repository does not support workspace management

destroyWorkspace

protected void destroyWorkspace(String workspaceName,
                                org.modeshape.jcr.JcrWorkspace currentWorkspace)
                         throws InvalidWorkspaceException,
                                UnsupportedRepositoryOperationException,
                                NoSuchWorkspaceException,
                                RepositorySourceException
Destroy the workspace with the supplied name.

Parameters:
workspaceName - the name of the workspace to be destroyed; may not be null
currentWorkspace - the workspace performing the operation; may not be null
Throws:
InvalidWorkspaceException - if the workspace cannot be destroyed
UnsupportedRepositoryOperationException - if this repository does not support workspace management
NoSuchWorkspaceException - if the workspace does not exist
RepositorySourceException - if there is an error destroying this workspace

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

isQueryExecutionEnabled

protected boolean isQueryExecutionEnabled()

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)

Specified by:
getDescriptorValue in interface Repository
Throws:
IllegalArgumentException - if key is null or empty
See Also:
Repository.getDescriptorValue(String)

getDescriptorValues

public org.modeshape.jcr.JcrValue[] getDescriptorValues(String key)

Specified by:
getDescriptorValues in interface Repository
Throws:
IllegalArgumentException - if key is null or empty
See Also:
Repository.getDescriptorValues(String)

isSingleValueDescriptor

public boolean isSingleValueDescriptor(String key)

Specified by:
isSingleValueDescriptor in interface Repository
Throws:
IllegalArgumentException - if key is null or empty
See Also:
Repository.isSingleValueDescriptor(String)

isStandardDescriptor

public boolean isStandardDescriptor(String key)

Specified by:
isStandardDescriptor in interface Repository
Throws:
IllegalArgumentException - if key is null or empty
See Also:
Repository.isStandardDescriptor(String)

getDescriptorKeys

public String[] getDescriptorKeys()

Specified by:
getDescriptorKeys in interface Repository
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)

getMetrics

public JcrRepository.Metrics getMetrics()
Get the component that exposes the metrics of a repository, which is for internal use only. This mechanism will almost certainly change or be replaced in an upcoming release.

Returns:
the metrics interface; never null

getBundleProperties

protected static Properties getBundleProperties()

getBundleProperty

protected static String getBundleProperty(String propertyName,
                                          boolean required)


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