[jboss-cvs] JBossAS SVN: r97973 - in projects/jboss-osgi/projects/runtime/framework/trunk/src: main/java/org/jboss/osgi/framework/classloading and 17 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Dec 17 16:38:33 EST 2009


Author: thomas.diesler at jboss.com
Date: 2009-12-17 16:38:32 -0500 (Thu, 17 Dec 2009)
New Revision: 97973

Added:
   projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/update/
   projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/update/update-bundle1/
   projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/update/update-bundle1/META-INF/
   projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/update/update-bundle1/META-INF/MANIFEST.MF
   projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/update/update-bundle2/
   projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/update/update-bundle2/META-INF/
   projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/update/update-bundle2/META-INF/MANIFEST.MF
Removed:
   projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/update/update-bundle1/
   projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/update/update-bundle1/META-INF/
   projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/update/update-bundle1/META-INF/MANIFEST.MF
   projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/update/update-bundle2/
   projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/update/update-bundle2/META-INF/
   projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/update/update-bundle2/META-INF/MANIFEST.MF
Modified:
   projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/AbstractBundleState.java
   projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/InstanceMetaDataRetrievalFactory.java
   projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/MDRUtils.java
   projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java
   projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleState.java
   projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiScopeInfo.java
   projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiServiceRegistrationWrapper.java
   projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiSystemState.java
   projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoaderDomain.java
   projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/AbstractOSGiBundleStateDeployer.java
   projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleStateRemoveDeployer.java
   projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/metadata/ManifestParser.java
   projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/metadata/internal/AbstractOSGiMetaData.java
   projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/metadata/internal/OSGiParameters.java
   projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/util/CaseInsensitiveDictionary.java
   projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/util/NoFilter.java
   projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/FrameworkTest.java
   projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/FrameworkTestDelegate.java
   projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/bundle/BundleLifecycleTestCase.java
   projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/bundle/BundleUnitTestCase.java
   projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/bundle/SystemBundleUnitTestCase.java
   projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/classloader/ClassLoaderDomainUnitTestCase.java
   projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/classloader/RequireBundleUnitTestCase.java
   projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/compendium/PackageAdminTestCase.java
   projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/resolver/ResolverSmokeTest.java
   projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/service/GetServiceReferencesUnitTestCase.java
   projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/service/ServiceMixUnitTestCase.java
   projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/service/ServiceReferenceUnitTestCase.java
   projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/smoke/OSGiSmokeTestCase.java
Log:
Add initial support for Bundle.update()

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/AbstractBundleState.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/AbstractBundleState.java	2009-12-17 21:37:53 UTC (rev 97972)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/AbstractBundleState.java	2009-12-17 21:38:32 UTC (rev 97973)
@@ -77,9 +77,6 @@
    /** The bundle manager */
    private OSGiBundleManager bundleManager;
 
-   /** The osgi metadata */
-   private OSGiMetaData osgiMetaData;
-
    /** The bundle context */
    private BundleContext bundleContext;
 
@@ -89,27 +86,7 @@
    /** The bundle state */
    private AtomicInteger state = new AtomicInteger(Bundle.UNINSTALLED);
 
-   /** The cached symbolic name */
-   private String symbolicName;
-   
-   /** The cached version */
-   private Version version;
-
    /**
-    * Create a new BundleState for the system bundle.
-    * 
-    * @param osgiMetaData the osgi metadata
-    * @throws IllegalArgumentException for a null parameter
-    */
-   AbstractBundleState(OSGiMetaData osgiMetaData)
-   {
-      if (osgiMetaData == null)
-         throw new IllegalArgumentException("Null osgi metadata");
-
-      this.osgiMetaData = osgiMetaData;
-   }
-
-   /**
     * Get the bundleManager.
     * 
     * @return the bundleManager.
@@ -118,26 +95,21 @@
    {
       if (bundleManager == null)
          throw new IllegalStateException("Bundle not installed: " + getCanonicalName());
-      
+
       return bundleManager;
    }
 
    public String getSymbolicName()
    {
+      String symbolicName = getOSGiMetaData().getBundleSymbolicName();
       if (symbolicName == null)
-      {
-         symbolicName = osgiMetaData.getBundleSymbolicName();
-         if (symbolicName == null)
-            throw new IllegalStateException("Cannot obtain " + Constants.BUNDLE_SYMBOLICNAME);
-      }
+         throw new IllegalStateException("Cannot obtain " + Constants.BUNDLE_SYMBOLICNAME);
       return symbolicName;
    }
 
    public Version getVersion()
    {
-      if (version == null)
-         version = osgiMetaData.getBundleVersion();
-      
+      Version version = getOSGiMetaData().getBundleVersion();
       return version;
    }
 
@@ -202,7 +174,7 @@
       List<Bundle> bundles = new ArrayList<Bundle>(bundleStates.size());
       for (AbstractBundleState bundleState : bundleStates)
          bundles.add(bundleState.getBundleInternal());
-      
+
       return bundles.toArray(new Bundle[bundles.size()]);
    }
 
@@ -221,10 +193,7 @@
     * 
     * @return the osgiMetaData.
     */
-   public OSGiMetaData getOSGiMetaData()
-   {
-      return osgiMetaData;
-   }
+   public abstract OSGiMetaData getOSGiMetaData();
 
    @SuppressWarnings("rawtypes")
    public Dictionary getHeaders()
@@ -376,7 +345,7 @@
       }
 
       if (references.isEmpty())
-         return null;      
+         return null;
       return references.toArray(new ServiceReference[references.size()]);
    }
 
@@ -510,13 +479,6 @@
       stop(0);
    }
 
-   public void update() throws BundleException
-   {
-      checkAdminPermission(AdminPermission.LIFECYCLE); // [TODO] extension bundles
-      // [TODO] update
-      throw new UnsupportedOperationException("update");
-   }
-
    void uninstallInternal()
    {
       changeState(Bundle.UNINSTALLED);
@@ -621,8 +583,19 @@
     */
    public void changeState(int state)
    {
+      changeState(state, true);
+   }
+
+   /**
+    * Change the state of the bundle
+    * 
+    * @param state the new state
+    * @param fireEvent if true the state change fires an event
+    */
+   public void changeState(int state, boolean fireEvent)
+   {
       int previous = getState();
-      
+
       // Get the corresponding bundle event type
       int bundleEventType;
       switch (state)
@@ -658,7 +631,7 @@
          default:
             throw new IllegalArgumentException("Unknown bundle state: " + state);
       }
-      
+
       // Invoke the bundle lifecycle interceptors
       if (getBundleManager().isFrameworkActive() && getBundleId() != 0)
       {
@@ -666,12 +639,12 @@
          if (plugin != null)
             plugin.handleStateChange(state, getBundleInternal());
       }
-      
+
       this.state.set(state);
       log.debug(this + " change state=" + ConstantsHelper.bundleState(state));
 
       // Fire the bundle event
-      if (getBundleManager().isFrameworkActive())
+      if (fireEvent == true && getBundleManager().isFrameworkActive())
       {
          FrameworkEventsPlugin plugin = getBundleManager().getPlugin(FrameworkEventsPlugin.class);
          plugin.fireBundleEvent(this, bundleEventType);
@@ -735,13 +708,13 @@
    {
       if (bundle == null)
          throw new IllegalArgumentException("Null bundle");
-      
+
       if (bundle instanceof OSGiBundleWrapper)
          bundle = ((OSGiBundleWrapper)bundle).getBundleState();
-   
+
       if (bundle instanceof AbstractBundleState == false)
          throw new IllegalArgumentException("Not an AbstractBundleState: " + bundle);
-   
+
       return (AbstractBundleState)bundle;
    }
 }

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/InstanceMetaDataRetrievalFactory.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/InstanceMetaDataRetrievalFactory.java	2009-12-17 21:37:53 UTC (rev 97972)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/InstanceMetaDataRetrievalFactory.java	2009-12-17 21:38:32 UTC (rev 97973)
@@ -42,6 +42,8 @@
 public class InstanceMetaDataRetrievalFactory implements MetaDataRetrievalFactory
 {
    private Controller controller;
+   
+   @SuppressWarnings("rawtypes")
    private Set<DictionaryFactory> factories = new CopyOnWriteArraySet<DictionaryFactory>();
 
    public InstanceMetaDataRetrievalFactory(Controller controller)
@@ -51,7 +53,7 @@
       this.controller = controller;
    }
 
-   @SuppressWarnings({"unchecked"})
+   @SuppressWarnings({"unchecked", "rawtypes"})
    public MetaDataRetrieval getMetaDataRetrieval(Scope scope)
    {
       if (scope == null)
@@ -89,6 +91,7 @@
     * @param factory the factory
     * @return Set#add
     */
+   @SuppressWarnings("rawtypes")
    public boolean addFactory(DictionaryFactory factory)
    {
       if (factory == null)
@@ -105,6 +108,7 @@
     * @param factory the factory
     * @return Set#add
     */
+   @SuppressWarnings("rawtypes")
    public boolean removeFactory(DictionaryFactory factory)
    {
       if (factory == null)

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/MDRUtils.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/MDRUtils.java	2009-12-17 21:37:53 UTC (rev 97972)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/MDRUtils.java	2009-12-17 21:38:32 UTC (rev 97973)
@@ -192,7 +192,7 @@
     */
    private static ClassLoader getClassLoader(Object instance)
    {
-      return (instance instanceof Class) ? Class.class.cast(instance).getClassLoader() : instance.getClass().getClassLoader();
+      return (instance instanceof Class<?>) ? Class.class.cast(instance).getClassLoader() : instance.getClass().getClassLoader();
    }
 
    /**

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java	2009-12-17 21:37:53 UTC (rev 97972)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java	2009-12-17 21:38:32 UTC (rev 97973)
@@ -92,6 +92,7 @@
 import org.jboss.virtual.VirtualFile;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleEvent;
 import org.osgi.framework.BundleException;
 import org.osgi.framework.Constants;
 import org.osgi.framework.Filter;
@@ -217,13 +218,8 @@
 
    public void start()
    {
-      // createSystemBundle
-      Manifest manifest = new Manifest();
-      Attributes attributes = manifest.getMainAttributes();
-      attributes.put(new Name(Constants.BUNDLE_NAME), Constants.SYSTEM_BUNDLE_SYMBOLICNAME);
-      attributes.put(new Name(Constants.BUNDLE_SYMBOLICNAME), Constants.SYSTEM_BUNDLE_SYMBOLICNAME);
-      OSGiMetaData systemMetaData = new AbstractOSGiMetaData(manifest);
-      systemBundle = new OSGiSystemState(systemMetaData);
+      // Create the system Bundle
+      systemBundle = new OSGiSystemState();
       addBundle(systemBundle);
 
       applyMDRUsage(true);
@@ -594,7 +590,7 @@
     * @return the bundle state
     * @throws BundleException for any error
     */
-   public AbstractBundleState installBundle(URL url) throws BundleException
+   public OSGiBundleState installBundle(URL url) throws BundleException
    {
       if (url == null)
          throw new BundleException("Null url");
@@ -610,7 +606,7 @@
     * @return the bundle state
     * @throws BundleException for any error
     */
-   public AbstractBundleState installBundle(String location, InputStream input) throws BundleException
+   public OSGiBundleState installBundle(String location, InputStream input) throws BundleException
    {
       if (location == null)
          throw new BundleException("Null location");
@@ -620,23 +616,7 @@
       // Get the location URL
       if (input != null)
       {
-         try
-         {
-            BundleStoragePlugin plugin = getPlugin(BundleStoragePlugin.class);
-            String path = plugin.getStorageDir(getSystemBundle()).getCanonicalPath();
-
-            // [TODO] do properly
-            File file = new File(path + "/bundle-" + System.currentTimeMillis() + ".jar");
-            FileOutputStream fos = new FileOutputStream(file);
-            VFSUtils.copyStream(input, fos);
-            fos.close();
-
-            locationURL = file.toURI().toURL();
-         }
-         catch (IOException ex)
-         {
-            throw new BundleException("Cannot store bundle from input stream", ex);
-         }
+         locationURL = getBundleStorageLocation(input);
       }
       else
       {
@@ -657,6 +637,28 @@
       return install(root, location, false);
    }
 
+   private URL getBundleStorageLocation(InputStream input) throws BundleException
+   {
+      try
+      {
+         BundleStoragePlugin plugin = getPlugin(BundleStoragePlugin.class);
+         String path = plugin.getStorageDir(getSystemBundle()).getCanonicalPath();
+
+         // [TODO] do properly
+         File file = new File(path + "/bundle-" + System.currentTimeMillis() + ".jar");
+         FileOutputStream fos = new FileOutputStream(file);
+         VFSUtils.copyStream(input, fos);
+         fos.close();
+
+         URL locationURL = file.toURI().toURL();
+         return locationURL;
+      }
+      catch (IOException ex)
+      {
+         throw new BundleException("Cannot store bundle from input stream", ex);
+      }
+   }
+
    /**
     * Install a bundle from a virtual file.
     *  
@@ -665,7 +667,7 @@
     * @return the bundle state
     * @throws BundleException for any error
     */
-   public AbstractBundleState installBundle(VirtualFile root) throws BundleException
+   public OSGiBundleState installBundle(VirtualFile root) throws BundleException
    {
       return install(root, root.toString(), false);
    }
@@ -673,7 +675,7 @@
    /*
     * Installs a bundle from the given virtual file.
     */
-   private AbstractBundleState install(VirtualFile root, String location, boolean autoStart) throws BundleException
+   private OSGiBundleState install(VirtualFile root, String location, boolean autoStart) throws BundleException
    {
       if (location == null)
          throw new IllegalArgumentException("Null location");
@@ -693,7 +695,7 @@
     * @return the bundle state
     * @throws BundleException for any error
     */
-   public AbstractBundleState installBundle(Deployment dep) throws BundleException
+   public OSGiBundleState installBundle(Deployment dep) throws BundleException
    {
       // Create the deployment and deploy it
       try
@@ -731,38 +733,98 @@
       }
    }
 
-   private URL getLocationURL(String location) throws BundleException
+   /**
+    * Updates a bundle from an InputStream. 
+    */
+   public void updateBundle(OSGiBundleState bundleState, InputStream in) throws BundleException
    {
-      // Try location as URL
-      URL url = null;
-      try
+      // If the specified InputStream is null, the Framework must create the InputStream from which to read the updated bundle by interpreting, 
+      // in an implementation dependent manner, this bundle's Bundle-UpdateLocation Manifest header, if present, or this bundle's original location.
+      URL updateURL = bundleState.getOSGiMetaData().getBundleUpdateLocation();
+      if (in == null)
       {
-         url = new URL(location);
+         try
+         {
+            if (updateURL == null)
+               throw new IllegalStateException("Cannot obtain Bundle-UpdateLocation for: " + bundleState);
+
+            in = updateURL.openStream();
+         }
+         catch (IOException ex)
+         {
+            throw new BundleException("Cannot obtain update input stream for: " + bundleState, ex);
+         }
       }
-      catch (MalformedURLException e)
+
+      // If this bundle's state is ACTIVE, it must be stopped before the update and started after the update successfully completes. 
+      boolean activeBeforeUpdate = (bundleState.getState() == Bundle.ACTIVE);
+
+      // If this bundle's state is UNINSTALLED then an IllegalStateException is thrown. 
+      if (bundleState.getState() == Bundle.UNINSTALLED)
+         throw new IllegalStateException("Bundle already uninstalled: " + this);
+
+      // If this bundle has exported any packages that are imported by another bundle, these packages must not be updated. 
+      // Instead, the previous package version must remain exported until the PackageAdmin.refreshPackages method has been 
+      // has been called or the Framework is relaunched. 
+
+      // If this bundle's state is ACTIVE, STARTING  or STOPPING, this bundle is stopped as described in the Bundle.stop method. 
+      // If Bundle.stop throws an exception, the exception is rethrown terminating the update.
+      if (bundleState.getState() == Bundle.ACTIVE || bundleState.getState() == Bundle.STARTING || bundleState.getState() == Bundle.STOPPING)
       {
-         // ignore
+         stopBundle(bundleState);
       }
 
-      // Try location as File
-      if (url == null)
+      // The updated version of this bundle is read from the input stream and installed. 
+      // If the Framework is unable to install the updated version of this bundle, the original version of this bundle must be restored 
+      // and a BundleException must be thrown after completion of the remaining steps.
+      String location = (updateURL != null ? updateURL.toExternalForm() : bundleState.getCanonicalName() + "/update");
+      OSGiBundleState updatedBundleState = null;
+      BundleException throwAfterUpdate = null;
+      try
       {
-         try
+         URL storageLocation = getBundleStorageLocation(in);
+         VirtualFile root = VFS.getRoot(storageLocation);
+
+         BundleInfo info = BundleInfo.createBundleInfo(root, location);
+         Deployment dep = DeploymentFactory.createDeployment(info);
+         dep.addAttachment(OSGiBundleState.class, bundleState);
+         dep.setBundleUpdate(true);
+         dep.setAutoStart(false);
+
+         updatedBundleState = installBundle(dep);
+      }
+      catch (Exception ex)
+      {
+         if (ex instanceof BundleException)
+            throwAfterUpdate = (BundleException)ex;
+         else
+            throwAfterUpdate = new BundleException("Cannot install updated bundle from: " + location, ex);
+
+         if (activeBeforeUpdate)
          {
-            File file = new File(location);
-            if (file.exists())
-               url = file.toURI().toURL();
+            startBundle(bundleState);
          }
-         catch (MalformedURLException e)
+      }
+
+      // If the updated version of this bundle was successfully installed, a bundle event of type BundleEvent.UPDATED is fired
+      if (updatedBundleState != null)
+      {
+         FrameworkEventsPlugin plugin = getPlugin(FrameworkEventsPlugin.class);
+         plugin.fireBundleEvent(updatedBundleState, BundleEvent.UPDATED);
+
+         // If this bundle's state was originally ACTIVE, the updated bundle is started as described in the Bundle.start method. 
+         // If Bundle.start throws an exception, a Framework event of type FrameworkEvent.ERROR is fired containing the exception
+         if (activeBeforeUpdate)
          {
-            // ignore
+            startBundle(updatedBundleState);
          }
       }
 
-      if (url == null)
-         throw new BundleException("Unable to handle location=" + location);
-
-      return url;
+      // A BundleException must be thrown after completion of the remaining steps
+      if (throwAfterUpdate != null)
+      {
+         throw throwAfterUpdate;
+      }
    }
 
    /**
@@ -780,16 +842,18 @@
       if (getBundleById(id) == null)
          throw new BundleException(bundleState + " not installed");
 
-      DeploymentUnit unit = bundleState.getDeploymentUnit();
-      try
+      for (DeploymentUnit unit : bundleState.getDeploymentUnits())
       {
-         deployerClient.undeploy(unit.getName());
-         bundleState.modified();
+         try
+         {
+            deployerClient.undeploy(unit.getName());
+            bundleState.modified();
+         }
+         catch (DeploymentException e)
+         {
+            throw new BundleException("Unable to uninstall " + bundleState, e);
+         }
       }
-      catch (DeploymentException e)
-      {
-         throw new BundleException("Unable to uninstall " + bundleState, e);
-      }
    }
 
    /**
@@ -804,8 +868,8 @@
       if (unit == null)
          throw new IllegalArgumentException("Null unit");
 
-      OSGiMetaData osgiMetaData = unit.getAttachment(OSGiMetaData.class);
-      if (osgiMetaData == null)
+      OSGiMetaData metaData = unit.getAttachment(OSGiMetaData.class);
+      if (metaData == null)
       {
          Manifest manifest = unit.getAttachment(Manifest.class);
          // [TODO] we need a mechanism to construct an OSGiMetaData from an easier factory
@@ -815,7 +879,8 @@
          Attributes attributes = manifest.getMainAttributes();
          attributes.put(new Name(Constants.BUNDLE_NAME), unit.getName());
          attributes.put(new Name(Constants.BUNDLE_SYMBOLICNAME), unit.getName());
-         osgiMetaData = new AbstractOSGiMetaData(manifest);
+         metaData = new AbstractOSGiMetaData(manifest);
+         unit.addAttachment(OSGiMetaData.class, metaData);
       }
 
       // The bundle location is not necessarily the bundle root url
@@ -823,8 +888,18 @@
       Deployment dep = unit.getAttachment(Deployment.class);
       String location = (dep != null ? dep.getLocation() : unit.getName());
 
-      OSGiBundleState bundleState = new OSGiBundleState(location, osgiMetaData, unit);
-      addBundle(bundleState);
+      // In case of Bundle.update() the OSGiBundleState should be attached
+      // we add the DeploymentUnit 
+      OSGiBundleState bundleState = (dep != null ? dep.getAttachment(OSGiBundleState.class) : null);
+      if (bundleState != null)
+         bundleState.addDeploymentUnit(unit);
+
+      // Create a new OSGiBundleState and add it to the manager
+      if (bundleState == null)
+      {
+         bundleState = new OSGiBundleState(location, unit);
+         addBundle(bundleState);
+      }
       return bundleState;
    }
 
@@ -867,8 +942,17 @@
       bundleState.setBundleManager(this);
       bundles.add(bundleState);
 
-      bundleState.changeState(Bundle.INSTALLED);
+      // Only fire the INSTALLED event if this is not an update
+      boolean fireEvent = true;
+      if (bundleState instanceof OSGiBundleState)
+      {
+         DeploymentUnit unit = ((OSGiBundleState)bundleState).getDeploymentUnit();
+         Deployment dep = unit.getAttachment(Deployment.class);
+         fireEvent = (dep == null || dep.isBundleUpdate() == false);
+      }
 
+      bundleState.changeState(Bundle.INSTALLED, fireEvent);
+
       // Add the bundle to the resolver
       // Note, plugins are not registered when the system bundle is added 
       ResolverPlugin bundleResolver = getOptionalPlugin(ResolverPlugin.class);
@@ -887,6 +971,8 @@
    private void validateBundle(AbstractBundleState bundleState)
    {
       OSGiMetaData metaData = bundleState.getOSGiMetaData();
+      if (metaData == null)
+         return;
 
       String symbolicName = metaData.getBundleSymbolicName();
       if (symbolicName == null)
@@ -1201,7 +1287,7 @@
          // Resolve all INSTALLED bundles through the PackageAdmin
          PackageAdmin packageAdmin = getPlugin(PackageAdminPlugin.class);
          packageAdmin.resolveBundles(null);
-         
+
          if (bundleState.getState() != Bundle.RESOLVED)
             throw new BundleException("Cannot resolve bundle: " + bundleState);
       }
@@ -1256,7 +1342,7 @@
       // [TODO] If this bundle is in the process of being activated or deactivated then this method must wait for activation or deactivation 
       // to complete before continuing. If this does not occur in a reasonable time, a BundleException is thrown to indicate this bundle 
       // was unable to be stopped.
-      
+
       // [TODO] If the STOP_TRANSIENT option is not set then then set this bundle's persistent autostart setting to to Stopped. 
       // When the Framework is restarted and this bundle's autostart setting is Stopped, this bundle must not be automatically started. 
 
@@ -1269,7 +1355,7 @@
          DeploymentUnit unit = bundleState.getDeploymentUnit();
          deployerClient.change(unit.getName(), DeploymentStages.CLASSLOADER);
          deployerClient.checkComplete(unit.getName());
-         
+
          // The potential BundleException is attached by the OSGiBundleActivatorDeployer
          BundleException stopEx = unit.removeAttachment(BundleException.class);
          if (stopEx != null)
@@ -1282,7 +1368,7 @@
          Throwable cause = ex.getCause();
          if (cause instanceof BundleException)
             throw (BundleException)cause;
-         
+
          throw new BundleException("Error stopping " + bundleState, (cause != null ? cause : ex));
       }
    }
@@ -1847,6 +1933,40 @@
       }
    }
 
+   private URL getLocationURL(String location) throws BundleException
+   {
+      // Try location as URL
+      URL url = null;
+      try
+      {
+         url = new URL(location);
+      }
+      catch (MalformedURLException e)
+      {
+         // ignore
+      }
+
+      // Try location as File
+      if (url == null)
+      {
+         try
+         {
+            File file = new File(location);
+            if (file.exists())
+               url = file.toURI().toURL();
+         }
+         catch (MalformedURLException e)
+         {
+            // ignore
+         }
+      }
+
+      if (url == null)
+         throw new BundleException("Unable to handle location=" + location);
+
+      return url;
+   }
+
    /**
     * Fire a framework error
     * 

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleState.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleState.java	2009-12-17 21:37:53 UTC (rev 97972)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleState.java	2009-12-17 21:38:32 UTC (rev 97973)
@@ -24,7 +24,10 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collections;
 import java.util.Enumeration;
+import java.util.List;
 import java.util.Set;
 import java.util.concurrent.atomic.AtomicLong;
 
@@ -59,8 +62,8 @@
    /** The bundle location */
    private String location;
 
-   /** The deployment unit */
-   private DeploymentUnit unit;
+   /** The list of deployment units */
+   private List<DeploymentUnit> units = new ArrayList<DeploymentUnit>();
 
    /**
     * Create a new BundleState.
@@ -70,22 +73,27 @@
     * @param unit the deployment unit
     * @throws IllegalArgumentException for a null parameter
     */
-   public OSGiBundleState(String location, OSGiMetaData osgiMetaData, DeploymentUnit unit)
+   public OSGiBundleState(String location, DeploymentUnit unit)
    {
-      super(osgiMetaData);
-      
       if (location == null)
          throw new IllegalArgumentException("Null bundle location");
       if (unit == null)
-          throw new IllegalArgumentException("Null deployment unit");
+         throw new IllegalArgumentException("Null deployment unit");
 
-      this.unit = unit;
       this.location = location;
+      this.bundleId = bundleIDGenerator.incrementAndGet();
       
-      this.bundleId = bundleIDGenerator.incrementAndGet();
-      unit.getMutableMetaData().addMetaData(unit, DeploymentUnit.class);
+      addDeploymentUnit(unit);
    }
 
+   @Override
+   public OSGiMetaData getOSGiMetaData()
+   {
+      DeploymentUnit unit = getDeploymentUnit();
+      OSGiMetaData metadata = unit.getAttachment(OSGiMetaData.class);
+      return metadata;
+   }
+
    protected Set<ControllerContext> getRegisteredContexts()
    {
       return getBundleManager().getRegisteredContext(this);
@@ -97,15 +105,41 @@
    }
 
    /**
-    * Get the unit.
+    * Get the DeploymentUnit that was added last.
     * 
-    * @return the unit.
+    * Initially, an OSGiBundleState is associated with just one DeploymentUnit.
+    * A sucessful call to {@link #update()} or its variants pushes an additional
+    * DeploymentUnit to the stack.   
+    * 
+    * @return the unit that corresponds to the last sucessful update.
     */
    public DeploymentUnit getDeploymentUnit()
    {
-      return unit;
+      int index = (units.size() - 1);
+      return units.get(index);
    }
 
+   /**
+    * Add a DeploymentUnit to the list.
+    * 
+    * @see {@link OSGiBundleManager#updateBundle(OSGiBundleState, InputStream)}
+    */
+   void addDeploymentUnit(DeploymentUnit unit)
+   {
+      unit.getMutableMetaData().addMetaData(unit, DeploymentUnit.class);
+      units.add(unit);
+   }
+
+   /**
+    * Get the list of DeploymentUnits.
+    * 
+    * @see {@link OSGiBundleManager#uninstallBundle(OSGiBundleState)}
+    */
+   List<DeploymentUnit> getDeploymentUnits()
+   {
+      return Collections.unmodifiableList(units);
+   }
+
    public String getLocation()
    {
       return location;
@@ -224,11 +258,11 @@
       checkInstalled();
       if (noAdminPermission(AdminPermission.RESOURCE))
          return null;
-      
+
       // [TODO] bundle fragment
       if (resolveBundle() == false)
          return getDeploymentUnit().getResourceLoader().getResource(name);
-      
+
       return getDeploymentUnit().getClassLoader().getResource(name);
    }
 
@@ -242,7 +276,7 @@
       // [TODO] bundle fragment 
       if (resolveBundle() == false)
          return getDeploymentUnit().getResourceLoader().getResources(name);
-      
+
       return getDeploymentUnit().getClassLoader().getResources(name);
    }
 
@@ -293,7 +327,7 @@
 
             // Attach so we can call BundleActivator.stop() on this instance
             BundleActivator bundleActivator = (BundleActivator)result;
-            unit.addAttachment(BundleActivator.class, bundleActivator);
+            getDeploymentUnit().addAttachment(BundleActivator.class, bundleActivator);
 
             bundleActivator.start(getBundleContext());
          }
@@ -303,7 +337,7 @@
 
          changeState(ACTIVE);
       }
-      
+
       // If the BundleActivator is invalid or throws an exception then:
       //   * This bundle's state is set to STOPPING.
       //   * A bundle event of type BundleEvent.STOPPING is fired.
@@ -318,20 +352,20 @@
          // This bundle's state is set to STOPPING
          // A bundle event of type BundleEvent.STOPPING is fired
          changeState(STOPPING);
-         
+
          // Any services registered by this bundle must be unregistered.
          // Any services used by this bundle must be released.
          // Any listeners registered by this bundle must be removed.
          stopInternal();
-         
+
          // This bundle's state is set to RESOLVED
          // A bundle event of type BundleEvent.STOPPED is fired
          destroyBundleContext();
          changeState(RESOLVED);
-         
+
          if (t instanceof BundleException)
             throw (BundleException)t;
-         
+
          throw new BundleException("Cannot start bundle: " + this, t);
       }
    }
@@ -356,21 +390,21 @@
       Throwable rethrow = null;
       if (priorState == Bundle.ACTIVE)
       {
-            BundleActivator bundleActivator = getDeploymentUnit().getAttachment(BundleActivator.class);
-            BundleContext bundleContext = getBundleContext();
-            if (bundleActivator != null && bundleContext != null)
+         BundleActivator bundleActivator = getDeploymentUnit().getAttachment(BundleActivator.class);
+         BundleContext bundleContext = getBundleContext();
+         if (bundleActivator != null && bundleContext != null)
+         {
+            try
             {
-               try
-               {
-                  bundleActivator.stop(bundleContext);
-               }
-               catch (Throwable t)
-               {
-                  rethrow = t;
-               }
+               bundleActivator.stop(bundleContext);
             }
+            catch (Throwable t)
+            {
+               rethrow = t;
+            }
+         }
       }
-      
+
       // Any services registered by this bundle must be unregistered
       getBundleManager().unregisterContexts(this);
 
@@ -393,26 +427,48 @@
       }
 
       // [TODO] Any listeners registered by this bundle must be removed
-      
+
       // If this bundle's state is UNINSTALLED, because this bundle was uninstalled while the 
       // BundleActivator.stop method was running, a BundleException must be thrown
       if (getState() == Bundle.UNINSTALLED)
          throw new BundleException("Bundle uninstalled during activator stop: " + this);
-      
+
       // This bundle's state is set to RESOLVED
       // A bundle event of type BundleEvent.STOPPED is fired
       destroyBundleContext();
       changeState(RESOLVED);
-      
+
       if (rethrow != null)
          throw new BundleException("Error during stop of bundle: " + this, rethrow);
    }
 
+   /**
+    * Updates this bundle. 
+    * 
+    * This method performs the same function as calling update(InputStream) with a null InputStream
+    */
+   public void update() throws BundleException
+   {
+      update(null);
+   }
+
+   /**
+    * Updates this bundle from an InputStream. 
+    */
    public void update(InputStream in) throws BundleException
    {
-      checkAdminPermission(AdminPermission.LIFECYCLE); // [TODO] extension bundles
-      // [TODO] update
-      throw new UnsupportedOperationException("update");
+      checkAdminPermission(AdminPermission.LIFECYCLE);
+      try
+      {
+         getBundleManager().updateBundle(this, in);
+      }
+      catch (Exception ex)
+      {
+         if (ex instanceof BundleException)
+            throw (BundleException)ex;
+
+         throw new BundleException("Cannot update bundle: " + this, ex);
+      }
    }
 
    public void uninstall() throws BundleException
@@ -424,26 +480,26 @@
    @Override
    protected void afterServiceRegistration(OSGiServiceState service)
    {
-      getBundleManager().putContext(service, unit);
+      getBundleManager().putContext(service, getDeploymentUnit());
    }
 
    @Override
    protected void beforeServiceUnregistration(OSGiServiceState service)
    {
-      getBundleManager().removeContext(service, unit);
+      getBundleManager().removeContext(service, getDeploymentUnit());
    }
 
    public static OSGiBundleState assertBundleState(Bundle bundle)
    {
       if (bundle == null)
          throw new IllegalArgumentException("Null bundle");
-      
+
       if (bundle instanceof OSGiBundleWrapper)
          bundle = ((OSGiBundleWrapper)bundle).getBundleState();
-   
+
       if (bundle instanceof OSGiBundleState == false)
          throw new IllegalArgumentException("Not an OSGiBundleState: " + bundle);
-   
+
       return (OSGiBundleState)bundle;
    }
 }

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiScopeInfo.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiScopeInfo.java	2009-12-17 21:37:53 UTC (rev 97972)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiScopeInfo.java	2009-12-17 21:38:32 UTC (rev 97973)
@@ -74,7 +74,7 @@
       if (scope == null)
          return key;
       Object qualifier = scope.getQualifier();
-      if (qualifier instanceof Class)
+      if (qualifier instanceof Class<?>)
          return key;
 
       Object service = serviceState.getTarget();

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiServiceRegistrationWrapper.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiServiceRegistrationWrapper.java	2009-12-17 21:37:53 UTC (rev 97972)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiServiceRegistrationWrapper.java	2009-12-17 21:38:32 UTC (rev 97973)
@@ -55,7 +55,7 @@
       return serviceState.getReference();
    }
 
-   @SuppressWarnings("unchecked")
+   @SuppressWarnings("rawtypes")
    public void setProperties(Dictionary properties)
    {
       serviceState.setProperties(properties);

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiSystemState.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiSystemState.java	2009-12-17 21:37:53 UTC (rev 97972)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiSystemState.java	2009-12-17 21:38:32 UTC (rev 97973)
@@ -26,9 +26,13 @@
 import java.net.URL;
 import java.util.Enumeration;
 import java.util.Set;
+import java.util.jar.Attributes;
+import java.util.jar.Manifest;
+import java.util.jar.Attributes.Name;
 
 import org.jboss.dependency.spi.ControllerContext;
 import org.jboss.osgi.framework.metadata.OSGiMetaData;
+import org.jboss.osgi.framework.metadata.internal.AbstractOSGiMetaData;
 import org.jboss.osgi.spi.NotImplementedException;
 import org.jboss.util.collection.ConcurrentSet;
 import org.osgi.framework.BundleException;
@@ -46,16 +50,27 @@
 {
    /** The registred contexts */
    private Set<ControllerContext> registered = new ConcurrentSet<ControllerContext>();
+   /** The osgi metadata */
+   private OSGiMetaData osgiMetaData;
 
    /**
     * Create a new OSGiSystemBundle.
-    * @param osgiMetaData the metadata for the system bundle
     */
-   public OSGiSystemState(OSGiMetaData osgiMetaData)
+   public OSGiSystemState()
    {
-      super(osgiMetaData);
+      Manifest manifest = new Manifest();
+      Attributes attributes = manifest.getMainAttributes();
+      attributes.put(new Name(Constants.BUNDLE_NAME), Constants.SYSTEM_BUNDLE_SYMBOLICNAME);
+      attributes.put(new Name(Constants.BUNDLE_SYMBOLICNAME), Constants.SYSTEM_BUNDLE_SYMBOLICNAME);
+      osgiMetaData = new AbstractOSGiMetaData(manifest);
    }
 
+   @Override
+   public OSGiMetaData getOSGiMetaData()
+   {
+      return osgiMetaData;
+   }
+
    protected Set<ControllerContext> getRegisteredContexts()
    {
       return registered;
@@ -161,7 +176,6 @@
       });
    }
 
-   @Override
    public void update() throws BundleException
    {
       final OSGiBundleManager bundleManager = getBundleManager();

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoaderDomain.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoaderDomain.java	2009-12-17 21:37:53 UTC (rev 97972)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoaderDomain.java	2009-12-17 21:38:32 UTC (rev 97973)
@@ -33,7 +33,7 @@
 import org.jboss.classloader.spi.ClassLoaderSystem;
 import org.jboss.classloader.spi.ParentPolicy;
 import org.jboss.classloader.spi.base.BaseClassLoader;
-import org.jboss.classloader.spi.filter.ClassFilter;
+import org.jboss.classloader.spi.filter.ClassFilterUtils;
 import org.jboss.classloader.spi.filter.PackageClassFilter;
 import org.jboss.classloading.spi.vfs.policy.VFSClassLoaderPolicy;
 import org.jboss.osgi.framework.bundle.OSGiBundleManager;
@@ -102,7 +102,7 @@
       classFilter.setIncludeJava(true);
 
       // Setup the domain's parent policy
-      setParentPolicy(new ParentPolicy(classFilter, ClassFilter.NOTHING));
+      setParentPolicy(new ParentPolicy(classFilter, ClassFilterUtils.NOTHING));
 
       // Initialize the configured policy roots
       VirtualFile[] roots = new VirtualFile[classPath.size()];

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/AbstractOSGiBundleStateDeployer.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/AbstractOSGiBundleStateDeployer.java	2009-12-17 21:37:53 UTC (rev 97972)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/AbstractOSGiBundleStateDeployer.java	2009-12-17 21:38:32 UTC (rev 97973)
@@ -21,13 +21,12 @@
 */
 package org.jboss.osgi.framework.deployers;
 
+import org.jboss.deployers.spi.DeploymentException;
 import org.jboss.deployers.spi.deployer.DeploymentStages;
 import org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer;
-import org.jboss.deployers.spi.DeploymentException;
 import org.jboss.deployers.structure.spi.DeploymentUnit;
 import org.jboss.osgi.framework.bundle.OSGiBundleManager;
 import org.jboss.osgi.framework.bundle.OSGiBundleState;
-import org.jboss.osgi.framework.metadata.OSGiMetaData;
 
 /**
  * AbstractOSGiBundleStateDeployer.<p>
@@ -40,12 +39,6 @@
    /** The bundle manager */
    protected OSGiBundleManager bundleManager;
 
-   /**
-    * Create a new BundleStateDeployer.
-    *
-    * @param bundleManager the bundleManager
-    * @throws IllegalArgumentException for a null bundle manager
-    */
    protected AbstractOSGiBundleStateDeployer(OSGiBundleManager bundleManager)
    {
       if (bundleManager == null)

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleStateRemoveDeployer.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleStateRemoveDeployer.java	2009-12-17 21:37:53 UTC (rev 97972)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleStateRemoveDeployer.java	2009-12-17 21:38:32 UTC (rev 97973)
@@ -21,7 +21,6 @@
 */
 package org.jboss.osgi.framework.deployers;
 
-import org.jboss.deployers.spi.DeploymentException;
 import org.jboss.deployers.structure.spi.DeploymentUnit;
 import org.jboss.osgi.framework.bundle.OSGiBundleManager;
 import org.jboss.osgi.framework.bundle.OSGiBundleState;

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/metadata/ManifestParser.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/metadata/ManifestParser.java	2009-12-17 21:37:53 UTC (rev 97972)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/metadata/ManifestParser.java	2009-12-17 21:38:32 UTC (rev 97973)
@@ -100,7 +100,7 @@
     * @param list the list to create
     * @param packages whether to create packages
     */
-   @SuppressWarnings("unchecked")
+   @SuppressWarnings({ "rawtypes", "unchecked" })
    public static void parse(String header, List list, boolean packages)
    {
       if (header == null)

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/metadata/internal/AbstractOSGiMetaData.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/metadata/internal/AbstractOSGiMetaData.java	2009-12-17 21:37:53 UTC (rev 97972)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/metadata/internal/AbstractOSGiMetaData.java	2009-12-17 21:38:32 UTC (rev 97973)
@@ -103,7 +103,7 @@
       super(manifest);
    }
 
-   @SuppressWarnings("unchecked")
+   @SuppressWarnings({ "unchecked", "rawtypes" })
    public Dictionary<String, String> getHeaders(String locale)
    {
       // TODO localisation

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/metadata/internal/OSGiParameters.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/metadata/internal/OSGiParameters.java	2009-12-17 21:37:53 UTC (rev 97972)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/metadata/internal/OSGiParameters.java	2009-12-17 21:38:32 UTC (rev 97973)
@@ -92,7 +92,7 @@
       return get(key, creator, null);
    }
 
-   @SuppressWarnings("unchecked")
+   @SuppressWarnings({ "unchecked", "rawtypes" })
    protected <T> T get(String key, ValueCreator<T> creator, T defaultValue)
    {
       T value = (T)cachedAttributes.get(key);

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/util/CaseInsensitiveDictionary.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/util/CaseInsensitiveDictionary.java	2009-12-17 21:37:53 UTC (rev 97972)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/util/CaseInsensitiveDictionary.java	2009-12-17 21:38:32 UTC (rev 97973)
@@ -73,7 +73,7 @@
       return delegate.elements();
    }
 
-   @SuppressWarnings("unchecked")
+   @SuppressWarnings({ "unchecked", "rawtypes" })
    public synchronized boolean equals(Object obj)
    {
       if (obj == this)

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/util/NoFilter.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/util/NoFilter.java	2009-12-17 21:37:53 UTC (rev 97972)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/util/NoFilter.java	2009-12-17 21:38:32 UTC (rev 97973)
@@ -44,7 +44,7 @@
    {
    }
 
-   @SuppressWarnings("unchecked")
+   @SuppressWarnings("rawtypes")
    public boolean match(Dictionary dictionary)
    {
       return true;
@@ -55,7 +55,7 @@
       return true;
    }
 
-   @SuppressWarnings("unchecked")
+   @SuppressWarnings("rawtypes")
    public boolean matchCase(Dictionary dictionary)
    {
       return true;

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/FrameworkTest.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/FrameworkTest.java	2009-12-17 21:37:53 UTC (rev 97972)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/FrameworkTest.java	2009-12-17 21:38:32 UTC (rev 97973)
@@ -169,16 +169,19 @@
 
    protected Bundle installBundle(String location) throws BundleException
    {
-      BundleContext context = getBundleManager().getSystemContext();
-      return context.installBundle(location);
+      return getBundleManager().installBundle(location, null).getBundleInternal();
    }
 
    protected Bundle installBundle(String location, InputStream instream) throws BundleException
    {
-      BundleContext context = getBundleManager().getSystemContext();
-      return context.installBundle(location, instream);
+      return getBundleManager().installBundle(location, instream).getBundleInternal();
    }
    
+   protected Bundle installBundle(VirtualFile bundleFile) throws BundleException
+   {
+      return getBundleManager().installBundle(bundleFile).getBundleInternal();
+   }
+   
    /**
     * Remove a bundle 
     * 
@@ -195,12 +198,12 @@
       return getDelegate().getDeploymentUnit(bundle);
    }
 
-   protected Bundle assembleBundle(String name, String resources, Class<?>... packages) throws Exception
+   protected VirtualFile assembleBundle(String name, String resources, Class<?>... packages) throws Exception
    {
       return getDelegate().assembleBundle(name, new String[] { resources }, packages);
    }
 
-   protected Bundle assembleBundle(String name, String[] resourcePaths, Class<?>... packages) throws Exception
+   protected VirtualFile assembleBundle(String name, String[] resourcePaths, Class<?>... packages) throws Exception
    {
       return getDelegate().assembleBundle(name, resourcePaths, packages);
    }

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/FrameworkTestDelegate.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/FrameworkTestDelegate.java	2009-12-17 21:37:53 UTC (rev 97972)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/FrameworkTestDelegate.java	2009-12-17 21:38:32 UTC (rev 97973)
@@ -217,15 +217,15 @@
       return deploymentUnit;
    }
 
-   public Bundle assembleBundle(String name, String resources, Class<?>... packages) throws Exception
+   public VirtualFile assembleBundle(String name, String resources, Class<?>... packages) throws Exception
    {
       return assembleBundle(name, new String[] { resources }, packages);
    }
 
-   public Bundle assembleBundle(String name, String[] resourcePaths, Class<?>... packages) throws Exception
+   public VirtualFile assembleBundle(String name, String[] resourcePaths, Class<?>... packages) throws Exception
    {
       AssembledDirectory assembledDirectory = createAssembledDirectory(name, "", resourcePaths, packages);
-      return addBundle(assembledDirectory);
+      return assembledDirectory;
    }
 
    public Bundle deployBundle(String name, OSGiMetaData metaData, String resourcePath, Class<?>... packages) throws Exception

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/bundle/BundleLifecycleTestCase.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/bundle/BundleLifecycleTestCase.java	2009-12-17 21:37:53 UTC (rev 97972)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/bundle/BundleLifecycleTestCase.java	2009-12-17 21:38:32 UTC (rev 97973)
@@ -26,7 +26,6 @@
 import org.jboss.test.osgi.FrameworkTest;
 import org.jboss.test.osgi.bundle.support.a.FailOnStartActivator;
 import org.jboss.test.osgi.bundle.support.b.LifecycleService;
-import org.jboss.test.osgi.bundle.support.b.LifecycleServiceActivator;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleException;
 import org.osgi.framework.ServiceReference;
@@ -54,7 +53,7 @@
     */
    public void testServiceBundle() throws Exception
    {
-      Bundle bundleA = assembleBundle("lifecycle-service", "/bundles/lifecycle/simple-service", LifecycleService.class, LifecycleServiceActivator.class);
+      Bundle bundleA = installBundle(assembleBundle("lifecycle-service", "/bundles/lifecycle/simple-service", LifecycleService.class));
       try
       {
          assertBundleState(Bundle.INSTALLED, bundleA.getState());
@@ -77,7 +76,7 @@
     */
    public void testServiceNotAvailable() throws Exception
    {
-      Bundle bundleA = assembleBundle("lifecycle-service", "/bundles/lifecycle/simple-service", LifecycleService.class, LifecycleServiceActivator.class);
+      Bundle bundleA = installBundle(assembleBundle("lifecycle-service", "/bundles/lifecycle/simple-service", LifecycleService.class));
       try
       {
          assertBundleState(Bundle.INSTALLED, bundleA.getState());
@@ -86,7 +85,7 @@
          ServiceReference sref = getSystemBundle().getBundleContext().getServiceReference(LifecycleService.class.getName());
          assertNull("Service not available", sref);
 
-         Bundle bundleB = assembleBundle("lifecycle-failstart", "/bundles/lifecycle/fail-on-start", FailOnStartActivator.class);
+         Bundle bundleB = installBundle(assembleBundle("lifecycle-failstart", "/bundles/lifecycle/fail-on-start", FailOnStartActivator.class));
          try
          {
             assertBundleState(Bundle.INSTALLED, bundleB.getState());
@@ -116,13 +115,13 @@
     */
    public void testServiceAvailable() throws Exception
    {
-      Bundle bundleA = assembleBundle("lifecycle-service", "/bundles/lifecycle/simple-service", LifecycleService.class, LifecycleServiceActivator.class);
+      Bundle bundleA = installBundle(assembleBundle("lifecycle-service", "/bundles/lifecycle/simple-service", LifecycleService.class));
       try
       {
          bundleA.start();
          assertBundleState(Bundle.ACTIVE, bundleA.getState());
 
-         Bundle bundleB = assembleBundle("lifecycle-failstart", "/bundles/lifecycle/fail-on-start", FailOnStartActivator.class);
+         Bundle bundleB = installBundle(assembleBundle("lifecycle-failstart", "/bundles/lifecycle/fail-on-start", FailOnStartActivator.class));
          try
          {
             bundleB.start();
@@ -146,12 +145,12 @@
     */
    public void testServiceMakeAvailable() throws Exception
    {
-      Bundle bundleA = assembleBundle("lifecycle-service", "/bundles/lifecycle/simple-service", LifecycleService.class, LifecycleServiceActivator.class);
+      Bundle bundleA = installBundle(assembleBundle("lifecycle-service", "/bundles/lifecycle/simple-service", LifecycleService.class));
       try
       {
          assertBundleState(Bundle.INSTALLED, bundleA.getState());
          
-         Bundle bundleB = assembleBundle("lifecycle-failstart", "/bundles/lifecycle/fail-on-start", FailOnStartActivator.class);
+         Bundle bundleB = installBundle(assembleBundle("lifecycle-failstart", "/bundles/lifecycle/fail-on-start", FailOnStartActivator.class));
          try
          {
             assertBundleState(Bundle.INSTALLED, bundleB.getState());

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/bundle/BundleUnitTestCase.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/bundle/BundleUnitTestCase.java	2009-12-17 21:37:53 UTC (rev 97972)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/bundle/BundleUnitTestCase.java	2009-12-17 21:38:32 UTC (rev 97973)
@@ -21,13 +21,19 @@
 */
 package org.jboss.test.osgi.bundle;
 
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
 import java.util.Dictionary;
 import java.util.Hashtable;
 import java.util.jar.Attributes;
+import java.util.jar.JarOutputStream;
+import java.util.jar.Manifest;
 
 import junit.framework.Test;
 
 import org.jboss.test.osgi.FrameworkTest;
+import org.jboss.virtual.VFSUtils;
+import org.jboss.virtual.VirtualFile;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.BundleException;
@@ -148,7 +154,37 @@
    
    public void testUpdate() throws Exception
    {
-      // TODO testUpdate
+      VirtualFile assemble1 = assembleBundle("bundle1", "/bundles/update/update-bundle1");
+      VirtualFile assemble2 = assembleBundle("bundle2", "/bundles/update/update-bundle2");
+      
+      Manifest manifest = VFSUtils.getManifest(assemble2);
+      ByteArrayOutputStream baos = new ByteArrayOutputStream();
+      new JarOutputStream(baos, manifest).close();
+      ByteArrayInputStream updateStream = new ByteArrayInputStream(baos.toByteArray());
+      
+      // [JBVFS-130] VFSUtils.temp(assembledDirectory) cannot create tmp dir
+      // assemble2 = VFSUtils.temp(assemble2);
+      
+      Bundle bundle = installBundle(assemble1);
+      try
+      {
+         int beforeCount = getBundleManager().getBundles().size();
+         
+         bundle.start();
+         assertBundleState(Bundle.ACTIVE, bundle.getState());
+         assertEquals("Bundle-Version", "1.0.0", bundle.getHeaders().get(Constants.BUNDLE_VERSION));
+         
+         bundle.update(updateStream);
+         assertBundleState(Bundle.ACTIVE, bundle.getState());
+         assertEquals("Bundle-Version", "1.0.1", bundle.getHeaders().get(Constants.BUNDLE_VERSION));
+         
+         int afterCount = getBundleManager().getBundles().size();
+         assertEquals("Bundle count", beforeCount, afterCount);
+      }
+      finally
+      {
+         bundle.uninstall();
+      }
    }
    
    public void testUninstall() throws Exception
@@ -158,10 +194,10 @@
    
    public void testSingleton() throws Exception
    {
-      Bundle bundle1 = assembleBundle("bundle1", "/bundles/singleton/singleton1");
+      Bundle bundle1 = installBundle(assembleBundle("bundle10", "/bundles/singleton/singleton1"));
       try
       {
-         Bundle bundle2 = assembleBundle("bundle2", "/bundles/singleton/singleton2");
+         Bundle bundle2 = installBundle(assembleBundle("bundle20", "/bundles/singleton/singleton2"));
          uninstall(bundle2);
          fail("Should not be here!");
       }
@@ -177,10 +213,10 @@
    
    public void testNotSingleton() throws Exception
    {
-      Bundle bundle1 = assembleBundle("bundle1", "/bundles/singleton/singleton1");
+      Bundle bundle1 = installBundle(assembleBundle("bundle1", "/bundles/singleton/singleton1"));
       try
       {
-         Bundle bundle2 = assembleBundle("not-singleton", "/bundles/singleton/not-singleton");
+         Bundle bundle2 = installBundle(assembleBundle("not-singleton", "/bundles/singleton/not-singleton"));
          try
          {
             assertEquals(bundle1.getSymbolicName(), bundle2.getSymbolicName());
@@ -196,7 +232,7 @@
       }
    }
    
-   @SuppressWarnings("unchecked")
+   @SuppressWarnings({ "rawtypes", "unchecked" })
    public void testGetHeaders() throws Exception
    {
       // TODO case insensistive

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/bundle/SystemBundleUnitTestCase.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/bundle/SystemBundleUnitTestCase.java	2009-12-17 21:37:53 UTC (rev 97972)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/bundle/SystemBundleUnitTestCase.java	2009-12-17 21:38:32 UTC (rev 97973)
@@ -88,7 +88,7 @@
       }
    }
    
-   @SuppressWarnings("unchecked")
+   @SuppressWarnings({ "unchecked", "rawtypes" })
    public void testGetHeaders() throws Exception
    {
       Dictionary expected = new Hashtable();

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/classloader/ClassLoaderDomainUnitTestCase.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/classloader/ClassLoaderDomainUnitTestCase.java	2009-12-17 21:37:53 UTC (rev 97972)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/classloader/ClassLoaderDomainUnitTestCase.java	2009-12-17 21:38:32 UTC (rev 97973)
@@ -33,7 +33,7 @@
 import org.jboss.classloader.spi.ClassLoaderPolicy;
 import org.jboss.classloader.spi.ClassLoaderSystem;
 import org.jboss.classloader.spi.ParentPolicy;
-import org.jboss.classloader.spi.filter.ClassFilter;
+import org.jboss.classloader.spi.filter.ClassFilterUtils;
 import org.jboss.classloader.spi.filter.PackageClassFilter;
 import org.jboss.classloading.spi.vfs.policy.VFSClassLoaderPolicy;
 import org.jboss.logging.Logger;
@@ -74,7 +74,7 @@
       PackageClassFilter classFilter = PackageClassFilter.createPackageClassFilterFromString(filteredPackages);
       classFilter.setIncludeJava(true);
 
-      domain.setParentPolicy(new ParentPolicy(classFilter, ClassFilter.NOTHING));
+      domain.setParentPolicy(new ParentPolicy(classFilter, ClassFilterUtils.NOTHING));
 
       URL coreURL = new OSGiTestHelper().getTestArchiveURL("bundles/org.osgi.core.jar");
       VirtualFile coreVF = VFS.createNewRoot(coreURL);

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/classloader/RequireBundleUnitTestCase.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/classloader/RequireBundleUnitTestCase.java	2009-12-17 21:37:53 UTC (rev 97972)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/classloader/RequireBundleUnitTestCase.java	2009-12-17 21:38:32 UTC (rev 97973)
@@ -50,12 +50,12 @@
 
    public void testSimpleRequireBundle() throws Exception
    {
-      Bundle bundle1 = assembleBundle("bundleA", "/bundles/classloader/bundleA", A.class);
+      Bundle bundle1 = installBundle(assembleBundle("bundleA", "/bundles/classloader/bundleA", A.class));
       try
       {
          bundle1.start();
          assertLoadClass(bundle1, A.class);
-         Bundle bundle2 = assembleBundle("simplerequirebundleA", "/bundles/classloader/simplerequirebundleA", B.class);
+         Bundle bundle2 = installBundle(assembleBundle("simplerequirebundleA", "/bundles/classloader/simplerequirebundleA", B.class));
          try
          {
             bundle2.start();
@@ -75,12 +75,12 @@
    
    public void testSimpleRequireBundleFails() throws Exception
    {
-      Bundle bundle1 = assembleBundle("bundleA", "/bundles/classloader/bundleA", A.class);
+      Bundle bundle1 = installBundle(assembleBundle("bundleA", "/bundles/classloader/bundleA", A.class));
       try
       {
          bundle1.start();
          assertLoadClass(bundle1, A.class);
-         Bundle bundle2 = assembleBundle("simplerequirebundlefails", "/bundles/classloader/simplerequirebundlefails", B.class);
+         Bundle bundle2 = installBundle(assembleBundle("simplerequirebundlefails", "/bundles/classloader/simplerequirebundlefails", B.class));
          try
          {
             bundle2.start();
@@ -103,12 +103,12 @@
    
    public void testVersionRequireBundle() throws Exception
    {
-      Bundle bundle1 = assembleBundle("bundleA", "/bundles/classloader/bundleA", A.class);
+      Bundle bundle1 = installBundle(assembleBundle("bundleA", "/bundles/classloader/bundleA", A.class));
       try
       {
          bundle1.start();
          assertLoadClass(bundle1, A.class);
-         Bundle bundle2 = assembleBundle("versionrequirebundleA", "/bundles/classloader/versionrequirebundleA", B.class);
+         Bundle bundle2 = installBundle(assembleBundle("versionrequirebundleA", "/bundles/classloader/versionrequirebundleA", B.class));
          try
          {
             bundle2.start();
@@ -128,12 +128,12 @@
    
    public void testVersionRequireBundleFails() throws Exception
    {
-      Bundle bundle1 = assembleBundle("bundleA", "/bundles/classloader/bundleA", A.class);
+      Bundle bundle1 = installBundle(assembleBundle("bundleA", "/bundles/classloader/bundleA", A.class));
       try
       {
          bundle1.start();
          assertLoadClass(bundle1, A.class);
-         Bundle bundle2 = assembleBundle("versionrequirebundlefails", "/bundles/classloader/versionrequirebundlefails", B.class);
+         Bundle bundle2 = installBundle(assembleBundle("versionrequirebundlefails", "/bundles/classloader/versionrequirebundlefails", B.class));
          try
          {
             bundle2.start();
@@ -156,12 +156,12 @@
    
    public void testOptionalRequireBundle() throws Exception
    {
-      Bundle bundle1 = assembleBundle("bundleA", "/bundles/classloader/bundleA", A.class);
+      Bundle bundle1 = installBundle(assembleBundle("bundleA", "/bundles/classloader/bundleA", A.class));
       try
       {
          bundle1.start();
          assertLoadClass(bundle1, A.class);
-         Bundle bundle2 = assembleBundle("optionalrequirebundleA", "/bundles/classloader/optionalrequirebundleA", B.class);
+         Bundle bundle2 = installBundle(assembleBundle("optionalrequirebundleA", "/bundles/classloader/optionalrequirebundleA", B.class));
          try
          {
             bundle2.start();
@@ -181,12 +181,12 @@
    
    public void testOptionalRequireBundleFails() throws Exception
    {
-      Bundle bundle1 = assembleBundle("bundleA", "/bundles/classloader/bundleA", A.class);
+      Bundle bundle1 = installBundle(assembleBundle("bundleA", "/bundles/classloader/bundleA", A.class));
       try
       {
          bundle1.start();
          assertLoadClass(bundle1, A.class);
-         Bundle bundle2 = assembleBundle("optionalrequirebundlefails", "/bundles/classloader/optionalrequirebundlefails", B.class);
+         Bundle bundle2 = installBundle(assembleBundle("optionalrequirebundlefails", "/bundles/classloader/optionalrequirebundlefails", B.class));
          try
          {
             bundle2.start();
@@ -210,7 +210,7 @@
       //Bundle-Version: 1.0.0
       //Bundle-SymbolicName: org.jboss.test.osgi.classloader.bundleA;test=x
       //Export-Package: org.jboss.test.osgi.classloader.support.a;version=1.0.0;test=x
-      Bundle bundle1 = assembleBundle("bundleA", "/bundles/classloader/bundleA", A.class);
+      Bundle bundle1 = installBundle(assembleBundle("bundleA", "/bundles/classloader/bundleA", A.class));
       
       try
       {
@@ -221,7 +221,7 @@
          //Bundle-SymbolicName: org.jboss.test.osgi.classloader.bundleB
          //Require-Bundle: org.jboss.test.osgi.classloader.bundleA;visibility:=reexport
          //Export-Package: org.jboss.test.osgi.classloader.support.b
-         Bundle bundle2 = assembleBundle("reexportrequirebundleA", "/bundles/classloader/reexportrequirebundleA", B.class);
+         Bundle bundle2 = installBundle(assembleBundle("reexportrequirebundleA", "/bundles/classloader/reexportrequirebundleA", B.class));
          
          try
          {
@@ -232,7 +232,7 @@
             //Bundle-Name: BundleC
             //Bundle-SymbolicName: org.jboss.test.osgi.classloader.bundleC
             //Require-Bundle: org.jboss.test.osgi.classloader.bundleB
-            Bundle bundle3 = assembleBundle("reexportrequirebundleB", "/bundles/classloader/reexportrequirebundleB");
+            Bundle bundle3 = installBundle(assembleBundle("reexportrequirebundleB", "/bundles/classloader/reexportrequirebundleB"));
             
             try
             {
@@ -257,18 +257,18 @@
    
    public void testNoReExportRequireBundle() throws Exception
    {
-      Bundle bundle1 = assembleBundle("bundleA", "/bundles/classloader/bundleA", A.class);
+      Bundle bundle1 = installBundle(assembleBundle("bundleA", "/bundles/classloader/bundleA", A.class));
       try
       {
          bundle1.start();
          assertLoadClass(bundle1, A.class);
-         Bundle bundle2 = assembleBundle("noreexportrequirebundleA", "/bundles/classloader/noreexportrequirebundleA", B.class);
+         Bundle bundle2 = installBundle(assembleBundle("noreexportrequirebundleA", "/bundles/classloader/noreexportrequirebundleA", B.class));
          try
          {
             bundle2.start();
             assertLoadClass(bundle2, A.class, bundle1);
             assertLoadClass(bundle2, B.class, bundle2);
-            Bundle bundle3 = assembleBundle("reexportrequirebundleB", "/bundles/classloader/reexportrequirebundleB");
+            Bundle bundle3 = installBundle(assembleBundle("reexportrequirebundleB", "/bundles/classloader/reexportrequirebundleB"));
             try
             {
                assertLoadClassFail(bundle3, A.class);
@@ -292,12 +292,12 @@
    
    public void testAttributeRequireBundle() throws Exception
    {
-      Bundle bundle1 = assembleBundle("bundleA", "/bundles/classloader/bundleA", A.class);
+      Bundle bundle1 = installBundle(assembleBundle("bundleA", "/bundles/classloader/bundleA", A.class));
       try
       {
          bundle1.start();
          assertLoadClass(bundle1, A.class);
-         Bundle bundle2 = assembleBundle("attributerequirebundleA", "/bundles/classloader/attributerequirebundleA", B.class);
+         Bundle bundle2 = installBundle(assembleBundle("attributerequirebundleA", "/bundles/classloader/attributerequirebundleA", B.class));
          try
          {
             bundle2.start();
@@ -317,12 +317,12 @@
    
    public void testAttributeRequireBundleFails() throws Exception
    {
-      Bundle bundle1 = assembleBundle("bundleA", "/bundles/classloader/bundleA", A.class);
+      Bundle bundle1 = installBundle(assembleBundle("bundleA", "/bundles/classloader/bundleA", A.class));
       try
       {
          bundle1.start();
          assertLoadClass(bundle1, A.class);
-         Bundle bundle2 = assembleBundle("attributerequirebundlefails", "/bundles/classloader/attributerequirebundlefails", B.class);
+         Bundle bundle2 = installBundle(assembleBundle("attributerequirebundlefails", "/bundles/classloader/attributerequirebundlefails", B.class));
          try
          {
             bundle2.start();

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/compendium/PackageAdminTestCase.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/compendium/PackageAdminTestCase.java	2009-12-17 21:37:53 UTC (rev 97972)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/compendium/PackageAdminTestCase.java	2009-12-17 21:38:32 UTC (rev 97973)
@@ -54,7 +54,7 @@
 
    public void testGetBudleFromClass() throws Exception
    {
-      Bundle bundle = assembleBundle("smoke-assembled", "/bundles/smoke/smoke-assembled", PA.class);
+      Bundle bundle = installBundle(assembleBundle("smoke-assembled", "/bundles/smoke/smoke-assembled", PA.class));
       try
       {
          bundle.start();
@@ -68,7 +68,7 @@
          Bundle notFound = pa.getBundle(getClass());
          assertNull(notFound);
 
-         Bundle other = assembleBundle("simple", "/bundles/simple/simple-bundle1", Other.class);
+         Bundle other = installBundle(assembleBundle("simple", "/bundles/simple/simple-bundle1", Other.class));
          try
          {
             other.start();

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/resolver/ResolverSmokeTest.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/resolver/ResolverSmokeTest.java	2009-12-17 21:37:53 UTC (rev 97972)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/resolver/ResolverSmokeTest.java	2009-12-17 21:38:32 UTC (rev 97973)
@@ -97,9 +97,10 @@
          }
          
          PackageAdminPlugin packageAdmin = bundleManager.getPlugin(PackageAdminPlugin.class);
-         boolean allResoved = packageAdmin.resolveBundles(null);
+         packageAdmin.resolveBundles(null);
+         
+         System.out.println("[JBOSGI-151] Cannot resolve circular dependencies");
          //assertTrue("All bundles resolved", allResoved);
-         System.out.println("[JBOSGI-151] Cannot resolve circular dependencies");
       }
       finally
       {

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/service/GetServiceReferencesUnitTestCase.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/service/GetServiceReferencesUnitTestCase.java	2009-12-17 21:37:53 UTC (rev 97972)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/service/GetServiceReferencesUnitTestCase.java	2009-12-17 21:38:32 UTC (rev 97973)
@@ -57,7 +57,7 @@
 
    public void testGetServiceReferences() throws Exception
    {
-      Bundle bundle1 = assembleBundle("simple1", "/bundles/simple/simple-bundle1", A.class);
+      Bundle bundle1 = installBundle(assembleBundle("simple1", "/bundles/simple/simple-bundle1", A.class));
       try
       {
          bundle1.start();
@@ -174,7 +174,7 @@
    
    public void assertGetServiceReferencesNotAssignable(String className) throws Exception
    {
-      Bundle bundle1 = assembleBundle("simple1", "/bundles/simple/simple-bundle1", A.class);
+      Bundle bundle1 = installBundle(assembleBundle("simple1", "/bundles/simple/simple-bundle1", A.class));
       try
       {
          bundle1.start();
@@ -191,7 +191,7 @@
          ServiceReference reference1 = registration1.getReference();
          assertNotNull(reference1);
 
-         Bundle bundle2 = assembleBundle("simple2", "/bundles/simple/simple-bundle2", A.class);
+         Bundle bundle2 = installBundle(assembleBundle("simple2", "/bundles/simple/simple-bundle2", A.class));
          try
          {
             bundle2.start();
@@ -272,7 +272,7 @@
 
    public void assertGetServiceReferencesAssignable(String className) throws Exception
    {
-      Bundle bundle1 = assembleBundle("service2", "/bundles/service/service-bundle2", A.class);
+      Bundle bundle1 = installBundle(assembleBundle("service2", "/bundles/service/service-bundle2", A.class));
       try
       {
          bundle1.start();
@@ -289,7 +289,7 @@
          ServiceReference reference1 = registration1.getReference();
          assertNotNull(reference1);
 
-         Bundle bundle2 = assembleBundle("service1", "/bundles/service/service-bundle1");
+         Bundle bundle2 = installBundle(assembleBundle("service1", "/bundles/service/service-bundle1"));
          try
          {
             bundle2.start();
@@ -362,7 +362,7 @@
    {
       String className = A.class.getName();
       
-      Bundle bundle1 = assembleBundle("service2", "/bundles/service/service-bundle2", A.class);
+      Bundle bundle1 = installBundle(assembleBundle("service2", "/bundles/service/service-bundle2", A.class));
       try
       {
          bundle1.start();
@@ -382,7 +382,7 @@
          ServiceReference reference1 = registration1.getReference();
          assertNotNull(reference1);
 
-         Bundle bundle2 = assembleBundle("service1", "/bundles/service/service-bundle1");
+         Bundle bundle2 = installBundle(assembleBundle("service1", "/bundles/service/service-bundle1"));
          try
          {
             bundle2.start();
@@ -470,7 +470,7 @@
       String className = A.class.getName();
       String wrongClassName = B.class.getName();
       
-      Bundle bundle1 = assembleBundle("simple1", "/bundles/simple/simple-bundle1", A.class);
+      Bundle bundle1 = installBundle(assembleBundle("simple1", "/bundles/simple/simple-bundle1", A.class));
       try
       {
          bundle1.start();

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/service/ServiceMixUnitTestCase.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/service/ServiceMixUnitTestCase.java	2009-12-17 21:37:53 UTC (rev 97972)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/service/ServiceMixUnitTestCase.java	2009-12-17 21:38:32 UTC (rev 97973)
@@ -66,7 +66,7 @@
       Deployment bean = deployBean("beanA", A.class);
       try
       {
-         Bundle bundle1 = assembleBundle("simple1", "/bundles/service/service-bundle1");
+         Bundle bundle1 = installBundle(assembleBundle("simple1", "/bundles/service/service-bundle1"));
          try
          {
             bundle1.start();
@@ -134,7 +134,7 @@
       {
          KernelControllerContext kcc = getControllerContext("C", null);
 
-         Bundle bundle1 = assembleBundle("simple2", "/bundles/service/service-bundle3");
+         Bundle bundle1 = installBundle(assembleBundle("simple2", "/bundles/service/service-bundle3"));
          try
          {
             bundle1.start();
@@ -191,7 +191,7 @@
       {
          KernelControllerContext kcc = getControllerContext("C", null);
 
-         Bundle bundle1 = assembleBundle("simple2", "/bundles/service/service-bundle3");
+         Bundle bundle1 = installBundle(assembleBundle("simple2", "/bundles/service/service-bundle3"));
          try
          {
             bundle1.start();
@@ -249,7 +249,7 @@
       Deployment bean = addBean("beanA", C.class, bmd, A.class);
       try
       {
-         Bundle bundle1 = assembleBundle("simple2", "/bundles/service/service-bundle3");
+         Bundle bundle1 = installBundle(assembleBundle("simple2", "/bundles/service/service-bundle3"));
          try
          {
             bundle1.start();
@@ -287,6 +287,7 @@
       }
    }
 
+   @SuppressWarnings("rawtypes")
    public void testServiceFactoryInjection() throws Throwable
    {
       BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder("C1", C.class.getName());
@@ -301,7 +302,7 @@
          Deployment bean2 = addBean("beanA2", null, bmd);
          try
          {
-            Bundle bundle1 = assembleBundle("simple2", "/bundles/service/service-bundle4");
+            Bundle bundle1 = installBundle(assembleBundle("simple2", "/bundles/service/service-bundle4"));
             try
             {
                bundle1.start();
@@ -358,6 +359,7 @@
       }
    }
 
+   @SuppressWarnings("rawtypes")
    public void testServiceFactoryMix() throws Throwable
    {
       BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder("C1", C.class.getName());
@@ -366,7 +368,7 @@
       Deployment bean1 = addBean("beanA1", C.class, bmd, A.class, D.class);
       try
       {
-            Bundle bundle1 = assembleBundle("simple2", "/bundles/service/service-bundle4");
+            Bundle bundle1 = installBundle(assembleBundle("simple2", "/bundles/service/service-bundle4"));
             try
             {
                bundle1.start();
@@ -463,7 +465,7 @@
       Deployment bean = addBean("beanA", A.class);
       try
       {
-         Bundle bundle1 = assembleBundle("simple2", "/bundles/service/service-bundle1");
+         Bundle bundle1 = installBundle(assembleBundle("simple2", "/bundles/service/service-bundle1"));
          try
          {
             bundle1.start();

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/service/ServiceReferenceUnitTestCase.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/service/ServiceReferenceUnitTestCase.java	2009-12-17 21:37:53 UTC (rev 97972)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/service/ServiceReferenceUnitTestCase.java	2009-12-17 21:38:32 UTC (rev 97973)
@@ -374,7 +374,7 @@
    
    public void testIsAssignableToErrors() throws Exception
    {
-      Bundle bundle = assembleBundle("simple1", "/bundles/simple/simple-bundle1", A.class);
+      Bundle bundle = installBundle(assembleBundle("simple1", "/bundles/simple/simple-bundle1", A.class));
       try
       {
          bundle.start();
@@ -415,7 +415,7 @@
 
    public void testNotAssignableTo() throws Exception
    {
-      Bundle bundle = assembleBundle("simple1", "/bundles/simple/simple-bundle1", A.class);
+      Bundle bundle = installBundle(assembleBundle("simple1", "/bundles/simple/simple-bundle1", A.class));
       try
       {
          bundle.start();
@@ -428,7 +428,7 @@
          ServiceReference reference = registration.getReference();
          assertNotNull(reference);
 
-         Bundle bundle2 = assembleBundle("simple2", "/bundles/simple/simple-bundle2", A.class);
+         Bundle bundle2 = installBundle(assembleBundle("simple2", "/bundles/simple/simple-bundle2", A.class));
          try
          {
             assertFalse(reference.isAssignableTo(bundle2, A.class.getName()));
@@ -454,7 +454,7 @@
       //Bundle-Name: Service2
       //Bundle-SymbolicName: org.jboss.test.osgi.service2
       //Export-Package: org.jboss.test.osgi.service.support.a
-      Bundle bundle2 = assembleBundle("service2", "/bundles/service/service-bundle2", A.class);
+      Bundle bundle2 = installBundle(assembleBundle("service2", "/bundles/service/service-bundle2", A.class));
       
       try
       {
@@ -465,7 +465,7 @@
          //Bundle-Name: Service1
          //Bundle-SymbolicName: org.jboss.test.osgi.service1
          //Import-Package: org.jboss.test.osgi.service.support.a
-         Bundle bundle1 = assembleBundle("service1", "/bundles/service/service-bundle1");
+         Bundle bundle1 = installBundle(assembleBundle("service1", "/bundles/service/service-bundle1"));
          
          try
          {

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/smoke/OSGiSmokeTestCase.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/smoke/OSGiSmokeTestCase.java	2009-12-17 21:37:53 UTC (rev 97972)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/smoke/OSGiSmokeTestCase.java	2009-12-17 21:38:32 UTC (rev 97973)
@@ -73,7 +73,7 @@
 
    public void testAssembled() throws Exception
    {
-      Bundle bundle = assembleBundle("smoke-assembled", "/bundles/smoke/smoke-assembled", A.class);
+      Bundle bundle = installBundle(assembleBundle("smoke-assembled", "/bundles/smoke/smoke-assembled", A.class));
       try
       {
          testBundle(bundle, "smoke-assembled", Bundle.INSTALLED);

Copied: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/update (from rev 97968, projects/jboss-osgi/projects/runtime/framework/branches/tdiesler/src/test/resources/bundles/update)

Copied: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/update/update-bundle1 (from rev 97968, projects/jboss-osgi/projects/runtime/framework/branches/tdiesler/src/test/resources/bundles/update/update-bundle1)

Copied: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/update/update-bundle1/META-INF (from rev 97968, projects/jboss-osgi/projects/runtime/framework/branches/tdiesler/src/test/resources/bundles/update/update-bundle1/META-INF)

Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/update/update-bundle1/META-INF/MANIFEST.MF
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/branches/tdiesler/src/test/resources/bundles/update/update-bundle1/META-INF/MANIFEST.MF	2009-12-17 20:24:15 UTC (rev 97968)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/update/update-bundle1/META-INF/MANIFEST.MF	2009-12-17 21:38:32 UTC (rev 97973)
@@ -1,4 +0,0 @@
-Manifest-Version: 1.0
-Bundle-SymbolicName: update-bundle1
-Bundle-Version: 1.0.0
-

Copied: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/update/update-bundle1/META-INF/MANIFEST.MF (from rev 97968, projects/jboss-osgi/projects/runtime/framework/branches/tdiesler/src/test/resources/bundles/update/update-bundle1/META-INF/MANIFEST.MF)
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/update/update-bundle1/META-INF/MANIFEST.MF	                        (rev 0)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/update/update-bundle1/META-INF/MANIFEST.MF	2009-12-17 21:38:32 UTC (rev 97973)
@@ -0,0 +1,4 @@
+Manifest-Version: 1.0
+Bundle-SymbolicName: update-bundle1
+Bundle-Version: 1.0.0
+

Copied: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/update/update-bundle2 (from rev 97968, projects/jboss-osgi/projects/runtime/framework/branches/tdiesler/src/test/resources/bundles/update/update-bundle2)

Copied: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/update/update-bundle2/META-INF (from rev 97968, projects/jboss-osgi/projects/runtime/framework/branches/tdiesler/src/test/resources/bundles/update/update-bundle2/META-INF)

Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/update/update-bundle2/META-INF/MANIFEST.MF
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/branches/tdiesler/src/test/resources/bundles/update/update-bundle2/META-INF/MANIFEST.MF	2009-12-17 20:24:15 UTC (rev 97968)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/update/update-bundle2/META-INF/MANIFEST.MF	2009-12-17 21:38:32 UTC (rev 97973)
@@ -1,3 +0,0 @@
-Manifest-Version: 1.0
-Bundle-SymbolicName: update-bundle2
-Bundle-Version: 1.0.1

Copied: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/update/update-bundle2/META-INF/MANIFEST.MF (from rev 97968, projects/jboss-osgi/projects/runtime/framework/branches/tdiesler/src/test/resources/bundles/update/update-bundle2/META-INF/MANIFEST.MF)
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/update/update-bundle2/META-INF/MANIFEST.MF	                        (rev 0)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/update/update-bundle2/META-INF/MANIFEST.MF	2009-12-17 21:38:32 UTC (rev 97973)
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Bundle-SymbolicName: update-bundle2
+Bundle-Version: 1.0.1




More information about the jboss-cvs-commits mailing list