incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1058196 - in /sling/trunk/installer/core/src: main/java/org/apache/sling/installer/api/tasks/ main/java/org/apache/sling/installer/core/impl/ main/java/org/apache/sling/installer/core/impl/config/ main/java/org/apache/sling/installer/core/...
Date Wed, 12 Jan 2011 15:39:02 GMT
Author: cziegeler
Date: Wed Jan 12 15:39:01 2011
New Revision: 1058196

URL: http://svn.apache.org/viewvc?rev=1058196&view=rev
Log:
SLING-1922 : Allow resource transformer for processing installable resources

Added:
    sling/trunk/installer/core/src/main/java/org/apache/sling/installer/api/tasks/ResourceState.java   (with props)
    sling/trunk/installer/core/src/main/java/org/apache/sling/installer/api/tasks/TaskResource.java   (with props)
Modified:
    sling/trunk/installer/core/src/main/java/org/apache/sling/installer/api/tasks/InstallTask.java
    sling/trunk/installer/core/src/main/java/org/apache/sling/installer/api/tasks/RegisteredResource.java
    sling/trunk/installer/core/src/main/java/org/apache/sling/installer/api/tasks/RegisteredResourceGroup.java
    sling/trunk/installer/core/src/main/java/org/apache/sling/installer/api/tasks/TransformationResult.java
    sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/DefaultTransformer.java
    sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/EntityResourceList.java
    sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/OsgiInstallerImpl.java
    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
    sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/config/ConfigInstallTask.java
    sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/config/ConfigRemoveTask.java
    sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/config/ConfigTaskCreator.java
    sling/trunk/installer/core/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/tasks/BundleRemoveTask.java
    sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/BundleStartTask.java
    sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/BundleTaskCreator.java
    sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/BundleUpdateTask.java
    sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/ChangeStateTask.java
    sling/trunk/installer/core/src/test/java/org/apache/sling/installer/core/impl/MockBundleResource.java
    sling/trunk/installer/core/src/test/java/org/apache/sling/installer/core/impl/RegisteredResourceComparatorTest.java
    sling/trunk/installer/core/src/test/java/org/apache/sling/installer/core/impl/RegisteredResourceTest.java
    sling/trunk/installer/core/src/test/java/org/apache/sling/installer/core/impl/TaskOrderingTest.java
    sling/trunk/installer/core/src/test/java/org/apache/sling/installer/core/impl/tasks/BundleTaskCreatorTest.java

Modified: sling/trunk/installer/core/src/main/java/org/apache/sling/installer/api/tasks/InstallTask.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/core/src/main/java/org/apache/sling/installer/api/tasks/InstallTask.java?rev=1058196&r1=1058195&r2=1058196&view=diff
==============================================================================
--- sling/trunk/installer/core/src/main/java/org/apache/sling/installer/api/tasks/InstallTask.java (original)
+++ sling/trunk/installer/core/src/main/java/org/apache/sling/installer/api/tasks/InstallTask.java Wed Jan 12 15:39:01 2011
@@ -39,7 +39,7 @@ public abstract class InstallTask implem
     /**
      * Return the corresponding resource - depending on the task this might be null.
      */
-    public RegisteredResource getResource() {
+    public TaskResource getResource() {
         if ( this.resourceGroup != null ) {
             return this.resourceGroup.getActiveResource();
         }
@@ -67,7 +67,7 @@ public abstract class InstallTask implem
 		return getSortKey().compareTo(o.getSortKey());
 	}
 
-	public void setFinishedState(final RegisteredResource.State state) {
+	public void setFinishedState(final ResourceState state) {
 	    this.resourceGroup.setFinishState(state);
 	}
 

Modified: sling/trunk/installer/core/src/main/java/org/apache/sling/installer/api/tasks/RegisteredResource.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/core/src/main/java/org/apache/sling/installer/api/tasks/RegisteredResource.java?rev=1058196&r1=1058195&r2=1058196&view=diff
==============================================================================
--- sling/trunk/installer/core/src/main/java/org/apache/sling/installer/api/tasks/RegisteredResource.java (original)
+++ sling/trunk/installer/core/src/main/java/org/apache/sling/installer/api/tasks/RegisteredResource.java Wed Jan 12 15:39:01 2011
@@ -20,9 +20,7 @@ package org.apache.sling.installer.api.t
 
 import java.io.IOException;
 import java.io.InputStream;
-import java.io.Serializable;
 import java.util.Dictionary;
-import java.util.Map;
 
 import org.apache.sling.installer.api.OsgiInstaller;
 
@@ -31,15 +29,7 @@ import org.apache.sling.installer.api.Os
  *  it locally to avoid holding up to classes or data from our
  *  clients, in case those disappear while we're installing stuff.
  */
-public interface RegisteredResource extends Serializable, Comparable<RegisteredResource> {
-
-    enum State {
-        INSTALL,
-        UNINSTALL,
-        INSTALLED,
-        UNINSTALLED,
-        IGNORED
-    }
+public interface RegisteredResource {
 
     /** Return the scheme from where the artifact is orginated. */
     String getScheme();
@@ -89,38 +79,9 @@ public interface RegisteredResource exte
      */
     int getPriority();
 
-	/**
-	 * Attributes include the bundle symbolic name, bundle version, etc.
-	 */
-	Map<String, Object> getAttributes();
-
 	/** Return the identifier of the OSGi "entity" that this resource
      *  represents, for example "bundle:SID" where SID is the bundle's
      *  symbolic ID, or "config:PID" where PID is config's PID.
      */
     String getEntityId();
-
-    /**
-     * Get the current state of the resource.
-     */
-    State getState();
-
-    /**
-     * Set the new state of teh resource.
-     */
-    void setState(final State s);
-
-    /**
-     * Get the value of a temporary attribute.
-     * @param key The name of the attribute
-     * @return The value of the attribute or <code>null</code>
-     */
-    Object getTemporaryAttribute(String key);
-
-    /**
-     * Set the value of a temporary attribute.
-     * @param key The name of the attribute
-     * @param value The attribute value or <code>null</code> to remove it.
-     */
-    void setTemporaryAttributee(String key, Object value);
 }

Modified: sling/trunk/installer/core/src/main/java/org/apache/sling/installer/api/tasks/RegisteredResourceGroup.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/core/src/main/java/org/apache/sling/installer/api/tasks/RegisteredResourceGroup.java?rev=1058196&r1=1058195&r2=1058196&view=diff
==============================================================================
--- sling/trunk/installer/core/src/main/java/org/apache/sling/installer/api/tasks/RegisteredResourceGroup.java (original)
+++ sling/trunk/installer/core/src/main/java/org/apache/sling/installer/api/tasks/RegisteredResourceGroup.java Wed Jan 12 15:39:01 2011
@@ -29,7 +29,7 @@ public interface RegisteredResourceGroup
     /**
      * Return the first resource if it either needs to be installed or uninstalled.
      */
-    RegisteredResource getActiveResource();
+    TaskResource getActiveResource();
 
 
     /**
@@ -37,5 +37,5 @@ public interface RegisteredResourceGroup
      * If this resource has been uninstalled, check the next in the list if it needs to
      * be reactivated.
      */
-    void setFinishState(RegisteredResource.State state);
+    void setFinishState(ResourceState state);
 }

Added: sling/trunk/installer/core/src/main/java/org/apache/sling/installer/api/tasks/ResourceState.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/core/src/main/java/org/apache/sling/installer/api/tasks/ResourceState.java?rev=1058196&view=auto
==============================================================================
--- sling/trunk/installer/core/src/main/java/org/apache/sling/installer/api/tasks/ResourceState.java (added)
+++ sling/trunk/installer/core/src/main/java/org/apache/sling/installer/api/tasks/ResourceState.java Wed Jan 12 15:39:01 2011
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.installer.api.tasks;
+
+public enum ResourceState {
+
+        INSTALL,
+        UNINSTALL,
+        INSTALLED,
+        UNINSTALLED,
+        IGNORED
+}

Propchange: sling/trunk/installer/core/src/main/java/org/apache/sling/installer/api/tasks/ResourceState.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/trunk/installer/core/src/main/java/org/apache/sling/installer/api/tasks/ResourceState.java
------------------------------------------------------------------------------
    svn:keywords = author date id revision rev url

Propchange: sling/trunk/installer/core/src/main/java/org/apache/sling/installer/api/tasks/ResourceState.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: sling/trunk/installer/core/src/main/java/org/apache/sling/installer/api/tasks/TaskResource.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/core/src/main/java/org/apache/sling/installer/api/tasks/TaskResource.java?rev=1058196&view=auto
==============================================================================
--- sling/trunk/installer/core/src/main/java/org/apache/sling/installer/api/tasks/TaskResource.java (added)
+++ sling/trunk/installer/core/src/main/java/org/apache/sling/installer/api/tasks/TaskResource.java Wed Jan 12 15:39:01 2011
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.installer.api.tasks;
+
+import java.util.Map;
+
+/** A resource that's been registered in the OSGi controller.
+ * 	Data can be either an InputStream or a Dictionary, and we store
+ *  it locally to avoid holding up to classes or data from our
+ *  clients, in case those disappear while we're installing stuff.
+ */
+public interface TaskResource extends RegisteredResource {
+
+	/**
+	 * Attributes include the bundle symbolic name, bundle version, etc.
+	 */
+	Map<String, Object> getAttributes();
+
+    /**
+     * Get the current state of the resource.
+     */
+    ResourceState getState();
+
+    /**
+     * Set the new state of teh resource.
+     */
+    void setState(final ResourceState s);
+
+    /**
+     * Get the value of a temporary attribute.
+     * @param key The name of the attribute
+     * @return The value of the attribute or <code>null</code>
+     */
+    Object getTemporaryAttribute(String key);
+
+    /**
+     * Set the value of a temporary attribute.
+     * @param key The name of the attribute
+     * @param value The attribute value or <code>null</code> to remove it.
+     */
+    void setTemporaryAttributee(String key, Object value);
+}

Propchange: sling/trunk/installer/core/src/main/java/org/apache/sling/installer/api/tasks/TaskResource.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/trunk/installer/core/src/main/java/org/apache/sling/installer/api/tasks/TaskResource.java
------------------------------------------------------------------------------
    svn:keywords = author date id revision rev url

Propchange: sling/trunk/installer/core/src/main/java/org/apache/sling/installer/api/tasks/TaskResource.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: sling/trunk/installer/core/src/main/java/org/apache/sling/installer/api/tasks/TransformationResult.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/core/src/main/java/org/apache/sling/installer/api/tasks/TransformationResult.java?rev=1058196&r1=1058195&r2=1058196&view=diff
==============================================================================
--- sling/trunk/installer/core/src/main/java/org/apache/sling/installer/api/tasks/TransformationResult.java (original)
+++ sling/trunk/installer/core/src/main/java/org/apache/sling/installer/api/tasks/TransformationResult.java Wed Jan 12 15:39:01 2011
@@ -19,6 +19,7 @@
 package org.apache.sling.installer.api.tasks;
 
 import java.io.InputStream;
+import java.util.Map;
 
 /**
  * A result of a {@link ResourceTransformer}.
@@ -34,6 +35,9 @@ public class TransformationResult {
     /** Unique id. */
     private String id;
 
+    /** Attributes */
+    private Map<String, Object> attributes;
+
     /**
      * Get the new resource type
      * @return New resource type or <code>null</code>.
@@ -81,4 +85,18 @@ public class TransformationResult {
     public void setInputStream(final InputStream inputStream) {
         this.inputStream = inputStream;
     }
+
+    /**
+     * Attributes include the bundle symbolic name, bundle version, etc.
+     */
+    public Map<String, Object> getAttributes() {
+        return this.attributes;
+    }
+
+    /**
+     * Set the new attributes.
+     */
+    public void setAttributes(final Map<String, Object> attr) {
+        this.attributes = attr;
+    }
 }

Modified: sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/DefaultTransformer.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/DefaultTransformer.java?rev=1058196&r1=1058195&r2=1058196&view=diff
==============================================================================
--- sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/DefaultTransformer.java (original)
+++ sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/DefaultTransformer.java Wed Jan 12 15:39:01 2011
@@ -20,6 +20,8 @@ package org.apache.sling.installer.core.
 
 import java.io.IOException;
 import java.io.InputStream;
+import java.util.HashMap;
+import java.util.Map;
 import java.util.jar.JarInputStream;
 import java.util.jar.Manifest;
 
@@ -85,12 +87,14 @@ public class DefaultTransformer
                 if (sn != null) {
                     final String v = m.getMainAttributes().getValue(Constants.BUNDLE_VERSION);
                     if (v != null) {
-                        resource.getAttributes().put(Constants.BUNDLE_SYMBOLICNAME, sn);
-                        resource.getAttributes().put(Constants.BUNDLE_VERSION, v.toString());
+                        final Map<String, Object> attr = new HashMap<String, Object>();
+                        attr.put(Constants.BUNDLE_SYMBOLICNAME, sn);
+                        attr.put(Constants.BUNDLE_VERSION, v.toString());
 
                         final TransformationResult tr = new TransformationResult();
                         tr.setId(sn);
                         tr.setResourceType(InstallableResource.TYPE_BUNDLE);
+                        tr.setAttributes(attr);
 
                         return new TransformationResult[] {tr};
                     }
@@ -135,13 +139,15 @@ public class DefaultTransformer
             configPid = pid;
         }
 
-        resource.getAttributes().put(Constants.SERVICE_PID, configPid);
+        final Map<String, Object> attr = new HashMap<String, Object>();
+
+        attr.put(Constants.SERVICE_PID, configPid);
         // Add pseudo-properties
         resource.getDictionary().put(ConfigTaskCreator.CONFIG_PATH_KEY, resource.getURL());
 
         // Factory?
         if (factoryPid != null) {
-            resource.getAttributes().put(ConfigurationAdmin.SERVICE_FACTORYPID, factoryPid);
+            attr.put(ConfigurationAdmin.SERVICE_FACTORYPID, factoryPid);
             resource.getDictionary().put(ConfigTaskCreator.ALIAS_KEY, configPid);
         }
 
@@ -149,6 +155,7 @@ public class DefaultTransformer
         final String id = (factoryPid == null ? "" : factoryPid + ".") + configPid;
         tr.setId(id);
         tr.setResourceType(InstallableResource.TYPE_CONFIG);
+        tr.setAttributes(attr);
 
         return new TransformationResult[] {tr};
     }

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=1058196&r1=1058195&r2=1058196&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 Wed Jan 12 15:39:01 2011
@@ -29,6 +29,8 @@ import java.util.TreeSet;
 
 import org.apache.sling.installer.api.tasks.RegisteredResource;
 import org.apache.sling.installer.api.tasks.RegisteredResourceGroup;
+import org.apache.sling.installer.api.tasks.ResourceState;
+import org.apache.sling.installer.api.tasks.TaskResource;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -48,7 +50,7 @@ public class EntityResourceList implemen
     private static final Logger LOGGER = LoggerFactory.getLogger(EntityResourceList.class);
 
     /** The set of registered resources for this entity. */
-    private final SortedSet<RegisteredResource> resources = new TreeSet<RegisteredResource>();
+    private final SortedSet<TaskResource> resources = new TreeSet<TaskResource>();
 
     /**
      * Serialize the object
@@ -80,7 +82,7 @@ public class EntityResourceList implemen
         Util.setField(this, "resources", new TreeSet<RegisteredResource>());
         final int size = in.readInt();
         for(int i=0; i < size; i++) {
-            final RegisteredResource rr = (RegisteredResource)in.readObject();
+            final TaskResource rr = (TaskResource)in.readObject();
             this.resources.add(rr);
         }
     }
@@ -93,11 +95,11 @@ public class EntityResourceList implemen
     /**
      * Return the first resource if it either needs to be installed or uninstalled.
      */
-    public RegisteredResource getActiveResource() {
+    public TaskResource getActiveResource() {
         if ( !resources.isEmpty() ) {
-            final RegisteredResource r = resources.first();
-            if ( r.getState() == RegisteredResource.State.INSTALL
-              || r.getState() == RegisteredResource.State.UNINSTALL ) {
+            final TaskResource r = resources.first();
+            if ( r.getState() == ResourceState.INSTALL
+              || r.getState() == ResourceState.UNINSTALL ) {
                 return r;
             }
         }
@@ -109,33 +111,33 @@ public class EntityResourceList implemen
      * If this resource has been uninstalled, check the next in the list if it needs to
      * be reactivated.
      */
-    public void setFinishState(RegisteredResource.State state) {
-        final RegisteredResource toActivate = getActiveResource();
+    public void setFinishState(ResourceState state) {
+        final TaskResource toActivate = getActiveResource();
         if ( toActivate != null ) {
-            if ( toActivate.getState() == RegisteredResource.State.UNINSTALL
+            if ( toActivate.getState() == ResourceState.UNINSTALL
                  && this.resources.size() > 1 ) {
 
                 // to get the second item in the set we have to use an iterator!
-                final Iterator<RegisteredResource> i = this.resources.iterator();
+                final Iterator<TaskResource> i = this.resources.iterator();
                 i.next(); // skip first
-                final RegisteredResource second = i.next();
-                if ( state == RegisteredResource.State.UNINSTALLED ) {
+                final TaskResource second = i.next();
+                if ( state == ResourceState.UNINSTALLED ) {
                     // first resource got uninstalled, go back to second
-                    if (second.getState() == RegisteredResource.State.IGNORED || second.getState() == RegisteredResource.State.INSTALLED) {
+                    if (second.getState() == ResourceState.IGNORED || second.getState() == ResourceState.INSTALLED) {
                         LOGGER.debug("Reactivating for next cycle: {}", second);
-                        second.setState(RegisteredResource.State.INSTALL);
+                        second.setState(ResourceState.INSTALL);
                     }
                 } else {
                     // don't install as the first did not get uninstalled
-                    if ( second.getState() == RegisteredResource.State.INSTALL ) {
-                        second.setState(RegisteredResource.State.IGNORED);
+                    if ( second.getState() == ResourceState.INSTALL ) {
+                        second.setState(ResourceState.IGNORED);
                     }
                     // and now set resource to uninstalled
-                    state = RegisteredResource.State.UNINSTALLED;
+                    state = ResourceState.UNINSTALLED;
                 }
             }
             toActivate.setState(state);
-            if ( state == RegisteredResource.State.UNINSTALLED ) {
+            if ( state == ResourceState.UNINSTALLED ) {
                 this.cleanup(toActivate);
             }
         }
@@ -147,16 +149,16 @@ public class EntityResourceList implemen
         }
     }
 
-    public Collection<RegisteredResource> getResources() {
+    public Collection<TaskResource> getResources() {
         return resources;
     }
 
-    public void addOrUpdate(final RegisteredResource r) {
+    public void addOrUpdate(final TaskResource r) {
         LOGGER.debug("Adding new resource: {}", r);
         // If an object with same url is already present, replace with the
         // new one which might have different attributes
         boolean first = true;
-        for(final RegisteredResource rr : resources) {
+        for(final TaskResource rr : resources) {
             if ( rr.getURL().equals(r.getURL()) ) {
                 LOGGER.debug("Cleanup obsolete resource: {}", rr);
                 this.cleanup(rr);
@@ -172,15 +174,15 @@ public class EntityResourceList implemen
     }
 
     public void remove(final String url) {
-        final Iterator<RegisteredResource> i = resources.iterator();
+        final Iterator<TaskResource> i = resources.iterator();
         boolean first = true;
         while ( i.hasNext() ) {
-            final RegisteredResource r = i.next();
+            final TaskResource r = i.next();
             if ( r.getURL().equals(url) ) {
-                if ( first && (r.getState() == RegisteredResource.State.INSTALLED
-                        || r.getState() == RegisteredResource.State.INSTALL)) {
+                if ( first && (r.getState() == ResourceState.INSTALLED
+                        || r.getState() == ResourceState.INSTALL)) {
                     LOGGER.debug("Marking for uninstalling: {}", r);
-                    r.setState(RegisteredResource.State.UNINSTALL);
+                    r.setState(ResourceState.UNINSTALL);
                 } else {
                     LOGGER.debug("Removing unused: {}", r);
                     i.remove();
@@ -191,7 +193,7 @@ public class EntityResourceList implemen
         }
     }
 
-    public void remove(final RegisteredResource r) {
+    public void remove(final TaskResource r) {
         if ( resources.remove(r) ) {
             LOGGER.debug("Removing unused: {}", r);
             this.cleanup(r);
@@ -203,9 +205,9 @@ public class EntityResourceList implemen
      */
     public boolean compact() {
         boolean changed = false;
-        final List<RegisteredResource> toDelete = new ArrayList<RegisteredResource>();
-        for(final RegisteredResource r : resources) {
-            if ( r.getState() == RegisteredResource.State.UNINSTALLED ) {
+        final List<TaskResource> toDelete = new ArrayList<TaskResource>();
+        for(final TaskResource r : resources) {
+            if ( r.getState() == ResourceState.UNINSTALLED ) {
                 toDelete.add(r);
             }
         }

Modified: sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/OsgiInstallerImpl.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/OsgiInstallerImpl.java?rev=1058196&r1=1058195&r2=1058196&view=diff
==============================================================================
--- sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/OsgiInstallerImpl.java (original)
+++ sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/OsgiInstallerImpl.java Wed Jan 12 15:39:01 2011
@@ -39,7 +39,9 @@ import org.apache.sling.installer.api.ta
 import org.apache.sling.installer.api.tasks.InstallationContext;
 import org.apache.sling.installer.api.tasks.RegisteredResource;
 import org.apache.sling.installer.api.tasks.RegisteredResourceGroup;
+import org.apache.sling.installer.api.tasks.ResourceState;
 import org.apache.sling.installer.api.tasks.ResourceTransformer;
+import org.apache.sling.installer.api.tasks.TaskResource;
 import org.apache.sling.installer.api.tasks.TransformationResult;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.BundleEvent;
@@ -342,9 +344,9 @@ public class OsgiInstallerImpl
                 for(final String entityId : this.persistentList.getEntityIds()) {
                     final EntityResourceList group = this.persistentList.getEntityResourceList(entityId);
 
-                    final List<RegisteredResource> toRemove = new ArrayList<RegisteredResource>();
+                    final List<TaskResource> toRemove = new ArrayList<TaskResource>();
                     boolean first = true;
-                    for(final RegisteredResource r : group.getResources()) {
+                    for(final TaskResource r : group.getResources()) {
                         if ( r.getScheme().equals(scheme) ) {
                             logger.debug("Checking {}", r);
                             // search if we have a new entry with the same url
@@ -358,9 +360,9 @@ public class OsgiInstallerImpl
                             }
                             if ( !found) {
                                 logger.debug("Resource {} seems to be removed.", r);
-                                if ( first && (r.getState() == RegisteredResource.State.INSTALLED
-                                           ||  r.getState() == RegisteredResource.State.INSTALL) ) {
-                                     r.setState(RegisteredResource.State.UNINSTALL);
+                                if ( first && (r.getState() == ResourceState.INSTALLED
+                                           ||  r.getState() == ResourceState.INSTALL) ) {
+                                     r.setState(ResourceState.UNINSTALL);
                                 } else {
                                     toRemove.add(r);
                                 }
@@ -368,7 +370,7 @@ public class OsgiInstallerImpl
                         }
                         first = false;
                     }
-                    for(final RegisteredResource rr : toRemove) {
+                    for(final TaskResource rr : toRemove) {
                         this.persistentList.remove(rr);
                     }
                 }
@@ -546,7 +548,7 @@ public class OsgiInstallerImpl
         if ( services != null && services.length > 0 ) {
             // Walk the list of unknown resources and invoke all transformers
             int index = 0;
-            final List<RegisteredResource> unknownList = this.persistentList.getUnknownResources();
+            final List<RegisteredResource> unknownList = this.persistentList.getUntransformedResources();
 
             while ( index < unknownList.size() ) {
                 final RegisteredResource resource = unknownList.get(index);
@@ -556,8 +558,7 @@ public class OsgiInstallerImpl
 
                         final TransformationResult[] result = transformer.transform(resource);
                         if ( result != null && result.length > 0 ) {
-                            // TODO: for now we support just one result
-                            this.persistentList.transform(resource, result[0]);
+                            this.persistentList.transform(resource, result);
                             changed = true;
                             index--;
                             break;

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=1058196&r1=1058195&r2=1058196&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 Wed Jan 12 15:39:01 2011
@@ -35,6 +35,7 @@ import java.util.Map;
 
 import org.apache.sling.installer.api.InstallableResource;
 import org.apache.sling.installer.api.tasks.RegisteredResource;
+import org.apache.sling.installer.api.tasks.TaskResource;
 import org.apache.sling.installer.api.tasks.TransformationResult;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -62,8 +63,8 @@ public class PersistentResourceList {
     /** The persistence file. */
     private final File dataFile;
 
-    /** All unknown resources. */
-    private final List<RegisteredResource> unknownResources;
+    /** All untransformed resources. */
+    private final List<RegisteredResource> untransformedResources;
 
     @SuppressWarnings("unchecked")
     public PersistentResourceList(final File dataFile) {
@@ -99,7 +100,7 @@ public class PersistentResourceList {
             }
         }
         data = restoredData != null ? restoredData : new HashMap<String, EntityResourceList>();
-        this.unknownResources = unknownList != null ? unknownList : new ArrayList<RegisteredResource>();
+        this.untransformedResources = unknownList != null ? unknownList : new ArrayList<RegisteredResource>();
 
         this.updateCache();
     }
@@ -130,7 +131,7 @@ public class PersistentResourceList {
             try {
                 oos.writeInt(VERSION);
                 oos.writeObject(data);
-                oos.writeObject(unknownResources);
+                oos.writeObject(untransformedResources);
                 logger.debug("Persisted resource list.");
             } finally {
                 oos.close();
@@ -167,7 +168,7 @@ public class PersistentResourceList {
             return;
         }
         try {
-            final RegisteredResource registeredResource = RegisteredResourceImpl.create(input);
+            final TaskResource registeredResource = RegisteredResourceImpl.create(input);
             this.checkInstallable(registeredResource);
         } catch (final IOException ioe) {
             logger.warn("Ignoring resource. Error during processing of " + input.getURL(), ioe);
@@ -178,7 +179,7 @@ public class PersistentResourceList {
      * Check if the provided installable resource is already installable (has a
      * known resource type)
      */
-    private void checkInstallable(final RegisteredResource input) {
+    private void checkInstallable(final TaskResource input) {
         if ( !InstallableResource.TYPE_FILE.equals(input.getType())
              && !InstallableResource.TYPE_PROPERTIES.equals(input.getType()) ) {
 
@@ -190,15 +191,15 @@ public class PersistentResourceList {
 
             t.addOrUpdate(input);
         } else {
-            this.unknownResources.add(input);
+            this.untransformedResources.add(input);
         }
     }
 
     /**
-     * Get the list of unknown resources = resources without resource type
+     * Get the list of untransformed resources = resources without resource type
      */
-    public List<RegisteredResource> getUnknownResources() {
-        return this.unknownResources;
+    public List<RegisteredResource> getUntransformedResources() {
+        return this.untransformedResources;
     }
 
     /**
@@ -214,13 +215,16 @@ public class PersistentResourceList {
     /**
      * Remove a resource.
      */
-    public void remove(final RegisteredResource r) {
+    public void remove(final TaskResource r) {
         final EntityResourceList group = this.data.get(r.getEntityId());
         if ( group != null ) {
             group.remove(r);
         }
     }
 
+    /**
+     * Get the resource group for an entity id.
+     */
     public EntityResourceList getEntityResourceList(final String entityId) {
         return this.data.get(entityId);
     }
@@ -247,12 +251,14 @@ public class PersistentResourceList {
      * Transform an unknown resource to a registered one
      */
     public void transform(final RegisteredResource resource,
-            final TransformationResult tr) {
+                          final TransformationResult[] result) {
         // remove resource from unknown list
-        this.unknownResources.remove(resource);
+        this.untransformedResources.remove(resource);
         try {
-            ((RegisteredResourceImpl)resource).update(tr);
-            this.checkInstallable(resource);
+            for(int i=0; i<result.length; i++) {
+                final TaskResource clone =  ((RegisteredResourceImpl)resource).clone(result[i]);
+                this.checkInstallable(clone);
+            }
         } catch (final IOException ioe) {
             logger.warn("Ignoring resource. Error during processing of " + resource, ioe);
         }

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=1058196&r1=1058195&r2=1058196&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 Wed Jan 12 15:39:01 2011
@@ -29,7 +29,8 @@ import java.util.HashMap;
 import java.util.Map;
 
 import org.apache.sling.installer.api.InstallableResource;
-import org.apache.sling.installer.api.tasks.RegisteredResource;
+import org.apache.sling.installer.api.tasks.ResourceState;
+import org.apache.sling.installer.api.tasks.TaskResource;
 import org.apache.sling.installer.api.tasks.TransformationResult;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.Constants;
@@ -39,7 +40,7 @@ import org.osgi.framework.Version;
  * Implementation of the registered resource
  */
 public class RegisteredResourceImpl
-    implements RegisteredResource, Serializable {
+    implements TaskResource, Serializable, Comparable<RegisteredResourceImpl> {
 
     /** Use own serial version ID as we control serialization. */
     private static final long serialVersionUID = 6L;
@@ -72,7 +73,7 @@ public class RegisteredResourceImpl
     private String resourceType;
 
     /** The current state of this resource. */
-    private State state = State.INSTALL;
+    private ResourceState state = ResourceState.INSTALL;
 
     /** Temporary attributes. */
     private transient Map<String, Object> temporaryAttributes;
@@ -98,7 +99,7 @@ public class RegisteredResourceImpl
         out.writeObject(dataFile);
         out.writeObject(resourceType);
         out.writeInt(priority);
-        out.writeObject(state);
+        out.writeObject(state.toString());
     }
 
     /**
@@ -121,7 +122,7 @@ public class RegisteredResourceImpl
         Util.setField(this, "dataFile", in.readObject());
         Util.setField(this, "resourceType", in.readObject());
         Util.setField(this, "priority", in.readInt());
-        this.state = (State) in.readObject();
+        this.state = ResourceState.valueOf((String) in.readObject());
     }
 
     /**
@@ -236,7 +237,7 @@ public class RegisteredResourceImpl
     }
 
     /**
-     * @see org.apache.sling.installer.api.tasks.RegisteredResource#getAttributes()
+     * @see org.apache.sling.installer.api.tasks.TaskResource#getAttributes()
      */
     public Map<String, Object> getAttributes() {
 		return attributes;
@@ -257,16 +258,16 @@ public class RegisteredResourceImpl
     }
 
     /**
-     * @see org.apache.sling.installer.api.tasks.RegisteredResource#getState()
+     * @see org.apache.sling.installer.api.tasks.TaskResource#getState()
      */
-    public State getState() {
+    public ResourceState getState() {
         return this.state;
     }
 
     /**
-     * @see org.apache.sling.installer.api.tasks.RegisteredResource#setState(org.apache.sling.installer.api.tasks.RegisteredResource.State)
+     * @see org.apache.sling.installer.api.tasks.TaskResource#setState(org.apache.sling.installer.api.tasks.ResourceState)
      */
-    public void setState(State s) {
+    public void setState(ResourceState s) {
         this.state = s;
     }
 
@@ -277,13 +278,13 @@ public class RegisteredResourceImpl
         if ( obj == this ) {
             return true;
         }
-        if ( ! (obj instanceof RegisteredResource) ) {
+        if ( ! (obj instanceof RegisteredResourceImpl) ) {
             return false;
         }
         if ( this.entity == null ) {
-            return this.getURL().equals(((RegisteredResource)obj).getURL());
+            return super.equals(obj);
         }
-        return compareTo((RegisteredResource)obj) == 0;
+        return compareTo((RegisteredResourceImpl)obj) == 0;
     }
 
     /**
@@ -296,7 +297,7 @@ public class RegisteredResourceImpl
     /**
      * @see java.lang.Comparable#compareTo(java.lang.Object)
      */
-    public int compareTo(final RegisteredResource b) {
+    public int compareTo(final RegisteredResourceImpl b) {
         return compare(this, b);
     }
 
@@ -306,7 +307,7 @@ public class RegisteredResourceImpl
      * together with an entity identifier for the to be installed resource like
      * the symbolic name of a bundle, the pid for a configuration etc.
      */
-    public static int compare(final RegisteredResource a, final RegisteredResource b) {
+    public static int compare(final TaskResource a, final TaskResource b) {
         // check entity id first
         int result = a.getEntityId().compareTo(b.getEntityId());
         if ( result == 0 ) {
@@ -336,7 +337,7 @@ public class RegisteredResourceImpl
      * - if the version is a snapshot version, the serial number and the digest are used
      *   in addition
      */
-    private static int compareBundles(final RegisteredResource a, final RegisteredResource b) {
+    private static int compareBundles(final TaskResource a, final TaskResource b) {
         boolean isSnapshot = false;
         int result = 0;
 
@@ -360,7 +361,7 @@ public class RegisteredResourceImpl
     }
 
     /**
-     * @see org.apache.sling.installer.api.tasks.RegisteredResource#getTemporaryAttribute(java.lang.String)
+     * @see org.apache.sling.installer.api.tasks.TaskResource#getTemporaryAttribute(java.lang.String)
      */
     public Object getTemporaryAttribute(final String key) {
         if ( this.temporaryAttributes != null ) {
@@ -370,7 +371,7 @@ public class RegisteredResourceImpl
     }
 
     /**
-     * @see org.apache.sling.installer.api.tasks.RegisteredResource#setTemporaryAttributee(java.lang.String, java.lang.Object)
+     * @see org.apache.sling.installer.api.tasks.TaskResource#setTemporaryAttributee(java.lang.String, java.lang.Object)
      */
     public void setTemporaryAttributee(final String key, final Object value) {
         if ( this.temporaryAttributes == null ) {
@@ -388,7 +389,7 @@ public class RegisteredResourceImpl
      * Currently only the input stream and resource type is updated.
      * @param tr Transformation result
      */
-    public void update(final TransformationResult tr)
+    private void update(final TransformationResult tr)
     throws IOException {
         final InputStream is = tr.getInputStream();
         if ( tr.getResourceType() != null ) {
@@ -419,5 +420,27 @@ public class RegisteredResourceImpl
                 } catch (final IOException ignore) {}
             }
         }
+        if ( tr.getAttributes() != null ) {
+            this.attributes.putAll(tr.getAttributes());
+        }
+    }
+
+    /**
+     * Create a new resource with updated information
+     */
+    public TaskResource clone(TransformationResult transformationResult)
+    throws IOException {
+        final int schemePos = this.url.indexOf(':');
+        final RegisteredResourceImpl rr = new RegisteredResourceImpl(
+                this.url.substring(schemePos + 1),
+                this.dataFile,
+                this.dictionary,
+                this.resourceType,
+                this.digest,
+                this.priority,
+                this.urlScheme);
+        rr.update(transformationResult);
+
+        return rr;
     }
 }
\ No newline at end of file

Modified: sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/config/ConfigInstallTask.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/config/ConfigInstallTask.java?rev=1058196&r1=1058195&r2=1058196&view=diff
==============================================================================
--- sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/config/ConfigInstallTask.java (original)
+++ sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/config/ConfigInstallTask.java Wed Jan 12 15:39:01 2011
@@ -19,8 +19,8 @@
 package org.apache.sling.installer.core.impl.config;
 
 import org.apache.sling.installer.api.tasks.InstallationContext;
-import org.apache.sling.installer.api.tasks.RegisteredResource;
 import org.apache.sling.installer.api.tasks.RegisteredResourceGroup;
+import org.apache.sling.installer.api.tasks.ResourceState;
 import org.osgi.service.cm.Configuration;
 import org.osgi.service.cm.ConfigurationAdmin;
 import org.osgi.util.tracker.ServiceTracker;
@@ -72,12 +72,12 @@ public class ConfigInstallTask extends A
                 }
                 config.update(getResource().getDictionary());
                 ctx.log("Installed configuration {} from resource {}", config.getPid(), getResource());
-                this.setFinishedState(RegisteredResource.State.INSTALLED);
+                this.setFinishedState(ResourceState.INSTALLED);
                 this.getLogger().debug("Configuration " + config.getPid()
                             + " " + (created ? "created" : "updated")
                             + " from " + getResource());
             } else {
-                this.setFinishedState(RegisteredResource.State.IGNORED);
+                this.setFinishedState(ResourceState.IGNORED);
             }
         } catch (Exception e) {
             this.getLogger().debug("Exception during installation of config " + this.getResource() + " : " + e.getMessage() + ". Retrying later.", e);

Modified: sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/config/ConfigRemoveTask.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/config/ConfigRemoveTask.java?rev=1058196&r1=1058195&r2=1058196&view=diff
==============================================================================
--- sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/config/ConfigRemoveTask.java (original)
+++ sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/config/ConfigRemoveTask.java Wed Jan 12 15:39:01 2011
@@ -19,8 +19,8 @@
 package org.apache.sling.installer.core.impl.config;
 
 import org.apache.sling.installer.api.tasks.InstallationContext;
-import org.apache.sling.installer.api.tasks.RegisteredResource;
 import org.apache.sling.installer.api.tasks.RegisteredResourceGroup;
+import org.apache.sling.installer.api.tasks.ResourceState;
 import org.osgi.service.cm.Configuration;
 import org.osgi.service.cm.ConfigurationAdmin;
 import org.osgi.util.tracker.ServiceTracker;
@@ -55,19 +55,19 @@ public class ConfigRemoveTask extends Ab
             final Configuration cfg = getConfiguration(ca, false);
             if (cfg == null) {
                 this.getLogger().debug("Cannot delete config , pid={} not found, ignored ({})", getCompositePid(), getResource());
-                this.setFinishedState(RegisteredResource.State.IGNORED);
+                this.setFinishedState(ResourceState.IGNORED);
             } else {
                 if ( cfg.getProperties().get(ConfigTaskCreator.CONFIG_PATH_KEY) == null ) {
                     this.getLogger().debug("Configuration has not been installed by this resource. Not removing!");
-                    this.setFinishedState(RegisteredResource.State.IGNORED);
+                    this.setFinishedState(ResourceState.IGNORED);
                 } else if ( !isSameData(cfg.getProperties(), this.getResource().getDictionary()) ) {
                     this.getLogger().debug("Configuration has changed after is has been installed. Not removing!");
-                    this.setFinishedState(RegisteredResource.State.IGNORED);
+                    this.setFinishedState(ResourceState.IGNORED);
                 } else {
                     this.getLogger().debug("Deleting config {} ({})", getCompositePid(), getResource());
                     cfg.delete();
                     ctx.log("Deleted configuration {} from resource {}", getCompositePid(), getResource());
-                    this.setFinishedState(RegisteredResource.State.UNINSTALLED);
+                    this.setFinishedState(ResourceState.UNINSTALLED);
                 }
             }
         } catch (Exception e) {

Modified: sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/config/ConfigTaskCreator.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/config/ConfigTaskCreator.java?rev=1058196&r1=1058195&r2=1058196&view=diff
==============================================================================
--- sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/config/ConfigTaskCreator.java (original)
+++ sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/config/ConfigTaskCreator.java Wed Jan 12 15:39:01 2011
@@ -21,8 +21,9 @@ package org.apache.sling.installer.core.
 import org.apache.sling.installer.api.InstallableResource;
 import org.apache.sling.installer.api.tasks.InstallTask;
 import org.apache.sling.installer.api.tasks.InstallTaskFactory;
-import org.apache.sling.installer.api.tasks.RegisteredResource;
 import org.apache.sling.installer.api.tasks.RegisteredResourceGroup;
+import org.apache.sling.installer.api.tasks.ResourceState;
+import org.apache.sling.installer.api.tasks.TaskResource;
 import org.apache.sling.installer.core.impl.InternalService;
 import org.osgi.framework.BundleContext;
 import org.osgi.service.cm.ConfigurationAdmin;
@@ -74,7 +75,7 @@ public class ConfigTaskCreator implement
 	 * @see org.apache.sling.installer.api.tasks.InstallTaskFactory#createTask(org.apache.sling.installer.api.tasks.RegisteredResourceGroup)
 	 */
 	public InstallTask createTask(final RegisteredResourceGroup group) {
-        final RegisteredResource toActivate = group.getActiveResource();
+        final TaskResource toActivate = group.getActiveResource();
         if ( !toActivate.getType().equals(InstallableResource.TYPE_CONFIG) ) {
             return null;
         }
@@ -83,7 +84,7 @@ public class ConfigTaskCreator implement
             return null;
 	    }
 	    final InstallTask result;
-		if (toActivate.getState() == RegisteredResource.State.UNINSTALL) {
+		if (toActivate.getState() == ResourceState.UNINSTALL) {
 		    result = new ConfigRemoveTask(group, this.configAdminServiceTracker);
 		} else {
 	        result = new ConfigInstallTask(group, this.configAdminServiceTracker);

Modified: sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/console/OsgiInstallerWebConsolePlugin.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/console/OsgiInstallerWebConsolePlugin.java?rev=1058196&r1=1058195&r2=1058196&view=diff
==============================================================================
--- sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/console/OsgiInstallerWebConsolePlugin.java (original)
+++ sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/console/OsgiInstallerWebConsolePlugin.java Wed Jan 12 15:39:01 2011
@@ -29,6 +29,7 @@ import javax.servlet.ServletRequest;
 import javax.servlet.ServletResponse;
 
 import org.apache.sling.installer.api.tasks.RegisteredResource;
+import org.apache.sling.installer.api.tasks.TaskResource;
 import org.apache.sling.installer.core.impl.EntityResourceList;
 import org.apache.sling.installer.core.impl.OsgiInstallerImpl;
 import org.osgi.framework.BundleContext;
@@ -72,7 +73,7 @@ public class OsgiInstallerWebConsolePlug
             Collection<String> entities = this.installer.getPersistentResourceList().getEntityIds();
             for (String entityId : entities) {
                 EntityResourceList erl = this.installer.getPersistentResourceList().getEntityResourceList(entityId);
-                RegisteredResource registeredResource = erl.getActiveResource();
+                TaskResource registeredResource = erl.getActiveResource();
                 if (registeredResource != null) {
                     pw.printf("<li>%s: %s, %s, %s%n",
                         registeredResource.getEntityId(),
@@ -80,10 +81,10 @@ public class OsgiInstallerWebConsolePlug
                         registeredResource.getScheme(),
                         registeredResource.getState());
                 }
-                Collection<RegisteredResource> resources = erl.getResources();
+                Collection<TaskResource> resources = erl.getResources();
                 if (resources.size() > 0) {
                     pw.println("<ul>");
-                    for (RegisteredResource resource : resources) {
+                    for (TaskResource resource : resources) {
                         pw.printf("<li>%s: %s, %s, %s</li>%n",
                             resource.getEntityId(), resource.getDigest(),
                             resource.getScheme(), resource.getState());
@@ -94,7 +95,7 @@ public class OsgiInstallerWebConsolePlug
             }
             pw.println("</ul>");
 
-            printUnknownResources(pw, this.installer.getPersistentResourceList().getUnknownResources());
+            printUnknownResources(pw, this.installer.getPersistentResourceList().getUntransformedResources());
         }
     }
 
@@ -112,7 +113,7 @@ public class OsgiInstallerWebConsolePlug
             Collection<String> entities = this.installer.getPersistentResourceList().getEntityIds();
             for (String entityId : entities) {
                 EntityResourceList erl = this.installer.getPersistentResourceList().getEntityResourceList(entityId);
-                RegisteredResource registeredResource = erl.getActiveResource();
+                TaskResource registeredResource = erl.getActiveResource();
                 if (registeredResource != null) {
                     pw.printf("- %s: %s, %s, %s%n",
                         registeredResource.getEntityId(),
@@ -120,9 +121,9 @@ public class OsgiInstallerWebConsolePlug
                         registeredResource.getScheme(),
                         registeredResource.getState());
                 }
-                Collection<RegisteredResource> resources = erl.getResources();
+                Collection<TaskResource> resources = erl.getResources();
                 if (resources.size() > 0) {
-                    for (RegisteredResource resource : resources) {
+                    for (TaskResource resource : resources) {
                         pw.printf("- %s: %s, %s, %s%n",
                             resource.getEntityId(), resource.getDigest(),
                             resource.getScheme(), resource.getState());
@@ -131,25 +132,23 @@ public class OsgiInstallerWebConsolePlug
             }
 
             pw.println();
-            pw.println("Unknown Resources:");
-            for (RegisteredResource registeredResource : this.installer.getPersistentResourceList().getUnknownResources()) {
-                pw.printf("- %s: %s, %s, %s</li>%n",
+            pw.println("Untransformed Resources:");
+            for (RegisteredResource registeredResource : this.installer.getPersistentResourceList().getUntransformedResources()) {
+                pw.printf("- %s: %s, %s%n",
                     registeredResource.getEntityId(),
-                    registeredResource.getDigest(), registeredResource.getScheme(),
-                    registeredResource.getState());
+                    registeredResource.getDigest(), registeredResource.getScheme());
             }
         }
     }
 
     private void printUnknownResources(final PrintWriter pw,
             final List<RegisteredResource> unknown) {
-        pw.println("<h1>Unknown Resources</h1>");
+        pw.println("<h1>Untransformed Resources</h1>");
         pw.println("<ul>");
         for (RegisteredResource registeredResource : unknown) {
-            pw.printf("<li>%s: %s, %s, %s</li>%n",
+            pw.printf("<li>%s: %s, %s</li>%n",
                 registeredResource.getEntityId(),
-                registeredResource.getDigest(), registeredResource.getScheme(),
-                registeredResource.getState());
+                registeredResource.getDigest(), registeredResource.getScheme());
         }
         pw.println("</ul>");
     }

Modified: sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/BundleRemoveTask.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/BundleRemoveTask.java?rev=1058196&r1=1058195&r2=1058196&view=diff
==============================================================================
--- sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/BundleRemoveTask.java (original)
+++ sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/BundleRemoveTask.java Wed Jan 12 15:39:01 2011
@@ -18,10 +18,10 @@
  */
 package org.apache.sling.installer.core.impl.tasks;
 
-import org.apache.sling.installer.api.tasks.InstallationContext;
 import org.apache.sling.installer.api.tasks.InstallTask;
-import org.apache.sling.installer.api.tasks.RegisteredResource;
+import org.apache.sling.installer.api.tasks.InstallationContext;
 import org.apache.sling.installer.api.tasks.RegisteredResourceGroup;
+import org.apache.sling.installer.api.tasks.ResourceState;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleException;
 import org.osgi.framework.Constants;
@@ -50,7 +50,7 @@ public class BundleRemoveTask extends In
         final Bundle b = this.creator.getMatchingBundle(symbolicName);
         if (b == null) {
             // nothing to do, so just stop
-            this.setFinishedState(RegisteredResource.State.IGNORED);
+            this.setFinishedState(ResourceState.IGNORED);
             return;
         }
         final int state = b.getState();
@@ -60,7 +60,7 @@ public class BundleRemoveTask extends In
             }
             b.uninstall();
             ctx.log("Uninstalled bundle {} from resource {}", b, getResource());
-            this.setFinishedState(RegisteredResource.State.UNINSTALLED);
+            this.setFinishedState(ResourceState.UNINSTALLED);
             ctx.addTaskToCurrentCycle(new SynchronousRefreshPackagesTask(this.creator));
         } catch (final BundleException be) {
             this.getLogger().debug("Exception during removal of bundle " + this.getResource() + " : " + be.getMessage() + ". Retrying later.", be);

Modified: sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/BundleStartTask.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/BundleStartTask.java?rev=1058196&r1=1058195&r2=1058196&view=diff
==============================================================================
--- sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/BundleStartTask.java (original)
+++ sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/BundleStartTask.java Wed Jan 12 15:39:01 2011
@@ -20,10 +20,11 @@ package org.apache.sling.installer.core.
 
 import java.text.DecimalFormat;
 
-import org.apache.sling.installer.api.tasks.InstallationContext;
 import org.apache.sling.installer.api.tasks.InstallTask;
-import org.apache.sling.installer.api.tasks.RegisteredResource;
+import org.apache.sling.installer.api.tasks.InstallationContext;
 import org.apache.sling.installer.api.tasks.RegisteredResourceGroup;
+import org.apache.sling.installer.api.tasks.ResourceState;
+import org.apache.sling.installer.api.tasks.TaskResource;
 import org.apache.sling.installer.core.impl.OsgiInstallerImpl;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleException;
@@ -52,7 +53,7 @@ public class BundleStartTask extends Ins
         this.bundleId = bundleId;
         this.creator = btc;
         this.sortKey = BUNDLE_START_ORDER + new DecimalFormat("00000").format(bundleId);
-        final RegisteredResource rr = this.getResource();
+        final TaskResource rr = this.getResource();
 	    if ( rr != null && rr.getTemporaryAttribute(ATTR_RC) != null ) {
 	        this.retryCount = (Integer)rr.getTemporaryAttribute(ATTR_RC);
             this.eventsCountForRetrying = (Long)rr.getTemporaryAttribute(ATTR_EC);
@@ -77,7 +78,7 @@ public class BundleStartTask extends Ins
         if (bundleId == 0) {
             this.getLogger().debug("Bundle 0 is the framework bundle, ignoring request to start it");
             if ( this.getResource() != null ) {
-                this.setFinishedState(RegisteredResource.State.INSTALLED);
+                this.setFinishedState(ResourceState.INSTALLED);
             }
             return;
         }
@@ -102,7 +103,7 @@ public class BundleStartTask extends Ins
         if (b.getState() == Bundle.ACTIVE) {
             this.getLogger().debug("Bundle already started, no action taken: {}/{}", bundleId, b.getSymbolicName());
             if ( this.getResource() != null ) {
-                this.setFinishedState(RegisteredResource.State.INSTALLED);
+                this.setFinishedState(ResourceState.INSTALLED);
             }
             return;
         }
@@ -110,7 +111,7 @@ public class BundleStartTask extends Ins
         try {
             b.start();
             if ( this.getResource() != null ) {
-                this.setFinishedState(RegisteredResource.State.INSTALLED);
+                this.setFinishedState(ResourceState.INSTALLED);
             }
             this.getLogger().info("Bundle started (retry count={}, bundle ID={}) : {}",
                     new Object[] {retryCount, bundleId, b.getSymbolicName()});

Modified: sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/BundleTaskCreator.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/BundleTaskCreator.java?rev=1058196&r1=1058195&r2=1058196&view=diff
==============================================================================
--- sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/BundleTaskCreator.java (original)
+++ sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/BundleTaskCreator.java Wed Jan 12 15:39:01 2011
@@ -21,8 +21,9 @@ package org.apache.sling.installer.core.
 import org.apache.sling.installer.api.InstallableResource;
 import org.apache.sling.installer.api.tasks.InstallTask;
 import org.apache.sling.installer.api.tasks.InstallTaskFactory;
-import org.apache.sling.installer.api.tasks.RegisteredResource;
 import org.apache.sling.installer.api.tasks.RegisteredResourceGroup;
+import org.apache.sling.installer.api.tasks.ResourceState;
+import org.apache.sling.installer.api.tasks.TaskResource;
 import org.apache.sling.installer.core.impl.InternalService;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
@@ -135,7 +136,7 @@ public class BundleTaskCreator implement
 	 * @see org.apache.sling.installer.api.tasks.InstallTaskFactory#createTask(org.apache.sling.installer.api.tasks.RegisteredResourceGroup)
 	 */
 	public InstallTask createTask(final RegisteredResourceGroup resourceList) {
-	    final RegisteredResource toActivate = resourceList.getActiveResource();
+	    final TaskResource toActivate = resourceList.getActiveResource();
 	    if ( !toActivate.getType().equals(InstallableResource.TYPE_BUNDLE) ) {
 	        return null;
 	    }
@@ -145,14 +146,14 @@ public class BundleTaskCreator implement
         final BundleInfo info = this.getBundleInfo(symbolicName);
 
 		// Uninstall
-		if (toActivate.getState() == RegisteredResource.State.UNINSTALL) {
+		if (toActivate.getState() == ResourceState.UNINSTALL) {
 		    // Remove corresponding bundle if present and if we installed it
 		    if (info != null
 		        && info.version.equals(new Version((String)toActivate.getAttributes().get(Constants.BUNDLE_VERSION))) ) {
 		        result = new BundleRemoveTask(resourceList, this);
 		    } else {
 	            logger.info("Bundle {} was not installed by this module, not removed", symbolicName);
-	            result = new ChangeStateTask(resourceList, RegisteredResource.State.IGNORED);
+	            result = new ChangeStateTask(resourceList, ResourceState.IGNORED);
 	        }
 
 		// Install
@@ -188,7 +189,7 @@ public class BundleTaskCreator implement
                     }
                 } else {
                     logger.debug("Nothing to install for {}, same version {} already installed.", toActivate, newVersion);
-                    result = new ChangeStateTask(resourceList, RegisteredResource.State.IGNORED);
+                    result = new ChangeStateTask(resourceList, ResourceState.IGNORED);
                 }
 			}
 		}

Modified: sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/BundleUpdateTask.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/BundleUpdateTask.java?rev=1058196&r1=1058195&r2=1058196&view=diff
==============================================================================
--- sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/BundleUpdateTask.java (original)
+++ sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/BundleUpdateTask.java Wed Jan 12 15:39:01 2011
@@ -18,10 +18,10 @@
  */
 package org.apache.sling.installer.core.impl.tasks;
 
-import org.apache.sling.installer.api.tasks.InstallationContext;
 import org.apache.sling.installer.api.tasks.InstallTask;
-import org.apache.sling.installer.api.tasks.RegisteredResource;
+import org.apache.sling.installer.api.tasks.InstallationContext;
 import org.apache.sling.installer.api.tasks.RegisteredResourceGroup;
+import org.apache.sling.installer.api.tasks.ResourceState;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.Constants;
 import org.osgi.framework.Version;
@@ -52,7 +52,7 @@ public class BundleUpdateTask extends In
         final Bundle b = this.creator.getMatchingBundle(symbolicName);
         if (b == null) {
             this.getLogger().debug("Bundle to update ({}) not found", symbolicName);
-            this.setFinishedState(RegisteredResource.State.IGNORED);
+            this.setFinishedState(ResourceState.IGNORED);
             return;
         }
 
@@ -65,7 +65,7 @@ public class BundleUpdateTask extends In
     	if (currentVersion.equals(newVersion) && !snapshot) {
     	    // TODO : Isn't this already checked in the task creator?
     	    this.getLogger().debug("Same version is already installed, and not a snapshot, ignoring update: {}", getResource());
-    	    this.setFinishedState(RegisteredResource.State.INSTALLED);
+    	    this.setFinishedState(ResourceState.INSTALLED);
     		return;
     	}
 
@@ -82,14 +82,14 @@ public class BundleUpdateTask extends In
                 this.getResource().getAttributes().put(BundleTaskCreator.ATTR_START, "true");
                 ctx.addTaskToCurrentCycle(new BundleStartTask(this.getResourceGroup(), b.getBundleId(), this.creator));
             } else {
-                this.setFinishedState(RegisteredResource.State.INSTALLED);
+                this.setFinishedState(ResourceState.INSTALLED);
             }
             ctx.addTaskToCurrentCycle(new SynchronousRefreshPackagesTask(this.creator));
             this.getLogger().debug("Bundle updated: {}/{}", b.getBundleId(), b.getSymbolicName());
     	} catch (Exception e) {
             if ( !canRetry ) {
                 this.getLogger().warn("Removing failing tasks - unable to retry: " + this, e);
-                this.setFinishedState(RegisteredResource.State.IGNORED);
+                this.setFinishedState(ResourceState.IGNORED);
             }
     	}
     }

Modified: sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/ChangeStateTask.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/ChangeStateTask.java?rev=1058196&r1=1058195&r2=1058196&view=diff
==============================================================================
--- sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/ChangeStateTask.java (original)
+++ sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/ChangeStateTask.java Wed Jan 12 15:39:01 2011
@@ -18,10 +18,10 @@
  */
 package org.apache.sling.installer.core.impl.tasks;
 
-import org.apache.sling.installer.api.tasks.InstallationContext;
 import org.apache.sling.installer.api.tasks.InstallTask;
-import org.apache.sling.installer.api.tasks.RegisteredResource;
+import org.apache.sling.installer.api.tasks.InstallationContext;
 import org.apache.sling.installer.api.tasks.RegisteredResourceGroup;
+import org.apache.sling.installer.api.tasks.ResourceState;
 
 /**
  * Simple general task, setting the state of a registered resource.
@@ -30,10 +30,10 @@ public class ChangeStateTask extends Ins
 
     private static final String ORDER = "00-";
 
-    private final RegisteredResource.State state;
+    private final ResourceState state;
 
     public ChangeStateTask(final RegisteredResourceGroup r,
-                           final RegisteredResource.State s) {
+                           final ResourceState s) {
         super(r);
         this.state = s;
     }

Modified: sling/trunk/installer/core/src/test/java/org/apache/sling/installer/core/impl/MockBundleResource.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/core/src/test/java/org/apache/sling/installer/core/impl/MockBundleResource.java?rev=1058196&r1=1058195&r2=1058196&view=diff
==============================================================================
--- sling/trunk/installer/core/src/test/java/org/apache/sling/installer/core/impl/MockBundleResource.java (original)
+++ sling/trunk/installer/core/src/test/java/org/apache/sling/installer/core/impl/MockBundleResource.java Wed Jan 12 15:39:01 2011
@@ -25,16 +25,20 @@ import java.util.HashMap;
 import java.util.Map;
 
 import org.apache.sling.installer.api.InstallableResource;
-import org.apache.sling.installer.api.tasks.RegisteredResource;
+import org.apache.sling.installer.api.tasks.ResourceState;
+import org.apache.sling.installer.api.tasks.TaskResource;
 import org.osgi.framework.Constants;
 
-/** Mock RegisteredResource that simulates a bundle */
-public class MockBundleResource implements RegisteredResource {
+/**
+ * Mock RegisteredResource that simulates a bundle
+ *
+ */
+public class MockBundleResource implements TaskResource, Comparable<MockBundleResource> {
 
     private static final long serialVersionUID = 1L;
     private final Map<String, Object> attributes = new HashMap<String, Object>();
     private final Map<String, Object> tempAttributes = new HashMap<String, Object>();
-	private State state = State.INSTALL;
+	private ResourceState state = ResourceState.INSTALL;
 	private final String digest;
 	private final int priority;
 
@@ -74,7 +78,7 @@ public class MockBundleResource implemen
 	}
 
 	/**
-	 * @see org.apache.sling.installer.api.tasks.RegisteredResource#getAttributes()
+	 * @see org.apache.sling.installer.api.tasks.TaskResource#getAttributes()
 	 */
 	public Map<String, Object> getAttributes() {
 		return attributes;
@@ -139,33 +143,33 @@ public class MockBundleResource implemen
     /**
      * @see java.lang.Comparable#compareTo(java.lang.Object)
      */
-    public int compareTo(RegisteredResource o) {
+    public int compareTo(MockBundleResource o) {
         return RegisteredResourceImpl.compare(this, o);
     }
 
     /**
-     * @see org.apache.sling.installer.api.tasks.RegisteredResource#getState()
+     * @see org.apache.sling.installer.api.tasks.TaskResource#getState()
      */
-    public State getState() {
+    public ResourceState getState() {
         return state;
     }
 
     /**
-     * @see org.apache.sling.installer.api.tasks.RegisteredResource#setState(org.apache.sling.installer.api.tasks.RegisteredResource.State)
+     * @see org.apache.sling.installer.api.tasks.TaskResource#setState(org.apache.sling.installer.api.tasks.ResourceState)
      */
-    public void setState(State s) {
+    public void setState(ResourceState s) {
         this.state = s;
     }
 
     /**
-     * @see org.apache.sling.installer.api.tasks.RegisteredResource#getTemporaryAttribute(java.lang.String)
+     * @see org.apache.sling.installer.api.tasks.TaskResource#getTemporaryAttribute(java.lang.String)
      */
     public Object getTemporaryAttribute(String key) {
         return this.tempAttributes.get(key);
     }
 
     /**
-     * @see org.apache.sling.installer.api.tasks.RegisteredResource#setTemporaryAttributee(java.lang.String, java.lang.Object)
+     * @see org.apache.sling.installer.api.tasks.TaskResource#setTemporaryAttributee(java.lang.String, java.lang.Object)
      */
     public void setTemporaryAttributee(String key, Object value) {
         if ( value == null ) {

Modified: sling/trunk/installer/core/src/test/java/org/apache/sling/installer/core/impl/RegisteredResourceComparatorTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/core/src/test/java/org/apache/sling/installer/core/impl/RegisteredResourceComparatorTest.java?rev=1058196&r1=1058195&r2=1058196&view=diff
==============================================================================
--- sling/trunk/installer/core/src/test/java/org/apache/sling/installer/core/impl/RegisteredResourceComparatorTest.java (original)
+++ sling/trunk/installer/core/src/test/java/org/apache/sling/installer/core/impl/RegisteredResourceComparatorTest.java Wed Jan 12 15:39:01 2011
@@ -45,11 +45,11 @@ public class RegisteredResourceComparato
         }
     }
 
-    private RegisteredResource getConfig(String url, Dictionary<String, Object> data, int priority) throws IOException {
+    private RegisteredResourceImpl getConfig(String url, Dictionary<String, Object> data, int priority) throws IOException {
         return getConfig(url, data, priority, null);
     }
 
-    private RegisteredResource getConfig(String url, Dictionary<String, Object> data, int priority, String digest) throws IOException {
+    private RegisteredResourceImpl getConfig(String url, Dictionary<String, Object> data, int priority, String digest) throws IOException {
         if(data == null) {
             data = new Hashtable<String, Object>();
             data.put("foo", "bar");
@@ -58,9 +58,7 @@ public class RegisteredResourceComparato
         final InstallableResource r = new InstallableResource(url, null, data, digest, null, priority);
         final InternalResource internal = InternalResource.create("test", r);
         final RegisteredResourceImpl rr = RegisteredResourceImpl.create(internal);
-        rr.update(new DefaultTransformer().transform(rr)[0]);
-
-        return rr;
+        return (RegisteredResourceImpl)rr.clone(new DefaultTransformer().transform(rr)[0]);
     }
 
     private void assertOrder(RegisteredResource[] inOrder) {
@@ -125,8 +123,8 @@ public class RegisteredResourceComparato
 
     @Test
     public void testBundleDigests() {
-        final RegisteredResource a = new MockBundleResource("a", "1.2.0", 0, "digestA");
-        final RegisteredResource b = new MockBundleResource("a", "1.2.0", 0, "digestB");
+        final MockBundleResource a = new MockBundleResource("a", "1.2.0", 0, "digestA");
+        final MockBundleResource b = new MockBundleResource("a", "1.2.0", 0, "digestB");
         assertEquals("Digests must not be included in bundles comparison", 0, a.compareTo(b));
     }
 
@@ -153,13 +151,13 @@ public class RegisteredResourceComparato
     public void testConfigDigests() throws IOException {
     	final Dictionary<String, Object> data = new Hashtable<String, Object>();
         data.put("foo", "bar");
-        final RegisteredResource a = getConfig("pid", data, 0);
+        final RegisteredResourceImpl a = getConfig("pid", data, 0);
         data.put("foo", "changed");
-        final RegisteredResource b = getConfig("pid", data, 0);
+        final RegisteredResourceImpl b = getConfig("pid", data, 0);
         assertEquals("Entity urls must be the same", a.getEntityId(), b.getEntityId());
         assertTrue("Digests must be included in configs comparison", a.compareTo(b) != 0);
-        final RegisteredResource a2 = getConfig("pid", data, 0);
-        final RegisteredResource b2 = getConfig("pid", data, 0);
+        final RegisteredResourceImpl a2 = getConfig("pid", data, 0);
+        final RegisteredResourceImpl b2 = getConfig("pid", data, 0);
         assertEquals("Digests must be included in configs comparison", 0, a2.compareTo(b2));
     }
 
@@ -181,12 +179,4 @@ public class RegisteredResourceComparato
         inOrder[3] = getConfig("pidB", null, 0);
         assertOrder(inOrder);
     }
-
-    @Test
-    public void testConfigAndBundle() throws IOException {
-    	final RegisteredResource cfg = getConfig("pid", null, InstallableResource.DEFAULT_PRIORITY);
-    	final RegisteredResource b = new MockBundleResource("a", "1.0");
-    	assertEquals("bundle is > config when compared", -1, b.compareTo(cfg));
-    	assertEquals("config is < bundle when compared", 1, cfg.compareTo(b));
-    }
 }
\ No newline at end of file

Modified: sling/trunk/installer/core/src/test/java/org/apache/sling/installer/core/impl/RegisteredResourceTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/core/src/test/java/org/apache/sling/installer/core/impl/RegisteredResourceTest.java?rev=1058196&r1=1058195&r2=1058196&view=diff
==============================================================================
--- sling/trunk/installer/core/src/test/java/org/apache/sling/installer/core/impl/RegisteredResourceTest.java (original)
+++ sling/trunk/installer/core/src/test/java/org/apache/sling/installer/core/impl/RegisteredResourceTest.java Wed Jan 12 15:39:01 2011
@@ -34,6 +34,7 @@ import java.util.Hashtable;
 
 import org.apache.sling.installer.api.InstallableResource;
 import org.apache.sling.installer.api.tasks.RegisteredResource;
+import org.apache.sling.installer.api.tasks.TaskResource;
 import org.apache.sling.installer.api.tasks.TransformationResult;
 import org.junit.Test;
 import org.osgi.framework.BundleContext;
@@ -66,7 +67,7 @@ public class RegisteredResourceTest {
             final Hashtable<String, Object> data = new Hashtable<String, Object>();
             data.put("foo", "bar");
             data.put("other", 2);
-            final RegisteredResource r = create(new InstallableResource("test:1", null, data, null, null, null));
+            final TaskResource r = create(new InstallableResource("test:1", null, data, null, null, null));
             assertEquals("No-extension URL with Dictionary creates a CONFIG resource",
                     InstallableResource.TYPE_CONFIG, r.getType());
             final InputStream rs = r.getInputStream();
@@ -112,14 +113,14 @@ public class RegisteredResourceTest {
     @org.junit.Test public void testBundleManifest() throws Exception {
         final File f = getTestBundle("testbundle-1.0.jar");
         final InstallableResource i = new InstallableResource("test:" + f.getAbsolutePath(), new FileInputStream(f), null, f.getName(), null, null);
-        final RegisteredResource r = create(i);
+        final TaskResource r = create(i);
         assertNotNull("RegisteredResource must have bundle symbolic name", r.getAttributes().get(Constants.BUNDLE_SYMBOLICNAME));
         assertEquals("RegisteredResource entity ID must match", "bundle:osgi-installer-testbundle", r.getEntityId());
     }
 
     @org.junit.Test public void testConfigEntity() throws Exception {
         final InstallableResource i = new InstallableResource("test:/foo/someconfig", null, new Hashtable<String, Object>(), null, null, null);
-        final RegisteredResource r = create(i);
+        final TaskResource r = create(i);
         assertNull("RegisteredResource must not have bundle symbolic name", r.getAttributes().get(Constants.BUNDLE_SYMBOLICNAME));
         assertEquals("RegisteredResource entity ID must match", "config:someconfig", r.getEntityId());
     }
@@ -162,13 +163,13 @@ public class RegisteredResourceTest {
         );
     }
 
-    private RegisteredResource create(final InstallableResource is) throws IOException {
+    private TaskResource create(final InstallableResource is) throws IOException {
         new FileDataStore(new MockBundleContext());
         final InternalResource internal = InternalResource.create("test", is);
         final RegisteredResourceImpl rr = RegisteredResourceImpl.create(internal);
         final TransformationResult[] tr = new DefaultTransformer().transform(rr);
         if ( tr != null ) {
-            rr.update(tr[0]);
+            return rr.clone(tr[0]);
         }
         return rr;
     }

Modified: sling/trunk/installer/core/src/test/java/org/apache/sling/installer/core/impl/TaskOrderingTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/core/src/test/java/org/apache/sling/installer/core/impl/TaskOrderingTest.java?rev=1058196&r1=1058195&r2=1058196&view=diff
==============================================================================
--- sling/trunk/installer/core/src/test/java/org/apache/sling/installer/core/impl/TaskOrderingTest.java (original)
+++ sling/trunk/installer/core/src/test/java/org/apache/sling/installer/core/impl/TaskOrderingTest.java Wed Jan 12 15:39:01 2011
@@ -53,8 +53,8 @@ public class TaskOrderingTest {
         new FileDataStore(new MockBundleContext());
         final InternalResource internal = InternalResource.create("test",
                 new InstallableResource(url, null, new Hashtable<String, Object>(), null, null, null));
-        final RegisteredResourceImpl rr = RegisteredResourceImpl.create(internal);
-        rr.update(new DefaultTransformer().transform(rr)[0]);
+        RegisteredResourceImpl rr = RegisteredResourceImpl.create(internal);
+        rr = (RegisteredResourceImpl)rr.clone(new DefaultTransformer().transform(rr)[0]);
 
         final EntityResourceList erl = new EntityResourceList();
 	    erl.addOrUpdate(rr);

Modified: sling/trunk/installer/core/src/test/java/org/apache/sling/installer/core/impl/tasks/BundleTaskCreatorTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/core/src/test/java/org/apache/sling/installer/core/impl/tasks/BundleTaskCreatorTest.java?rev=1058196&r1=1058195&r2=1058196&view=diff
==============================================================================
--- sling/trunk/installer/core/src/test/java/org/apache/sling/installer/core/impl/tasks/BundleTaskCreatorTest.java (original)
+++ sling/trunk/installer/core/src/test/java/org/apache/sling/installer/core/impl/tasks/BundleTaskCreatorTest.java Wed Jan 12 15:39:01 2011
@@ -27,27 +27,23 @@ import java.util.SortedSet;
 import java.util.TreeSet;
 
 import org.apache.sling.installer.api.tasks.InstallTask;
-import org.apache.sling.installer.api.tasks.RegisteredResource;
+import org.apache.sling.installer.api.tasks.ResourceState;
+import org.apache.sling.installer.api.tasks.TaskResource;
 import org.apache.sling.installer.core.impl.EntityResourceList;
 import org.apache.sling.installer.core.impl.MockBundleResource;
-import org.apache.sling.installer.core.impl.tasks.BundleInstallTask;
-import org.apache.sling.installer.core.impl.tasks.BundleRemoveTask;
-import org.apache.sling.installer.core.impl.tasks.BundleTaskCreator;
-import org.apache.sling.installer.core.impl.tasks.BundleUpdateTask;
-import org.apache.sling.installer.core.impl.tasks.ChangeStateTask;
 import org.junit.Test;
 import org.osgi.framework.Bundle;
 
 public class BundleTaskCreatorTest {
 	public static final String SN = "TestSymbolicName";
 
-	private SortedSet<InstallTask> getTasks(RegisteredResource [] resources, BundleTaskCreator btc) throws IOException {
-	    final SortedSet<RegisteredResource> sortedResources = new TreeSet<RegisteredResource>();
-	    for(final RegisteredResource rr : resources) {
+	private SortedSet<InstallTask> getTasks(TaskResource [] resources, BundleTaskCreator btc) throws IOException {
+	    final SortedSet<TaskResource> sortedResources = new TreeSet<TaskResource>();
+	    for(final TaskResource rr : resources) {
 	        sortedResources.add(rr);
 	    }
 		final SortedSet<InstallTask> tasks = new TreeSet<InstallTask>();
-        for(final RegisteredResource r : sortedResources) {
+        for(final TaskResource r : sortedResources) {
             final EntityResourceList erl = new EntityResourceList();
             erl.addOrUpdate(r);
   		    tasks.add(btc.createTask(erl));
@@ -57,7 +53,7 @@ public class BundleTaskCreatorTest {
 
 	@Test
 	public void testSingleBundleNew() throws IOException {
-		final RegisteredResource [] r = {
+		final TaskResource [] r = {
 				new MockBundleResource(SN, "1.0")
 		};
         final MockBundleTaskCreator c = new MockBundleTaskCreator();
@@ -68,7 +64,7 @@ public class BundleTaskCreatorTest {
 
 	@Test
     public void testSingleBundleAlreadyInstalled() throws IOException {
-        final RegisteredResource [] r = {
+        final TaskResource [] r = {
                 new MockBundleResource(SN, "1.0")
         };
 
@@ -91,7 +87,7 @@ public class BundleTaskCreatorTest {
 
     @Test
     public void testBundleUpgrade() throws IOException {
-        final RegisteredResource [] r = {
+        final TaskResource [] r = {
                 new MockBundleResource(SN, "1.1")
         };
 
@@ -106,7 +102,7 @@ public class BundleTaskCreatorTest {
 
     @Test
     public void testBundleUpgradeBothRegistered() throws IOException {
-        final RegisteredResource [] r = {
+        final TaskResource [] r = {
                 new MockBundleResource(SN, "1.1"),
                 new MockBundleResource(SN, "1.0")
         };
@@ -123,7 +119,7 @@ public class BundleTaskCreatorTest {
 
     @Test
     public void testBundleUpgradeBothRegisteredReversed() throws IOException {
-        final RegisteredResource [] r = {
+        final TaskResource [] r = {
                 new MockBundleResource(SN, "1.0"),
                 new MockBundleResource(SN, "1.1")
         };
@@ -143,7 +139,7 @@ public class BundleTaskCreatorTest {
         // Need to use OSGi-compliant version number, in bundles
         // bnd and other tools generate correct numbers.
         final String v = "2.0.7.SNAPSHOT";
-        final RegisteredResource [] r = {
+        final TaskResource [] r = {
                 new MockBundleResource(SN, v)
         };
 
@@ -159,10 +155,10 @@ public class BundleTaskCreatorTest {
     @Test
     public void testBundleRemoveSingle() throws IOException {
         final String version = "1.0";
-        final RegisteredResource [] r = {
+        final TaskResource [] r = {
                 new MockBundleResource(SN, version)
         };
-        r[0].setState(RegisteredResource.State.UNINSTALL);
+        r[0].setState(ResourceState.UNINSTALL);
 
         {
             final MockBundleTaskCreator c = new MockBundleTaskCreator();
@@ -175,13 +171,13 @@ public class BundleTaskCreatorTest {
 
     @Test
     public void testBundleRemoveMultiple() throws IOException {
-        final RegisteredResource [] r = {
+        final TaskResource [] r = {
                 new MockBundleResource(SN, "1.0"),
                 new MockBundleResource(SN, "1.1"),
                 new MockBundleResource(SN, "2.0")
         };
-        for(RegisteredResource x : r) {
-            x.setState(RegisteredResource.State.UNINSTALL);
+        for(TaskResource x : r) {
+            x.setState(ResourceState.UNINSTALL);
         }
 
         {
@@ -199,13 +195,13 @@ public class BundleTaskCreatorTest {
 
     @Test
     public void testDowngradeOfRemovedResource() throws IOException {
-        final RegisteredResource [] r = {
+        final TaskResource [] r = {
                 new MockBundleResource(SN, "1.0.0"),
                 new MockBundleResource(SN, "1.1.0"),
         };
 
         // Simulate V1.1 installed but resource is gone -> downgrade to 1.0
-        r[1].setState(RegisteredResource.State.UNINSTALL);
+        r[1].setState(ResourceState.UNINSTALL);
 
        {
             final MockBundleTaskCreator c = new MockBundleTaskCreator();



Mime
View raw message