org.jboss.dna.repository.sequencers
Class SequencingService

java.lang.Object
  extended by org.jboss.dna.repository.sequencers.SequencingService
All Implemented Interfaces:
NodeChangeListener, AdministeredService

public class SequencingService
extends Object
implements AdministeredService, NodeChangeListener

A sequencing system is used to monitor changes in the content of JCR repositories and to sequence the content to extract or to generate structured information.

Author:
Randall Hauch, John Verhaeg

Nested Class Summary
static interface SequencingService.NodeFilter
          Interface used to determine whether a NodeChange should be processed.
static interface SequencingService.Selector
          Interface used to select the set of Sequencer instances that should be run.
 class SequencingService.Statistics
          The statistics for the system.
 
Field Summary
static SequencingService.NodeFilter DEFAULT_NODE_FILTER
          The default SequencingService.NodeFilter that accepts new nodes or nodes that have new/changed properties.
static SequencingService.Selector DEFAULT_SEQUENCER_SELECTOR
          The default SequencingService.Selector that considers every Sequencer to be used for every node.
 
Constructor Summary
SequencingService()
          Create a new sequencing system, configured with no sequencers and not monitoring any workspaces.
 
Method Summary
 boolean addSequencer(SequencerConfig config)
          Add the configuration for a sequencer, or update any existing one that represents the same configuration
 ServiceAdministrator getAdministrator()
          Return the administrative component for this service.
 JcrExecutionContext getExecutionContext()
           
 ExecutorService getExecutorService()
          Get the executor service used to run the sequencers.
 SequencingService.NodeFilter getNodeFilter()
          Get the node filter used by this system.
 SequencingService.Selector getSequencerSelector()
          Get the sequencing selector used by this system.
 SequencingService.Statistics getStatistics()
          Get the statistics for this system.
 void onNodeChanges(NodeChanges changes)
          
 boolean removeSequencer(SequencerConfig config)
          Remove the configuration for a sequencer.
 void setExecutionContext(JcrExecutionContext executionContext)
           
 void setExecutorService(ExecutorService executorService)
          Set the executor service that should be used by this system.
 void setNodeFilter(SequencingService.NodeFilter nodeFilter)
          Set the filter that checks which nodes are to be sequenced, or null if the default node filter should be used.
 void setSequencerSelector(SequencingService.Selector sequencerSelector)
          Set the sequencer selector, or null if the default sequencer selector should be used.
 boolean updateSequencer(SequencerConfig config)
          Update the configuration for a sequencer, or add it if there is no matching configuration.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_SEQUENCER_SELECTOR

public static final SequencingService.Selector DEFAULT_SEQUENCER_SELECTOR
The default SequencingService.Selector that considers every Sequencer to be used for every node.

See Also:
setSequencerSelector(org.jboss.dna.repository.sequencers.SequencingService.Selector)

DEFAULT_NODE_FILTER

public static final SequencingService.NodeFilter DEFAULT_NODE_FILTER
The default SequencingService.NodeFilter that accepts new nodes or nodes that have new/changed properties.

See Also:
setSequencerSelector(org.jboss.dna.repository.sequencers.SequencingService.Selector)
Constructor Detail

SequencingService

public SequencingService()
Create a new sequencing system, configured with no sequencers and not monitoring any workspaces. Upon construction, the system is paused and must be configured and then started.

Method Detail

getAdministrator

public ServiceAdministrator getAdministrator()
Return the administrative component for this service.

Specified by:
getAdministrator in interface AdministeredService
Returns:
the administrative component; never null

getStatistics

public SequencingService.Statistics getStatistics()
Get the statistics for this system.

Returns:
statistics

addSequencer

public boolean addSequencer(SequencerConfig config)
Add the configuration for a sequencer, or update any existing one that represents the same configuration

Parameters:
config - the new configuration
Returns:
true if the sequencer was added, or false if there already was an existing and unchanged sequencer configuration
Throws:
IllegalArgumentException - if config is null
See Also:
updateSequencer(SequencerConfig), removeSequencer(SequencerConfig)

updateSequencer

public boolean updateSequencer(SequencerConfig config)
Update the configuration for a sequencer, or add it if there is no matching configuration.

Parameters:
config - the updated (or new) configuration
Returns:
true if the sequencer was updated, or false if there already was an existing and unchanged sequencer configuration
Throws:
IllegalArgumentException - if config is null
See Also:
addSequencer(SequencerConfig), removeSequencer(SequencerConfig)

removeSequencer

public boolean removeSequencer(SequencerConfig config)
Remove the configuration for a sequencer.

Parameters:
config - the configuration to be removed
Returns:
true if the sequencer was removed, or false if there was no existing sequencer
Throws:
IllegalArgumentException - if config is null
See Also:
addSequencer(SequencerConfig), updateSequencer(SequencerConfig)

getExecutionContext

public JcrExecutionContext getExecutionContext()
Returns:
executionContext

setExecutionContext

public void setExecutionContext(JcrExecutionContext executionContext)
Parameters:
executionContext - Sets executionContext to the specified value.

getExecutorService

public ExecutorService getExecutorService()
Get the executor service used to run the sequencers.

Returns:
the executor service
See Also:
setExecutorService(ExecutorService)

setExecutorService

public void setExecutorService(ExecutorService executorService)
Set the executor service that should be used by this system. By default, the system is set up with a executor that uses a single thread.

Parameters:
executorService - the executor service
See Also:
getExecutorService(), Executors.newCachedThreadPool(), Executors.newCachedThreadPool(java.util.concurrent.ThreadFactory), Executors.newFixedThreadPool(int), Executors.newFixedThreadPool(int, java.util.concurrent.ThreadFactory), Executors.newScheduledThreadPool(int), Executors.newScheduledThreadPool(int, java.util.concurrent.ThreadFactory), Executors.newSingleThreadExecutor(), Executors.newSingleThreadExecutor(java.util.concurrent.ThreadFactory), Executors.newSingleThreadScheduledExecutor(), Executors.newSingleThreadScheduledExecutor(java.util.concurrent.ThreadFactory)

getSequencerSelector

public SequencingService.Selector getSequencerSelector()
Get the sequencing selector used by this system.

Returns:
the sequencing selector

setSequencerSelector

public void setSequencerSelector(SequencingService.Selector sequencerSelector)
Set the sequencer selector, or null if the default sequencer selector should be used.

Parameters:
sequencerSelector - the selector

getNodeFilter

public SequencingService.NodeFilter getNodeFilter()
Get the node filter used by this system.

Returns:
the node filter

setNodeFilter

public void setNodeFilter(SequencingService.NodeFilter nodeFilter)
Set the filter that checks which nodes are to be sequenced, or null if the default node filter should be used.

Parameters:
nodeFilter - the new node filter

onNodeChanges

public void onNodeChanges(NodeChanges changes)

Specified by:
onNodeChanges in interface NodeChangeListener


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