incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1392797 - in /sling/trunk/installer: console/src/main/java/org/apache/sling/installer/core/impl/console/OsgiInstallerWebConsolePlugin.java core/src/main/java/org/apache/sling/installer/core/impl/EntityResourceList.java
Date Tue, 02 Oct 2012 09:00:15 GMT
Author: cziegeler
Date: Tue Oct  2 09:00:15 2012
New Revision: 1392797

URL: http://svn.apache.org/viewvc?rev=1392797&view=rev
Log:
SLING-2612 : Add support for excluding artifacts for installation

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

Modified: sling/trunk/installer/console/src/main/java/org/apache/sling/installer/core/impl/console/OsgiInstallerWebConsolePlugin.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/console/src/main/java/org/apache/sling/installer/core/impl/console/OsgiInstallerWebConsolePlugin.java?rev=1392797&r1=1392796&r2=1392797&view=diff
==============================================================================
--- sling/trunk/installer/console/src/main/java/org/apache/sling/installer/core/impl/console/OsgiInstallerWebConsolePlugin.java
(original)
+++ sling/trunk/installer/console/src/main/java/org/apache/sling/installer/core/impl/console/OsgiInstallerWebConsolePlugin.java
Tue Oct  2 09:00:15 2012
@@ -91,15 +91,17 @@ public class OsgiInstallerWebConsolePlug
     }
 
     private String getState(final Resource rsrc) {
+        String stateInfo = rsrc.getState().toString();
         // INSTALLED state has some variants
         if ( rsrc.getState() == ResourceState.INSTALLED) {
-            if(rsrc.getAttribute(TaskResource.ATTR_INSTALL_EXCLUDED) != null ) {
-                return "EXCLUDED";
-            } else if(rsrc.getAttribute(TaskResource.ATTR_INSTALL_INFO) != null) {
-                return "INSTALLED(*)";
+            if (rsrc.getAttribute(TaskResource.ATTR_INSTALL_EXCLUDED) != null ) {
+                stateInfo = "EXCLUDED";
+            }
+            if (rsrc.getAttribute(TaskResource.ATTR_INSTALL_INFO) != null) {
+                stateInfo = stateInfo + "(*)";
             }
         }
-        return rsrc.getState().toString();
+        return stateInfo;
     }
 
     private String getInfo(final RegisteredResource rsrc) {

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=1392797&r1=1392796&r2=1392797&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
Tue Oct  2 09:00:15 2012
@@ -75,7 +75,7 @@ public class EntityResourceList implemen
      * @throws IOException
      */
     private void writeObject(final java.io.ObjectOutputStream out)
-    throws IOException {
+            throws IOException {
         out.writeInt(VERSION);
         out.writeInt(resources.size());
         for(final RegisteredResource rr : this.resources) {
@@ -91,7 +91,7 @@ public class EntityResourceList implemen
      * - deserialize each entry in the resources list
      */
     private void readObject(final java.io.ObjectInputStream in)
-    throws IOException, ClassNotFoundException {
+            throws IOException, ClassNotFoundException {
         final int version = in.readInt();
         if ( version < 1 || version > VERSION ) {
             throw new ClassNotFoundException(this.getClass().getName());
@@ -122,7 +122,7 @@ public class EntityResourceList implemen
         if ( !resources.isEmpty() ) {
             final TaskResource r = resources.first();
             if ( r.getState() == ResourceState.INSTALL
-              || r.getState() == ResourceState.UNINSTALL ) {
+                    || r.getState() == ResourceState.UNINSTALL ) {
                 return r;
             }
         }
@@ -199,7 +199,7 @@ public class EntityResourceList implemen
         final TaskResource toActivate = getActiveResource();
         if ( toActivate != null ) {
             if ( toActivate.getState() == ResourceState.UNINSTALL
-                 && this.resources.size() > 1 ) {
+                    && this.resources.size() > 1 ) {
 
                 final TaskResource second = this.getNextActiveResource();
                 if ( state == ResourceState.UNINSTALLED ) {
@@ -232,6 +232,22 @@ public class EntityResourceList implemen
 
             }
             ((RegisteredResourceImpl)toActivate).setState(state);
+
+            if ( state != ResourceState.INSTALLED ) {
+                // make sure to remove all install info attributes if the resource is not
+                // installed anymore
+                toActivate.setAttribute(TaskResource.ATTR_INSTALL_EXCLUDED, null);
+                toActivate.setAttribute(TaskResource.ATTR_INSTALL_INFO, null);
+            }
+            // remove install info attributes on all other resources in the group
+            final Iterator<TaskResource> tri = this.resources.iterator();
+            tri.next(); // skip first
+            while ( tri.hasNext() ) {
+                final TaskResource rsrc = tri.next();
+                rsrc.setAttribute(TaskResource.ATTR_INSTALL_EXCLUDED, null);
+                rsrc.setAttribute(TaskResource.ATTR_INSTALL_INFO, null);
+            }
+
             this.listener.onEvent(new InstallationEvent() {
 
                 public TYPE getType() {



Mime
View raw message