use of org.apache.commons.collections.map.LinkedMap in project jackrabbit by apache.
the class LockManagerImpl method consolidateEvents.
/**
* Consolidate an event iterator obtained from observation, merging
* add and remove operations on nodes with the same UUID into a move
* operation.
*/
@SuppressWarnings("unchecked")
private Iterator<HierarchyEvent> consolidateEvents(EventIterator events) {
LinkedMap eventMap = new LinkedMap();
while (events.hasNext()) {
EventImpl event = (EventImpl) events.nextEvent();
HierarchyEvent he;
try {
he = new HierarchyEvent(event.getChildId(), sysSession.getQPath(event.getPath()).getNormalizedPath(), event.getType());
} catch (MalformedPathException e) {
log.info("Unable to get event's path: " + e.getMessage());
continue;
} catch (RepositoryException e) {
log.info("Unable to get event's path: " + e.getMessage());
continue;
}
HierarchyEvent heExisting = (HierarchyEvent) eventMap.get(he.id);
if (heExisting != null) {
heExisting.merge(he);
} else {
eventMap.put(he.id, he);
}
}
return eventMap.values().iterator();
}
Aggregations