incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r984304 - in /sling/trunk/installer/osgi/installer/src: main/java/org/apache/sling/osgi/installer/ main/java/org/apache/sling/osgi/installer/impl/ main/java/org/apache/sling/osgi/installer/impl/tasks/ test/java/org/apache/sling/osgi/install...
Date Wed, 11 Aug 2010 06:03:08 GMT
Author: cziegeler
Date: Wed Aug 11 06:03:07 2010
New Revision: 984304

URL: http://svn.apache.org/viewvc?rev=984304&view=rev
Log:
SLING-1560 : Move all config admin related stuff into config admin package, reduce usage of installer context

Modified:
    sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/InstallableResource.java
    sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/BundleTaskCreator.java
    sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/OsgiInstallerContext.java
    sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/OsgiInstallerImpl.java
    sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/OsgiInstallerThread.java
    sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/PersistentResourceList.java
    sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/RegisteredResource.java
    sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/RegisteredResourceComparator.java
    sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/RegisteredResourceImpl.java
    sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/BundleInstallTask.java
    sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/BundleRemoveTask.java
    sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/BundleUpdateTask.java
    sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/ConfigInstallTask.java
    sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/SynchronousRefreshPackagesTask.java
    sling/trunk/installer/osgi/installer/src/test/java/org/apache/sling/osgi/installer/impl/LocalFileRegisteredResource.java
    sling/trunk/installer/osgi/installer/src/test/java/org/apache/sling/osgi/installer/impl/MockBundleResource.java
    sling/trunk/installer/osgi/installer/src/test/java/org/apache/sling/osgi/installer/impl/MockBundleTaskCreator.java
    sling/trunk/installer/osgi/installer/src/test/java/org/apache/sling/osgi/installer/impl/MockOsgiInstallerContext.java
    sling/trunk/installer/osgi/installer/src/test/java/org/apache/sling/osgi/installer/impl/PersistentResourceListTest.java
    sling/trunk/installer/osgi/installer/src/test/java/org/apache/sling/osgi/installer/impl/RegisteredResourceTest.java
    sling/trunk/installer/osgi/installer/src/test/java/org/apache/sling/osgi/installer/impl/TaskOrderingTest.java

Modified: sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/InstallableResource.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/InstallableResource.java?rev=984304&r1=984303&r2=984304&view=diff
==============================================================================
--- sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/InstallableResource.java (original)
+++ sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/InstallableResource.java Wed Aug 11 06:03:07 2010
@@ -18,6 +18,7 @@
  */
 package org.apache.sling.osgi.installer;
 
+import java.io.IOException;
 import java.io.InputStream;
 import java.util.Dictionary;
 
@@ -64,7 +65,7 @@ public interface InstallableResource {
 	 * if this resource is of type BUNDLE it must return an input stream!
 	 * @return The input stream or null.
 	 */
-    InputStream getInputStream();
+    InputStream getInputStream() throws IOException;
 
 	/**
 	 * Return this resource's dictionary.

Modified: sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/BundleTaskCreator.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/BundleTaskCreator.java?rev=984304&r1=984303&r2=984304&view=diff
==============================================================================
--- sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/BundleTaskCreator.java (original)
+++ sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/BundleTaskCreator.java Wed Aug 11 06:03:07 2010
@@ -27,18 +27,37 @@ import org.apache.sling.osgi.installer.i
 import org.apache.sling.osgi.installer.impl.tasks.BundleRemoveTask;
 import org.apache.sling.osgi.installer.impl.tasks.BundleUpdateTask;
 import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
 import org.osgi.framework.Constants;
 import org.osgi.framework.Version;
+import org.osgi.service.packageadmin.PackageAdmin;
+import org.osgi.util.tracker.ServiceTracker;
 
 /** TaskCreator that processes a list of bundle RegisteredResources */
 class BundleTaskCreator {
 
+    /** Interface of the package admin */
+    private static String PACKAGE_ADMIN_NAME = PackageAdmin.class.getName();
+
+    /** Tracker for the package admin. */
+    private final ServiceTracker packageAdminTracker;
+
     /** Store the digests of the bundles for which we create update tasks,
      *  keyed by symbolic name, to avoid generating repated updates
      *  for snapshot bundles
      */
     private final Map<String, String> digests = new HashMap<String, String>();
 
+    public BundleTaskCreator(final BundleContext bc) {
+        // create and start tracker
+        this.packageAdminTracker = new ServiceTracker(bc, PACKAGE_ADMIN_NAME, null);
+        this.packageAdminTracker.open();
+    }
+
+    public void deactivate() {
+        this.packageAdminTracker.close();
+    }
+
     /** Holds the bundle info that we need, makes it easier to test
      *  without an OSGi framework */
     static class BundleInfo {
@@ -89,7 +108,7 @@ class BundleTaskCreator {
 		            Logger.logInfo("Bundle " + symbolicName
                                 + " was not installed by this module, not removed");
 		        } else {
-		            tasks.add(new BundleRemoveTask(resources.first()));
+		            tasks.add(new BundleRemoveTask(resources.first(), this.packageAdminTracker));
 		        }
 	        }
 
@@ -134,7 +153,7 @@ class BundleTaskCreator {
                     digestToSave = previousDigest;
 			    } else {
 			        Logger.logDebug("Scheduling update of " + toUpdate + ", digest has changed");
-			        tasks.add(new BundleUpdateTask(toUpdate));
+			        tasks.add(new BundleUpdateTask(toUpdate, this.packageAdminTracker));
 			        digestToSave = toUpdate.getDigest();
 			    }
 			}

Modified: sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/OsgiInstallerContext.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/OsgiInstallerContext.java?rev=984304&r1=984303&r2=984304&view=diff
==============================================================================
--- sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/OsgiInstallerContext.java (original)
+++ sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/OsgiInstallerContext.java Wed Aug 11 06:03:07 2010
@@ -23,7 +23,6 @@ import java.io.IOException;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.Version;
-import org.osgi.service.packageadmin.PackageAdmin;
 
 /**
  * Installer context, gives access to selected methods of the {@link OsgiInstallerImpl}
@@ -35,11 +34,6 @@ public interface OsgiInstallerContext {
      */
     BundleContext getBundleContext();
 
-    /**
-     * Return the package admin.
-     */
-    PackageAdmin getPackageAdmin();
-
     void incrementCounter(int index);
     void setCounter(int index, long value);
     /**

Modified: sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/OsgiInstallerImpl.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/OsgiInstallerImpl.java?rev=984304&r1=984303&r2=984304&view=diff
==============================================================================
--- sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/OsgiInstallerImpl.java (original)
+++ sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/OsgiInstallerImpl.java Wed Aug 11 06:03:07 2010
@@ -28,15 +28,10 @@ import org.apache.sling.osgi.installer.O
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.Version;
-import org.osgi.service.packageadmin.PackageAdmin;
-import org.osgi.util.tracker.ServiceTracker;
 
 /** OsgiInstaller service implementation */
 public class OsgiInstallerImpl implements OsgiInstaller, OsgiInstallerStatistics, OsgiInstallerContext {
 
-    /** Interface of the package admin */
-    private static String PACKAGE_ADMIN_NAME = PackageAdmin.class.getName();
-
     public static final String MAVEN_SNAPSHOT_MARKER = "SNAPSHOT";
 
     /** The bundle context. */
@@ -48,19 +43,12 @@ public class OsgiInstallerImpl implement
     private long [] counters = new long[COUNTERS_SIZE];
     private PersistentBundleInfo bundleDigestsStorage;
 
-    /** Tracker for the package admin. */
-    private final ServiceTracker packageAdminTracker;
-
     /**
      * Construct a new service
      */
     public OsgiInstallerImpl(final BundleContext bc)
     throws IOException {
         this.bundleContext = bc;
-        // create and start tracker
-        this.packageAdminTracker = new ServiceTracker(bc, PACKAGE_ADMIN_NAME, null);
-        this.packageAdminTracker.open();
-
         bundleDigestsStorage = new PersistentBundleInfo(bc.getDataFile("bundle-digests.properties"));
 
         installerThread = new OsgiInstallerThread(this);
@@ -95,8 +83,6 @@ public class OsgiInstallerImpl implement
             // we simply ignore this
         }
 
-        this.packageAdminTracker.close();
-
         Logger.logWarn(OsgiInstaller.class.getName()
                 + " service deactivated - this warning can be ignored if system is shutting down");
     }
@@ -124,13 +110,6 @@ public class OsgiInstallerImpl implement
 	}
 
 	/**
-	 * @see org.apache.sling.osgi.installer.impl.OsgiInstallerContext#getPackageAdmin()
-	 */
-	public PackageAdmin getPackageAdmin() {
-		return (PackageAdmin)this.packageAdminTracker.getService();
-	}
-
-	/**
 	 * @see org.apache.sling.osgi.installer.OsgiInstallerStatistics#getCounters()
 	 */
 	public long [] getCounters() {

Modified: sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/OsgiInstallerThread.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/OsgiInstallerThread.java?rev=984304&r1=984303&r2=984304&view=diff
==============================================================================
--- sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/OsgiInstallerThread.java (original)
+++ sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/OsgiInstallerThread.java Wed Aug 11 06:03:07 2010
@@ -62,20 +62,22 @@ class OsgiInstallerThread extends Thread
     private final HashMap<String, SortedSet<RegisteredResource>> registeredResources;
     private final PersistentResourceList persistentList;
 
-    private final BundleTaskCreator bundleTaskCreator = new BundleTaskCreator();
+    private final BundleTaskCreator bundleTaskCreator;
     private final ConfigTaskCreator configTaskCreator;
 
     OsgiInstallerThread(final OsgiInstallerContext ctx) {
         this.configTaskCreator = new ConfigTaskCreator(ctx.getBundleContext());
+        this.bundleTaskCreator = new BundleTaskCreator(ctx.getBundleContext());
         setName(getClass().getSimpleName());
         this.ctx = ctx;
         final File f = ctx.getBundleContext().getDataFile("RegisteredResourceList.ser");
-        persistentList = new PersistentResourceList(f);
+        persistentList = new PersistentResourceList(ctx.getBundleContext(), f);
         registeredResources = persistentList.getData();
     }
 
     void deactivate() {
         this.configTaskCreator.deactivate();
+        this.bundleTaskCreator.deactivate();
         ctx.getBundleContext().removeBundleListener(this);
         active = false;
         synchronized (newResources) {
@@ -239,7 +241,7 @@ class OsgiInstallerThread extends Thread
                 	for(RegisteredResource rr : t) {
                 		if(t.comparator().compare(rr, r) == 0) {
                 		    Logger.logDebug("Cleanup obsolete " + rr);
-                			rr.cleanup(ctx);
+                			rr.cleanup();
                 		}
                 	}
                     t.remove(r);
@@ -252,7 +254,7 @@ class OsgiInstallerThread extends Thread
             if(!urlsToRemove.isEmpty()) {
                 for(SortedSet<RegisteredResource> group : registeredResources.values()) {
                 	for(RegisteredResource r : group) {
-                		if(urlsToRemove.contains(r.getUrl())) {
+                		if(urlsToRemove.contains(r.getURL())) {
                 		    Logger.logDebug("Marking " + r + " uninistallable, URL is included in urlsToRemove");
                 			r.setInstallable(false);
                 		}
@@ -298,7 +300,7 @@ class OsgiInstallerThread extends Thread
             if (group.isEmpty()) {
                 continue;
             }
-            final String rt = group.first().getResourceType();
+            final String rt = group.first().getType();
             if ( InstallableResource.TYPE_BUNDLE.equals(rt) ) {
                 bundleTaskCreator.createTasks(ctx, group, tasks);
             } else if ( InstallableResource.TYPE_CONFIG.equals(rt) ) {
@@ -353,7 +355,7 @@ class OsgiInstallerThread extends Thread
             }
             for(RegisteredResource r : toDelete) {
                 group.remove(r);
-                r.cleanup(ctx);
+                r.cleanup();
                 Logger.logDebug("Removing RegisteredResource from list, not installable and has been processed: " + r);
             }
             if(group.isEmpty() && key != null) {

Modified: sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/PersistentResourceList.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/PersistentResourceList.java?rev=984304&r1=984303&r2=984304&view=diff
==============================================================================
--- sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/PersistentResourceList.java (original)
+++ sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/PersistentResourceList.java Wed Aug 11 06:03:07 2010
@@ -27,6 +27,8 @@ import java.io.ObjectOutputStream;
 import java.util.HashMap;
 import java.util.SortedSet;
 
+import org.osgi.framework.BundleContext;
+
 /** Persistent list of RegisteredResource, used by installer to
  *  keep track of all registered resources
  */
@@ -35,7 +37,7 @@ class PersistentResourceList {
     private final File dataFile;
 
     @SuppressWarnings("unchecked")
-    PersistentResourceList(final File dataFile) {
+    PersistentResourceList(final BundleContext bc, final File dataFile) {
         this.dataFile = dataFile;
 
         ObjectInputStream ois = null;
@@ -54,7 +56,15 @@ class PersistentResourceList {
                 }
             }
         }
-
+        if ( restoredData != null ) {
+            for(final SortedSet<RegisteredResource> set : restoredData.values() ) {
+                for(final RegisteredResource rr : set) {
+                    if ( rr instanceof RegisteredResourceImpl ) {
+                        ((RegisteredResourceImpl)rr).init(bc);
+                    }
+                }
+            }
+        }
         data = restoredData != null ? restoredData : new HashMap<String, SortedSet<RegisteredResource>>();
     }
 

Modified: sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/RegisteredResource.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/RegisteredResource.java?rev=984304&r1=984303&r2=984304&view=diff
==============================================================================
--- sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/RegisteredResource.java (original)
+++ sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/RegisteredResource.java Wed Aug 11 06:03:07 2010
@@ -18,36 +18,32 @@
  */
 package org.apache.sling.osgi.installer.impl;
 
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Dictionary;
 import java.util.Map;
 
-import org.osgi.framework.BundleContext;
+import org.apache.sling.osgi.installer.InstallableResource;
 
 /** 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 RegisteredResource {
+public interface RegisteredResource extends InstallableResource {
 
-	public static final String DIGEST_TYPE = "MD5";
-    public static final String ENTITY_JAR_PREFIX = "jar:";
-	public static final String ENTITY_BUNDLE_PREFIX = "bundle:";
-	public static final String ENTITY_CONFIG_PREFIX = "config:";
+	String DIGEST_TYPE = "MD5";
+    String ENTITY_JAR_PREFIX = "jar:";
+	String ENTITY_BUNDLE_PREFIX = "bundle:";
+	String ENTITY_CONFIG_PREFIX = "config:";
 
-	void cleanup(OsgiInstallerContext ctx);
+    /** Attribute key: configuration pid */
+    String CONFIG_PID_ATTRIBUTE = "config.pid";
+
+
+    void cleanup();
 	String getURL();
-	InputStream getInputStream(BundleContext bc) throws IOException;
-	Dictionary<String, Object> getDictionary();
-	String getDigest();
-	String getUrl();
+
 	boolean isInstallable();
 	void setInstallable(boolean installable);
-	String getResourceType();
 	String getUrlScheme();
-	int getPriority();
 	long getSerialNumber();
 
 	/** Attributes include the bundle symbolic name, bundle version, etc. */
@@ -59,7 +55,4 @@ public interface RegisteredResource {
      */
     String getEntityId();
 
-    /** Attribute key: configuration pid */
-    String CONFIG_PID_ATTRIBUTE = "config.pid";
-
 }

Modified: sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/RegisteredResourceComparator.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/RegisteredResourceComparator.java?rev=984304&r1=984303&r2=984304&view=diff
==============================================================================
--- sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/RegisteredResourceComparator.java (original)
+++ sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/RegisteredResourceComparator.java Wed Aug 11 06:03:07 2010
@@ -36,8 +36,8 @@ class RegisteredResourceComparator imple
     private static final long serialVersionUID = 1L;
 
     public int compare(RegisteredResource a, RegisteredResource b) {
-    	final boolean aBundle = a.getResourceType().equals(InstallableResource.TYPE_BUNDLE);
-    	final boolean bBundle = b.getResourceType().equals(InstallableResource.TYPE_BUNDLE);
+    	final boolean aBundle = a.getType().equals(InstallableResource.TYPE_BUNDLE);
+    	final boolean bBundle = b.getType().equals(InstallableResource.TYPE_BUNDLE);
 
         if(aBundle && bBundle) {
             return compareBundles(a, b);

Modified: sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/RegisteredResourceImpl.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/RegisteredResourceImpl.java?rev=984304&r1=984303&r2=984304&view=diff
==============================================================================
--- sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/RegisteredResourceImpl.java (original)
+++ sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/RegisteredResourceImpl.java Wed Aug 11 06:03:07 2010
@@ -48,6 +48,7 @@ import org.osgi.framework.Constants;
  */
 public class RegisteredResourceImpl implements RegisteredResource, Serializable {
     private static final long serialVersionUID = 2L;
+    private final String id;
 	private final String url;
 	private final String urlScheme;
 	private final String digest;
@@ -62,6 +63,8 @@ public class RegisteredResourceImpl impl
 
     private final String resourceType;
 
+    private transient BundleContext bundleContext;
+
 	/** Create a RegisteredResource from given data. If the data's extension
 	 *  maps to a configuration and the data provides an input stream, it is
 	 *  converted to a Dictionary
@@ -69,12 +72,14 @@ public class RegisteredResourceImpl impl
 	public RegisteredResourceImpl(final BundleContext ctx,
 	        final InstallableResource input,
 	        final String scheme) throws IOException {
+	    this.bundleContext = ctx;
         if ( scheme == null || scheme.length() == 0 ) {
             throw new IllegalArgumentException("Scheme required");
         }
         if ( scheme.indexOf(':') != -1 ) {
             throw new IllegalArgumentException("Scheme must not contain a colon");
         }
+        this.id = input.getId();
 		url = scheme + ':' + input.getId();
 		urlScheme = scheme;
 		resourceType = input.getType();
@@ -92,12 +97,12 @@ public class RegisteredResourceImpl impl
             }
             try {
                 dictionary = null;
-                final File f = getDataFile(ctx);
+                final File f = getDataFile();
                 Logger.logDebug("Copying data to local storage " + f.getAbsolutePath());
                 copyToLocalStorage(input.getInputStream(), f);
                 hasDataFile = true;
                 digest = input.getDigest();
-                setAttributesFromManifest(ctx);
+                setAttributesFromManifest();
                 final String name = (String)attributes.get(Constants.BUNDLE_SYMBOLICNAME);
                 if(name == null) {
                     // not a bundle - use "jar" entity to make it easier to find out
@@ -121,6 +126,10 @@ public class RegisteredResourceImpl impl
 		}
 	}
 
+	public void init(final BundleContext bc) {
+	    this.bundleContext = bc;
+	}
+
     private static long getNextSerialNumber() {
         synchronized (RegisteredResourceImpl.class) {
             return serialNumberCounter++;
@@ -132,13 +141,13 @@ public class RegisteredResourceImpl impl
 	    return getClass().getSimpleName() + " " + url + ", digest=" + digest + ", serialNumber=" + serialNumber;
 	}
 
-	protected File getDataFile(BundleContext ctx) {
+	protected File getDataFile() {
 		final String filename = getClass().getSimpleName() + "." + serialNumber;
-		return ctx.getDataFile(filename);
+		return this.bundleContext.getDataFile(filename);
 	}
 
-	public void cleanup(OsgiInstallerContext ctx) {
-	    final File dataFile = getDataFile(ctx.getBundleContext());
+	public void cleanup() {
+	    final File dataFile = getDataFile();
 		if(dataFile.exists()) {
 		    Logger.logDebug("Deleting local storage file "
 		                + dataFile.getAbsolutePath());
@@ -150,9 +159,9 @@ public class RegisteredResourceImpl impl
 		return url;
 	}
 
-	public InputStream getInputStream(BundleContext bc) throws IOException {
+	public InputStream getInputStream() throws IOException {
 	    if(hasDataFile) {
-	        final File dataFile = getDataFile(bc);
+	        final File dataFile = getDataFile();
 	        if(dataFile.exists()) {
 	            return new BufferedInputStream(new FileInputStream(dataFile));
 	        }
@@ -198,11 +207,11 @@ public class RegisteredResourceImpl impl
 	    return result;
 	}
 
-	public String getUrl() {
-	    return url;
+	public String getId() {
+	    return id;
 	}
 
-    public String getResourceType() {
+    public String getType() {
         return resourceType;
     }
 
@@ -256,8 +265,8 @@ public class RegisteredResourceImpl impl
         return result;
     }
 
-    private void setAttributesFromManifest(BundleContext bc) throws IOException {
-    	final Manifest m = getManifest(getInputStream(bc));
+    private void setAttributesFromManifest() throws IOException {
+    	final Manifest m = getManifest(getInputStream());
     	if(m == null) {
             throw new IOException("Cannot get manifest of bundle resource");
     	}

Modified: sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/BundleInstallTask.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/BundleInstallTask.java?rev=984304&r1=984303&r2=984304&view=diff
==============================================================================
--- sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/BundleInstallTask.java (original)
+++ sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/BundleInstallTask.java Wed Aug 11 06:03:07 2010
@@ -44,7 +44,7 @@ public class BundleInstallTask extends O
     }
 
     public void execute(OsgiInstallerContext ctx) throws Exception {
-        final Bundle b = ctx.getBundleContext().installBundle(resource.getUrl(), resource.getInputStream(ctx.getBundleContext()));
+        final Bundle b = ctx.getBundleContext().installBundle(resource.getURL(), resource.getInputStream());
         final Version newVersion = new Version((String)resource.getAttributes().get(Constants.BUNDLE_VERSION));
         ctx.saveInstalledBundleInfo(b, resource.getDigest(), newVersion.toString());
         logExecution();
@@ -54,7 +54,7 @@ public class BundleInstallTask extends O
 
     @Override
     public String getSortKey() {
-        return BUNDLE_INSTALL_ORDER + resource.getUrl();
+        return BUNDLE_INSTALL_ORDER + resource.getURL();
     }
 
 }

Modified: sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/BundleRemoveTask.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/BundleRemoveTask.java?rev=984304&r1=984303&r2=984304&view=diff
==============================================================================
--- sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/BundleRemoveTask.java (original)
+++ sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/BundleRemoveTask.java Wed Aug 11 06:03:07 2010
@@ -24,6 +24,7 @@ import org.apache.sling.osgi.installer.i
 import org.apache.sling.osgi.installer.impl.RegisteredResource;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.Constants;
+import org.osgi.util.tracker.ServiceTracker;
 
 /** Remove a bundle from a RegisteredResource.
  *  Creates a SynchronousRefreshPackagesTask when
@@ -35,8 +36,12 @@ public class BundleRemoveTask extends Os
 
     private final RegisteredResource resource;
 
-    public BundleRemoveTask(RegisteredResource r) {
+    /** Tracker for the package admin. */
+    private final ServiceTracker packageAdminTracker;
+
+    public BundleRemoveTask(final RegisteredResource r, final ServiceTracker packageAdminTracker) {
         this.resource = r;
+        this.packageAdminTracker = packageAdminTracker;
     }
 
     @Override
@@ -57,13 +62,13 @@ public class BundleRemoveTask extends Os
         	b.stop();
         }
         b.uninstall();
-        ctx.addTaskToCurrentCycle(new SynchronousRefreshPackagesTask());
+        ctx.addTaskToCurrentCycle(new SynchronousRefreshPackagesTask(this.packageAdminTracker));
         ctx.incrementCounter(OsgiInstallerStatistics.OSGI_TASKS_COUNTER);
     }
 
     @Override
     public String getSortKey() {
-        return BUNDLE_REMOVE_ORDER + resource.getUrl();
+        return BUNDLE_REMOVE_ORDER + resource.getURL();
     }
 
 }

Modified: sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/BundleUpdateTask.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/BundleUpdateTask.java?rev=984304&r1=984303&r2=984304&view=diff
==============================================================================
--- sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/BundleUpdateTask.java (original)
+++ sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/BundleUpdateTask.java Wed Aug 11 06:03:07 2010
@@ -28,6 +28,7 @@ import org.apache.sling.osgi.installer.i
 import org.osgi.framework.Bundle;
 import org.osgi.framework.Constants;
 import org.osgi.framework.Version;
+import org.osgi.util.tracker.ServiceTracker;
 
 /** Update a bundle from a RegisteredResource. Creates
  *  a bundleStartTask to restart the bundle if it was
@@ -37,11 +38,15 @@ public class BundleUpdateTask extends Os
 
     private static final String BUNDLE_UPDATE_ORDER = "40-";
 
+    /** Tracker for the package admin. */
+    private final ServiceTracker packageAdminTracker;
+
     private final RegisteredResource resource;
     private boolean canRetry = true;
 
-    public BundleUpdateTask(RegisteredResource r) {
+    public BundleUpdateTask(final RegisteredResource r, final ServiceTracker packageAdminTracker) {
         this.resource = r;
+        this.packageAdminTracker = packageAdminTracker;
     }
 
     public RegisteredResource getResource() {
@@ -89,7 +94,7 @@ public class BundleUpdateTask extends Os
             ctx.addTaskToCurrentCycle(new BundleStartTask(b.getBundleId()));
         }
         b.stop();
-        final InputStream is = resource.getInputStream(ctx.getBundleContext());
+        final InputStream is = resource.getInputStream();
         if(is == null) {
         	canRetry = false;
             throw new IllegalStateException(
@@ -98,7 +103,7 @@ public class BundleUpdateTask extends Os
         }
         b.update(is);
         ctx.saveInstalledBundleInfo(b, resource.getDigest(), newVersion.toString());
-        ctx.addTaskToCurrentCycle(new SynchronousRefreshPackagesTask());
+        ctx.addTaskToCurrentCycle(new SynchronousRefreshPackagesTask(this.packageAdminTracker));
         Logger.logDebug("Bundle updated: " + b.getBundleId() + "/" + b.getSymbolicName());
         ctx.incrementCounter(OsgiInstallerStatistics.OSGI_TASKS_COUNTER);
     }
@@ -110,7 +115,7 @@ public class BundleUpdateTask extends Os
 
     @Override
     public String getSortKey() {
-        return BUNDLE_UPDATE_ORDER + resource.getUrl();
+        return BUNDLE_UPDATE_ORDER + resource.getURL();
     }
 
 }
\ No newline at end of file

Modified: sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/ConfigInstallTask.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/ConfigInstallTask.java?rev=984304&r1=984303&r2=984304&view=diff
==============================================================================
--- sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/ConfigInstallTask.java (original)
+++ sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/ConfigInstallTask.java Wed Aug 11 06:03:07 2010
@@ -76,7 +76,7 @@ public class ConfigInstallTask extends A
         }
 
         // Add pseudo-properties
-        dict.put(CONFIG_PATH_KEY, resource.getUrl());
+        dict.put(CONFIG_PATH_KEY, resource.getURL());
 
         // Factory?
         if(pid.getFactoryPid() != null) {

Modified: sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/SynchronousRefreshPackagesTask.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/SynchronousRefreshPackagesTask.java?rev=984304&r1=984303&r2=984304&view=diff
==============================================================================
--- sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/SynchronousRefreshPackagesTask.java (original)
+++ sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/SynchronousRefreshPackagesTask.java Wed Aug 11 06:03:07 2010
@@ -24,10 +24,15 @@ import org.apache.sling.osgi.installer.i
 import org.osgi.framework.Bundle;
 import org.osgi.framework.FrameworkEvent;
 import org.osgi.framework.FrameworkListener;
+import org.osgi.service.packageadmin.PackageAdmin;
+import org.osgi.util.tracker.ServiceTracker;
 
 /** Execute an OSGi "refresh packages" operation, synchronously */
 public class SynchronousRefreshPackagesTask extends OsgiInstallerTask implements FrameworkListener {
 
+    /** Tracker for the package admin. */
+    private final ServiceTracker packageAdminTracker;
+
     private static final String REFRESH_PACKAGES_ORDER = "60-";
 
     /** Max time allowed to refresh packages (TODO configurable??) */
@@ -35,6 +40,10 @@ public class SynchronousRefreshPackagesT
 
 	private volatile int packageRefreshEventsCount;
 
+	public SynchronousRefreshPackagesTask(final ServiceTracker packageAdminTracker) {
+	    this.packageAdminTracker = packageAdminTracker;
+	}
+
     /**
      * Handles the PACKAGES_REFRESHED framework event which is sent after
      * the PackageAdmin.refreshPackages has finished its work of refreshing
@@ -59,7 +68,14 @@ public class SynchronousRefreshPackagesT
 		return getClass().getSimpleName();
 	}
 
-	public void execute(OsgiInstallerContext ctx) throws Exception {
+    private PackageAdmin getPackageAdmin() {
+        return (PackageAdmin)this.packageAdminTracker.getService();
+    }
+
+    /**
+     * @see org.apache.sling.osgi.installer.impl.OsgiInstallerTask#execute(org.apache.sling.osgi.installer.impl.OsgiInstallerContext)
+     */
+    public void execute(OsgiInstallerContext ctx) throws Exception {
         logExecution();
         final int targetEventCount = packageRefreshEventsCount + 1;
         final long start = System.currentTimeMillis();
@@ -80,7 +96,7 @@ public class SynchronousRefreshPackagesT
         // if one happened very recently and there's nothing to refresh
         ctx.getBundleContext().addFrameworkListener(this);
         try {
-            ctx.getPackageAdmin().refreshPackages(null);
+            this.getPackageAdmin().refreshPackages(null);
             while(true) {
                 if(System.currentTimeMillis() > timeout) {
                     Logger.logWarn("No FrameworkEvent.PACKAGES_REFRESHED event received within "

Modified: sling/trunk/installer/osgi/installer/src/test/java/org/apache/sling/osgi/installer/impl/LocalFileRegisteredResource.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/osgi/installer/src/test/java/org/apache/sling/osgi/installer/impl/LocalFileRegisteredResource.java?rev=984304&r1=984303&r2=984304&view=diff
==============================================================================
--- sling/trunk/installer/osgi/installer/src/test/java/org/apache/sling/osgi/installer/impl/LocalFileRegisteredResource.java (original)
+++ sling/trunk/installer/osgi/installer/src/test/java/org/apache/sling/osgi/installer/impl/LocalFileRegisteredResource.java Wed Aug 11 06:03:07 2010
@@ -22,9 +22,9 @@ import java.io.File;
 import java.io.IOException;
 
 import org.apache.sling.osgi.installer.InstallableResource;
-import org.osgi.framework.BundleContext;
 
 /** RegisteredResource that stores data to a local temporary file */
+@SuppressWarnings("serial")
 class LocalFileRegisteredResource extends RegisteredResourceImpl {
 	private File storage;
 
@@ -33,7 +33,7 @@ class LocalFileRegisteredResource extend
 	}
 
 	@Override
-	protected File getDataFile(BundleContext ctx) {
+	protected File getDataFile() {
 		if(storage == null) {
 	        try {
 	            storage = File.createTempFile(getClass().getName(), "test");

Modified: sling/trunk/installer/osgi/installer/src/test/java/org/apache/sling/osgi/installer/impl/MockBundleResource.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/osgi/installer/src/test/java/org/apache/sling/osgi/installer/impl/MockBundleResource.java?rev=984304&r1=984303&r2=984304&view=diff
==============================================================================
--- sling/trunk/installer/osgi/installer/src/test/java/org/apache/sling/osgi/installer/impl/MockBundleResource.java (original)
+++ sling/trunk/installer/osgi/installer/src/test/java/org/apache/sling/osgi/installer/impl/MockBundleResource.java Wed Aug 11 06:03:07 2010
@@ -27,7 +27,6 @@ import java.util.Map;
 
 import org.apache.sling.osgi.installer.InstallableResource;
 import org.apache.sling.osgi.installer.InstallableResourceFactory;
-import org.osgi.framework.BundleContext;
 import org.osgi.framework.Constants;
 
 /** Mock RegisteredResource that simulates a bundle */
@@ -77,7 +76,8 @@ public class MockBundleResource implemen
         ;
 	}
 
-	public void cleanup(OsgiInstallerContext ctx) {
+	public void cleanup() {
+	    // nothing to do
 	}
 
 	public Map<String, Object> getAttributes() {
@@ -96,15 +96,15 @@ public class MockBundleResource implemen
 		return null;
 	}
 
-	public InputStream getInputStream(BundleContext ctx) throws IOException {
+	public InputStream getInputStream() throws IOException {
 		return null;
 	}
 
-	public String getResourceType() {
+	public String getType() {
 		return InstallableResource.TYPE_BUNDLE;
 	}
 
-	public String getUrl() {
+	public String getId() {
 		return null;
 	}
 

Modified: sling/trunk/installer/osgi/installer/src/test/java/org/apache/sling/osgi/installer/impl/MockBundleTaskCreator.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/osgi/installer/src/test/java/org/apache/sling/osgi/installer/impl/MockBundleTaskCreator.java?rev=984304&r1=984303&r2=984304&view=diff
==============================================================================
--- sling/trunk/installer/osgi/installer/src/test/java/org/apache/sling/osgi/installer/impl/MockBundleTaskCreator.java (original)
+++ sling/trunk/installer/osgi/installer/src/test/java/org/apache/sling/osgi/installer/impl/MockBundleTaskCreator.java Wed Aug 11 06:03:07 2010
@@ -18,21 +18,155 @@
  */
 package org.apache.sling.osgi.installer.impl;
 
+import java.io.File;
+import java.io.InputStream;
+import java.util.Dictionary;
 import java.util.HashMap;
 import java.util.Map;
 
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.BundleListener;
 import org.osgi.framework.Constants;
+import org.osgi.framework.Filter;
+import org.osgi.framework.FrameworkListener;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceListener;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.ServiceRegistration;
 import org.osgi.framework.Version;
 
 /** BundleTaskCreator that simulates the presence and state of bundles */
 class MockBundleTaskCreator extends BundleTaskCreator {
 
     private final Map<String, BundleInfo> fakeBundleInfo = new HashMap<String, BundleInfo>();
-    
+
+    public MockBundleTaskCreator() {
+        super(new BundleContext() {
+
+            public boolean ungetService(ServiceReference reference) {
+                // TODO Auto-generated method stub
+                return false;
+            }
+
+            public void removeServiceListener(ServiceListener listener) {
+                // TODO Auto-generated method stub
+
+            }
+
+            public void removeFrameworkListener(FrameworkListener listener) {
+                // TODO Auto-generated method stub
+
+            }
+
+            public void removeBundleListener(BundleListener listener) {
+                // TODO Auto-generated method stub
+
+            }
+
+            public ServiceRegistration registerService(String clazz, Object service,
+                    Dictionary properties) {
+                // TODO Auto-generated method stub
+                return null;
+            }
+
+            public ServiceRegistration registerService(String[] clazzes,
+                    Object service, Dictionary properties) {
+                // TODO Auto-generated method stub
+                return null;
+            }
+
+            public Bundle installBundle(String location) throws BundleException {
+                // TODO Auto-generated method stub
+                return null;
+            }
+
+            public Bundle installBundle(String location, InputStream input)
+                    throws BundleException {
+                // TODO Auto-generated method stub
+                return null;
+            }
+
+            public ServiceReference[] getServiceReferences(String clazz, String filter)
+                    throws InvalidSyntaxException {
+                // TODO Auto-generated method stub
+                return null;
+            }
+
+            public ServiceReference getServiceReference(String clazz) {
+                // TODO Auto-generated method stub
+                return null;
+            }
+
+            public Object getService(ServiceReference reference) {
+                // TODO Auto-generated method stub
+                return null;
+            }
+
+            public String getProperty(String key) {
+                // TODO Auto-generated method stub
+                return null;
+            }
+
+            public File getDataFile(String filename) {
+                // TODO Auto-generated method stub
+                return null;
+            }
+
+            public Bundle[] getBundles() {
+                // TODO Auto-generated method stub
+                return null;
+            }
+
+            public Bundle getBundle(long id) {
+                // TODO Auto-generated method stub
+                return null;
+            }
+
+            public Bundle getBundle() {
+                // TODO Auto-generated method stub
+                return null;
+            }
+
+            public ServiceReference[] getAllServiceReferences(String clazz,
+                    String filter) throws InvalidSyntaxException {
+                // TODO Auto-generated method stub
+                return null;
+            }
+
+            public Filter createFilter(String filter) throws InvalidSyntaxException {
+                // TODO Auto-generated method stub
+                return null;
+            }
+
+            public void addServiceListener(ServiceListener listener) {
+                // TODO Auto-generated method stub
+
+            }
+
+            public void addServiceListener(ServiceListener listener, String filter)
+                    throws InvalidSyntaxException {
+                // TODO Auto-generated method stub
+
+            }
+
+            public void addFrameworkListener(FrameworkListener listener) {
+                // TODO Auto-generated method stub
+
+            }
+
+            public void addBundleListener(BundleListener listener) {
+                // TODO Auto-generated method stub
+
+            }
+        });
+    }
+
     void addBundleInfo(String symbolicName, String version, int state) {
         fakeBundleInfo.put(symbolicName, new BundleInfo(symbolicName, new Version(version), state));
     }
-    
+
     @Override
     protected BundleInfo getBundleInfo(OsgiInstallerContext ctx, RegisteredResource bundle) {
         return fakeBundleInfo.get(bundle.getAttributes().get(Constants.BUNDLE_SYMBOLICNAME));

Modified: sling/trunk/installer/osgi/installer/src/test/java/org/apache/sling/osgi/installer/impl/MockOsgiInstallerContext.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/osgi/installer/src/test/java/org/apache/sling/osgi/installer/impl/MockOsgiInstallerContext.java?rev=984304&r1=984303&r2=984304&view=diff
==============================================================================
--- sling/trunk/installer/osgi/installer/src/test/java/org/apache/sling/osgi/installer/impl/MockOsgiInstallerContext.java (original)
+++ sling/trunk/installer/osgi/installer/src/test/java/org/apache/sling/osgi/installer/impl/MockOsgiInstallerContext.java Wed Aug 11 06:03:07 2010
@@ -24,8 +24,6 @@ import java.io.IOException;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.Version;
-import org.osgi.service.cm.ConfigurationAdmin;
-import org.osgi.service.packageadmin.PackageAdmin;
 
 public class MockOsgiInstallerContext implements OsgiInstallerContext {
 
@@ -47,14 +45,6 @@ public class MockOsgiInstallerContext im
 		return null;
 	}
 
-	public ConfigurationAdmin getConfigurationAdmin() {
-		return null;
-	}
-
-	public PackageAdmin getPackageAdmin() {
-		return null;
-	}
-
     public void incrementCounter(int index) {
     }
 

Modified: sling/trunk/installer/osgi/installer/src/test/java/org/apache/sling/osgi/installer/impl/PersistentResourceListTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/osgi/installer/src/test/java/org/apache/sling/osgi/installer/impl/PersistentResourceListTest.java?rev=984304&r1=984303&r2=984304&view=diff
==============================================================================
--- sling/trunk/installer/osgi/installer/src/test/java/org/apache/sling/osgi/installer/impl/PersistentResourceListTest.java (original)
+++ sling/trunk/installer/osgi/installer/src/test/java/org/apache/sling/osgi/installer/impl/PersistentResourceListTest.java Wed Aug 11 06:03:07 2010
@@ -41,7 +41,7 @@ public class PersistentResourceListTest 
     @Test
     public void testFileNotFound() throws IOException {
         File f = new File("NONEXISTENT");
-        PersistentResourceList p = new PersistentResourceList(f);
+        PersistentResourceList p = new PersistentResourceList(null, f);
         assertNotNull(p.getData());
     }
 
@@ -55,7 +55,7 @@ public class PersistentResourceListTest 
         } finally {
             oos.close();
         }
-        PersistentResourceList p = new PersistentResourceList(f);
+        PersistentResourceList p = new PersistentResourceList(null, f);
         assertNotNull(p.getData());
         assertEquals("Constructor must fail gracefully with invalid data file", 0, p.getData().size());
     }
@@ -63,7 +63,7 @@ public class PersistentResourceListTest 
     @Test
     public void testTestData() throws IOException {
         File f = new File("NONEXISTENT");
-        PersistentResourceList p = new PersistentResourceList(f);
+        PersistentResourceList p = new PersistentResourceList(null, f);
         assertNotNull(p.getData());
         addTestData(p);
         assertTestData(p);
@@ -74,12 +74,12 @@ public class PersistentResourceListTest 
         File f  = File.createTempFile(getClass().getSimpleName(), ".ser");
         f.deleteOnExit();
         {
-            PersistentResourceList p = new PersistentResourceList(f);
+            PersistentResourceList p = new PersistentResourceList(null, f);
             addTestData(p);
             p.save();
         }
         {
-            PersistentResourceList p = new PersistentResourceList(f);
+            PersistentResourceList p = new PersistentResourceList(null, f);
             assertTestData(p);
         }
     }

Modified: sling/trunk/installer/osgi/installer/src/test/java/org/apache/sling/osgi/installer/impl/RegisteredResourceTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/osgi/installer/src/test/java/org/apache/sling/osgi/installer/impl/RegisteredResourceTest.java?rev=984304&r1=984303&r2=984304&view=diff
==============================================================================
--- sling/trunk/installer/osgi/installer/src/test/java/org/apache/sling/osgi/installer/impl/RegisteredResourceTest.java (original)
+++ sling/trunk/installer/osgi/installer/src/test/java/org/apache/sling/osgi/installer/impl/RegisteredResourceTest.java Wed Aug 11 06:03:07 2010
@@ -52,8 +52,8 @@ public class RegisteredResourceTest {
             final InputStream s = new FileInputStream(getTestBundle("testbundle-1.0.jar"));
             final RegisteredResource r = new LocalFileRegisteredResource(factory.create("test:1.jar", s, null, "some digest", null, null));
             assertEquals(".jar URL creates a BUNDLE resource",
-                    InstallableResource.TYPE_BUNDLE, r.getResourceType());
-            final InputStream rs = r.getInputStream(null);
+                    InstallableResource.TYPE_BUNDLE, r.getType());
+            final InputStream rs = r.getInputStream();
             assertNotNull("BUNDLE resource provides an InputStream", rs);
             rs.close();
             assertNull("BUNDLE resource does not provide a Dictionary", r.getDictionary());
@@ -66,8 +66,8 @@ public class RegisteredResourceTest {
             data.put("other", 2);
             final RegisteredResource r = new LocalFileRegisteredResource(factory.create("test:1", null, data, null, null, null));
             assertEquals("No-extension URL with Dictionary creates a CONFIG resource",
-                    InstallableResource.TYPE_CONFIG, r.getResourceType());
-            final InputStream rs = r.getInputStream(null);
+                    InstallableResource.TYPE_CONFIG, r.getType());
+            final InputStream rs = r.getInputStream();
             assertNull("CONFIG resource does not provide an InputStream", rs);
             final Dictionary<String, Object> d = r.getDictionary();
             assertNotNull("CONFIG resource provides a Dictionary", d);
@@ -80,9 +80,9 @@ public class RegisteredResourceTest {
 	    final File f = getTestBundle("testbundle-1.0.jar");
         final InputStream s = new FileInputStream(f);
 		final LocalFileRegisteredResource r = new LocalFileRegisteredResource(factory.create("test:1.jar", s, null, "somedigest", null, null));
-		assertTrue("Local file exists", r.getDataFile(null).exists());
+		assertTrue("Local file exists", r.getDataFile().exists());
 
-		assertEquals("Local file length matches our data", f.length(), r.getDataFile(null).length());
+		assertEquals("Local file length matches our data", f.length(), r.getDataFile().length());
 	}
 
     @org.junit.Test public void testMissingDigest() throws Exception {

Modified: sling/trunk/installer/osgi/installer/src/test/java/org/apache/sling/osgi/installer/impl/TaskOrderingTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/osgi/installer/src/test/java/org/apache/sling/osgi/installer/impl/TaskOrderingTest.java?rev=984304&r1=984303&r2=984304&view=diff
==============================================================================
--- sling/trunk/installer/osgi/installer/src/test/java/org/apache/sling/osgi/installer/impl/TaskOrderingTest.java (original)
+++ sling/trunk/installer/osgi/installer/src/test/java/org/apache/sling/osgi/installer/impl/TaskOrderingTest.java Wed Aug 11 06:03:07 2010
@@ -72,10 +72,10 @@ public class TaskOrderingTest {
 		final OsgiInstallerTask [] tasksInOrder = {
 		    new ConfigRemoveTask(getRegisteredResource("test:a"), null),
             new ConfigInstallTask(getRegisteredResource("test:a"), null),
-		    new BundleRemoveTask(getRegisteredResource("test:url")),
-		    new BundleUpdateTask(getRegisteredResource("test:url")),
+		    new BundleRemoveTask(getRegisteredResource("test:url"), null),
+		    new BundleUpdateTask(getRegisteredResource("test:url"), null),
 		    new BundleInstallTask(getRegisteredResource("test:url")),
-			new SynchronousRefreshPackagesTask(),
+			new SynchronousRefreshPackagesTask(null),
 			new BundleStartTask(0),
 		};
 
@@ -130,7 +130,7 @@ public class TaskOrderingTest {
 		final OsgiInstallerTask [] tasksInOrder = {
 			new BundleInstallTask(getRegisteredResource("test:someURIa.nothing")),
             new BundleInstallTask(getRegisteredResource("test:someURIb.nothing")),
-			new SynchronousRefreshPackagesTask(),
+			new SynchronousRefreshPackagesTask(null),
 			new BundleStartTask(0),
 		};
 
@@ -153,8 +153,8 @@ public class TaskOrderingTest {
 	public void testMultipleRefreshAndStart() throws Exception {
 		int testIndex = 1;
 		final OsgiInstallerTask [] tasksInOrder = {
-		    new BundleRemoveTask(getRegisteredResource("test:url")),
-			new SynchronousRefreshPackagesTask(),
+		    new BundleRemoveTask(getRegisteredResource("test:url"), null),
+			new SynchronousRefreshPackagesTask(null),
 			new BundleStartTask(0),
 			new BundleStartTask(1),
 		};
@@ -162,23 +162,23 @@ public class TaskOrderingTest {
 		taskSet.clear();
 		taskSet.add(tasksInOrder[3]);
 		taskSet.add(tasksInOrder[3]);
-		taskSet.add(new SynchronousRefreshPackagesTask());
+		taskSet.add(new SynchronousRefreshPackagesTask(null));
 		taskSet.add(tasksInOrder[2]);
 		taskSet.add(tasksInOrder[2]);
 		taskSet.add(tasksInOrder[1]);
-		taskSet.add(new SynchronousRefreshPackagesTask());
-		taskSet.add(new SynchronousRefreshPackagesTask());
+		taskSet.add(new SynchronousRefreshPackagesTask(null));
+		taskSet.add(new SynchronousRefreshPackagesTask(null));
 		taskSet.add(tasksInOrder[0]);
 		taskSet.add(tasksInOrder[3]);
-		taskSet.add(new SynchronousRefreshPackagesTask());
+		taskSet.add(new SynchronousRefreshPackagesTask(null));
 		taskSet.add(tasksInOrder[3]);
 		taskSet.add(tasksInOrder[2]);
-		taskSet.add(new SynchronousRefreshPackagesTask());
+		taskSet.add(new SynchronousRefreshPackagesTask(null));
 		taskSet.add(tasksInOrder[2]);
 		taskSet.add(tasksInOrder[1]);
-		taskSet.add(new SynchronousRefreshPackagesTask());
+		taskSet.add(new SynchronousRefreshPackagesTask(null));
 		taskSet.add(tasksInOrder[1]);
-		taskSet.add(new SynchronousRefreshPackagesTask());
+		taskSet.add(new SynchronousRefreshPackagesTask(null));
 
 		assertOrder(testIndex++, taskSet, tasksInOrder);
 	}



Mime
View raw message