org.jboss.dna.repository.sequencer
Interface Sequencer

All Superinterfaces:
Component<SequencerConfig>
All Known Implementing Classes:
StreamSequencerAdapter

@ThreadSafe
public interface Sequencer
extends Component<SequencerConfig>

The interface for a DNA sequencer, which sequences nodes and their content to extract additional information from the information.

Implementations must provide a no-argument constructor.


Method Summary
 void execute(Node input, String sequencedPropertyName, NetChangeObserver.NetChange changes, Set<RepositoryNodePath> outputPaths, SequencerContext context, Problems problems)
          Execute the sequencing operation on the supplied node, which has recently been created or changed.
 
Methods inherited from interface org.jboss.dna.common.component.Component
getConfiguration, setConfiguration
 

Method Detail

execute

void execute(Node input,
             String sequencedPropertyName,
             NetChangeObserver.NetChange changes,
             Set<RepositoryNodePath> outputPaths,
             SequencerContext context,
             Problems problems)
             throws SequencerException
Execute the sequencing operation on the supplied node, which has recently been created or changed. The implementation of this method is responsible for modifying the appropriate nodes and saving any changes made by this sequencer, and closing any other acquired resources, even in the case of exceptions.

The SequencingService determines the sequencers that should be executed by monitoring the changes to one or more workspaces (it registers an Observer with the RepositoryLibrary). Changes in those workspaces are aggregated for each transaction, and organized into changes for each node. The SequencingService then determines for each set of changes to a node the set of full paths to the properties that have changed and whether those paths match the sequencer's path expressions. Each path expression produces the path to the output node, and these output paths are accumulated and (with the original node that changed, the node change summary, and other information) supplied to the sequencer via this method.

It is possible that a sequencer is configured to apply to multiple properties on a node. So, in cases where multiple properties are changed on a single node (within a single repository transaction), the sequencer will only be executed once. Also, in such cases the sequencer's configuration may imply multiple output nodes, so it is left to the sequencer to define the behavior in such cases.

Parameters:
input - the node that has recently been created or changed; never null
sequencedPropertyName - the name of the property that caused this sequencer to be executed; never null and never empty
changes - the immutable summary of changes that occurred on the input node within the transaction; never null
outputPaths - the paths to the nodes where the sequencing content should be placed; never null and never empty, but the set may contain paths for non-existent nodes or may reference the input node
context - the context in which this sequencer is executing; never null
problems - the interface used for recording problems; never null
Throws:
SequencerException - if there is an error in this sequencer


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