ModeShape Distribution 3.2.0.Final

org.modeshape.jcr
Class Connectors

java.lang.Object
  extended by org.modeshape.jcr.Connectors

public class Connectors
extends Object

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


Nested Class Summary
protected static class Connectors.LocalDocumentStoreExtraProperties
           
protected  class Connectors.Projection
           
 
Constructor Summary
protected Connectors(JcrRepository.RunningState repository, Collection<RepositoryConfiguration.Component> components, Map<String,List<RepositoryConfiguration.ProjectionConfiguration>> preconfiguredProjections)
           
 
Method Summary
 void addConnector(RepositoryConfiguration.Component component)
          Add a new connector by supplying the component definition.
 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.
 String getProjectedNodeKey(String externalNodeKey)
          Returns the key of the internal (federated) node which has been projected on the external node with the given key.
 boolean hasConnectors()
          Checks if there are any registered connectors.
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  void registerConnector(Connector connector)
           
 boolean removeConnector(String connectorName)
          Remove an existing connector registered with the supplied name.
protected  void shutdown()
           
 
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

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.

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.

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

addConnector

public void addConnector(RepositoryConfiguration.Component component)
                  throws RepositoryException
Add a new connector by supplying the component definition. This method instantiates, initializes, and then registers the connector into this manager. If registration is successful, this method will replace any running connector already registered with the same name.

Parameters:
component - the component describing the connector; may not be null
Throws:
RepositoryException - if there is a problem initializing the connector

removeConnector

public boolean removeConnector(String connectorName)
Remove an existing connector registered with the supplied name.

Parameters:
connectorName - the name of the connector that should be removed; may not be null
Returns:
true if the existing connector was found and removed, or false if there was no connector with the given name

instantiateConnector

protected Connector instantiateConnector(RepositoryConfiguration.Component component)

initializeConnector

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

registerConnector

protected void registerConnector(Connector connector)

shutdown

protected void shutdown()

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

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

getDocumentTranslator

public DocumentTranslator getDocumentTranslator()
Returns the repository's document translator.

Returns:
a DocumentTranslator instance.

hasConnectors

public boolean hasConnectors()
Checks if there are any registered connectors.

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

ModeShape Distribution 3.2.0.Final

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