Return-Path: Delivered-To: apmail-sling-commits-archive@www.apache.org Received: (qmail 7881 invoked from network); 21 Jan 2011 09:42:07 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 21 Jan 2011 09:42:07 -0000 Received: (qmail 68540 invoked by uid 500); 21 Jan 2011 09:42:07 -0000 Delivered-To: apmail-sling-commits-archive@sling.apache.org Received: (qmail 68479 invoked by uid 500); 21 Jan 2011 09:42:05 -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 68459 invoked by uid 99); 21 Jan 2011 09:42:04 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 21 Jan 2011 09:42:04 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.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, 21 Jan 2011 09:42:03 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 38CD42388A4B; Fri, 21 Jan 2011 09:41:43 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1061707 - in /sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl: PersistentResourceList.java RegisteredResourceImpl.java Date: Fri, 21 Jan 2011 09:41:43 -0000 To: commits@sling.apache.org From: cziegeler@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110121094143.38CD42388A4B@eris.apache.org> Author: cziegeler Date: Fri Jan 21 09:41:42 2011 New Revision: 1061707 URL: http://svn.apache.org/viewvc?rev=1061707&view=rev Log: SLING-1945 : Remove resource from untransformed resources if resource is removed by provider Modified: sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/PersistentResourceList.java sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/RegisteredResourceImpl.java Modified: sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/PersistentResourceList.java URL: http://svn.apache.org/viewvc/sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/PersistentResourceList.java?rev=1061707&r1=1061706&r2=1061707&view=diff ============================================================================== --- sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/PersistentResourceList.java (original) +++ sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/PersistentResourceList.java Fri Jan 21 09:41:42 2011 @@ -191,6 +191,10 @@ public class PersistentResourceList { t.addOrUpdate(input); } else { + // check if there is an old resource and remove it first + if ( this.untransformedResources.contains(input) ) { + this.untransformedResources.remove(input); + } this.untransformedResources.add(input); } } @@ -203,13 +207,25 @@ public class PersistentResourceList { } /** - * Remove a resource by url + * Remove a resource by url. + * Check all resource groups and the list of untransformed resources. * @param url The url to remove */ public void remove(final String url) { + // iterate over all resource groups and remove resources + // with the given url for(final EntityResourceList group : this.data.values()) { group.remove(url); } + // iterate over untransformed resources and remove + // the resource with that url + for(final RegisteredResource rr : this.untransformedResources) { + if ( rr.getURL().equals(url) ) { + ((RegisteredResourceImpl)rr).cleanup(); + this.untransformedResources.remove(rr); + break; + } + } } /** Modified: sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/RegisteredResourceImpl.java URL: http://svn.apache.org/viewvc/sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/RegisteredResourceImpl.java?rev=1061707&r1=1061706&r2=1061707&view=diff ============================================================================== --- sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/RegisteredResourceImpl.java (original) +++ sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/RegisteredResourceImpl.java Fri Jan 21 09:41:42 2011 @@ -293,7 +293,7 @@ public class RegisteredResourceImpl return false; } if ( this.entity == null ) { - return super.equals(obj); + return this.getURL().equals(((RegisteredResourceImpl)obj).getURL()); } return compareTo((RegisteredResourceImpl)obj) == 0; }