@ThreadSafe public class RecordingChanges extends Object implements Changes, ChangeSet
Changes
implementation that records the changes and makes them available for iteration.Constructor and Description |
---|
RecordingChanges(String sessionId,
String processKey,
String repositoryKey,
String workspaceName,
String journalId)
Creates a new change set.
|
Modifier and Type | Method and Description |
---|---|
void |
binaryValueNoLongerUsed(BinaryKey key)
Signal that the binary with the given key is not longer used by any properties.
|
void |
binaryValueUsed(BinaryKey key)
Signal that the binary with the given key is being used by some properties.
|
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.
|
String |
getSessionId()
Returns the ID of the session in which the changes occurred.
|
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 |
hasBinaryChanges()
Checks if there are any binary changes in this change set.
|
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)
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)
Signal that a new node was created.
|
void |
nodeMoved(NodeKey key,
Name primaryType,
Set<Name> mixinTypes,
NodeKey newParent,
NodeKey oldParent,
Path newPath,
Path oldPath)
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,
Name parentPrimaryType,
Set<Name> parentMixinTypes)
Signal that a node was removed.
|
void |
nodeRenamed(NodeKey key,
Path newPath,
Path.Segment oldName,
Name primaryType,
Set<Name> mixinTypes)
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)
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)
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,
Throwable cause)
Signal that a node was not sequenced successfully.
|
void |
propertyAdded(NodeKey key,
Name nodePrimaryType,
Set<Name> nodeMixinTypes,
Path nodePath,
Property property)
Signal that a property was added to a node.
|
void |
propertyChanged(NodeKey key,
Name nodePrimaryType,
Set<Name> nodeMixinTypes,
Path nodePath,
Property newProperty,
Property oldProperty)
Signal that a property was changed on a node.
|
void |
propertyRemoved(NodeKey key,
Name nodePrimaryType,
Set<Name> nodeMixinTypes,
Path nodePath,
Property property)
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() |
Set<BinaryKey> |
unusedBinaries()
Returns the set of binary keys for those binary values which have become unused.
|
Set<BinaryKey> |
usedBinaries()
Returns the set of binary keys for those binary values which are being used.
|
void |
workspaceAdded(String workspaceName)
Signal that a new workspace has been added.
|
void |
workspaceRemoved(String workspaceName)
Signal that a new workspace has been removed.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
forEach, spliterator
public RecordingChanges(String sessionId, String processKey, String repositoryKey, String workspaceName, String journalId)
sessionId
- the ID of the session in which the change set was created; may not be null;processKey
- the UUID of the process which created the change set; may not be nullrepositoryKey
- 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 nullpublic void workspaceAdded(String workspaceName)
Changes
workspaceAdded
in interface Changes
workspaceName
- the name of the workspace; may not be nullpublic void workspaceRemoved(String workspaceName)
Changes
workspaceRemoved
in interface Changes
workspaceName
- the name of the workspace; may not be nullpublic void repositoryMetadataChanged()
Changes
repositoryMetadataChanged
in interface Changes
public void nodeCreated(NodeKey key, NodeKey parentKey, Path path, Name primaryType, Set<Name> mixinTypes, Map<Name,Property> properties)
Changes
nodeCreated
in interface Changes
key
- the key for the new node; may not be nullparentKey
- the key for the parent of the new node; may not be nullpath
- the path to the new node; may not be nullprimaryType
- the primary type of the node; may not be nullmixinTypes
- the mixin types of the node; may not be nullproperties
- the properties in the new node, or null if there are nonepublic void nodeRemoved(NodeKey key, NodeKey parentKey, Path path, Name primaryType, Set<Name> mixinTypes, Name parentPrimaryType, Set<Name> parentMixinTypes)
Changes
nodeRemoved
in interface Changes
key
- the key for the removed node; may not be nullparentKey
- the key for the old parent of the removed node; may not be nullpath
- the path to the removed node; may not be nullprimaryType
- the primary type of the node; may not be nullmixinTypes
- the mixin types of the node; may not be nullparentPrimaryType
- the primary type of the parent of the node; may be null if this information is not availableparentMixinTypes
- the mixin types of the parent of the node; may be null if this information is not availablepublic void nodeRenamed(NodeKey key, Path newPath, Path.Segment oldName, Name primaryType, Set<Name> mixinTypes)
Changes
nodeRenamed
in interface Changes
key
- the key for the node; may not be nullnewPath
- the new path for the node; may not be nulloldName
- the old name (including SNS index); may not be nullprimaryType
- the primary type of the node; may not be nullmixinTypes
- the mixin types of the node; may not be nullpublic void nodeMoved(NodeKey key, Name primaryType, Set<Name> mixinTypes, NodeKey newParent, NodeKey oldParent, Path newPath, Path oldPath)
Changes
nodeMoved
in interface Changes
key
- the key for the node; may not be nullprimaryType
- the primary type of the node; may not be nullmixinTypes
- the mixin types of the node; may not be nullnewParent
- the new parent for the node; may not be nulloldParent
- the old parent for the node; may not be nullnewPath
- the new path for the node after it has been moved; may not be nulloldPath
- the old path for the node before it was moved; may not be nullpublic void nodeReordered(NodeKey key, Name primaryType, Set<Name> mixinTypes, NodeKey parent, Path newPath, Path oldPath, Path reorderedBeforePath)
Changes
nodeReordered
in interface Changes
key
- the key for the node; may not be nullprimaryType
- the primary type of the node; may not be nullmixinTypes
- the mixin types of the node; may not be nullparent
- the key for the parent of the node; may not be nullnewPath
- the new path for the node after it has been reordered; may not be nulloldPath
- the old path for the node before it was reordered; may be null in the case of transient reorderingsreorderedBeforePath
- the path of the node before which the node was moved; or null if the node was reordered to thepublic void nodeChanged(NodeKey key, Path path, Name primaryType, Set<Name> mixinTypes)
Changes
nodeChanged
in interface Changes
key
- the node key; may not be nullpath
- the pathprimaryType
- the primary type of the node; may not be nullmixinTypes
- the mixin types of the node; may not be nullpublic void nodeSequenced(NodeKey sequencedNodeKey, Path sequencedNodePath, Name sequencedNodePrimaryType, Set<Name> sequencedNodeMixinTypes, NodeKey outputNodeKey, Path outputNodePath, String outputPath, String userId, String selectedPath, String sequencerName)
Changes
nodeSequenced
in interface Changes
sequencedNodeKey
- the key of the node that was used as input and sequenced; may not be nullsequencedNodePath
- the path of the node that was used as input and sequenced; may not be nullsequencedNodePrimaryType
- the primary type of the node that was used as input and sequenced; may not be nullsequencedNodeMixinTypes
- the mixin types of the node that was used as input and sequenced; may not be nulloutputNodeKey
- the key of the top-level node output by the sequencing operation; may not be nulloutputNodePath
- the path of the top-level node output by the sequencing operation; may not be nulloutputPath
- the string representation of the output path of the sequencing operationuserId
- the username of the session that generated the change that led to the sequencing operationselectedPath
- 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 nullsequencerName
- the name of the sequencer; may not be nullpublic void nodeSequencingFailure(NodeKey sequencedNodeKey, Path sequencedNodePath, Name sequencedNodePrimaryType, Set<Name> sequencedNodeMixinTypes, String outputPath, String userId, String selectedPath, String sequencerName, Throwable cause)
Changes
nodeSequencingFailure
in interface Changes
sequencedNodeKey
- the key of the node that was used as input and sequenced; may not be nullsequencedNodePath
- the path of the node that was used as input and sequenced; may not be nullsequencedNodePrimaryType
- the primary type of the node that was used as input and sequenced; may not be nullsequencedNodeMixinTypes
- the mixin types of the node that was used as input and sequenced; may not be nulloutputPath
- the string representation of the output path of the sequencing operationuserId
- the username of the session that generated the change that led to the (failed) sequencing operationselectedPath
- 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 nullsequencerName
- the name of the sequencer; may not be nullcause
- the exception that caused the failure; may not be nullpublic void propertyAdded(NodeKey key, Name nodePrimaryType, Set<Name> nodeMixinTypes, Path nodePath, Property property)
Changes
propertyAdded
in interface Changes
key
- the key of the node that was changed; may not be nullnodePrimaryType
- the primary type of the node; may not be nullnodeMixinTypes
- the mixin types of the node; may not be nullnodePath
- the path of the node that was changedproperty
- the new property, with name and value(s); may not be nullpublic void propertyRemoved(NodeKey key, Name nodePrimaryType, Set<Name> nodeMixinTypes, Path nodePath, Property property)
Changes
propertyRemoved
in interface Changes
key
- the key of the node that was changed; may not be nullnodePrimaryType
- the primary type of the node; may not be nullnodeMixinTypes
- the mixin types of the node; may not be nullnodePath
- the path of the node that was changedproperty
- the property that was removed, with name and value(s); may not be nullpublic void propertyChanged(NodeKey key, Name nodePrimaryType, Set<Name> nodeMixinTypes, Path nodePath, Property newProperty, Property oldProperty)
Changes
propertyChanged
in interface Changes
key
- the key of the node that was changed; may not be nullnodePrimaryType
- the primary type of the node; may not be nullnodeMixinTypes
- the mixin types of the node; may not be nullnodePath
- the path of the node that was changednewProperty
- the new property, with name and value(s); may not be nulloldProperty
- the old property, with name and value(s); may not be nullpublic void binaryValueNoLongerUsed(BinaryKey key)
Changes
binaryValueNoLongerUsed
in interface Changes
key
- a BinaryKey
instance; never null
public void binaryValueUsed(BinaryKey key)
Changes
binaryValueUsed
in interface Changes
key
- a BinaryKey
instance; never null
public int size()
ChangeSet
public boolean isEmpty()
ChangeSet
public Iterator<Change> iterator()
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.iterator
in interface Iterable<Change>
Iterable.iterator()
public Set<NodeKey> changedNodes()
ChangeSet
changedNodes
in interface ChangeSet
null
public Set<BinaryKey> unusedBinaries()
ChangeSet
unusedBinaries
in interface ChangeSet
public Set<BinaryKey> usedBinaries()
ChangeSet
usedBinaries
in interface ChangeSet
public boolean hasBinaryChanges()
ChangeSet
hasBinaryChanges
in interface ChangeSet
public void setChangedNodes(Set<NodeKey> keys)
keys
- a Setpublic void freeze(String userId, Map<String,String> userData, DateTime timestamp)
userId
- the username from the session which originated the changes; may not be nulluserData
- a Map which can contains arbitrary information; may be nulltimestamp
- a DateTime
at which the changes set was created.public String getProcessKey()
ChangeSet
getProcessKey
in interface ChangeSet
public String getRepositoryKey()
ChangeSet
getRepositoryKey
in interface ChangeSet
public String getWorkspaceName()
ChangeSet
getWorkspaceName
in interface ChangeSet
public DateTime getTimestamp()
ChangeSet
getTimestamp
in interface ChangeSet
DateTime
instance; never null
public Map<String,String> getUserData()
ChangeSet
getUserData
in interface ChangeSet
Map
of additional information; never null
but possibly empty.public String getUserId()
ChangeSet
public String getSessionId()
ChangeSet
getSessionId
in interface ChangeSet
null
public String getJournalId()
ChangeSet
ChangeJournal
instance.getJournalId
in interface ChangeSet
String
if journaling is enabled, or null
if journaling isn't enabled.public String getUUID()
ChangeSet
Copyright © 2008–2016 JBoss, a division of Red Hat. All rights reserved.