incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1152134 - /sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/EntityResourceList.java
Date Fri, 29 Jul 2011 07:42:11 GMT
Author: cziegeler
Date: Fri Jul 29 07:42:10 2011
New Revision: 1152134

URL: http://svn.apache.org/viewvc?rev=1152134&view=rev
Log:
Minor update: handle state for more than three resources for the same entity

Modified:
    sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/EntityResourceList.java

Modified: sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/EntityResourceList.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/EntityResourceList.java?rev=1152134&r1=1152133&r2=1152134&view=diff
==============================================================================
--- sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/EntityResourceList.java
(original)
+++ sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/EntityResourceList.java
Fri Jul 29 07:42:10 2011
@@ -203,6 +203,20 @@ public class EntityResourceList implemen
                     // and now set resource to uninstalled
                     state = ResourceState.UNINSTALLED;
                 }
+            } else if ( state == ResourceState.INSTALLED ) {
+                // make sure that no other resource has state INSTALLED
+                if ( this.resources.size() > 1 ) {
+                    // to get the second item in the set we have to use an iterator!
+                    final Iterator<TaskResource> i = this.resources.iterator();
+                    i.next(); // skip first
+                    while ( i.hasNext() ) {
+                        final TaskResource rsrc = i.next();
+                        if ( rsrc.getState() == ResourceState.INSTALLED ) {
+                            ((RegisteredResourceImpl)rsrc).setState(ResourceState.INSTALL);
+                        }
+                    }
+                }
+
             }
             ((RegisteredResourceImpl)toActivate).setState(state);
             if ( state == ResourceState.UNINSTALLED ) {



Mime
View raw message