You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by bd...@apache.org on 2009/05/19 17:45:12 UTC

svn commit: r776361 - in /incubator/sling/trunk/contrib/extensions/jcrinstall: it/ it/src/test/java/org/apache/sling/jcr/jcrinstall/it/ osgi/src/main/java/org/apache/sling/osgi/installer/impl/

Author: bdelacretaz
Date: Tue May 19 15:45:11 2009
New Revision: 776361

URL: http://svn.apache.org/viewvc?rev=776361&view=rev
Log:
SLING-904 - refactor for more general purpose tasks

Added:
    incubator/sling/trunk/contrib/extensions/jcrinstall/osgi/src/main/java/org/apache/sling/osgi/installer/impl/OsgiResourceTask.java
      - copied, changed from r776322, incubator/sling/trunk/contrib/extensions/jcrinstall/osgi/src/main/java/org/apache/sling/osgi/installer/impl/OsgiControllerTask.java
Modified:
    incubator/sling/trunk/contrib/extensions/jcrinstall/it/pom.xml
    incubator/sling/trunk/contrib/extensions/jcrinstall/it/src/test/java/org/apache/sling/jcr/jcrinstall/it/OsgiControllerTest.java
    incubator/sling/trunk/contrib/extensions/jcrinstall/osgi/src/main/java/org/apache/sling/osgi/installer/impl/OsgiControllerImpl.java
    incubator/sling/trunk/contrib/extensions/jcrinstall/osgi/src/main/java/org/apache/sling/osgi/installer/impl/OsgiControllerTask.java
    incubator/sling/trunk/contrib/extensions/jcrinstall/osgi/src/main/java/org/apache/sling/osgi/installer/impl/OsgiControllerTaskExecutor.java
    incubator/sling/trunk/contrib/extensions/jcrinstall/osgi/src/main/java/org/apache/sling/osgi/installer/impl/ResourceQueueTask.java

Modified: incubator/sling/trunk/contrib/extensions/jcrinstall/it/pom.xml
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/contrib/extensions/jcrinstall/it/pom.xml?rev=776361&r1=776360&r2=776361&view=diff
==============================================================================
--- incubator/sling/trunk/contrib/extensions/jcrinstall/it/pom.xml (original)
+++ incubator/sling/trunk/contrib/extensions/jcrinstall/it/pom.xml Tue May 19 15:45:11 2009
@@ -168,6 +168,42 @@
                             </archive>
                         </configuration>
                     </execution>
+                    <execution>
+                        <id>otherbundleA-1.0</id>
+                        <phase>compile</phase>
+                        <goals>
+                            <goal>jar</goal>
+                        </goals>
+                        <configuration>
+                            <classifier>otherbundleA-1.0</classifier>
+                            <archive>
+                                <manifestEntries>
+                                    <Manifest-Version>2</Manifest-Version>
+                                    <Bundle-Name>JCRinstall test bundle</Bundle-Name>
+                                    <Bundle-SymbolicName>jcrinstall-otherbundleA</Bundle-SymbolicName>
+                                    <Bundle-Version>1.0</Bundle-Version>
+                                </manifestEntries>
+                            </archive>
+                        </configuration>
+                    </execution>
+                    <execution>
+                        <id>otherbundleB-1.0</id>
+                        <phase>compile</phase>
+                        <goals>
+                            <goal>jar</goal>
+                        </goals>
+                        <configuration>
+                            <classifier>otherbundleB-1.0</classifier>
+                            <archive>
+                                <manifestEntries>
+                                    <Manifest-Version>2</Manifest-Version>
+                                    <Bundle-Name>JCRinstall test bundle</Bundle-Name>
+                                    <Bundle-SymbolicName>jcrinstall-otherbundleB</Bundle-SymbolicName>
+                                    <Bundle-Version>1.0</Bundle-Version>
+                                </manifestEntries>
+                            </archive>
+                        </configuration>
+                    </execution>
                 </executions>
             </plugin>
           </plugins>

Modified: incubator/sling/trunk/contrib/extensions/jcrinstall/it/src/test/java/org/apache/sling/jcr/jcrinstall/it/OsgiControllerTest.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/contrib/extensions/jcrinstall/it/src/test/java/org/apache/sling/jcr/jcrinstall/it/OsgiControllerTest.java?rev=776361&r1=776360&r2=776361&view=diff
==============================================================================
--- incubator/sling/trunk/contrib/extensions/jcrinstall/it/src/test/java/org/apache/sling/jcr/jcrinstall/it/OsgiControllerTest.java (original)
+++ incubator/sling/trunk/contrib/extensions/jcrinstall/it/src/test/java/org/apache/sling/jcr/jcrinstall/it/OsgiControllerTest.java Tue May 19 15:45:11 2009
@@ -230,6 +230,49 @@
         	assertFalse("Bundle ID must have changed after uninstall and reinstall", bundleId == b.getBundleId());
     	}
     }
+    
+    @Test
+    public void testBundleStatePreserved() throws Exception {
+    	final OsgiController c = getService(OsgiController.class);
+    	
+    	// Install two bundles, one started, one stopped
+    	{
+        	c.scheduleInstallOrUpdate("otherBundleA.jar", 
+        			new SimpleFileInstallableData(getTestBundle("org.apache.sling.jcr.jcrinstall.it-" + POM_VERSION + "-otherBundleA-1.0.jar")));
+        	c.executeScheduledOperations();
+    	}
+    	{
+        	c.scheduleInstallOrUpdate("otherBundleB.jar", 
+        			new SimpleFileInstallableData(getTestBundle("org.apache.sling.jcr.jcrinstall.it-" + POM_VERSION + "-otherBundleB-1.0.jar")));
+        	c.executeScheduledOperations();
+        	findBundle("jcrinstall-otherbundleB").stop();
+    	}
+    	
+    	assertEquals("Bundle A must be started", Bundle.ACTIVE, findBundle("jcrinstall-otherbundleA").getState());
+    	assertEquals("Bundle B must be stopped", Bundle.RESOLVED, findBundle("jcrinstall-otherbundleB").getState());
+    	
+    	// Execute some OsgiController operations
+    	final String symbolicName = "jcrinstall-testbundle";
+    	final String uri = symbolicName + ".jar";
+    	final String BUNDLE_VERSION = "Bundle-Version";
+    	c.scheduleInstallOrUpdate(uri, 
+    			new SimpleFileInstallableData(getTestBundle("org.apache.sling.jcr.jcrinstall.it-" + POM_VERSION + "-testbundle-1.1.jar")));
+    	c.executeScheduledOperations();
+    	c.scheduleInstallOrUpdate(uri, 
+    			new SimpleFileInstallableData(getTestBundle("org.apache.sling.jcr.jcrinstall.it-" + POM_VERSION + "-testbundle-1.2.jar")));
+    	c.executeScheduledOperations();
+    	c.scheduleInstallOrUpdate(uri, 
+    			new SimpleFileInstallableData(getTestBundle("org.apache.sling.jcr.jcrinstall.it-" + POM_VERSION + "-testbundle-1.0.jar")));
+    	c.executeScheduledOperations();
+    	final Bundle b = findBundle(symbolicName);
+    	assertNotNull("Installed bundle must be found", b);
+    	assertEquals("Installed bundle must be started", Bundle.ACTIVE, b.getState());
+    	assertEquals("Version must be 1.2", "1.2", b.getHeaders().get(BUNDLE_VERSION));
+    	
+    	// And check that bundles A and B have kept their states
+    	assertEquals("Bundle A must be started", Bundle.ACTIVE, findBundle("jcrinstall-otherbundleA").getState());
+    	assertEquals("Bundle B must be stopped", Bundle.RESOLVED, findBundle("jcrinstall-otherbundleB").getState());
+    }
 
     @org.ops4j.pax.exam.junit.Configuration
     public static Option[] configuration() {

Modified: incubator/sling/trunk/contrib/extensions/jcrinstall/osgi/src/main/java/org/apache/sling/osgi/installer/impl/OsgiControllerImpl.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/contrib/extensions/jcrinstall/osgi/src/main/java/org/apache/sling/osgi/installer/impl/OsgiControllerImpl.java?rev=776361&r1=776360&r2=776361&view=diff
==============================================================================
--- incubator/sling/trunk/contrib/extensions/jcrinstall/osgi/src/main/java/org/apache/sling/osgi/installer/impl/OsgiControllerImpl.java (original)
+++ incubator/sling/trunk/contrib/extensions/jcrinstall/osgi/src/main/java/org/apache/sling/osgi/installer/impl/OsgiControllerImpl.java Tue May 19 15:45:11 2009
@@ -23,7 +23,6 @@
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
-import java.util.concurrent.Callable;
 
 import org.apache.sling.osgi.installer.InstallableData;
 import org.apache.sling.osgi.installer.JcrInstallException;
@@ -54,13 +53,13 @@
  *      name="service.vendor"
  *      value="The Apache Software Foundation"
 */
-public class OsgiControllerImpl implements OsgiController, SynchronousBundleListener, OsgiControllerServices {
+public class OsgiControllerImpl implements OsgiController, SynchronousBundleListener, OsgiControllerServices, OsgiControllerTask.Context {
 
 	private BundleContext bundleContext;
     private Storage storage;
     private OsgiResourceProcessorList processors;
     private ResourceOverrideRules roRules;
-    private final List<Callable<Object>> tasks = new LinkedList<Callable<Object>>();
+    private final List<OsgiControllerTask> tasks = new LinkedList<OsgiControllerTask>();
     private final OsgiControllerTaskExecutor executor = new OsgiControllerTaskExecutor();
 
     public static final String STORAGE_FILENAME = "controller.storage";
@@ -116,13 +115,13 @@
     
     public void scheduleInstallOrUpdate(String uri, InstallableData data) throws IOException, JcrInstallException {
     	synchronized (tasks) {
-        	tasks.add(new OsgiControllerTask(storage, processors, roRules, uri, data, bundleContext));
+        	tasks.add(new OsgiResourceTask(uri, data, bundleContext));
 		}
     }
 
     public void scheduleUninstall(String uri) throws IOException, JcrInstallException {
     	synchronized (tasks) {
-        	tasks.add(new OsgiControllerTask(storage, processors, roRules, uri, null, bundleContext));
+        	tasks.add(new OsgiResourceTask(uri, null, bundleContext));
     	}
     }
 
@@ -183,7 +182,7 @@
             
             // execute returns the list of tasks that could not be executed but should be retried later
             // and those have been removed from the tasks list
-            tasks.addAll(executor.execute(tasks));
+            tasks.addAll(executor.execute(tasks, this));
             
         	if(logService != null) {
                 logService.log(LogService.LOG_DEBUG, 
@@ -207,4 +206,16 @@
 		}
 		return null;
 	}
+
+	public OsgiResourceProcessorList getProcessors() {
+		return processors;
+	}
+
+	public ResourceOverrideRules getResourceOverrideRules() {
+		return roRules;
+	}
+
+	public Storage getStorage() {
+		return storage;
+	}
 }
\ No newline at end of file

Modified: incubator/sling/trunk/contrib/extensions/jcrinstall/osgi/src/main/java/org/apache/sling/osgi/installer/impl/OsgiControllerTask.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/contrib/extensions/jcrinstall/osgi/src/main/java/org/apache/sling/osgi/installer/impl/OsgiControllerTask.java?rev=776361&r1=776360&r2=776361&view=diff
==============================================================================
--- incubator/sling/trunk/contrib/extensions/jcrinstall/osgi/src/main/java/org/apache/sling/osgi/installer/impl/OsgiControllerTask.java (original)
+++ incubator/sling/trunk/contrib/extensions/jcrinstall/osgi/src/main/java/org/apache/sling/osgi/installer/impl/OsgiControllerTask.java Tue May 19 15:45:11 2009
@@ -18,135 +18,15 @@
  */
 package org.apache.sling.osgi.installer.impl;
 
-import static org.apache.sling.osgi.installer.InstallResultCode.IGNORED;
-
-import java.io.IOException;
-import java.util.Map;
-import java.util.concurrent.Callable;
-
-import org.apache.sling.osgi.installer.InstallableData;
-import org.apache.sling.osgi.installer.OsgiResourceProcessor;
 import org.apache.sling.osgi.installer.ResourceOverrideRules;
-import org.osgi.framework.BundleContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/** An install/upgrade/uninistall task, meant to be executed
- * 	by the OsgiController worker thread.
- */
-class OsgiControllerTask implements Callable<Object> {
-	
-	private final String uri;
-	private final InstallableData data;
-	private final Storage storage;
-	private final OsgiResourceProcessorList processors;
-	private final ResourceOverrideRules roRules;
-	
-    private static final Logger log = LoggerFactory.getLogger(OsgiControllerTask.class);
 
-    /** Create a task that will install, update or uninstall a resource.
-     * @param data if not null, operation is install or update, else uninstall
-     */
-	OsgiControllerTask(
-			Storage storage, 
-			OsgiResourceProcessorList processors, 
-			ResourceOverrideRules roRules, 
-			String uri, 
-			InstallableData data,
-			BundleContext bc) throws IOException
-	{
-		this.storage = storage;
-		this.processors = processors;
-		this.roRules = roRules;
-		this.uri = uri;
-		this.data = (data == null ? null : new InstallableDataWrapper(data, bc));
-	}
-	
-	@Override
-	public String toString() {
-		return 
-			getClass().getSimpleName()
-			+ ", "
-			+ (isInstallOrUpdate() ? "install/update" : "uninstall")
-			+ ", "
-			+ uri
-		;
-	}
-	
-	public Object call() throws Exception {
-		if(isInstallOrUpdate()) {
-			executeInstallOrUpdate();
-		} else {
-			executeUninstall();
-		}
-		
-		// Cleanup InstallableDataWrapper
-		if(data instanceof InstallableDataWrapper) {
-			((InstallableDataWrapper)data).cleanup();
-		}
-		
-		return null;
-	}
+/** A Task that can be executed by the OsgiController */ 
+interface OsgiControllerTask {
+	static interface Context {
+		ResourceOverrideRules getResourceOverrideRules();
+		OsgiResourceProcessorList getProcessors();
+		Storage getStorage();
+	};
 	
-	boolean isInstallOrUpdate() {
-		return data != null;
-	}
-
-	private void executeUninstall() throws Exception {
-        // If a corresponding higher priority resource is installed, ignore this request
-        if(roRules != null) {
-            for(String r : roRules.getHigherPriorityResources(uri)) {
-                if(storage.contains(r)) {
-                    log.info("Resource {} won't be uninstalled, overridden by {} which has higher priority",
-                            uri, r);
-                    return;
-                }
-            }
-        }
-        
-        // let each processor try to uninstall, one of them
-    	// should know how that handle uri
-    	for(OsgiResourceProcessor p : this.processors) {
-                p.uninstall(uri, storage.getMap(uri));
-    	}
-    	
-        storage.remove(uri);
-        storage.saveToFile();
-	}
-
-	private void executeInstallOrUpdate() throws Exception {
-        // If a corresponding higher priority resource is already installed, ignore this one
-        if(roRules != null) {
-            for(String r : roRules.getHigherPriorityResources(uri)) {
-                if(storage.contains(r)) {
-                    log.info("Resource {} ignored, overridden by {} which has higher priority",
-                            uri, r);
-                    return;
-                }
-            }
-        }
-        
-        // If a corresponding lower priority resource is installed, uninstall it first
-        if(roRules != null) {
-            for(String r : roRules.getLowerPriorityResources(uri)) {
-                if(storage.contains(r)) {
-                    log.info("Resource {} overrides {}, uninstalling the latter",
-                            uri, r);
-                    executeUninstall();
-                }
-            }
-        }
-        
-        // let suitable OsgiResourceProcessor process install
-        final OsgiResourceProcessor p = processors.getProcessor(uri, data);
-        if (p != null) {
-            final Map<String, Object> map = storage.getMap(uri);
-            if(p.installOrUpdate(uri, map, data) != IGNORED) {
-                map.put(OsgiControllerImpl.KEY_DIGEST, data.getDigest());
-            }
-            storage.saveToFile();
-        }
-        return;
-		
-	}
-}
+	void execute(Context ctx) throws Exception;
+}
\ No newline at end of file

Modified: incubator/sling/trunk/contrib/extensions/jcrinstall/osgi/src/main/java/org/apache/sling/osgi/installer/impl/OsgiControllerTaskExecutor.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/contrib/extensions/jcrinstall/osgi/src/main/java/org/apache/sling/osgi/installer/impl/OsgiControllerTaskExecutor.java?rev=776361&r1=776360&r2=776361&view=diff
==============================================================================
--- incubator/sling/trunk/contrib/extensions/jcrinstall/osgi/src/main/java/org/apache/sling/osgi/installer/impl/OsgiControllerTaskExecutor.java (original)
+++ incubator/sling/trunk/contrib/extensions/jcrinstall/osgi/src/main/java/org/apache/sling/osgi/installer/impl/OsgiControllerTaskExecutor.java Tue May 19 15:45:11 2009
@@ -20,7 +20,6 @@
 
 import java.util.LinkedList;
 import java.util.List;
-import java.util.concurrent.Callable;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -32,29 +31,30 @@
     static int counter;
     
 	/** Execute the given tasks in a new thread, return when done */
-    List<Callable<Object>> execute(final List<Callable<Object>> tasks) throws InterruptedException {
-    	final List<Callable<Object>> remainingTasks = new LinkedList<Callable<Object>>();
+    List<OsgiControllerTask >execute(final List<OsgiControllerTask> tasks, final OsgiControllerTask.Context context) 
+    throws InterruptedException {
+    	final List<OsgiControllerTask> remainingTasks = new LinkedList<OsgiControllerTask>(); 
 		final String threadName = getClass().getSimpleName() + " #" + (++counter);
-		final Thread t = new Thread(threadName) {
+		final Thread executor = new Thread(threadName) {
 			@Override
 			public void run() {
 				while(!tasks.isEmpty()) {
-					final Callable<Object> c = tasks.remove(0);
+					final OsgiControllerTask t = tasks.remove(0);
 					try {
-						c.call();
-						log.debug("Task execution successful: " + c);
+						t.execute(context);
+						log.debug("Task execution successful: " + t);
 					} catch(MissingServiceException mse) {
-						log.info("Task execution deferred due to " + mse + ", task=" + c);
-						remainingTasks.add(c);
+						log.info("Task execution deferred due to " + mse + ", task=" + t);
+						remainingTasks.add(t);
 					} catch(Exception e) {
-						log.warn("Task execution failed: " + c, e);
+						log.warn("Task execution failed: " + t, e);
 					}
 				}
 			}
 		};
-		t.setDaemon(true);
-		t.start();
-		t.join();
+		executor.setDaemon(true);
+		executor.start();
+		executor.join();
 		return remainingTasks;
 	}
 }

Copied: incubator/sling/trunk/contrib/extensions/jcrinstall/osgi/src/main/java/org/apache/sling/osgi/installer/impl/OsgiResourceTask.java (from r776322, incubator/sling/trunk/contrib/extensions/jcrinstall/osgi/src/main/java/org/apache/sling/osgi/installer/impl/OsgiControllerTask.java)
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/contrib/extensions/jcrinstall/osgi/src/main/java/org/apache/sling/osgi/installer/impl/OsgiResourceTask.java?p2=incubator/sling/trunk/contrib/extensions/jcrinstall/osgi/src/main/java/org/apache/sling/osgi/installer/impl/OsgiResourceTask.java&p1=incubator/sling/trunk/contrib/extensions/jcrinstall/osgi/src/main/java/org/apache/sling/osgi/installer/impl/OsgiControllerTask.java&r1=776322&r2=776361&rev=776361&view=diff
==============================================================================
--- incubator/sling/trunk/contrib/extensions/jcrinstall/osgi/src/main/java/org/apache/sling/osgi/installer/impl/OsgiControllerTask.java (original)
+++ incubator/sling/trunk/contrib/extensions/jcrinstall/osgi/src/main/java/org/apache/sling/osgi/installer/impl/OsgiResourceTask.java Tue May 19 15:45:11 2009
@@ -22,11 +22,9 @@
 
 import java.io.IOException;
 import java.util.Map;
-import java.util.concurrent.Callable;
 
 import org.apache.sling.osgi.installer.InstallableData;
 import org.apache.sling.osgi.installer.OsgiResourceProcessor;
-import org.apache.sling.osgi.installer.ResourceOverrideRules;
 import org.osgi.framework.BundleContext;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -34,30 +32,21 @@
 /** An install/upgrade/uninistall task, meant to be executed
  * 	by the OsgiController worker thread.
  */
-class OsgiControllerTask implements Callable<Object> {
+class OsgiResourceTask implements OsgiControllerTask {
 	
 	private final String uri;
 	private final InstallableData data;
-	private final Storage storage;
-	private final OsgiResourceProcessorList processors;
-	private final ResourceOverrideRules roRules;
 	
-    private static final Logger log = LoggerFactory.getLogger(OsgiControllerTask.class);
+    private static final Logger log = LoggerFactory.getLogger(OsgiResourceTask.class);
 
     /** Create a task that will install, update or uninstall a resource.
      * @param data if not null, operation is install or update, else uninstall
      */
-	OsgiControllerTask(
-			Storage storage, 
-			OsgiResourceProcessorList processors, 
-			ResourceOverrideRules roRules, 
+	OsgiResourceTask(
 			String uri, 
 			InstallableData data,
 			BundleContext bc) throws IOException
 	{
-		this.storage = storage;
-		this.processors = processors;
-		this.roRules = roRules;
 		this.uri = uri;
 		this.data = (data == null ? null : new InstallableDataWrapper(data, bc));
 	}
@@ -72,31 +61,31 @@
 			+ uri
 		;
 	}
+
 	
-	public Object call() throws Exception {
+	public void execute(OsgiControllerTask.Context context) throws Exception {
+		// TODO Auto-generated method stub
 		if(isInstallOrUpdate()) {
-			executeInstallOrUpdate();
+			executeInstallOrUpdate(context);
 		} else {
-			executeUninstall();
+			executeUninstall(context);
 		}
 		
 		// Cleanup InstallableDataWrapper
 		if(data instanceof InstallableDataWrapper) {
 			((InstallableDataWrapper)data).cleanup();
 		}
-		
-		return null;
 	}
-	
+
 	boolean isInstallOrUpdate() {
 		return data != null;
 	}
 
-	private void executeUninstall() throws Exception {
+	private void executeUninstall(OsgiControllerTask.Context context) throws Exception {
         // If a corresponding higher priority resource is installed, ignore this request
-        if(roRules != null) {
-            for(String r : roRules.getHigherPriorityResources(uri)) {
-                if(storage.contains(r)) {
+        if(context.getResourceOverrideRules() != null) {
+            for(String r : context.getResourceOverrideRules().getHigherPriorityResources(uri)) {
+                if(context.getStorage().contains(r)) {
                     log.info("Resource {} won't be uninstalled, overridden by {} which has higher priority",
                             uri, r);
                     return;
@@ -106,19 +95,19 @@
         
         // let each processor try to uninstall, one of them
     	// should know how that handle uri
-    	for(OsgiResourceProcessor p : this.processors) {
-                p.uninstall(uri, storage.getMap(uri));
+    	for(OsgiResourceProcessor p : context.getProcessors()) {
+                p.uninstall(uri, context.getStorage().getMap(uri));
     	}
     	
-        storage.remove(uri);
-        storage.saveToFile();
+    	context.getStorage().remove(uri);
+    	context.getStorage().saveToFile();
 	}
 
-	private void executeInstallOrUpdate() throws Exception {
+	private void executeInstallOrUpdate(OsgiControllerTask.Context context) throws Exception {
         // If a corresponding higher priority resource is already installed, ignore this one
-        if(roRules != null) {
-            for(String r : roRules.getHigherPriorityResources(uri)) {
-                if(storage.contains(r)) {
+        if(context.getResourceOverrideRules() != null) {
+            for(String r : context.getResourceOverrideRules().getHigherPriorityResources(uri)) {
+                if(context.getStorage().contains(r)) {
                     log.info("Resource {} ignored, overridden by {} which has higher priority",
                             uri, r);
                     return;
@@ -127,24 +116,24 @@
         }
         
         // If a corresponding lower priority resource is installed, uninstall it first
-        if(roRules != null) {
-            for(String r : roRules.getLowerPriorityResources(uri)) {
-                if(storage.contains(r)) {
+        if(context.getResourceOverrideRules() != null) {
+            for(String r : context.getResourceOverrideRules().getLowerPriorityResources(uri)) {
+                if(context.getStorage().contains(r)) {
                     log.info("Resource {} overrides {}, uninstalling the latter",
                             uri, r);
-                    executeUninstall();
+                    executeUninstall(context);
                 }
             }
         }
         
         // let suitable OsgiResourceProcessor process install
-        final OsgiResourceProcessor p = processors.getProcessor(uri, data);
+        final OsgiResourceProcessor p = context.getProcessors().getProcessor(uri, data);
         if (p != null) {
-            final Map<String, Object> map = storage.getMap(uri);
+            final Map<String, Object> map = context.getStorage().getMap(uri);
             if(p.installOrUpdate(uri, map, data) != IGNORED) {
                 map.put(OsgiControllerImpl.KEY_DIGEST, data.getDigest());
             }
-            storage.saveToFile();
+            context.getStorage().saveToFile();
         }
         return;
 		

Modified: incubator/sling/trunk/contrib/extensions/jcrinstall/osgi/src/main/java/org/apache/sling/osgi/installer/impl/ResourceQueueTask.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/contrib/extensions/jcrinstall/osgi/src/main/java/org/apache/sling/osgi/installer/impl/ResourceQueueTask.java?rev=776361&r1=776360&r2=776361&view=diff
==============================================================================
--- incubator/sling/trunk/contrib/extensions/jcrinstall/osgi/src/main/java/org/apache/sling/osgi/installer/impl/ResourceQueueTask.java (original)
+++ incubator/sling/trunk/contrib/extensions/jcrinstall/osgi/src/main/java/org/apache/sling/osgi/installer/impl/ResourceQueueTask.java Tue May 19 15:45:11 2009
@@ -18,12 +18,10 @@
  */
 package org.apache.sling.osgi.installer.impl;
 
-import java.util.concurrent.Callable;
-
 import org.apache.sling.osgi.installer.OsgiResourceProcessor;
 
 /** Callable that processes the resource queue of an OsgiResourceProcessor */
-class ResourceQueueTask implements Callable<Object> {
+class ResourceQueueTask implements OsgiControllerTask {
 	private final OsgiResourceProcessor p;
 	
 	ResourceQueueTask(OsgiResourceProcessor p) {
@@ -34,9 +32,8 @@
 		return getClass().getSimpleName() + ": " + p.getClass().getSimpleName()+ ".processResourceQueue()";
 	}
 	
-	public Object call() throws Exception {
+	
+	public void execute(Context ctx) throws Exception {
 		p.processResourceQueue();
-		return null;
 	}
-
 }