org.jboss.dna.connector.federation.executor
Class FederatingCommandExecutor

java.lang.Object
  extended by org.jboss.dna.graph.requests.processor.RequestProcessor
      extended by org.jboss.dna.connector.federation.executor.FederatingCommandExecutor

@NotThreadSafe
public class FederatingCommandExecutor
extends org.jboss.dna.graph.requests.processor.RequestProcessor

Author:
Randall Hauch

Nested Class Summary
 
Nested classes/interfaces inherited from class org.jboss.dna.graph.requests.processor.RequestProcessor
org.jboss.dna.graph.requests.processor.RequestProcessor.LocationWithDepth
 
Constructor Summary
FederatingCommandExecutor(org.jboss.dna.graph.ExecutionContext context, String sourceName, List<Projection> sourceProjections, org.jboss.dna.graph.connectors.RepositoryConnectionFactory connectionFactory)
          Create a command executor that federates (merges) the information from multiple sources described by the source projections.
FederatingCommandExecutor(org.jboss.dna.graph.ExecutionContext context, String sourceName, Projection cacheProjection, org.jboss.dna.graph.cache.CachePolicy defaultCachePolicy, List<Projection> sourceProjections, org.jboss.dna.graph.connectors.RepositoryConnectionFactory connectionFactory)
          Create a command executor that federates (merges) the information from multiple sources described by the source projections.
 
Method Summary
 void close()
          
protected  FederatedNode createFederatedNode(org.jboss.dna.graph.Location location, List<Contribution> contributions, boolean updateCache)
           
 Projection getCacheProjection()
          Get the projection defining the cache.
protected  org.jboss.dna.graph.connectors.RepositoryConnection getConnection(Projection projection)
           
protected  org.jboss.dna.graph.connectors.RepositoryConnection getConnectionToCache()
           
protected  org.jboss.dna.graph.properties.DateTime getCurrentTimeInUtc()
           
protected  MergePlan getMergePlan(org.jboss.dna.graph.requests.ReadNodeRequest request)
           
protected  org.jboss.dna.graph.requests.ReadNodeRequest getNode(org.jboss.dna.graph.Location location)
          Get the node information from the underlying sources or, if possible, from the cache.
protected  Set<String> getOpenConnections()
           
 List<Projection> getSourceProjections()
          Get an unmodifiable list of the immutable source projections.
protected  void loadContributionsFromSources(org.jboss.dna.graph.Location location, Set<String> sourceNames, List<Contribution> contributions)
          Load the node at the supplied location from the sources with the supplied name, returning the information.
 void process(org.jboss.dna.graph.requests.CopyBranchRequest request)
          
 void process(org.jboss.dna.graph.requests.CreateNodeRequest request)
          
 void process(org.jboss.dna.graph.requests.DeleteBranchRequest request)
          
 void process(org.jboss.dna.graph.requests.MoveBranchRequest request)
          
 void process(org.jboss.dna.graph.requests.ReadAllChildrenRequest request)
          
 void process(org.jboss.dna.graph.requests.ReadAllPropertiesRequest request)
          
 void process(org.jboss.dna.graph.requests.ReadNodeRequest request)
          
 void process(org.jboss.dna.graph.requests.UpdatePropertiesRequest request)
          
 void setMergingStrategy(MergeStrategy mergingStrategy)
           
protected  void updateCache(FederatedNode mergedNode)
           
 
Methods inherited from class org.jboss.dna.graph.requests.processor.RequestProcessor
getExecutionContext, getNowInUtc, getSourceName, process, process, process, process, process, process, process, process
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FederatingCommandExecutor

public FederatingCommandExecutor(org.jboss.dna.graph.ExecutionContext context,
                                 String sourceName,
                                 List<Projection> sourceProjections,
                                 org.jboss.dna.graph.connectors.RepositoryConnectionFactory connectionFactory)
Create a command executor that federates (merges) the information from multiple sources described by the source projections. The resulting command executor does not first consult a cache for the merged information; if a cache is desired, see constructor that takes a cache projection.

Parameters:
context - the execution context in which the executor will be run; may not be null
sourceName - the name of the RepositorySource that is making use of this executor; may not be null or empty
sourceProjections - the source projections; may not be null
connectionFactory - the factory for RepositoryConnection instances

FederatingCommandExecutor

public FederatingCommandExecutor(org.jboss.dna.graph.ExecutionContext context,
                                 String sourceName,
                                 Projection cacheProjection,
                                 org.jboss.dna.graph.cache.CachePolicy defaultCachePolicy,
                                 List<Projection> sourceProjections,
                                 org.jboss.dna.graph.connectors.RepositoryConnectionFactory connectionFactory)
Create a command executor that federates (merges) the information from multiple sources described by the source projections. The resulting command executor will use the supplied cache projection to identify the repository source for the cache as well as the rules for how the paths are mapped in the cache. This cache will be consulted first for the requested information, and will be kept up to date as changes are made to the federated information.

Parameters:
context - the execution context in which the executor will be run; may not be null
sourceName - the name of the RepositorySource that is making use of this executor; may not be null or empty
cacheProjection - the projection used for the cached information; may be null if there is no cache
defaultCachePolicy - the default caching policy that outlines the length of time that information should be cached, or null if there is no cache or no specific cache policy
sourceProjections - the source projections; may not be null
connectionFactory - the factory for RepositoryConnection instances
Method Detail

setMergingStrategy

public void setMergingStrategy(MergeStrategy mergingStrategy)
Parameters:
mergingStrategy - Sets mergingStrategy to the specified value.

getSourceProjections

public List<Projection> getSourceProjections()
Get an unmodifiable list of the immutable source projections.

Returns:
the set of projections used as sources; never null

getCacheProjection

public Projection getCacheProjection()
Get the projection defining the cache.

Returns:
the cache projection

getCurrentTimeInUtc

protected org.jboss.dna.graph.properties.DateTime getCurrentTimeInUtc()

close

public void close()

Overrides:
close in class org.jboss.dna.graph.requests.processor.RequestProcessor
See Also:
RequestProcessor.close()

getConnectionToCache

protected org.jboss.dna.graph.connectors.RepositoryConnection getConnectionToCache()
                                                                            throws org.jboss.dna.graph.connectors.RepositorySourceException
Throws:
org.jboss.dna.graph.connectors.RepositorySourceException

getConnection

protected org.jboss.dna.graph.connectors.RepositoryConnection getConnection(Projection projection)
                                                                     throws org.jboss.dna.graph.connectors.RepositorySourceException
Throws:
org.jboss.dna.graph.connectors.RepositorySourceException

getOpenConnections

protected Set<String> getOpenConnections()

process

public void process(org.jboss.dna.graph.requests.ReadAllChildrenRequest request)

Specified by:
process in class org.jboss.dna.graph.requests.processor.RequestProcessor
See Also:
RequestProcessor.process(org.jboss.dna.graph.requests.ReadAllChildrenRequest)

process

public void process(org.jboss.dna.graph.requests.ReadAllPropertiesRequest request)

Specified by:
process in class org.jboss.dna.graph.requests.processor.RequestProcessor
See Also:
RequestProcessor.process(org.jboss.dna.graph.requests.ReadAllPropertiesRequest)

process

public void process(org.jboss.dna.graph.requests.ReadNodeRequest request)

Overrides:
process in class org.jboss.dna.graph.requests.processor.RequestProcessor
See Also:
RequestProcessor.process(org.jboss.dna.graph.requests.ReadNodeRequest)

process

public void process(org.jboss.dna.graph.requests.CopyBranchRequest request)

Specified by:
process in class org.jboss.dna.graph.requests.processor.RequestProcessor
See Also:
RequestProcessor.process(org.jboss.dna.graph.requests.CopyBranchRequest)

process

public void process(org.jboss.dna.graph.requests.CreateNodeRequest request)

Specified by:
process in class org.jboss.dna.graph.requests.processor.RequestProcessor
See Also:
RequestProcessor.process(org.jboss.dna.graph.requests.CreateNodeRequest)

process

public void process(org.jboss.dna.graph.requests.DeleteBranchRequest request)

Specified by:
process in class org.jboss.dna.graph.requests.processor.RequestProcessor
See Also:
RequestProcessor.process(org.jboss.dna.graph.requests.DeleteBranchRequest)

process

public void process(org.jboss.dna.graph.requests.MoveBranchRequest request)

Specified by:
process in class org.jboss.dna.graph.requests.processor.RequestProcessor
See Also:
RequestProcessor.process(org.jboss.dna.graph.requests.MoveBranchRequest)

process

public void process(org.jboss.dna.graph.requests.UpdatePropertiesRequest request)

Specified by:
process in class org.jboss.dna.graph.requests.processor.RequestProcessor
See Also:
RequestProcessor.process(org.jboss.dna.graph.requests.UpdatePropertiesRequest)

getNode

protected org.jboss.dna.graph.requests.ReadNodeRequest getNode(org.jboss.dna.graph.Location location)
                                                        throws org.jboss.dna.graph.connectors.RepositorySourceException
Get the node information from the underlying sources or, if possible, from the cache.

Parameters:
location - the location of the node to be returned
Returns:
the node information
Throws:
org.jboss.dna.graph.connectors.RepositorySourceException

createFederatedNode

protected FederatedNode createFederatedNode(org.jboss.dna.graph.Location location,
                                            List<Contribution> contributions,
                                            boolean updateCache)
                                     throws org.jboss.dna.graph.connectors.RepositorySourceException
Throws:
org.jboss.dna.graph.connectors.RepositorySourceException

loadContributionsFromSources

protected void loadContributionsFromSources(org.jboss.dna.graph.Location location,
                                            Set<String> sourceNames,
                                            List<Contribution> contributions)
                                     throws org.jboss.dna.graph.connectors.RepositorySourceException
Load the node at the supplied location from the sources with the supplied name, returning the information. This method always obtains the information from the sources and does not use or update the cache.

Parameters:
location - the location of the node that is to be loaded
sourceNames - the names of the sources from which contributions are to be loaded; may be empty or null if all contributions from all sources are to be loaded
contributions - the list into which the contributions are to be placed
Throws:
org.jboss.dna.graph.connectors.RepositorySourceException

getMergePlan

protected MergePlan getMergePlan(org.jboss.dna.graph.requests.ReadNodeRequest request)

updateCache

protected void updateCache(FederatedNode mergedNode)
                    throws org.jboss.dna.graph.connectors.RepositorySourceException
Throws:
org.jboss.dna.graph.connectors.RepositorySourceException


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