Author: fmeschbe
Date: Fri Feb 3 00:36:31 2012
New Revision: 1239956
URL: http://svn.apache.org/viewvc?rev=1239956&view=rev
Log:
SLING-2399 Property events should not be discarded in case of handling add or
remove events for the parent nodes; rather this information should be provided
along with the resouce added and removed OSGi events
Modified:
sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceListener.java
Modified:
sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceListener.java
URL:
http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceListener.java?rev=1239956&r1=1239955&r2=1239956&view=diff
==============================================================================
---
sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceListener.java
(original)
+++
sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceListener.java
Fri Feb 3 00:36:31 2012
@@ -186,24 +186,20 @@ public class JcrResourceListener impleme
final int lastSlash = eventPath.lastIndexOf('/');
final String nodePath = eventPath.substring(0, lastSlash);
final String propName = eventPath.substring(lastSlash + 1);
- if ( !addedEvents.containsKey(nodePath) ) {
- this.updateChangedEvent(changedEvents, nodePath,
event, propName);
- }
+ this.updateChangedEvent(changedEvents, nodePath, event,
propName);
+
} else if ( event.getType() == Event.NODE_ADDED ) {
// check if this is a remove/add operation
if ( removedEvents.remove(eventPath) != null ) {
this.updateChangedEvent(changedEvents, eventPath,
event, null);
} else {
- changedEvents.remove(eventPath);
addedEvents.put(eventPath, event);
}
} else if ( event.getType() == Event.NODE_REMOVED) {
// remove is the strongest operation, therefore remove all
removed
- // paths from changed and added
+ // paths from added
addedEvents.remove(eventPath);
- changedEvents.remove(eventPath);
-
removedEvents.put(eventPath, event);
}
} catch (final RepositoryException e) {
@@ -213,12 +209,14 @@ public class JcrResourceListener impleme
for (final Entry<String, Event> e : removedEvents.entrySet()) {
// Launch an OSGi event
- sendOsgiEvent(e.getKey(), e.getValue(),
SlingConstants.TOPIC_RESOURCE_REMOVED, null);
+ sendOsgiEvent(e.getKey(), e.getValue(),
SlingConstants.TOPIC_RESOURCE_REMOVED,
+ changedEvents.remove(e.getKey()));
}
for (final Entry<String, Event> e : addedEvents.entrySet()) {
// Launch an OSGi event.
- sendOsgiEvent(e.getKey(), e.getValue(),
SlingConstants.TOPIC_RESOURCE_ADDED, null);
+ sendOsgiEvent(e.getKey(), e.getValue(),
SlingConstants.TOPIC_RESOURCE_ADDED,
+ changedEvents.remove(e.getKey()));
}
// Send the changed events.