org.modeshape.jcr.cache.change

## Class ChangeSetAdapter

- java.lang.Object
- - org.modeshape.jcr.cache.change.ChangeSetAdapter

- All Implemented Interfaces:
    ChangeSetListener
  Direct Known Subclasses:
    IndexChangeAdapter

      public abstract class ChangeSetAdapter
      extends Object
      implements ChangeSetListener

  An adapter class that processes `ChangeSet` instances and for each `Change` calls the appropriate protected method that, by default, do nothing. Implementations simply override at least one of the relevant methods for the kind of changes they expect.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected ExecutionContext` | `context`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ChangeSetAdapter(ExecutionContext context)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `addNode(String workspaceName, NodeKey key, Path path, Name primaryType, Set<Name> mixinTypes, CachedNode.Properties properties, boolean queryable)` Handle the addition of a node.
    `protected void` | `addWorkspace(String workspaceName)` Handle the addition of a new workspace in the repository.
    `protected void` | `beginWorkspaceChanges()` Signals the beginning of processing for the changes in a transaction described by a single `ChangeSet`.
    `protected void` | `binaryValueUnused(BinaryKey key)` Handle the marking of a binary value as being unused.
    `protected void` | `changeNode(String workspaceName, NodeKey key, Path path, Name primaryType, Set<Name> mixinTypes, boolean queryable)` Handle the change of a node.
    `protected void` | `completeWorkspaceChanges()` Signals the end of processing for the changes in a transaction described by a single `ChangeSet`.
    `protected boolean` | `includesWorkspace(String workspaceName)` Determine whether changes in the named workspace should be processed.
    `protected void` | `modifyProperties(NodeKey key, Map<Name,AbstractPropertyChange> propChanges)` Handle the addition, change, and removal of one or more properties of a single node.
    `protected void` | `moveNode(String workspaceName, NodeKey key, Name primaryType, Set<Name> mixinTypes, NodeKey oldParent, NodeKey newParent, Path newPath, Path oldPath, boolean queryable)` Handle the move of a node.
    `void` | `notify(ChangeSet changeSet)` Notifies a listener of the given changes.
    `protected void` | `removeNode(String workspaceName, NodeKey key, NodeKey parentKey, Path path, Name primaryType, Set<Name> mixinTypes, boolean queryable)` Handle the removal of a node.
    `protected void` | `removeWorkspace(String workspaceName)` Handle the removal of a workspace in the repository.
    `protected void` | `renameNode(String workspaceName, NodeKey key, Path newPath, Path.Segment oldSegment, Name primaryType, Set<Name> mixinTypes, boolean queryable)` Handle the renaming of a node.
    `protected void` | `reorderNode(String workspaceName, NodeKey key, Name primaryType, Set<Name> mixinTypes, NodeKey parent, Path newPath, Path oldPath, Path reorderedBeforePath, boolean queryable)` Handle the reordering of a node.
    `protected void` | `repositoryMetadataChanged()` Handle the changing of the repository metadata information.
    `protected void` | `sequenced(String workspaceName, NodeKey sequencedNodeKey, Path sequencedNodePath, Name sequencedNodePrimaryType, Set<Name> sequencedNodeMixinTypes, NodeKey outputNodeKey, Path outputNodePath, String outputPath, String userId, String selectedPath, String sequencerName, boolean queryable)`
    `protected void` | `sequenceFailure(String workspaceName, NodeKey sequencedNodeKey, Path sequencedNodePath, Name sequencedNodePrimaryType, Set<Name> sequencedNodeMixinTypes, String outputPath, String userId, String selectedPath, String sequencerName, boolean queryable, Throwable cause)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### context

          protected final ExecutionContext context

  - ### Constructor Detail

    - #### ChangeSetAdapter

          public ChangeSetAdapter(ExecutionContext context)

      Parameters:
        `context` - the execution context in which this adapter is supposed to run; may not be null

  - ### Method Detail

    - #### notify

          public void notify(ChangeSet changeSet)

      Description copied from interface: `ChangeSetListener`
      Notifies a listener of the given changes.
      Specified by:
        `notify` in interface `ChangeSetListener`
      Parameters:
        `changeSet` - a `non-null` `ChangeSet`

    - #### beginWorkspaceChanges

          protected void beginWorkspaceChanges()

      Signals the beginning of processing for the changes in a transaction described by a single `ChangeSet`.
      See Also:
        `completeWorkspaceChanges()`

    - #### completeWorkspaceChanges

          protected void completeWorkspaceChanges()

      Signals the end of processing for the changes in a transaction described by a single `ChangeSet`.
      See Also:
        `beginWorkspaceChanges()`

    - #### modifyProperties

          protected void modifyProperties(NodeKey key,
                              Map<Name,AbstractPropertyChange> propChanges)

      Handle the addition, change, and removal of one or more properties of a single node. This method is called once for each existing node whose properties are modified.
      Parameters:
        `key` - the unique key for the node; may not be null
        `propChanges` - the map of property modification events, keyed by the names of the properties; never null and never empty

    - #### includesWorkspace

          protected boolean includesWorkspace(String workspaceName)

      Determine whether changes in the named workspace should be processed. By default this method returns `true`, which means changes to content in all workspaces are handled by this adapter.
      Parameters:
        `workspaceName` - the workspace that has changes in content
      Returns:
        true if the changes should be processed, or false otherwise

    - #### addNode

          protected void addNode(String workspaceName,
                     NodeKey key,
                     Path path,
                     Name primaryType,
                     Set<Name> mixinTypes,
                     CachedNode.Properties properties,
                     boolean queryable)

      Handle the addition of a node.
      Parameters:
        `workspaceName` - the workspace in which the node information should be available; may not be null
        `key` - the unique key for the node; may not be null
        `path` - the path of the node; may not be null
        `primaryType` - the primary type of the node; may not be null
        `mixinTypes` - the mixin types for the node; may not be null but may be empty
        `properties` - the properties of the node; may not be null but may be empty
        `queryable` - true if the node is queryable, false otherwise

    - #### removeNode

          protected void removeNode(String workspaceName,
                        NodeKey key,
                        NodeKey parentKey,
                        Path path,
                        Name primaryType,
                        Set<Name> mixinTypes,
                        boolean queryable)

      Handle the removal of a node.
      Parameters:
        `workspaceName` - the workspace in which the node information should be available; may not be null
        `key` - the unique key for the node; may not be null
        `parentKey` - the unique key for the parent of the node; may not be null
        `path` - the path of the node; may not be null
        `primaryType` - the primary type of the node; may not be null
        `mixinTypes` - the mixin types for the node; may not be null but may be empty
        `queryable` - true if the node is queryable, false otherwise

    - #### changeNode

          protected void changeNode(String workspaceName,
                        NodeKey key,
                        Path path,
                        Name primaryType,
                        Set<Name> mixinTypes,
                        boolean queryable)

      Handle the change of a node.
      Parameters:
        `workspaceName` - the workspace in which the node information should be available; may not be null
        `key` - the unique key for the node; may not be null
        `path` - the path of the node; may not be null
        `primaryType` - the primary type of the node; may not be null
        `mixinTypes` - the mixin types for the node; may not be null but may be empty
        `queryable` - true if the node is queryable, false otherwise

    - #### moveNode

          protected void moveNode(String workspaceName,
                      NodeKey key,
                      Name primaryType,
                      Set<Name> mixinTypes,
                      NodeKey oldParent,
                      NodeKey newParent,
                      Path newPath,
                      Path oldPath,
                      boolean queryable)

      Handle the move of a node.
      Parameters:
        `workspaceName` - the workspace in which the node information should be available; may not be null
        `key` - the unique key for the node; may not be null
        `primaryType` - the primary type of the node; may not be null
        `mixinTypes` - the mixin types for the node; may not be null but may be empty
        `oldParent` - the key of the node's parent before it was moved; may not be null
        `newParent` - the key of the node's parent after it was moved; may not be null
        `newPath` - the new path of the node after it was moved; may not be null
        `oldPath` - the old path of the node before it was moved; may not be null
        `queryable` - true if the node is queryable, false otherwise

    - #### renameNode

          protected void renameNode(String workspaceName,
                        NodeKey key,
                        Path newPath,
                        Path.Segment oldSegment,
                        Name primaryType,
                        Set<Name> mixinTypes,
                        boolean queryable)

      Handle the renaming of a node.
      Parameters:
        `workspaceName` - the workspace in which the node information should be available; may not be null
        `key` - the unique key for the node; may not be null
        `newPath` - the new path of the node after it was moved; may not be null
        `oldSegment` - the old segment of the node before it was moved; may not be null
        `primaryType` - the primary type of the node; may not be null
        `mixinTypes` - the mixin types for the node; may not be null but may be empty
        `queryable` - true if the node is queryable, false otherwise

    - #### reorderNode

          protected void reorderNode(String workspaceName,
                         NodeKey key,
                         Name primaryType,
                         Set<Name> mixinTypes,
                         NodeKey parent,
                         Path newPath,
                         Path oldPath,
                         Path reorderedBeforePath,
                         boolean queryable)

      Handle the reordering of a node.
      Parameters:
        `workspaceName` - the workspace in which the node information should be available; may not be null
        `key` - the unique key for the node; may not be null
        `primaryType` - the primary type of the node; may not be null
        `mixinTypes` - the mixin types for the node; may not be null but may be empty
        `parent` - the key of the node's parent; may not be null
        `newPath` - the new path of the node after it was moved; may not be null
        `oldPath` - the old path of the node before it was moved; may not be null
        `reorderedBeforePath` - the path of the node before which the node was placed; null if it was moved to the end
        `queryable` - true if the node is queryable, false otherwise

    - #### sequenced

          protected void sequenced(String workspaceName,
                       NodeKey sequencedNodeKey,
                       Path sequencedNodePath,
                       Name sequencedNodePrimaryType,
                       Set<Name> sequencedNodeMixinTypes,
                       NodeKey outputNodeKey,
                       Path outputNodePath,
                       String outputPath,
                       String userId,
                       String selectedPath,
                       String sequencerName,
                       boolean queryable)

    - #### sequenceFailure

          protected void sequenceFailure(String workspaceName,
                             NodeKey sequencedNodeKey,
                             Path sequencedNodePath,
                             Name sequencedNodePrimaryType,
                             Set<Name> sequencedNodeMixinTypes,
                             String outputPath,
                             String userId,
                             String selectedPath,
                             String sequencerName,
                             boolean queryable,
                             Throwable cause)

    - #### repositoryMetadataChanged

          protected void repositoryMetadataChanged()

      Handle the changing of the repository metadata information.

    - #### binaryValueUnused

          protected void binaryValueUnused(BinaryKey key)

      Handle the marking of a binary value as being unused.
      Parameters:
        `key` - the binary key of the binary value that is no longer used; may not be null

    - #### addWorkspace

          protected void addWorkspace(String workspaceName)

      Handle the addition of a new workspace in the repository.
      Parameters:
        `workspaceName` - the name of the workspace that was added; may not be null

    - #### removeWorkspace

          protected void removeWorkspace(String workspaceName)

      Handle the removal of a workspace in the repository.
      Parameters:
        `workspaceName` - the name of the workspace that was removed; may not be null

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