org.modeshape.jcr

## Class Connectors.Snapshot

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

- Enclosing class:
    Connectors

      @Immutable
      protected class Connectors.Snapshot
      extends Object

  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.

  Instances are publicly immutable.

- - ### Constructor Summary

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

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `containsProjectionForExternalNode(String externalNodeKey)` Determine if this snapshot contains a projection that uses the supplied external node key.
    `boolean` | `containsProjectionForInternalNode(String internalNodeKey)` Determine if this snapshot contains a projection that uses the supplied internal node key.
    `Collection<Connector>` | `getConnectors()` Get the `Connector` instances.
    `Connector` | `getConnectorWithSourceKey(String sourceKey)` Get the `Connector` instance that has the same source key (generated from the connector's `source name`).
    `Connectors.PathMappings` | `getPathMappings(Connector connector)` Get the immutable mappings from connector-specific external paths to projected, repository paths.
    `List<RepositoryConfiguration.ProjectionConfiguration>` | `getProjectionConfigurationsForWorkspace(String workspaceName)` Get all of the `RepositoryConfiguration.ProjectionConfiguration`s that apply to the workspace with the given name.
    `Connectors.Projection` | `getProjectionForExternalNode(String externalNodeKey)` Get the projection that uses the supplied external node key.
    `Collection<Connectors.Projection>` | `getProjections()` Get the `Connectors.Projection` instances in this snapshot.
    `String` | `getSourceNameAtKey(String sourceKey)` Returns the name of the external source mapped at the given key.
    `Collection<String>` | `getWorkspacesWithProjections()` Get the names of the workspaces that contain at least one projection.
    `Set<String>` | `getWorkspacesWithProjectionsFor(Connector connector)` Get the set of workspace names that contain projections of the supplied connector.
    `boolean` | `hasConnectors()` Determine if this snapshot contains any `Connector` instances.
    `boolean` | `hasExternalProjection(String alias, String externalNodeKey)` Determine if this snapshot contains a projection with the given alias and external node key
    `boolean` | `hasInternalProjection(String alias, String projectedNodeKey)` Determine if this snapshot contains a projection with the given alias and projected (internal) node key
    `protected boolean` | `hasReadonlyConnectors()`
    `protected void` | `shutdownUnusedConnectors()`
    `protected Connectors.Snapshot` | `withOnlyProjectionConfigurations()` Create a new snapshot that contains only the same `projection configurations` that this snapshot contains.
    `protected Connectors.Snapshot` | `withoutConnectors(Iterable<Connector> connectors)` Create a new snapshot that is a copy of this snapshot but which excludes any of the supplied connector instances.
    `protected Connectors.Snapshot` | `withoutProjection(String externalNodeKey)` Create a new snapshot that excludes any existing projection that uses the supplied external node key.
    `protected Connectors.Snapshot` | `withProjection(Connectors.Projection projection)` Create a new snapshot that is a copy of this snapshot but which includes the supplied projection.
    `protected Connectors.Snapshot` | `withProjections(Iterable<Connectors.Projection> projections)` Create a new snapshot that is a copy of this snapshot but which includes the supplied projections.

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

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

- - ### Constructor Detail

    - #### Connectors.Snapshot

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

    - #### Connectors.Snapshot

          protected Connectors.Snapshot(Connectors.Snapshot original)

  - ### Method Detail

    - #### shutdownUnusedConnectors

          protected void shutdownUnusedConnectors()

    - #### hasConnectors

          public boolean hasConnectors()

      Determine if this snapshot contains any `Connector` instances.
      Returns:
        true if there is at least one Connector instance, or false otherwise

    - #### getConnectorWithSourceKey

          public Connector getConnectorWithSourceKey(String sourceKey)

      Get the `Connector` instance that has the same source key (generated from the connector's `source name`).
      Parameters:
        `sourceKey` - the source key
      Returns:
        the Connector, or null if no such connector exists

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

    - #### getConnectors

          public Collection<Connector> getConnectors()

      Get the `Connector` instances.
      Returns:
        the (immutable) collection of Connector instances

    - #### getWorkspacesWithProjections

          public Collection<String> getWorkspacesWithProjections()

      Get the names of the workspaces that contain at least one projection.
      Returns:
        the (immutable) collection of workspace names
      See Also:
        `getProjectionConfigurationsForWorkspace(String)`

    - #### getProjectionConfigurationsForWorkspace

          public List<RepositoryConfiguration.ProjectionConfiguration> getProjectionConfigurationsForWorkspace(String workspaceName)

      Get all of the `RepositoryConfiguration.ProjectionConfiguration`s that apply to the workspace with the given name.
      Parameters:
        `workspaceName` - the name of the workspace
      Returns:
        the (immutable) list of projection configurations
      See Also:
        `getWorkspacesWithProjections()`

    - #### getWorkspacesWithProjectionsFor

          public Set<String> getWorkspacesWithProjectionsFor(Connector connector)

      Get the set of workspace names that contain projections of the supplied connector.
      Parameters:
        `connector` - the connector
      Returns:
        the set of workspace names

    - #### hasInternalProjection

          public boolean hasInternalProjection(String alias,
                                      String projectedNodeKey)

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

    - #### hasExternalProjection

          public boolean hasExternalProjection(String alias,
                                      String externalNodeKey)

      Determine if this snapshot contains a projection with the given alias and external node key
      Parameters:
        `alias` - the alias
        `externalNodeKey` - the node key of the external node
      Returns:
        true if there is such a projection, or false otherwise

    - #### getProjections

          public Collection<Connectors.Projection> getProjections()

      Get the `Connectors.Projection` instances in this snapshot.
      Returns:
        the (immutable) collection of (immutable) Projection instances

    - #### getProjectionForExternalNode

          public Connectors.Projection getProjectionForExternalNode(String externalNodeKey)

      Get the projection that uses the supplied external node key.
      Parameters:
        `externalNodeKey` - the node key for the external node
      Returns:
        the projection, or null if there is no such projection

    - #### containsProjectionForExternalNode

          public boolean containsProjectionForExternalNode(String externalNodeKey)

      Determine if this snapshot contains a projection that uses the supplied external node key.
      Parameters:
        `externalNodeKey` - the node key for the external node
      Returns:
        true if there is an existing projection, or false otherwise

    - #### containsProjectionForInternalNode

          public boolean containsProjectionForInternalNode(String internalNodeKey)

      Determine if this snapshot contains a projection that uses the supplied internal node key.
      Parameters:
        `internalNodeKey` - the node key for the internal node
      Returns:
        true if there is an existing projection, or false otherwise

    - #### withoutProjection

          protected Connectors.Snapshot withoutProjection(String externalNodeKey)

      Create a new snapshot that excludes any existing projection that uses the supplied external node key.
      Parameters:
        `externalNodeKey` - the node key for the external node
      Returns:
        the new snapshot, or this instance if there is no such projection

    - #### withoutConnectors

          protected Connectors.Snapshot withoutConnectors(Iterable<Connector> connectors)

      Create a new snapshot that is a copy of this snapshot but which excludes any of the supplied connector instances.
      Parameters:
        `connectors` - the connectors
      Returns:
        the new snapshot, or this instance if it contains none of the supplied connectors
      See Also:
        `should be called after this Snapshot is no longer accessible, so that any previous Connector instance is {@link Connector#shutdown()}`

    - #### withProjection

          protected Connectors.Snapshot withProjection(Connectors.Projection projection)

      Create a new snapshot that is a copy of this snapshot but which includes the supplied projection.
      Parameters:
        `projection` - the projection
      Returns:
        the new snapshot

    - #### withProjections

          protected Connectors.Snapshot withProjections(Iterable<Connectors.Projection> projections)

      Create a new snapshot that is a copy of this snapshot but which includes the supplied projections.
      Parameters:
        `projections` - the projections
      Returns:
        the new snapshot

    - #### withOnlyProjectionConfigurations

          protected Connectors.Snapshot withOnlyProjectionConfigurations()

      Create a new snapshot that contains only the same `projection configurations` that this snapshot contains.
      Returns:
        the new snapshot

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

    - #### hasReadonlyConnectors

          protected boolean hasReadonlyConnectors()

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