try {
// Now process the changes ...
for (Change change : changeSet) {
// Look at property added and removed events.
if (change instanceof PropertyAdded) {
PropertyAdded added = (PropertyAdded)change;
Path nodePath = added.getPathToNode();
String strPath = stringFactory.create(nodePath);
Name propName = added.getProperty().getName();
// Check if the property is sequencable ...
for (SequencingConfiguration config : configs) {
Matcher matcher = config.matches(strPath, propName);
if (!matcher.matches()) {
if (TRACE) {
LOGGER.trace("Added property '{1}:{0}' in repository '{2}' did not match sequencer '{3}' and path expression '{4}'",
added.getPath(), workspaceName, repository.name(), config.getSequencer().getName(),
config.getPathExpression());
}
continue;
}
if (TRACE) {
LOGGER.trace("Submitting added property '{1}:{0}' in repository '{2}' for sequencing using '{3}' and path expression '{4}'",
added.getPath(), workspaceName, repository.name(), config.getSequencer().getName(),
config.getPathExpression());
}
// The property should be sequenced ...
submitWork(config, matcher, workspaceName, stringFactory.create(propName), changeSet.getUserId());
}
} else if (change instanceof PropertyChanged) {
PropertyChanged changed = (PropertyChanged)change;
Path nodePath = changed.getPathToNode();
String strPath = stringFactory.create(nodePath);
Name propName = changed.getNewProperty().getName();
// Check if the property is sequencable ...
for (SequencingConfiguration config : configs) {
Matcher matcher = config.matches(strPath, propName);
if (!matcher.matches()) {
if (TRACE) {
LOGGER.trace("Changed property '{1}:{0}' in repository '{2}' did not match sequencer '{3}' and path expression '{4}'",
changed.getPath(), workspaceName, repository.name(),
config.getSequencer().getName(), config.getPathExpression());
}
continue;
}
if (TRACE) {
LOGGER.trace("Submitting changed property '{1}:{0}' in repository '{2}' for sequencing using '{3}' and path expression '{4}'",
changed.getPath(), workspaceName, repository.name(), config.getSequencer().getName(),
config.getPathExpression());
}
// The property should be sequenced ...
submitWork(config, matcher, workspaceName, stringFactory.create(propName), changeSet.getUserId());
}
}
// It's possible we should also be looking at other types of events (like property removed or
// node added/changed/removed events), but this is consistent with the 2.x behavior.
// Handle the workspace changes ...
else if (change instanceof WorkspaceAdded) {
WorkspaceAdded added = (WorkspaceAdded)change;
workspaceAdded(added.getWorkspaceName());
} else if (change instanceof WorkspaceRemoved) {
WorkspaceRemoved removed = (WorkspaceRemoved)change;
workspaceRemoved(removed.getWorkspaceName());
}
}