org.modeshape.jcr

## Class Connectors

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

-     @ThreadSafe
      public final class Connectors
      extends Object

  Class which maintains (based on the configuration) the list of available connectors for a repository.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `protected static class` | `Connectors.AbstractPathMappings`
    `protected static class` | `Connectors.BasicPathMappings`
    `protected static class` | `Connectors.EmptyPathMappings`
    `protected static class` | `Connectors.LocalDocumentStoreExtraProperties`
    `protected static class` | `Connectors.PathMapping`
    `static interface` | `Connectors.PathMappings` The immutable mappings between the (federated) repository nodes and the external nodes exposed by a connector that they project.
    `protected class` | `Connectors.Projection`
    `protected class` | `Connectors.Snapshot` An immutable class used internally to provide a consistent (immutable) view of the `Connector` instances, along with various cached data to make it easy to find a `Connector` instance by projected or external source keys, etc.

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `Connectors(JcrRepository.RunningState repository, Collection<RepositoryConfiguration.Component> components, Map<String,List<RepositoryConfiguration.ProjectionConfiguration>> preconfiguredProjections)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addProjection(String externalNodeKey, String projectedNodeKey, String alias)` Stores a mapping from an external node towards an existing, internal node which will become a federated node.
    `void` | `externalNodeRemoved(String externalNodeKey)` Signals that an external node with the given key has been removed.
    `Connector` | `getConnectorForSourceKey(String sourceKey)` Returns the connector which is mapped to the given source key.
    `Connector` | `getConnectorForSourceName(String sourceName)` Returns a connector which was registered for the given source name.
    `DocumentTranslator` | `getDocumentTranslator()` Returns the repository's document translator.
    `Connectors.PathMappings` | `getPathMappings(Connector connector)` Get the immutable mappings from connector-specific external paths to projected, repository paths.
    `String` | `getProjectedNodeKey(String externalNodeKey)` Returns the key of the internal (federated) node which has been projected on the external node with the given key.
    `String` | `getSourceNameAtKey(String sourceKey)` Returns the name of the external source mapped at the given key.
    `protected Set<String>` | `getWorkspacesWithProjectionsFor(Connector connector)`
    `boolean` | `hasConnectors()` Checks if there are any registered connectors.
    `boolean` | `hasExternalProjection(String alias, String externalNodeKey)` Determine there is a projection with the given alias and projected (internal) node key
    `protected boolean` | `hasReadonlyConnectors()`
    `protected void` | `initialize()`
    `protected void` | `initializeConnector(Connector connector, NamespaceRegistry registry, NodeTypeManager nodeTypeManager)`
    `protected Connector` | `instantiateConnector(RepositoryConfiguration.Component component)`
    `void` | `internalNodeRemoved(String internalNodeKey)` Signals that an internal node with the given key has been removed.
    `protected boolean` | `isReadonlyPath(Path path, JcrSession session)`
    `protected JcrRepository.RunningState` | `repository()`
    `protected void` | `shutdown()`
    `protected Map<String,String>` | `workspaceNamesByKey()`

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

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

- - ### Constructor Detail

    - #### Connectors

          protected Connectors(JcrRepository.RunningState repository,
                    Collection<RepositoryConfiguration.Component> components,
                    Map<String,List<RepositoryConfiguration.ProjectionConfiguration>> preconfiguredProjections)

  - ### Method Detail

    - #### initialize

          protected void initialize()
                             throws RepositoryException

      Throws:
        `RepositoryException`

    - #### getProjectedNodeKey

          public String getProjectedNodeKey(String externalNodeKey)

      Returns the key of the internal (federated) node which has been projected on the external node with the given key.
      Parameters:
        `externalNodeKey` - a `non-null` String representing the `NodeKey` format an external node
      Returns:
        either a `non-null` String representing the node key of the projected node, or `null` if there is no projection.

    - #### addProjection

          public void addProjection(String externalNodeKey,
                           String projectedNodeKey,
                           String alias)

      Stores a mapping from an external node towards an existing, internal node which will become a federated node. These projections are created via `FederationManager.createProjection(String, String, String, String)` and need to be stored so that parent back references (from the projection to the external node) are correctly handled.
      Parameters:
        `externalNodeKey` - a `non-null` String representing the `NodeKey` format of the projection's id.
        `projectedNodeKey` - a `non-null` String, representing the value of the external node's key
        `alias` - a `non-null` String, representing the alias of the projection.

    - #### externalNodeRemoved

          public void externalNodeRemoved(String externalNodeKey)

      Signals that an external node with the given key has been removed.
      Parameters:
        `externalNodeKey` - a `non-null` String

    - #### internalNodeRemoved

          public void internalNodeRemoved(String internalNodeKey)

      Signals that an internal node with the given key has been removed.
      Parameters:
        `internalNodeKey` - a `non-null` String

    - #### instantiateConnector

          protected Connector instantiateConnector(RepositoryConfiguration.Component component)

    - #### initializeConnector

          protected void initializeConnector(Connector connector,
                                 NamespaceRegistry registry,
                                 NodeTypeManager nodeTypeManager)
                                      throws IOException,
                                             RepositoryException

      Throws:
        `IOException`
        `RepositoryException`

    - #### repository

          protected JcrRepository.RunningState repository()

    - #### getWorkspacesWithProjectionsFor

          protected final Set<String> getWorkspacesWithProjectionsFor(Connector connector)

    - #### workspaceNamesByKey

          protected final Map<String,String> workspaceNamesByKey()

    - #### shutdown

          protected void shutdown()

    - #### hasReadonlyConnectors

          protected boolean hasReadonlyConnectors()

    - #### getConnectorForSourceKey

          public Connector getConnectorForSourceKey(String sourceKey)

      Returns the connector which is mapped to the given source key.
      Parameters:
        `sourceKey` - a `non-null` `String`
      Returns:
        either a `Connector` instance of `null`

    - #### getSourceNameAtKey

          public String getSourceNameAtKey(String sourceKey)

      Returns the name of the external source mapped at the given key.
      Parameters:
        `sourceKey` - the key of the source; may not be null
      Returns:
        the name of the external source to which the key is mapped; may be null

    - #### hasExternalProjection

          public boolean hasExternalProjection(String alias,
                                      String externalNodeKey)

      Determine there is a projection with the given alias and projected (internal) node key
      Parameters:
        `alias` - the alias
        `externalNodeKey` - the node key of the projected (internal) node
      Returns:
        true if there is such a projection, or false otherwise

    - #### getConnectorForSourceName

          public Connector getConnectorForSourceName(String sourceName)

      Returns a connector which was registered for the given source name.
      Parameters:
        `sourceName` - a `non-null` String; the name of a source
      Returns:
        either a `Connector` instance or `null`

    - #### hasConnectors

          public boolean hasConnectors()

      Checks if there are any registered connectors.
      Returns:
        `true` if any connectors are registered, `false` otherwise.

    - #### getDocumentTranslator

          public DocumentTranslator getDocumentTranslator()

      Returns the repository's document translator.
      Returns:
        a `DocumentTranslator` instance.

    - #### getPathMappings

          public Connectors.PathMappings getPathMappings(Connector connector)

      Get the immutable mappings from connector-specific external paths to projected, repository paths. The supplied object is intended to be used for a specific activity (where a consistent set of mappings is expected), discarded, and then reacquired the next time mappings are needed.
      Parameters:
        `connector` - the connector for which the path mappings are requested; may not be null
      Returns:
        the path mappings; never null

    - #### isReadonlyPath

          protected boolean isReadonlyPath(Path path,
                               JcrSession session)
                                    throws RepositoryException

      Throws:
        `RepositoryException`

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