[jboss-osgi-commits] JBoss-OSGI SVN: r101139 - in projects/jboss-osgi: projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle and 9 other directories.

jboss-osgi-commits at lists.jboss.org jboss-osgi-commits at lists.jboss.org
Thu Feb 18 21:24:10 EST 2010


Author: thomas.diesler at jboss.com
Date: 2010-02-18 21:24:08 -0500 (Thu, 18 Feb 2010)
New Revision: 101139

Added:
   projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleStateCreateDeployer.java
   projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleStateInstallDeployer.java
Removed:
   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/OSGiBundleStateAddDeployer.java
   projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleStateRemoveDeployer.java
Modified:
   projects/jboss-osgi/projects/runtime/framework/trunk/src/etc/osgitck/jboss-osgi-bootstrap.xml
   projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/ControllerContextPluginImpl.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/deployers/AbstractOSGiClassLoadingDeployer.java
   projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/service/internal/LifecycleInterceptorServiceImpl.java
   projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/DeployersTest.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/service/support/LazyBundle.java
   projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bootstrap/jboss-osgi-bootstrap.xml
   projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-jbossmc.xml
   projects/jboss-osgi/trunk/distribution/installer/src/main/resources/runtime/server/conf/jboss-osgi-bootstrap.xml
   projects/jboss-osgi/trunk/testsuite/example/src/test/resources/META-INF/jboss-osgi-bootstrap.xml
   projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/META-INF/jboss-osgi-bootstrap.xml
Log:
[JBOSGI-292] PackageAdmin cannot obtain classloading metadata
Cleanup BundleState attachment to the DeploymentUnit

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/etc/osgitck/jboss-osgi-bootstrap.xml
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/etc/osgitck/jboss-osgi-bootstrap.xml	2010-02-18 23:54:47 UTC (rev 101138)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/etc/osgitck/jboss-osgi-bootstrap.xml	2010-02-19 02:24:08 UTC (rev 101139)
@@ -149,12 +149,10 @@
 
   <!-- OSGI Deployment -->
   <bean name="OSGiBundleActivatorDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleActivatorDeployer" />
-  <bean name="OSGiBundleStateAddDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleStateAddDeployer">
+  <bean name="OSGiBundleStateCreateDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleStateCreateDeployer">
     <constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
   </bean>
-  <bean name="OSGiBundleStateRemoveDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleStateRemoveDeployer">
-    <constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
-  </bean>
+  <bean name="OSGiBundleStateInstallDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleStateInstallDeployer"/>
   <bean name="OSGiContextTrackerDeployer" class="org.jboss.osgi.framework.deployers.OSGiContextTrackerDeployer" />
   <bean name="OSGiManifestParsingDeployer" class="org.jboss.osgi.framework.deployers.OSGiManifestParsingDeployer" />
   <bean name="OSGiNativeCodeMetaDataDeployer" class="org.jboss.osgi.framework.deployers.OSGiNativeCodeMetaDataDeployer" />

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/ControllerContextPluginImpl.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/ControllerContextPluginImpl.java	2010-02-18 23:54:47 UTC (rev 101138)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/ControllerContextPluginImpl.java	2010-02-19 02:24:08 UTC (rev 101139)
@@ -119,7 +119,7 @@
       {
          synchronized (unit)
          {
-            OSGiBundleState bundleState = unit.getAttachment(OSGiBundleState.class);
+            OSGiBundleState bundleState = (OSGiBundleState)unit.getAttachment(AbstractBundleState.class);
             if (bundleState == null)
             {
                OSGiMetaData osgiMetaData = unit.getAttachment(OSGiMetaData.class);

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-02-18 23:54:47 UTC (rev 101138)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java	2010-02-19 02:24:08 UTC (rev 101139)
@@ -45,6 +45,7 @@
 import java.util.concurrent.Executors;
 import java.util.concurrent.atomic.AtomicInteger;
 
+import org.jboss.classloading.spi.metadata.ClassLoadingMetaData;
 import org.jboss.dependency.spi.ControllerContext;
 import org.jboss.dependency.spi.ControllerState;
 import org.jboss.deployers.client.spi.DeployerClient;
@@ -787,11 +788,9 @@
    }
 
    /**
-    * Add a deployment
+    * Add a deployment to the manager, which creates the bundle state.
     * 
-    * @param unit the deployment unit
-    * @return the bundle state
-    * @throws IllegalArgumentException for a null parameter
+    * Note, the bundle state is not yet added to the manager.
     */
    public AbstractBundleState addDeployment(DeploymentUnit unit)
    {
@@ -803,7 +802,7 @@
       if (absBundle != null)
       {
          // Add the DeploymentUnit to the OSGiBundleState
-         AbstractDeployedBundleState depBundle = (AbstractDeployedBundleState)absBundle;
+         OSGiBundleState depBundle = (OSGiBundleState)absBundle;
          depBundle.addDeploymentUnit(unit);
       }
       else
@@ -825,11 +824,13 @@
       }
 
       // Attach the abstract bundle state
+      unit.addAttachment(AbstractBundleState.class, absBundle);
+      
       if (absBundle.isFragment())
          unit.addAttachment(OSGiFragmentState.class, (OSGiFragmentState)absBundle);
       else
          unit.addAttachment(OSGiBundleState.class, (OSGiBundleState)absBundle);
-
+      
       return absBundle;
    }
 
@@ -852,6 +853,9 @@
       if (bundleState instanceof OSGiBundleState)
       {
          DeploymentUnit unit = ((AbstractDeployedBundleState)bundleState).getDeploymentUnit();
+         if (unit.getAttachment(ClassLoadingMetaData.class) == null)
+            throw new IllegalStateException("Cannot obtain ClassLoadingMetaData");
+            
          Deployment dep = unit.getAttachment(Deployment.class);
          if (dep != null && dep.isBundleUpdate())
             return;

Deleted: 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-02-18 23:54:47 UTC (rev 101138)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/AbstractOSGiBundleStateDeployer.java	2010-02-19 02:24:08 UTC (rev 101139)
@@ -1,58 +0,0 @@
-/*
-* 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;
-
-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.structure.spi.DeploymentUnit;
-import org.jboss.osgi.framework.bundle.AbstractBundleState;
-import org.jboss.osgi.framework.bundle.OSGiBundleManager;
-
-/**
- * AbstractOSGiBundleStateDeployer.<p>
- *
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @author <a href="ales.justin at jboss.org">Ales Justin</a>
- */
-public abstract class AbstractOSGiBundleStateDeployer extends AbstractRealDeployer
-{
-   /** The bundle manager */
-   protected OSGiBundleManager bundleManager;
-
-   protected AbstractOSGiBundleStateDeployer(OSGiBundleManager bundleManager)
-   {
-      if (bundleManager == null)
-         throw new IllegalArgumentException("Null bundle manager");
-
-      setOutput(AbstractBundleState.class);
-      setStage(DeploymentStages.POST_PARSE);
-      setTopLevelOnly(true);
-
-      this.bundleManager = bundleManager;
-   }
-
-   protected void internalDeploy(DeploymentUnit unit) throws DeploymentException
-   {
-      // do nothing
-   }
-}
\ No newline at end of file

Modified: 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	2010-02-18 23:54:47 UTC (rev 101138)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/AbstractOSGiClassLoadingDeployer.java	2010-02-19 02:24:08 UTC (rev 101139)
@@ -142,9 +142,6 @@
 
       unit.addAttachment(ClassLoadingMetaData.class, classLoadingMetaData);
       
-      // Add the bundle to the manager when the class loading metadata is available
-      bundleManager.addBundle(bundleState);
-
       // AnnotationMetaDataDeployer.ANNOTATION_META_DATA_COMPLETE
       unit.addAttachment("org.jboss.deployment.annotation.metadata.complete", Boolean.TRUE);
 
@@ -152,15 +149,4 @@
       if (factory != null)
          unit.addAttachment(ClassLoaderFactory.class, factory);
    }
-
-   @Override
-   public void undeploy(DeploymentUnit unit, OSGiMetaData deployment)
-   {
-      AbstractBundleState bundleState = unit.getAttachment(AbstractBundleState.class);
-      if (bundleState != null)
-      {
-         OSGiBundleManager bundleManager = bundleState.getBundleManager();
-         bundleManager.removeBundle(bundleState);
-      }
-   }
 }

Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleStateAddDeployer.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleStateAddDeployer.java	2010-02-18 23:54:47 UTC (rev 101138)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleStateAddDeployer.java	2010-02-19 02:24:08 UTC (rev 101139)
@@ -1,66 +0,0 @@
-/*
-* 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;
-
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.spi.deployer.DeploymentStages;
-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.metadata.OSGiMetaData;
-
-/**
- * OSGiBundleStateDeployer.<p>
- * 
- * This deployer creates a bundle state object for all top level bundle deployments.
- * 
- * Note: undeploy/remove part is in a separate deployer.
- *
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @author <a href="ales.justin at jboss.org">Ales Justin</a>
- * @version $Revision: 1.1 $
- */
-public class OSGiBundleStateAddDeployer extends AbstractOSGiBundleStateDeployer
-{
-   /**
-    * Create a new BundleStateDeployer.
-    * 
-    * @param bundleManager the bundleManager
-    * @throws IllegalArgumentException for a null bundle manager
-    */
-   public OSGiBundleStateAddDeployer(OSGiBundleManager bundleManager)
-   {
-      super(bundleManager);
-      setInput(OSGiMetaData.class);
-   }
-
-   @Override
-   protected void internalDeploy(DeploymentUnit unit) throws DeploymentException
-   {
-      // [TODO] look at manifest headers and persistent state for this
-      unit.setRequiredStage(DeploymentStages.DESCRIBE);
-      
-      // Attach the abstract bundle state
-      AbstractBundleState bundleState = bundleManager.addDeployment(unit);
-      unit.addAttachment(AbstractBundleState.class, bundleState);
-   }
-}

Copied: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleStateCreateDeployer.java (from rev 101138, 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/OSGiBundleStateCreateDeployer.java	                        (rev 0)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleStateCreateDeployer.java	2010-02-19 02:24:08 UTC (rev 101139)
@@ -0,0 +1,66 @@
+/*
+* 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;
+
+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.structure.spi.DeploymentUnit;
+import org.jboss.osgi.framework.bundle.AbstractBundleState;
+import org.jboss.osgi.framework.bundle.OSGiBundleManager;
+import org.jboss.osgi.framework.metadata.OSGiMetaData;
+
+/**
+ * A deployer that creates the bundle state through the bundle manager.
+ * 
+ * The bundle is not yet INSTALLED.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @author <a href="ales.justin at jboss.org">Ales Justin</a>
+ * @author Thomas.Diesler at jboss.com
+ */
+public class OSGiBundleStateCreateDeployer extends AbstractRealDeployer
+{
+   /** The bundle manager */
+   protected OSGiBundleManager bundleManager;
+
+   public OSGiBundleStateCreateDeployer(OSGiBundleManager bundleManager)
+   {
+      if (bundleManager == null)
+         throw new IllegalArgumentException("Null bundle manager");
+      this.bundleManager = bundleManager;
+
+      setInput(OSGiMetaData.class);
+      setOutput(AbstractBundleState.class);
+      setStage(DeploymentStages.POST_PARSE);
+      setTopLevelOnly(true);
+   }
+
+   @Override
+   public void internalDeploy(DeploymentUnit unit) throws DeploymentException
+   {
+      unit.setRequiredStage(DeploymentStages.DESCRIBE);
+      
+      // Create the bundle state
+      bundleManager.addDeployment(unit);
+   }
+}
\ No newline at end of file

Added: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleStateInstallDeployer.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleStateInstallDeployer.java	                        (rev 0)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleStateInstallDeployer.java	2010-02-19 02:24:08 UTC (rev 101139)
@@ -0,0 +1,65 @@
+/*
+* 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;
+
+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.bundle.OSGiBundleManager;
+
+/**
+ * A deployer that adds the bundle state to the bundle manager.
+ * 
+ * This causes the bundle to get INSTALLED.
+ *
+ * @author Thomas.Diesler at jboss.com
+ * @since 19-Feb-2010
+ */
+public class OSGiBundleStateInstallDeployer extends AbstractSimpleRealDeployer<AbstractBundleState>
+{
+   public OSGiBundleStateInstallDeployer()
+   {
+      super(AbstractBundleState.class);
+      addInput(ClassLoadingMetaData.class);
+      setStage(DeploymentStages.POST_PARSE);
+      setTopLevelOnly(true);
+   }
+
+   @Override
+   public void deploy(DeploymentUnit unit, AbstractBundleState bundleState) throws DeploymentException
+   {
+      // Add the bundle to the manager when it is metadata complete
+      OSGiBundleManager bundleManager = bundleState.getBundleManager();
+      bundleManager.addBundle(bundleState);
+   }
+
+   @Override
+   public void undeploy(DeploymentUnit unit, AbstractBundleState bundleState)
+   {
+      // Remove the bundle from the manager
+      OSGiBundleManager bundleManager = bundleState.getBundleManager();
+      bundleManager.removeBundle(bundleState);
+   }
+}
\ No newline at end of file

Deleted: 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-02-18 23:54:47 UTC (rev 101138)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleStateRemoveDeployer.java	2010-02-19 02:24:08 UTC (rev 101139)
@@ -1,56 +0,0 @@
-/*
-* 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;
-
-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.metadata.OSGiMetaData;
-
-/**
- * This deployer removes any osgi state bundle from manager.
- *
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @author <a href="ales.justin at jboss.org">Ales Justin</a>
- */
-public class OSGiBundleStateRemoveDeployer extends AbstractOSGiBundleStateDeployer
-{
-   /**
-    * Create a new BundleStateDeployer.
-    *
-    * @param bundleManager the bundleManager
-    * @throws IllegalArgumentException for a null bundle manager
-    */
-   public OSGiBundleStateRemoveDeployer(OSGiBundleManager bundleManager)
-   {
-      super(bundleManager);
-      addInput(OSGiMetaData.class);
-   }
-
-   @Override
-   protected void internalUndeploy(DeploymentUnit unit)
-   {
-      AbstractBundleState bundleState = unit.getAttachment(AbstractBundleState.class);
-      if (bundleState != null)
-         bundleManager.removeBundle(bundleState);
-   }
-}
\ No newline at end of file

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/service/internal/LifecycleInterceptorServiceImpl.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/service/internal/LifecycleInterceptorServiceImpl.java	2010-02-18 23:54:47 UTC (rev 101138)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/service/internal/LifecycleInterceptorServiceImpl.java	2010-02-19 02:24:08 UTC (rev 101139)
@@ -67,8 +67,8 @@
          {
             long bundleId = bundle.getBundleId();
             AbstractDeployedBundleState bundleState = (AbstractDeployedBundleState)getBundleManager().getBundleById(bundleId);
-            if (bundle == null)
-               throw new IllegalStateException("Cannot obtain bundle for: " + bundle);
+            if (bundleState == null)
+               throw new IllegalStateException("Cannot obtain bundleState for: " + bundle);
 
             VFSDeploymentUnit unit = (VFSDeploymentUnit)bundleState.getDeploymentUnit();
             InvocationContext inv = unit.getAttachment(InvocationContext.class);

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/DeployersTest.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/DeployersTest.java	2010-02-18 23:54:47 UTC (rev 101138)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/DeployersTest.java	2010-02-19 02:24:08 UTC (rev 101139)
@@ -25,10 +25,9 @@
 import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
 import org.jboss.deployers.client.spi.Deployment;
 import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.osgi.framework.bundle.AbstractBundleState;
 import org.jboss.virtual.AssembledDirectory;
 import org.jboss.virtual.VirtualFile;
-import org.jboss.osgi.framework.bundle.AbstractDeployedBundleState;
-import org.jboss.osgi.framework.bundle.OSGiBundleState;
 import org.osgi.framework.Bundle;
 
 /**
@@ -140,7 +139,7 @@
 
    protected Bundle getBundle(DeploymentUnit unit) throws Exception
    {
-      AbstractDeployedBundleState bundle = unit.getAttachment(OSGiBundleState.class);
+      AbstractBundleState bundle = unit.getAttachment(AbstractBundleState.class);
       assertNotNull(bundle);
       return bundle.getBundleInternal();
    }

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	2010-02-18 23:54:47 UTC (rev 101138)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/FrameworkTestDelegate.java	2010-02-19 02:24:08 UTC (rev 101139)
@@ -286,7 +286,7 @@
       try
       {
          DeploymentUnit unit = deployerStructure.getDeploymentUnit(deployment.getName());
-         AbstractDeployedBundleState bundleState = unit.getAttachment(OSGiBundleState.class);
+         AbstractBundleState bundleState = unit.getAttachment(AbstractBundleState.class);
          if (bundleState == null)
             throw new IllegalStateException("Unable to determine bundle state for " + deployment.getName());
 

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/service/support/LazyBundle.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/service/support/LazyBundle.java	2010-02-18 23:54:47 UTC (rev 101138)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/service/support/LazyBundle.java	2010-02-19 02:24:08 UTC (rev 101139)
@@ -26,8 +26,7 @@
 import java.lang.reflect.Proxy;
 
 import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.osgi.framework.bundle.AbstractDeployedBundleState;
-import org.jboss.osgi.framework.bundle.OSGiBundleState;
+import org.jboss.osgi.framework.bundle.AbstractBundleState;
 import org.osgi.framework.Bundle;
 
 /**
@@ -61,7 +60,7 @@
       {
          if (bundle == null)
          {
-            AbstractDeployedBundleState bundle = unit.getAttachment(OSGiBundleState.class);
+            AbstractBundleState bundle = unit.getAttachment(AbstractBundleState.class);
             if (bundle == null)
                throw new IllegalArgumentException("No such OSGiBundleState attachment: " + unit);
             this.bundle = bundle.getBundleInternal();                        

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bootstrap/jboss-osgi-bootstrap.xml
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bootstrap/jboss-osgi-bootstrap.xml	2010-02-18 23:54:47 UTC (rev 101138)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bootstrap/jboss-osgi-bootstrap.xml	2010-02-19 02:24:08 UTC (rev 101139)
@@ -160,12 +160,10 @@
 
   <!-- OSGI Deployment -->
   <bean name="OSGiBundleActivatorDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleActivatorDeployer" />
-  <bean name="OSGiBundleStateAddDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleStateAddDeployer">
+  <bean name="OSGiBundleStateCreateDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleStateCreateDeployer">
     <constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
   </bean>
-  <bean name="OSGiBundleStateRemoveDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleStateRemoveDeployer">
-    <constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
-  </bean>
+  <bean name="OSGiBundleStateInstallDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleStateInstallDeployer"/>
   <bean name="OSGiContextTrackerDeployer" class="org.jboss.osgi.framework.deployers.OSGiContextTrackerDeployer" />
   <bean name="OSGiManifestParsingDeployer" class="org.jboss.osgi.framework.deployers.OSGiManifestParsingDeployer" />
   <bean name="OSGiNativeCodeMetaDataDeployer" class="org.jboss.osgi.framework.deployers.OSGiNativeCodeMetaDataDeployer" />

Modified: projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-jbossmc.xml
===================================================================
--- projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-jbossmc.xml	2010-02-18 23:54:47 UTC (rev 101138)
+++ projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-jbossmc.xml	2010-02-19 02:24:08 UTC (rev 101139)
@@ -171,12 +171,10 @@
   </bean>
 
   <bean name="OSGiBundleActivatorDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleActivatorDeployer" />
-  <bean name="OSGiBundleStateAddDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleStateAddDeployer">
+  <bean name="OSGiBundleStateCreateDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleStateCreateDeployer">
     <constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
   </bean>
-  <bean name="OSGiBundleStateRemoveDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleStateRemoveDeployer">
-    <constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
-  </bean>
+  <bean name="OSGiBundleStateInstallDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleStateInstallDeployer"/>
   <bean name="OSGiBundleStructure" class="org.jboss.osgi.deployer.BundleStructureDeployer" />
   <bean name="OSGiContextTrackerDeployer" class="org.jboss.osgi.framework.deployers.OSGiContextTrackerDeployer" />
   <bean name="OSGiManifestParsingDeployer" class="org.jboss.osgi.framework.deployers.OSGiManifestParsingDeployer" />

Modified: projects/jboss-osgi/trunk/distribution/installer/src/main/resources/runtime/server/conf/jboss-osgi-bootstrap.xml
===================================================================
--- projects/jboss-osgi/trunk/distribution/installer/src/main/resources/runtime/server/conf/jboss-osgi-bootstrap.xml	2010-02-18 23:54:47 UTC (rev 101138)
+++ projects/jboss-osgi/trunk/distribution/installer/src/main/resources/runtime/server/conf/jboss-osgi-bootstrap.xml	2010-02-19 02:24:08 UTC (rev 101139)
@@ -202,12 +202,10 @@
 
   <!-- OSGI Deployment -->
   <bean name="OSGiBundleActivatorDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleActivatorDeployer" />
-  <bean name="OSGiBundleStateAddDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleStateAddDeployer">
+  <bean name="OSGiBundleStateCreateDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleStateCreateDeployer">
     <constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
   </bean>
-  <bean name="OSGiBundleStateRemoveDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleStateRemoveDeployer">
-    <constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
-  </bean>
+  <bean name="OSGiBundleStateInstallDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleStateInstallDeployer"/>
   <bean name="OSGiContextTrackerDeployer" class="org.jboss.osgi.framework.deployers.OSGiContextTrackerDeployer" />
   <bean name="OSGiManifestParsingDeployer" class="org.jboss.osgi.framework.deployers.OSGiManifestParsingDeployer" />
   <bean name="OSGiNativeCodeMetaDataDeployer" class="org.jboss.osgi.framework.deployers.OSGiNativeCodeMetaDataDeployer" />

Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/resources/META-INF/jboss-osgi-bootstrap.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/resources/META-INF/jboss-osgi-bootstrap.xml	2010-02-18 23:54:47 UTC (rev 101138)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/resources/META-INF/jboss-osgi-bootstrap.xml	2010-02-19 02:24:08 UTC (rev 101139)
@@ -185,12 +185,10 @@
 
   <!-- OSGI Deployment -->
   <bean name="OSGiBundleActivatorDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleActivatorDeployer" />
-  <bean name="OSGiBundleStateAddDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleStateAddDeployer">
+  <bean name="OSGiBundleStateCreateDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleStateCreateDeployer">
     <constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
   </bean>
-  <bean name="OSGiBundleStateRemoveDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleStateRemoveDeployer">
-    <constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
-  </bean>
+  <bean name="OSGiBundleStateInstallDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleStateInstallDeployer"/>
   <bean name="OSGiContextTrackerDeployer" class="org.jboss.osgi.framework.deployers.OSGiContextTrackerDeployer" />
   <bean name="OSGiManifestParsingDeployer" class="org.jboss.osgi.framework.deployers.OSGiManifestParsingDeployer" />
   <bean name="OSGiNativeCodeMetaDataDeployer" class="org.jboss.osgi.framework.deployers.OSGiNativeCodeMetaDataDeployer" />

Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/META-INF/jboss-osgi-bootstrap.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/META-INF/jboss-osgi-bootstrap.xml	2010-02-18 23:54:47 UTC (rev 101138)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/META-INF/jboss-osgi-bootstrap.xml	2010-02-19 02:24:08 UTC (rev 101139)
@@ -159,12 +159,10 @@
 
   <!-- OSGI Deployment -->
   <bean name="OSGiBundleActivatorDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleActivatorDeployer" />
-  <bean name="OSGiBundleStateAddDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleStateAddDeployer">
+  <bean name="OSGiBundleStateCreateDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleStateCreateDeployer">
     <constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
   </bean>
-  <bean name="OSGiBundleStateRemoveDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleStateRemoveDeployer">
-    <constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
-  </bean>
+  <bean name="OSGiBundleStateInstallDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleStateInstallDeployer"/>
   <bean name="OSGiContextTrackerDeployer" class="org.jboss.osgi.framework.deployers.OSGiContextTrackerDeployer" />
   <bean name="OSGiManifestParsingDeployer" class="org.jboss.osgi.framework.deployers.OSGiManifestParsingDeployer" />
   <bean name="OSGiNativeCodeMetaDataDeployer" class="org.jboss.osgi.framework.deployers.OSGiNativeCodeMetaDataDeployer" />



More information about the jboss-osgi-commits mailing list