org.modeshape.jcr

## Class Sequencers

- java.lang.Object
- - 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

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `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`
    `protected class` | `Sequencers.SequencingWorkQueue`
    `protected static interface` | `Sequencers.WorkQueue`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected JcrRepository.RunningState` | `repository`
    `protected ExecutorService` | `sequencingExecutor`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `Sequencers(JcrRepository.RunningState repository, RepositoryConfiguration config, Iterable<String> workspaceNames)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected Set<SequencerPathExpression>` | `buildPathExpressionSet(Sequencer sequencer)`
    `Sequencer` | `getSequencer(String sequencerName)`
    `protected 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`

- - ### Field Detail

    - #### repository

          protected final JcrRepository.RunningState repository

    - #### sequencingExecutor

          protected final ExecutorService sequencingExecutor

  - ### Constructor Detail

    - #### Sequencers

          protected Sequencers(JcrRepository.RunningState repository,
                    RepositoryConfiguration config,
                    Iterable<String> workspaceNames)

  - ### 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

          protected Sequencer getSequencer(UUID id)

    - #### getSequencer

          public Sequencer getSequencer(String sequencerName)

    - #### 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

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