/**
* @param events Events reporting hold/retention policy changes.
*/
public void onEvent(EventIterator events) {
while (events.hasNext()) {
Event ev = events.nextEvent();
try {
Path evPath = session.getQPath(ev.getPath());
Path nodePath = evPath.getAncestor(1);
Name propName = evPath.getNameElement().getName();
if (RetentionManagerImpl.REP_HOLD.equals(propName)) {
// hold changes
switch (ev.getType()) {
case Event.PROPERTY_ADDED:
case Event.PROPERTY_CHANGED:
// build the Hold objects from the rep:hold property
// and put them into the hold map.
PropertyImpl p = (PropertyImpl) session.getProperty(ev.getPath());
addHolds(nodePath, p);
break;
case Event.PROPERTY_REMOVED:
// all holds present on this node were remove
// -> remove the corresponding entry in the holdMap.
removeHolds(nodePath);
break;
}
} else if (RetentionManagerImpl.REP_RETENTION_POLICY.equals(propName)) {
// retention policy changes
switch (ev.getType()) {
case Event.PROPERTY_ADDED:
case Event.PROPERTY_CHANGED:
// build the RetentionPolicy objects from the rep:retentionPolicy property
// and put it into the retentionMap.
PropertyImpl p = (PropertyImpl) session.getProperty(ev.getPath());
addRetentionPolicy(nodePath, p);
break;
case Event.PROPERTY_REMOVED:
// retention policy present on this node was remove
// -> remove the corresponding entry in the retentionMap.