org.modeshape.jcr.cache.change

## Class RecordingChanges

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

- All Implemented Interfaces:
    Serializable, Iterable<Change>, Changes, ChangeSet

      @ThreadSafe
      public class RecordingChanges
      extends Object
      implements Changes, ChangeSet

  A thread-safe `Changes` implementation that records the changes and makes them available for iteration.
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `RecordingChanges(String processKey, String repositoryKey, String workspaceName, String journalId)` Creates a new change set.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `binaryValueNoLongerUsed(BinaryKey key)` Create an event that signals that the (stored) binary value with the supplied key is no longer used.
    `Set<NodeKey>` | `changedNodes()` Returns the set of keys for the nodes which has been changed.
    `void` | `freeze(String userId, Map<String,String> userData, DateTime timestamp)` Marks this change set as frozen (aka. closed).
    `String` | `getJournalId()` Returns the identifier of the local `ChangeJournal` instance.
    `String` | `getProcessKey()` Get the key of the process in which the changes were made.
    `String` | `getRepositoryKey()` Get the key of the repository in which the changes were made.
    `DateTime` | `getTimestamp()` Returns the time at which the change set was created.
    `Map<String,String>` | `getUserData()` Returns a set of (key,value) pairs which may contain additional user information.
    `String` | `getUserId()` Returns the ID (username) of the user which performed the changes.
    `String` | `getUUID()` Returns a unique identifier for this change set.
    `String` | `getWorkspaceName()` Get the name of the workspace in which the changes were made.
    `boolean` | `isEmpty()` Checks if this set has any changes.
    `Iterator<Change>` | `iterator()` Returns an iterator over the elements in this queue in proper sequence.
    `void` | `nodeChanged(NodeKey key, Path path, Name primaryType, Set<Name> mixinTypes, boolean queryable)` Create an event signifying that something about the node (other than the properties or location) changed.
    `void` | `nodeCreated(NodeKey key, NodeKey parentKey, Path path, Name primaryType, Set<Name> mixinTypes, Map<Name,Property> properties, boolean queryable)` Signal that a new node was created.
    `void` | `nodeMoved(NodeKey key, Name primaryType, Set<Name> mixinTypes, NodeKey newParent, NodeKey oldParent, Path newPath, Path oldPath, boolean queryable)` Signal that a node was moved from one parent to another, and may have also been renamed.
    `void` | `nodeRemoved(NodeKey key, NodeKey parentKey, Path path, Name primaryType, Set<Name> mixinTypes, boolean queryable)` Signal that a node was removed.
    `void` | `nodeRenamed(NodeKey key, Path newPath, Path.Segment oldName, Name primaryType, Set<Name> mixinTypes, boolean queryable)` Signal that a node was renamed (but still has the same parent)
    `void` | `nodeReordered(NodeKey key, Name primaryType, Set<Name> mixinTypes, NodeKey parent, Path newPath, Path oldPath, Path reorderedBeforePath, boolean queryable)` Signal that a node was placed into a new location within the same parent.
    `void` | `nodeSequenced(NodeKey sequencedNodeKey, Path sequencedNodePath, Name sequencedNodePrimaryType, Set<Name> sequencedNodeMixinTypes, NodeKey outputNodeKey, Path outputNodePath, String outputPath, String userId, String selectedPath, String sequencerName, boolean queryable)` Signal that a node was successfully sequenced.
    `void` | `nodeSequencingFailure(NodeKey sequencedNodeKey, Path sequencedNodePath, Name sequencedNodePrimaryType, Set<Name> sequencedNodeMixinTypes, String outputPath, String userId, String selectedPath, String sequencerName, boolean queryable, Throwable cause)` Signal that a node was not sequenced successfully.
    `void` | `propertyAdded(NodeKey key, Name nodePrimaryType, Set<Name> nodeMixinTypes, Path nodePath, Property property, boolean queryable)` Signal that a property was added to a node.
    `void` | `propertyChanged(NodeKey key, Name nodePrimaryType, Set<Name> nodeMixinTypes, Path nodePath, Property newProperty, Property oldProperty, boolean queryable)` Signal that a property was changed on a node.
    `void` | `propertyRemoved(NodeKey key, Name nodePrimaryType, Set<Name> nodeMixinTypes, Path nodePath, Property property, boolean queryable)` Signal that a property was removed from a node.
    `void` | `repositoryMetadataChanged()` Signal that the repository metadata has changed.
    `void` | `setChangedNodes(Set<NodeKey> keys)` Sets the list of node keys involved in this change set.
    `int` | `size()` Return the number of individual changes.
    `String` | `toString()`
    `void` | `workspaceAdded(String workspaceName)` Signal that a new workspace has been added.
    `void` | `workspaceRemoved(String workspaceName)` Signal that a new workspace has been removed.

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

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

- - ### Constructor Detail

    - #### RecordingChanges

          public RecordingChanges(String processKey,
                          String repositoryKey,
                          String workspaceName,
                          String journalId)

      Creates a new change set.
      Parameters:
        `processKey` - the UUID of the process which created the change set; may not be null
        `repositoryKey` - the key of the repository for which the changes set is created; may not be null.
        `workspaceName` - the name of the workspace in which the changes occurred; may be null.
        `journalId` - the ID of the journal where this change set will be saved; may be null

  - ### Method Detail

    - #### workspaceAdded

          public void workspaceAdded(String workspaceName)

      Description copied from interface: `Changes`
      Signal that a new workspace has been added.
      Specified by:
        `workspaceAdded` in interface `Changes`
      Parameters:
        `workspaceName` - the name of the workspace; may not be null

    - #### workspaceRemoved

          public void workspaceRemoved(String workspaceName)

      Description copied from interface: `Changes`
      Signal that a new workspace has been removed.
      Specified by:
        `workspaceRemoved` in interface `Changes`
      Parameters:
        `workspaceName` - the name of the workspace; may not be null

    - #### repositoryMetadataChanged

          public void repositoryMetadataChanged()

      Description copied from interface: `Changes`
      Signal that the repository metadata has changed.
      Specified by:
        `repositoryMetadataChanged` in interface `Changes`

    - #### nodeCreated

          public void nodeCreated(NodeKey key,
                         NodeKey parentKey,
                         Path path,
                         Name primaryType,
                         Set<Name> mixinTypes,
                         Map<Name,Property> properties,
                         boolean queryable)

      Description copied from interface: `Changes`
      Signal that a new node was created.
      Specified by:
        `nodeCreated` in interface `Changes`
      Parameters:
        `key` - the key for the new node; may not be null
        `parentKey` - the key for the parent of the new node; may not be null
        `path` - the path to the new node; may not be null
        `primaryType` - the primary type of the node; may not be null
        `mixinTypes` - the mixin types of the node; may not be null
        `properties` - the properties in the new node, or null if there are none
        `queryable` - true if this node is queryable, or false otherwise

    - #### nodeRemoved

          public void nodeRemoved(NodeKey key,
                         NodeKey parentKey,
                         Path path,
                         Name primaryType,
                         Set<Name> mixinTypes,
                         boolean queryable)

      Description copied from interface: `Changes`
      Signal that a node was removed.
      Specified by:
        `nodeRemoved` in interface `Changes`
      Parameters:
        `key` - the key for the removed node; may not be null
        `parentKey` - the key for the old parent of the removed node; may not be null
        `path` - the path to the removed node; may not be null
        `primaryType` - the primary type of the node; may not be null
        `mixinTypes` - the mixin types of the node; may not be null
        `queryable` - true if this node is queryable, or false otherwise

    - #### nodeRenamed

          public void nodeRenamed(NodeKey key,
                         Path newPath,
                         Path.Segment oldName,
                         Name primaryType,
                         Set<Name> mixinTypes,
                         boolean queryable)

      Description copied from interface: `Changes`
      Signal that a node was renamed (but still has the same parent)
      Specified by:
        `nodeRenamed` in interface `Changes`
      Parameters:
        `key` - the key for the node; may not be null
        `newPath` - the new path for the node; may not be null
        `oldName` - the old name (including SNS index); may not be null
        `primaryType` - the primary type of the node; may not be null
        `mixinTypes` - the mixin types of the node; may not be null
        `queryable` - true if this node is queryable, or false otherwise

    - #### nodeMoved

          public void nodeMoved(NodeKey key,
                       Name primaryType,
                       Set<Name> mixinTypes,
                       NodeKey newParent,
                       NodeKey oldParent,
                       Path newPath,
                       Path oldPath,
                       boolean queryable)

      Description copied from interface: `Changes`
      Signal that a node was moved from one parent to another, and may have also been renamed.
      Specified by:
        `nodeMoved` in interface `Changes`
      Parameters:
        `key` - the key for the node; may not be null
        `primaryType` - the primary type of the node; may not be null
        `mixinTypes` - the mixin types of the node; may not be null
        `newParent` - the new parent for the node; may not be null
        `oldParent` - the old parent for the node; may not be null
        `newPath` - the new path for the node after it has been moved; may not be null
        `oldPath` - the old path for the node before it was moved; may not be null
        `queryable` - true if this node is queryable, or false otherwise

    - #### nodeReordered

          public void nodeReordered(NodeKey key,
                           Name primaryType,
                           Set<Name> mixinTypes,
                           NodeKey parent,
                           Path newPath,
                           Path oldPath,
                           Path reorderedBeforePath,
                           boolean queryable)

      Description copied from interface: `Changes`
      Signal that a node was placed into a new location within the same parent.
      Specified by:
        `nodeReordered` in interface `Changes`
      Parameters:
        `key` - the key for the node; may not be null
        `primaryType` - the primary type of the node; may not be null
        `mixinTypes` - the mixin types of the node; may not be null
        `parent` - the key for the parent of the node; may not be null
        `newPath` - the new path for the node after it has been reordered; may not be null
        `oldPath` - the old path for the node before it was reordered; may be null in the case of transient reorderings
        `reorderedBeforePath` - the path of the node before which the node was moved; or null if the node was reordered to the
        `queryable` - true if this node is queryable, or false otherwise

    - #### nodeChanged

          public void nodeChanged(NodeKey key,
                         Path path,
                         Name primaryType,
                         Set<Name> mixinTypes,
                         boolean queryable)

      Description copied from interface: `Changes`
      Create an event signifying that something about the node (other than the properties or location) changed.
      Specified by:
        `nodeChanged` in interface `Changes`
      Parameters:
        `key` - the node key; may not be null
        `path` - the path
        `primaryType` - the primary type of the node; may not be null
        `mixinTypes` - the mixin types of the node; may not be null
        `queryable` - true if this node is queryable, or false otherwise

    - #### nodeSequenced

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

      Description copied from interface: `Changes`
      Signal that a node was successfully sequenced.
      Specified by:
        `nodeSequenced` in interface `Changes`
      Parameters:
        `sequencedNodeKey` - the key of the node that was used as input and sequenced; may not be null
        `sequencedNodePath` - the path of the node that was used as input and sequenced; may not be null
        `sequencedNodePrimaryType` - the primary type of the node that was used as input and sequenced; may not be null
        `sequencedNodeMixinTypes` - the mixin types of the node that was used as input and sequenced; may not be null
        `outputNodeKey` - the key of the top-level node output by the sequencing operation; may not be null
        `outputNodePath` - the path of the top-level node output by the sequencing operation; may not be null
        `outputPath` - the string representation of the output path of the sequencing operation
        `userId` - the username of the session that generated the change that led to the sequencing operation
        `selectedPath` - the string representation of the path that led to the sequencing operation (which may or may not be the same as the sequenced node path); may not be null
        `sequencerName` - the name of the sequencer; may not be null
        `queryable` - true if this node is queryable, or false otherwise

    - #### nodeSequencingFailure

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

      Description copied from interface: `Changes`
      Signal that a node was not sequenced successfully.
      Specified by:
        `nodeSequencingFailure` in interface `Changes`
      Parameters:
        `sequencedNodeKey` - the key of the node that was used as input and sequenced; may not be null
        `sequencedNodePath` - the path of the node that was used as input and sequenced; may not be null
        `sequencedNodePrimaryType` - the primary type of the node that was used as input and sequenced; may not be null
        `sequencedNodeMixinTypes` - the mixin types of the node that was used as input and sequenced; may not be null
        `outputPath` - the string representation of the output path of the sequencing operation
        `userId` - the username of the session that generated the change that led to the (failed) sequencing operation
        `selectedPath` - the string representation of the path that led to the (failed) sequencing operation (which may or may not be the same as the sequenced node path); may not be null
        `sequencerName` - the name of the sequencer; may not be null
        `queryable` - true if this node is queryable, or false otherwise
        `cause` - the exception that caused the failure; may not be null

    - #### propertyAdded

          public void propertyAdded(NodeKey key,
                           Name nodePrimaryType,
                           Set<Name> nodeMixinTypes,
                           Path nodePath,
                           Property property,
                           boolean queryable)

      Description copied from interface: `Changes`
      Signal that a property was added to a node.
      Specified by:
        `propertyAdded` in interface `Changes`
      Parameters:
        `key` - the key of the node that was changed; may not be null
        `nodePrimaryType` - the primary type of the node; may not be null
        `nodeMixinTypes` - the mixin types of the node; may not be null
        `nodePath` - the path of the node that was changed
        `property` - the new property, with name and value(s); may not be null
        `queryable` - true if this node is queryable, or false otherwise

    - #### propertyRemoved

          public void propertyRemoved(NodeKey key,
                             Name nodePrimaryType,
                             Set<Name> nodeMixinTypes,
                             Path nodePath,
                             Property property,
                             boolean queryable)

      Description copied from interface: `Changes`
      Signal that a property was removed from a node.
      Specified by:
        `propertyRemoved` in interface `Changes`
      Parameters:
        `key` - the key of the node that was changed; may not be null
        `nodePrimaryType` - the primary type of the node; may not be null
        `nodeMixinTypes` - the mixin types of the node; may not be null
        `nodePath` - the path of the node that was changed
        `property` - the property that was removed, with name and value(s); may not be null
        `queryable` - true if this node is queryable, or false otherwise

    - #### propertyChanged

          public void propertyChanged(NodeKey key,
                             Name nodePrimaryType,
                             Set<Name> nodeMixinTypes,
                             Path nodePath,
                             Property newProperty,
                             Property oldProperty,
                             boolean queryable)

      Description copied from interface: `Changes`
      Signal that a property was changed on a node.
      Specified by:
        `propertyChanged` in interface `Changes`
      Parameters:
        `key` - the key of the node that was changed; may not be null
        `nodePrimaryType` - the primary type of the node; may not be null
        `nodeMixinTypes` - the mixin types of the node; may not be null
        `nodePath` - the path of the node that was changed
        `newProperty` - the new property, with name and value(s); may not be null
        `oldProperty` - the old property, with name and value(s); may not be null
        `queryable` - true if this node is queryable, or false otherwise

    - #### binaryValueNoLongerUsed

          public void binaryValueNoLongerUsed(BinaryKey key)

      Description copied from interface: `Changes`
      Create an event that signals that the (stored) binary value with the supplied key is no longer used.
      Specified by:
        `binaryValueNoLongerUsed` in interface `Changes`
      Parameters:
        `key` - the key for the now-unused binary value; may not be null

    - #### size

          public int size()

      Description copied from interface: `ChangeSet`
      Return the number of individual changes.
      Specified by:
        `size` in interface `ChangeSet`
      Returns:
        the number of changes

    - #### isEmpty

          public boolean isEmpty()

      Description copied from interface: `ChangeSet`
      Checks if this set has any changes.
      Specified by:
        `isEmpty` in interface `ChangeSet`
      Returns:
        `true` if there are any changes in this set.

    - #### iterator

          public Iterator<Change> iterator()

      Returns an iterator over the elements in this queue in proper sequence. The returned iterator is a "weakly consistent" iterator that will never throw `ConcurrentModificationException`, and guarantees to traverse elements as they existed upon construction of the iterator, and may (but is not guaranteed to) reflect any modifications subsequent to construction.
      Specified by:
        `iterator` in interface `Iterable<Change>`
      Returns:
        an iterator over the elements in this queue in proper sequence; never null
      See Also:
        `Iterable.iterator()`

    - #### changedNodes

          public Set<NodeKey> changedNodes()

      Description copied from interface: `ChangeSet`
      Returns the set of keys for the nodes which has been changed.
      Specified by:
        `changedNodes` in interface `ChangeSet`
      Returns:
        the set of changed node keys; never `null`

    - #### setChangedNodes

          public void setChangedNodes(Set<NodeKey> keys)

      Sets the list of node keys involved in this change set.
      Parameters:
        `keys` - a Set; may not be null

    - #### freeze

          public void freeze(String userId,
                    Map<String,String> userData,
                    DateTime timestamp)

      Marks this change set as frozen (aka. closed). This means it should not accept any more changes.
      Parameters:
        `userId` - the username from the session which originated the changes; may not be null
        `userData` - a Map which can contains arbitrary information; may be null
        `timestamp` - a `DateTime` at which the changes set was created.

    - #### getProcessKey

          public String getProcessKey()

      Description copied from interface: `ChangeSet`
      Get the key of the process in which the changes were made.
      Specified by:
        `getProcessKey` in interface `ChangeSet`
      Returns:
        the process key; never null

    - #### getRepositoryKey

          public String getRepositoryKey()

      Description copied from interface: `ChangeSet`
      Get the key of the repository in which the changes were made.
      Specified by:
        `getRepositoryKey` in interface `ChangeSet`
      Returns:
        the repository key; never null

    - #### getWorkspaceName

          public String getWorkspaceName()

      Description copied from interface: `ChangeSet`
      Get the name of the workspace in which the changes were made.
      Specified by:
        `getWorkspaceName` in interface `ChangeSet`
      Returns:
        the workspace name; may be null only when workspaces are added or removed

    - #### getTimestamp

          public DateTime getTimestamp()

      Description copied from interface: `ChangeSet`
      Returns the time at which the change set was created.
      Specified by:
        `getTimestamp` in interface `ChangeSet`
      Returns:
        a `DateTime` instance; never `null`

    - #### getUserData

          public Map<String,String> getUserData()

      Description copied from interface: `ChangeSet`
      Returns a set of (key,value) pairs which may contain additional user information.
      Specified by:
        `getUserData` in interface `ChangeSet`
      Returns:
        a `Map` of additional information; never `null` but possibly empty.

    - #### getUserId

          public String getUserId()

      Description copied from interface: `ChangeSet`
      Returns the ID (username) of the user which performed the changes.
      Specified by:
        `getUserId` in interface `ChangeSet`
      Returns:
        a `String` representing the username; may be `null` in the case of changes performed "by the system.

    - #### getJournalId

          public String getJournalId()

      Description copied from interface: `ChangeSet`
      Returns the identifier of the local `ChangeJournal` instance.
      Specified by:
        `getJournalId` in interface `ChangeSet`
      Returns:
        either a non-null `String` if journaling is enabled, or `null` if journaling isn't enabled.

    - #### getUUID

          public String getUUID()

      Description copied from interface: `ChangeSet`
      Returns a unique identifier for this change set.
      Specified by:
        `getUUID` in interface `ChangeSet`
      Returns:
        a `String`; never null.

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

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