org.modeshape.jcr

## Class JcrRepositoriesContainer

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

- All Implemented Interfaces:
    RepositoriesContainer

      @ThreadSafe
      public final class JcrRepositoriesContainer
      extends Object
      implements RepositoriesContainer

  Service provider implementation of the `RepositoriesContainer` interface.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `protected class` | `JcrRepositoriesContainer.JNDIRepositoryLookup`
    `protected class` | `JcrRepositoriesContainer.UrlRepositoryLookup`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected static ModeShapeEngine` | `ENGINE` The engine that hosts the deployed repository instances.
    `protected static String` | `FILE_PROTOCOL`
    `protected static String` | `JNDI_PROTOCOL`
    `protected static Logger` | `LOG`
    `protected static String` | `REPOSITORY_NAME_URL_PARAM`

    - ### Fields inherited from interface org.modeshape.jcr.api.RepositoriesContainer

      `REPOSITORY_NAME, URL`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `JcrRepositoriesContainer()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected ModeShapeEngine` | `engine()`
    `JcrRepository` | `getRepository(String repositoryName, Map parameters)` Return the JCR Repository with the supplied name and an optional map of parameters which can be used to initialize the repository.
    `Set<String>` | `getRepositoryNames(Map<?,?> parameters)` Returns the names of all the available repositories, using an optional map of parameters which may be used to initialize additional repositories, which will also be returned.
    `protected String` | `repositoryNameFrom(String url, Map<?,?> parameters)`
    `Future<Boolean>` | `shutdown()` Shutdown this engine to stop all repositories created by calls to `RepositoriesContainer.getRepository(String, java.util.Map)`, terminate any ongoing background operations (such as sequencing), and reclaim any resources that were acquired by the repositories.
    `boolean` | `shutdown(long timeout, TimeUnit unit)` Shutdown this engine to stop all repositories created by calls to `RepositoriesContainer.getRepository(String, java.util.Map)`, terminate any ongoing background operations (such as sequencing), and reclaim any resources that were acquired by the repositories.

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

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

- - ### Field Detail

    - #### LOG

          protected static final Logger LOG

    - #### REPOSITORY_NAME_URL_PARAM

          protected static final String REPOSITORY_NAME_URL_PARAM

      See Also:
        Constant Field Values

    - #### FILE_PROTOCOL

          protected static final String FILE_PROTOCOL

      See Also:
        Constant Field Values

    - #### JNDI_PROTOCOL

          protected static final String JNDI_PROTOCOL

      See Also:
        Constant Field Values

    - #### ENGINE

          protected static final ModeShapeEngine ENGINE

      The engine that hosts the deployed repository instances.

  - ### Constructor Detail

    - #### JcrRepositoriesContainer

          public JcrRepositoriesContainer()

  - ### Method Detail

    - #### getRepository

          public JcrRepository getRepository(String repositoryName,
                                    Map parameters)
                                      throws RepositoryException

      Description copied from interface: `RepositoriesContainer`
      Return the JCR Repository with the supplied name and an optional map of parameters which can be used to initialize the repository.
      Specified by:
        `getRepository` in interface `RepositoriesContainer`
      Parameters:
        `repositoryName` - the name of the repository to return; may be `null` if, for example, the parameters map already contains this information.
        `parameters` - map of string key/value pairs as repository arguments. My be `null` if no configuration parameters exist.
      Returns:
        the repository with the given name or `null` if no repository is found
      Throws:
        `RepositoryException` - if there is an error communicating with the repository
      See Also:
        `RepositoryFactory.getRepository(java.util.Map)`

    - #### getRepositoryNames

          public Set<String> getRepositoryNames(Map<?,?> parameters)
                                         throws RepositoryException

      Description copied from interface: `RepositoriesContainer`
      Returns the names of all the available repositories, using an optional map of parameters which may be used to initialize additional repositories, which will also be returned.
      Specified by:
        `getRepositoryNames` in interface `RepositoriesContainer`
      Parameters:
        `parameters` - map of string key/value pairs as repository arguments or `null` if none are provided
      Returns:
        the immutable set of repository names provided by this container; never `null`
      Throws:
        `RepositoryException` - if there is an error performing the lookup.
      See Also:
        `RepositoryFactory.getRepository(java.util.Map)`

    - #### shutdown

          public Future<Boolean> shutdown()

      Description copied from interface: `RepositoriesContainer`
      Shutdown this engine to stop all repositories created by calls to `RepositoriesContainer.getRepository(String, java.util.Map)`, terminate any ongoing background operations (such as sequencing), and reclaim any resources that were acquired by the repositories. This method may be called multiple times, but only the first time has an effect.

      Invoking this method does not preclude creating new `Repository` instances with future calls to `RepositoriesContainer.getRepository(String, java.util.Map)`. Any caller using this method as part of an application shutdown process should take care to cease invocations of `RepositoriesContainer.getRepository(String, java.util.Map)` prior to invoking this method.

      This method returns immediately, even before the repositories have been shut down. However, the caller can simply call the `get()` method on the returned `Future` to block until all repositories have shut down. Note that the `Future.get(long, java.util.concurrent.TimeUnit)` method can be called to block for a maximum amount of time.

      Specified by:
        `shutdown` in interface `RepositoriesContainer`
      Returns:
        a future that allows the caller to block until the engine is shutdown; any error during shutdown will be thrown when `getting` the repository from the future, where the exception is wrapped in a `ExecutionException`. The value returned from the future will always be true if the engine shutdown (or was not running), or false if the engine is still running.

    - #### shutdown

          public boolean shutdown(long timeout,
                         TimeUnit unit)
                           throws InterruptedException

      Description copied from interface: `RepositoriesContainer`
      Shutdown this engine to stop all repositories created by calls to `RepositoriesContainer.getRepository(String, java.util.Map)`, terminate any ongoing background operations (such as sequencing), and reclaim any resources that were acquired by the repositories. This method may be called multiple times, but only the first time has an effect.

      This method is equivalent to calling "`shutdown().get(timeout,unit)`" on this method.

      Invoking this method does not preclude creating new `Repository` instances with future calls to `RepositoriesContainer.getRepository(String, java.util.Map)`. Any caller using this method as part of an application shutdown process should take care to cease invocations of `RepositoriesContainer.getRepository(String, java.util.Map)` prior to invoking this method.

      This method returns immediately, even before the repositories have been shut down. However, the caller can simply call the `get()` method on the returned `Future` to block until all repositories have shut down. Note that the `Future.get(long, java.util.concurrent.TimeUnit)` method can be called to block for a maximum amount of time.

      Specified by:
        `shutdown` in interface `RepositoriesContainer`
      Parameters:
        `timeout` - the maximum time per engine to allow for shutdown
        `unit` - the time unit of the timeout argument
      Returns:
        `true` if all engines completely shut down and `false` if the timeout elapsed before it was shut down completely
      Throws:
        `InterruptedException` - if interrupted while waiting

    - #### engine

          protected ModeShapeEngine engine()

    - #### repositoryNameFrom

          protected String repositoryNameFrom(String url,
                                  Map<?,?> parameters)

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