[jboss-cvs] JBossAS SVN: r93030 - in projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins: facade/bundle and 2 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Aug 31 10:25:44 EDT 2009


Author: thomas.diesler at jboss.com
Date: 2009-08-31 10:25:43 -0400 (Mon, 31 Aug 2009)
New Revision: 93030

Modified:
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/deployers/bundle/OSGiBundleActivatorDeployer.java
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiBundleState.java
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/plugins/FrameworkEventsPluginImpl.java
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/service/MicrocontainerServiceImpl.java
Log:
Required fixes for blueprint example test

Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/deployers/bundle/OSGiBundleActivatorDeployer.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/deployers/bundle/OSGiBundleActivatorDeployer.java	2009-08-31 13:21:57 UTC (rev 93029)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/deployers/bundle/OSGiBundleActivatorDeployer.java	2009-08-31 14:25:43 UTC (rev 93030)
@@ -43,15 +43,15 @@
    }
 
    @Override
-   public void deploy(DeploymentUnit unit, OSGiBundleState deployment) throws DeploymentException
+   public void deploy(DeploymentUnit unit, OSGiBundleState bundleState) throws DeploymentException
    {
       try
       {
-         deployment.startInternal();
+         bundleState.startInternal();
       }
       catch (Throwable t)
       {
-         throw DeploymentException.rethrowAsDeploymentException("Error starting bundle: " + deployment, t);
+         throw DeploymentException.rethrowAsDeploymentException("Error starting bundle: " + bundleState, t);
       }
    }
 

Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiBundleState.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiBundleState.java	2009-08-31 13:21:57 UTC (rev 93029)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiBundleState.java	2009-08-31 14:25:43 UTC (rev 93030)
@@ -283,14 +283,20 @@
    /**
     * Start internal
     * 
-    * [TODO] Start Level Service & START_TRANSIENT? [TODO] START_ACTIVATION_POLICY [TODO] LAZY_ACTIVATION [TODO] locks [TODO] options
+    * [TODO] Start Level Service & START_TRANSIENT? 
+    * [TODO] START_ACTIVATION_POLICY 
+    * [TODO] LAZY_ACTIVATION 
+    * [TODO] locks 
+    * [TODO] options
     * 
     * @throws Throwable for any error
     */
    public void startInternal() throws Throwable
    {
+      // Bundle extenders catch the STARTING event and might expect a valid context
+      createBundleContext();
       changeState(STARTING);
-      createBundleContext();
+      
       try
       {
          OSGiMetaData metaData = getOSGiMetaData();

Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/plugins/FrameworkEventsPluginImpl.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/plugins/FrameworkEventsPluginImpl.java	2009-08-31 13:21:57 UTC (rev 93029)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/plugins/FrameworkEventsPluginImpl.java	2009-08-31 14:25:43 UTC (rev 93030)
@@ -37,6 +37,7 @@
 import org.jboss.osgi.plugins.facade.bundle.OSGiBundleManager;
 import org.jboss.osgi.plugins.facade.bundle.OSGiServiceState;
 import org.jboss.osgi.plugins.filter.NoFilter;
+import org.jboss.osgi.spi.util.ConstantsHelper;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleEvent;
 import org.osgi.framework.BundleListener;
@@ -236,6 +237,7 @@
          // Expose the wrapper not the state itself
          bundle = assertBundle(bundle);
          BundleEvent event = new BundleEvent(type, bundle);
+         String typeName = ConstantsHelper.bundleEvent(event.getType());
 
          // Synchronous listeners first
          for (Entry<Bundle, List<BundleListener>> entry : bundleListeners.entrySet())
@@ -249,7 +251,7 @@
                }
                catch (Throwable t)
                {
-                  log.warn("Error while firing bundle event: " + event.getType() + " for bundle " + bundle, t);
+                  log.warn("Error while firing bundle event: " + typeName + " for bundle " + bundle, t);
                }
             }
          }
@@ -268,7 +270,7 @@
                   }
                   catch (Throwable t)
                   {
-                     log.warn("Error while firing bundle event: " + event.getType() + " for bundle " + this, t);
+                     log.warn("Error while firing bundle event: " + typeName + " for bundle " + this, t);
                   }
                }
             }

Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/service/MicrocontainerServiceImpl.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/service/MicrocontainerServiceImpl.java	2009-08-31 13:21:57 UTC (rev 93029)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/service/MicrocontainerServiceImpl.java	2009-08-31 14:25:43 UTC (rev 93030)
@@ -28,6 +28,7 @@
 import java.util.List;
 
 import javax.management.MBeanServer;
+import javax.management.StandardMBean;
 
 import org.jboss.dependency.plugins.AbstractController;
 import org.jboss.dependency.plugins.AbstractControllerContext;
@@ -43,7 +44,6 @@
 import org.jboss.osgi.spi.service.MicrocontainerService;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceReference;
-import org.osgi.framework.ServiceRegistration;
 import org.osgi.util.tracker.ServiceTracker;
 
 /**
@@ -56,7 +56,6 @@
 {
    private Kernel kernel;
    private BundleContext sysContext;
-   private ServiceRegistration registration;
 
    public MicrocontainerServiceImpl(Kernel kernel, BundleContext sysContext)
    {
@@ -72,9 +71,10 @@
    public void start()
    {
       installKernelBean(BEAN_SYSTEM_BUNDLE_CONTEXT, sysContext);
-      registration = sysContext.registerService(MicrocontainerService.class.getName(), this, null);
+      sysContext.registerService(MicrocontainerService.class.getName(), this, null);
 
       // Track the MBeanServer and register this service as an MBean 
+      final MicrocontainerServiceMBean mbeanImpl = this;
       ServiceTracker tracker = new ServiceTracker(sysContext, MBeanServer.class.getName(), null)
       {
          @Override
@@ -84,7 +84,8 @@
             try
             {
                installKernelBean(BEAN_MBEAN_SERVER, server);
-               server.registerMBean(this, MBEAN_MICROCONTAINER_SERVICE);
+               StandardMBean mbean = new StandardMBean(mbeanImpl, MicrocontainerServiceMBean.class);
+               server.registerMBean(mbean, MBEAN_MICROCONTAINER_SERVICE);
             }
             catch (Exception ex)
             {
@@ -96,12 +97,6 @@
       tracker.open();
    }
 
-   public void stop()
-   {
-      if (registration != null)
-         registration.unregister();
-   }
-
    public Object getRegisteredBean(String beanName)
    {
       ControllerContext context = kernel.getController().getInstalledContext(beanName);




More information about the jboss-cvs-commits mailing list