org.modeshape.jcr

## Class JcrRepository

- java.lang.Object
- - org.modeshape.jcr.JcrRepository

- All Implemented Interfaces:
    Repository, NamedRepository

      public class JcrRepository
      extends Object
      implements Repository

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `protected static class` | `JcrRepository.BackgroundRepositoryTask` The garbage collection tasks should get cancelled before the repository is shut down, but just in case we'll use a weak reference to hold onto the JcrRepository instance and we'll also check that the repository is running before we actually do any work.
    `protected static class` | `JcrRepository.BinaryValueGarbageCollectionTask`
    `protected static class` | `JcrRepository.ConfigurationChange`
    `protected static class` | `JcrRepository.JournalingGCTask`
    `protected static class` | `JcrRepository.LockGarbageCollectionTask`
    `protected static class` | `JcrRepository.OptimizationTask`
    `static class` | `JcrRepository.QueryLanguage` The set of supported query language string constants.
    `protected static class` | `JcrRepository.RepositorySessionEnvironment`
    `protected class` | `JcrRepository.RunningState`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected Logger` | `logger`
    `protected static Set<String>` | `MISSING_JAAS_POLICIES`

    - ### 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`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `JcrRepository(RepositoryConfiguration configuration)` Create a Repository instance given the `configuration`.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected ChangeBus` | `changeBus()`
    `protected void` | `completeRestore()`
    `protected long` | `determineInitialDelay(String initialTimeExpression)` Determine the initial delay before the garbage collection process(es) should be run, based upon the supplied initial expression.
    `protected DocumentStore` | `documentStore()`
    `protected boolean` | `doShutdown()`
    `protected JcrRepository.RunningState` | `doStart()`
    `int` | `getActiveSessionsCount()` Returns the number of active client sessions for this repository.
    `RepositoryConfiguration` | `getConfiguration()` Get the immutable configuration for this repository.
    `String` | `getDescriptor(String key)`
    `String[]` | `getDescriptorKeys()`
    `org.modeshape.jcr.JcrValue` | `getDescriptorValue(String key)`
    `org.modeshape.jcr.JcrValue[]` | `getDescriptorValues(String key)`
    `IndexManager` | `getIndexManager()` Get the manager for the index definitions and index providers.
    `String` | `getName()` Get the name of this JCR repository instance.
    `RepositoryStatistics` | `getRepositoryStatistics()` Get the component that can be used to obtain statistics for this repository.
    `Problems` | `getStartupProblems()` Starts this repository instance (if not already started) and returns all the possible startup problems & warnings which did not prevent the repository from starting up.
    `ModeShapeEngine.State` | `getState()` Get the state of this JCR repository instance.
    `protected boolean` | `hasWorkspace(String workspaceName)`
    `boolean` | `isSingleValueDescriptor(String key)`
    `boolean` | `isStandardDescriptor(String key)`
    `protected ChangeJournal` | `journal()`
    `protected String` | `journalId()`
    `protected org.modeshape.jcr.RepositoryLockManager` | `lockManager()`
    `JcrSession` | `login()`
    `JcrSession` | `login(Credentials credentials)`
    `JcrSession` | `login(Credentials credentials, String workspaceName)`
    `JcrSession` | `login(String workspaceName)`
    `protected org.modeshape.jcr.RepositoryNodeTypeManager` | `nodeTypeManager()`
    `protected NamespaceRegistry` | `persistentRegistry()`
    `protected void` | `prepareToRestore()`
    `protected org.modeshape.jcr.RepositoryQueryManager` | `queryManager()`
    `protected void` | `refreshWorkspaces()`
    `protected RepositoryCache` | `repositoryCache()`
    `protected String` | `repositoryKey()`
    `protected String` | `repositoryName()`
    `protected JcrRepository.RunningState` | `runningState()`
    `protected RepositoryStatistics` | `statistics()`
    `protected String` | `systemWorkspaceKey()`
    `protected String` | `systemWorkspaceName()`
    `protected TransactionManager` | `transactionManager()`
    `protected NodeCache` | `workspaceCache(String workspaceName)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### MISSING_JAAS_POLICIES

          protected static final Set<String> MISSING_JAAS_POLICIES

    - #### logger

          protected final Logger logger

  - ### Constructor Detail

    - #### JcrRepository

          protected JcrRepository(RepositoryConfiguration configuration)
                           throws ConfigurationException

      Create a Repository instance given the `configuration`.
      Parameters:
        `configuration` - the repository configuration; may not be null
      Throws:
        `ConfigurationException` - if there is a problem with the configuration

  - ### Method Detail

    - #### getState

          public ModeShapeEngine.State getState()

      Get the state of this JCR repository instance.
      Returns:
        the state; never null

    - #### getName

          public String getName()

      Get the name of this JCR repository instance.
      Specified by:
        `getName` in interface `NamedRepository`
      Returns:
        the name; never null

    - #### getActiveSessionsCount

          public int getActiveSessionsCount()

      Description copied from interface: `Repository`
      Returns the number of active client sessions for this repository. An active session is a session on which `Session.logout()` hasn't been called yet.
      Returns:
        the number of sessions

    - #### getRepositoryStatistics

          public RepositoryStatistics getRepositoryStatistics()

      Get the component that can be used to obtain statistics for this repository.

      Note that this provides un-checked access to the statistics, unlike `RepositoryManager.getRepositoryMonitor()` in the public API which only exposes the statistics if the session's user has administrative privileges.

      Returns:
        the statistics component; never null
      Throws:
        `IllegalStateException` - if the repository is not `running`
      See Also:
        `Workspace.getRepositoryManager()`, `RepositoryManager.getRepositoryMonitor()`

    - #### getStartupProblems

          public Problems getStartupProblems()
                                      throws Exception

      Starts this repository instance (if not already started) and returns all the possible startup problems & warnings which did not prevent the repository from starting up.

      The are 2 general categories of issues that can be logged as problems:

      - configuration warnings - any warnings raised by the structure of the repository configuration file
      - startup warnings/error - any warnings/errors raised by various repository components which didn't prevent them from starting up, but could mean they are only partly intialized.
      Returns:
        a `Problems` instance which may contains errors and warnings raised by various components; may be empty if nothing unusual happened during start but never `null`
      Throws:
        `FileNotFoundException` - if the Infinispan configuration file is specified but could not be found
        `IOException` - if there is a problem with the specified Infinispan configuration file
        `Exception` - if there is a problem with underlying resource setup

    - #### doStart

          protected final JcrRepository.RunningState doStart()
                                                      throws Exception

      Throws:
        `Exception`

    - #### doShutdown

          protected final boolean doShutdown()

    - #### getIndexManager

          public IndexManager getIndexManager()

      Get the manager for the index definitions and index providers.
      Returns:
        the index manager; never null

    - #### documentStore

          protected final DocumentStore documentStore()

    - #### repositoryName

          protected final String repositoryName()

    - #### repositoryCache

          protected final RepositoryCache repositoryCache()

    - #### statistics

          protected final RepositoryStatistics statistics()

    - #### nodeTypeManager

          protected final org.modeshape.jcr.RepositoryNodeTypeManager nodeTypeManager()

    - #### queryManager

          protected final org.modeshape.jcr.RepositoryQueryManager queryManager()

    - #### lockManager

          protected final org.modeshape.jcr.RepositoryLockManager lockManager()

    - #### persistentRegistry

          protected final NamespaceRegistry persistentRegistry()

    - #### systemWorkspaceName

          protected final String systemWorkspaceName()

    - #### systemWorkspaceKey

          protected final String systemWorkspaceKey()

    - #### changeBus

          protected final ChangeBus changeBus()

    - #### repositoryKey

          protected final String repositoryKey()

    - #### runningState

          protected final JcrRepository.RunningState runningState()

    - #### hasWorkspace

          protected final boolean hasWorkspace(String workspaceName)

    - #### workspaceCache

          protected final NodeCache workspaceCache(String workspaceName)

    - #### transactionManager

          protected final TransactionManager transactionManager()

    - #### prepareToRestore

          protected final void prepareToRestore()
                                         throws RepositoryException

      Throws:
        `RepositoryException`

    - #### journalId

          protected final String journalId()

    - #### journal

          protected final ChangeJournal journal()

    - #### completeRestore

          protected final void completeRestore()
                                        throws ExecutionException,
                                               Exception

      Throws:
        `ExecutionException`
        `Exception`

    - #### getConfiguration

          public RepositoryConfiguration getConfiguration()

      Get the immutable configuration for this repository.
      Returns:
        the configuration; never null

    - #### getDescriptor

          public String getDescriptor(String key)

      Specified by:
        `getDescriptor` in interface `Repository`

    - #### getDescriptorValue

          public org.modeshape.jcr.JcrValue getDescriptorValue(String key)

      Specified by:
        `getDescriptorValue` in interface `Repository`

    - #### getDescriptorValues

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

      Specified by:
        `getDescriptorValues` in interface `Repository`

    - #### isSingleValueDescriptor

          public boolean isSingleValueDescriptor(String key)

      Specified by:
        `isSingleValueDescriptor` in interface `Repository`

    - #### isStandardDescriptor

          public boolean isStandardDescriptor(String key)

      Specified by:
        `isStandardDescriptor` in interface `Repository`

    - #### getDescriptorKeys

          public String[] getDescriptorKeys()

      Specified by:
        `getDescriptorKeys` in interface `Repository`

    - #### login

          public JcrSession login()
                           throws RepositoryException

      Specified by:
        `login` in interface `Repository`
      Throws:
        `RepositoryException`

    - #### login

          public JcrSession login(Credentials credentials)
                           throws RepositoryException

      Specified by:
        `login` in interface `Repository`
      Throws:
        `RepositoryException`

    - #### login

          public JcrSession login(String workspaceName)
                           throws RepositoryException

      Specified by:
        `login` in interface `Repository`
      Throws:
        `RepositoryException`

    - #### login

          public JcrSession 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)`

    - #### refreshWorkspaces

          protected void refreshWorkspaces()

    - #### determineInitialDelay

          protected long determineInitialDelay(String initialTimeExpression)

      Determine the initial delay before the garbage collection process(es) should be run, based upon the supplied initial expression. Note that the initial expression specifies the hours and minutes in local time, whereas this method should return the delay in milliseconds after the current time.
      Parameters:
        `initialTimeExpression` - the expression of the form "`hh:mm`"; never null
      Returns:
        the number of milliseconds after now that the process(es) should be started

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