Return-Path: X-Original-To: apmail-sling-commits-archive@www.apache.org Delivered-To: apmail-sling-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2B8629145 for ; Fri, 3 Feb 2012 00:36:54 +0000 (UTC) Received: (qmail 68218 invoked by uid 500); 3 Feb 2012 00:36:54 -0000 Delivered-To: apmail-sling-commits-archive@sling.apache.org Received: (qmail 68155 invoked by uid 500); 3 Feb 2012 00:36:53 -0000 Mailing-List: contact commits-help@sling.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@sling.apache.org Delivered-To: mailing list commits@sling.apache.org Received: (qmail 68147 invoked by uid 99); 3 Feb 2012 00:36:53 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 03 Feb 2012 00:36:53 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 03 Feb 2012 00:36:52 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 1BF6B2388A40; Fri, 3 Feb 2012 00:36:32 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1239956 - /sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceListener.java Date: Fri, 03 Feb 2012 00:36:32 -0000 To: commits@sling.apache.org From: fmeschbe@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120203003632.1BF6B2388A40@eris.apache.org> 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 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 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.