ModeShape Distribution 3.2.0.Final

org.modeshape.jcr
Class Sequencers

java.lang.Object
  extended by org.modeshape.jcr.Sequencers
All Implemented Interfaces:
ChangeSetListener

@Immutable
public class Sequencers
extends Object
implements ChangeSetListener

Component that manages the library of sequencers configured for a repository. Simply instantiate, and register as a listener of cache changes.

This class keeps a cache of the SequencerPathExpression instances (and the corresponding Sequencer implementation) for each workspace. This is so that it's much easier and more efficient to process the events, which happens very frequently. Also, that structure is a bit backward compared to how the sequencers are defined in the configuration.


Nested Class Summary
protected  class Sequencers.SequencingConfiguration
          This class represents a single SequencerPathExpression and the corresponding Sequencer implementation that should be used if the path expression matches.
protected static class Sequencers.SequencingContext
           
static class Sequencers.SequencingWorkItem
           
static interface Sequencers.WorkQueue
           
 
Constructor Summary
Sequencers(JcrRepository.RunningState repository, Collection<RepositoryConfiguration.Component> components, Iterable<String> workspaceNames, Sequencers.WorkQueue workQueue)
           
 
Method Summary
protected  Set<SequencerPathExpression> buildPathExpressionSet(Sequencer sequencer)
           
 Sequencer getSequencer(UUID id)
           
protected  void initialize()
           
 boolean isEmpty()
          Determine if there are no sequencers configured.
 void notify(ChangeSet changeSet)
          This method is called when changes are persisted to the repository.
protected  void shutdown()
           
protected  RepositoryStatistics statistics()
           
protected  ValueFactory<String> stringFactory()
           
protected  void submitWork(Sequencers.SequencingConfiguration sequencingConfig, SequencerPathExpression.Matcher matcher, String inputWorkspaceName, String propertyName, String userId)
           
protected  Sequencers with(JcrRepository.RunningState repository)
           
protected  void workspaceAdded(String workspaceName)
          Signal that a new workspace was added.
protected  void workspaceRemoved(String workspaceName)
          Signal that a new workspace was removed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Sequencers

public Sequencers(JcrRepository.RunningState repository,
                  Collection<RepositoryConfiguration.Component> components,
                  Iterable<String> workspaceNames,
                  Sequencers.WorkQueue workQueue)
Method Detail

with

protected Sequencers with(JcrRepository.RunningState repository)

initialize

protected void initialize()

isEmpty

public boolean isEmpty()
Determine if there are no sequencers configured.

Returns:
true if there are no sequencers, or false if there is at least one.

workspaceAdded

protected void workspaceAdded(String workspaceName)
Signal that a new workspace was added.

Parameters:
workspaceName - the workspace name; may not be null

workspaceRemoved

protected void workspaceRemoved(String workspaceName)
Signal that a new workspace was removed.

Parameters:
workspaceName - the workspace name; may not be null

stringFactory

protected final ValueFactory<String> stringFactory()
Returns:
stringFactory

shutdown

protected final void shutdown()

statistics

protected final RepositoryStatistics statistics()

submitWork

protected void submitWork(Sequencers.SequencingConfiguration sequencingConfig,
                          SequencerPathExpression.Matcher matcher,
                          String inputWorkspaceName,
                          String propertyName,
                          String userId)

getSequencer

public Sequencer getSequencer(UUID id)

buildPathExpressionSet

protected Set<SequencerPathExpression> buildPathExpressionSet(Sequencer sequencer)
                                                       throws InvalidSequencerPathExpression
Throws:
InvalidSequencerPathExpression

notify

public void notify(ChangeSet changeSet)
This method is called when changes are persisted to the repository. This method quickly looks at the changes and decides which (if any) sequencers should be called, and enqueues any sequencing work in the supplied work queue for subsequent asynchronous processing.

Specified by:
notify in interface ChangeSetListener
Parameters:
changeSet - the changes

ModeShape Distribution 3.2.0.Final

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