[jboss-cvs] JBossAS SVN: r95913 - in projects/jboss-osgi: projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/internal and 3 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Nov 2 07:18:47 EST 2009


Author: thomas.diesler at jboss.com
Date: 2009-11-02 07:18:46 -0500 (Mon, 02 Nov 2009)
New Revision: 95913

Added:
   projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/AbstractMicrocontainerDeployerService.java
   projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerDeployerServiceImpl.java
   projects/jboss-osgi/projects/runtime/jbossas/trunk/src/main/java/org/jboss/osgi/integration/jbossas/MicrocontainerDeployerServiceBean.java
Modified:
   projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/AbstractMicrocontainerService.java
   projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceActivator.java
   projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceImpl.java
   projects/jboss-osgi/projects/runtime/jbossas/trunk/pom.xml
   projects/jboss-osgi/projects/runtime/jbossas/trunk/src/main/java/org/jboss/osgi/integration/jbossas/MicrocontainerServiceBean.java
   projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-equinox.xml
   projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-felix.xml
   projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-jbossmc.xml
   projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jta-service-jboss-beans.xml
   projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/microcontainer-service-jboss-beans.xml
Log:
Separate mc service from deployer service integration

Added: projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/AbstractMicrocontainerDeployerService.java
===================================================================
--- projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/AbstractMicrocontainerDeployerService.java	                        (rev 0)
+++ projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/AbstractMicrocontainerDeployerService.java	2009-11-02 12:18:46 UTC (rev 95913)
@@ -0,0 +1,175 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.microcontainer;
+
+//$Id$
+
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.deployers.client.spi.main.MainDeployer;
+import org.jboss.deployers.spi.attachments.MutableAttachments;
+import org.jboss.deployers.vfs.spi.client.VFSDeployment;
+import org.jboss.deployers.vfs.spi.client.VFSDeploymentFactory;
+import org.jboss.osgi.deployment.deployer.AbstractDeployerService;
+import org.jboss.osgi.deployment.deployer.DeployerService;
+import org.jboss.osgi.deployment.deployer.Deployment;
+import org.jboss.osgi.deployment.deployer.DeploymentRegistryService;
+import org.jboss.osgi.spi.OSGiConstants;
+import org.jboss.virtual.VirtualFile;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+import org.osgi.util.tracker.ServiceTracker;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * An abstract base implementation of the {@link DeployerService} that delegates to the MC
+ * provided deployer architecture.
+ * 
+ * The jboss-osgi-microcontainer bundle and the jbossas integration both provide 
+ * concrete implementations. 
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 02-Nov-2009
+ */
+public abstract class AbstractMicrocontainerDeployerService extends AbstractDeployerService
+{
+   // Provide logging
+   private Logger log = LoggerFactory.getLogger(AbstractMicrocontainerDeployerService.class);
+   
+   private VFSDeploymentFactory deploymentFactory = VFSDeploymentFactory.getInstance();
+   private ServiceTracker registryTracker;
+   
+   public abstract MainDeployer getMainDeployer();
+
+   public abstract BundleContext getBundleContext();
+
+   public void deploy(URL url) throws BundleException
+   {
+      Deployment dep = createDeployment(url);
+      deploy(new Deployment[] { dep });
+   }
+
+   public void undeploy(URL url) throws BundleException
+   {
+      DeploymentRegistryService registry = getDeploymentRegistry();
+      Deployment dep = registry.getDeployment(url);
+      if (dep != null)
+      {
+         try
+         {
+            VFSDeployment vfsdep = dep.getAttachment(VFSDeployment.class);
+            getMainDeployer().removeDeployment(vfsdep.getName());
+            getMainDeployer().process();
+         }
+         catch (Exception ex)
+         {
+            log.warn("Cannot undeploy bundle", ex);
+         }
+      }
+   }
+
+   public void deploy(Deployment[] depArr) throws BundleException
+   {
+      ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader();
+      try
+      {
+         Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
+
+         List<VFSDeployment> depList = new ArrayList<VFSDeployment>();
+         DeploymentRegistryService registry = getDeploymentRegistry();
+         
+         for (Deployment dep : depArr)
+         {
+            VirtualFile root = dep.getRoot();
+            VFSDeployment vfsdep = deploymentFactory.createVFSDeployment(root);
+            dep.addAttachment(VFSDeployment.class, vfsdep);
+            registry.registerDeployment(dep);
+            depList.add(vfsdep);
+            
+            MutableAttachments att = (MutableAttachments)vfsdep.getPredeterminedManagedObjects();
+            att.addAttachment(OSGiConstants.PROPERTY_START_LEVEL, new Integer(dep.getStartLevel()));
+            att.addAttachment(OSGiConstants.PROPERTY_AUTO_START, new Boolean(dep.isAutoStart()));
+            
+            getMainDeployer().addDeployment(vfsdep);
+         }
+
+         // Process the deployments
+         getMainDeployer().process();
+
+         // Check for completeness
+         VFSDeployment[] deploymentArr = depList.toArray(new VFSDeployment[depList.size()]);
+         getMainDeployer().checkComplete(deploymentArr);
+      }
+      catch (RuntimeException rte)
+      {
+         throw rte;
+      }
+      catch (Exception ex)
+      {
+         throw new BundleException("Cannot deploy bundles", ex);
+      }
+      finally
+      {
+         Thread.currentThread().setContextClassLoader(ctxLoader);
+      }
+   }
+
+   public void undeploy(Deployment[] depArr) throws BundleException
+   {
+      try
+      {
+         DeploymentRegistryService registry = getDeploymentRegistry();
+         
+         for (Deployment dep : depArr)
+         {
+            registry.unregisterDeployment(dep);
+            VFSDeployment vfsdep = dep.getAttachment(VFSDeployment.class);
+            getMainDeployer().removeDeployment(vfsdep.getName());
+         }
+         getMainDeployer().process();
+      }
+      catch (RuntimeException rte)
+      {
+         throw rte;
+      }
+      catch (Exception ex)
+      {
+         log.warn("Cannot undeploy bundles", ex);
+      }
+   }
+
+   private DeploymentRegistryService getDeploymentRegistry()
+   {
+      if (registryTracker == null)
+      {
+         registryTracker = new ServiceTracker(getBundleContext(), DeploymentRegistryService.class.getName(), null);
+         registryTracker.open();
+      }
+      DeploymentRegistryService service = (DeploymentRegistryService)registryTracker.getService();
+      if (service == null)
+         throw new IllegalStateException("Cannot obtain DeploymentRegistryService");
+      return service;
+   }
+}
\ No newline at end of file


Property changes on: projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/AbstractMicrocontainerDeployerService.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Modified: projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/AbstractMicrocontainerService.java
===================================================================
--- projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/AbstractMicrocontainerService.java	2009-11-02 11:03:54 UTC (rev 95912)
+++ projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/AbstractMicrocontainerService.java	2009-11-02 12:18:46 UTC (rev 95913)
@@ -25,7 +25,6 @@
 
 import static org.jboss.osgi.spi.management.MicrocontainerServiceMBean.MBEAN_MICROCONTAINER_SERVICE;
 
-import java.net.URL;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -40,46 +39,30 @@
 import org.jboss.dependency.spi.ControllerContext;
 import org.jboss.dependency.spi.ControllerContextActions;
 import org.jboss.dependency.spi.ControllerState;
-import org.jboss.deployers.client.spi.main.MainDeployer;
-import org.jboss.deployers.spi.attachments.MutableAttachments;
-import org.jboss.deployers.vfs.spi.client.VFSDeployment;
-import org.jboss.deployers.vfs.spi.client.VFSDeploymentFactory;
 import org.jboss.kernel.Kernel;
 import org.jboss.kernel.spi.dependency.KernelController;
 import org.jboss.kernel.spi.dependency.KernelControllerContext;
-import org.jboss.osgi.deployment.deployer.AbstractDeployerService;
-import org.jboss.osgi.deployment.deployer.Deployment;
-import org.jboss.osgi.deployment.deployer.DeploymentRegistryService;
-import org.jboss.osgi.spi.OSGiConstants;
 import org.jboss.osgi.spi.management.MicrocontainerServiceMBean;
 import org.jboss.osgi.spi.service.MicrocontainerService;
-import org.jboss.virtual.VirtualFile;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleException;
-import org.osgi.util.tracker.ServiceTracker;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
- * An OSGi Service the gives access to the Kernel.
+ * An abstract base implementation of the {@link MicrocontainerService}.
  * 
+ * The jboss-osgi-microcontainer bundle and the jbossas integration both provide 
+ * concrete implementations. 
+ * 
  * @author thomas.diesler at jboss.com
  * @since 23-Jan-2009
  */
-public abstract class AbstractMicrocontainerService extends AbstractDeployerService implements MicrocontainerService
+public abstract class AbstractMicrocontainerService implements MicrocontainerService
 {
-   private VFSDeploymentFactory deploymentFactory = VFSDeploymentFactory.getInstance();
-   private ServiceTracker registryTracker;
-
+   // Provide logging
+   private Logger log = LoggerFactory.getLogger(AbstractMicrocontainerService.class);
+   
    public abstract Kernel getKernel();
 
-   public abstract void logDebug(String message);
-
-   public abstract void logWarning(String message, Exception ex);
-
-   public void logWarning(String message)
-   {
-      logWarning(message, null);
-   }
-
    public List<String> getRegisteredBeans()
    {
       List<String> names = new ArrayList<String>();
@@ -106,104 +89,6 @@
       return (T)getRegisteredBean(beanName);
    }
 
-   public void deploy(URL url) throws BundleException
-   {
-      Deployment dep = createDeployment(url);
-      deploy(new Deployment[] { dep });
-   }
-
-   public void undeploy(URL url) throws BundleException
-   {
-      DeploymentRegistryService registry = getDeploymentRegistry();
-      Deployment dep = registry.getDeployment(url);
-      if (dep != null)
-      {
-         try
-         {
-            MainDeployer mainDeployer = (MainDeployer)getRegisteredBean("MainDeployer");
-            VFSDeployment vfsdep = dep.getAttachment(VFSDeployment.class);
-            mainDeployer.removeDeployment(vfsdep.getName());
-            mainDeployer.process();
-         }
-         catch (Exception ex)
-         {
-            logWarning("Cannot undeploy bundle", ex);
-         }
-      }
-   }
-
-   public void deploy(Deployment[] depArr) throws BundleException
-   {
-      ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader();
-      try
-      {
-         Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
-
-         List<VFSDeployment> depList = new ArrayList<VFSDeployment>();
-         MainDeployer mainDeployer = (MainDeployer)getRegisteredBean("MainDeployer");
-         DeploymentRegistryService registry = getDeploymentRegistry();
-         
-         for (Deployment dep : depArr)
-         {
-            VirtualFile root = dep.getRoot();
-            VFSDeployment vfsdep = deploymentFactory.createVFSDeployment(root);
-            dep.addAttachment(VFSDeployment.class, vfsdep);
-            registry.registerDeployment(dep);
-            depList.add(vfsdep);
-            
-            MutableAttachments att = (MutableAttachments)vfsdep.getPredeterminedManagedObjects();
-            att.addAttachment(OSGiConstants.PROPERTY_START_LEVEL, new Integer(dep.getStartLevel()));
-            att.addAttachment(OSGiConstants.PROPERTY_AUTO_START, new Boolean(dep.isAutoStart()));
-            
-            mainDeployer.addDeployment(vfsdep);
-         }
-
-         // Process the deployments
-         mainDeployer.process();
-
-         // Check for completeness
-         VFSDeployment[] deploymentArr = depList.toArray(new VFSDeployment[depList.size()]);
-         mainDeployer.checkComplete(deploymentArr);
-      }
-      catch (RuntimeException rte)
-      {
-         throw rte;
-      }
-      catch (Exception ex)
-      {
-         throw new BundleException("Cannot deploy bundles", ex);
-      }
-      finally
-      {
-         Thread.currentThread().setContextClassLoader(ctxLoader);
-      }
-   }
-
-   public void undeploy(Deployment[] depArr) throws BundleException
-   {
-      try
-      {
-         MainDeployer mainDeployer = (MainDeployer)getRegisteredBean("MainDeployer");
-         DeploymentRegistryService registry = getDeploymentRegistry();
-         
-         for (Deployment dep : depArr)
-         {
-            registry.unregisterDeployment(dep);
-            VFSDeployment vfsdep = dep.getAttachment(VFSDeployment.class);
-            mainDeployer.removeDeployment(vfsdep.getName());
-         }
-         mainDeployer.process();
-      }
-      catch (RuntimeException rte)
-      {
-         throw rte;
-      }
-      catch (Exception ex)
-      {
-         logWarning("Cannot undeploy bundles", ex);
-      }
-   }
-
    protected void installBean(KernelController controller, String beanName, Object beanImpl)
    {
       try
@@ -240,30 +125,16 @@
       {
          try
          {
-            logDebug("Unregister MicrocontainerServiceMBean");
+            log.debug("Unregister MicrocontainerServiceMBean");
             mbeanServer.unregisterMBean(MBEAN_MICROCONTAINER_SERVICE);
          }
          catch (Exception ex)
          {
-            logWarning("Cannot unregister MicrocontainerServiceMBean", ex);
+            log.warn("Cannot unregister MicrocontainerServiceMBean", ex);
          }
       }
    }
 
-   private DeploymentRegistryService getDeploymentRegistry()
-   {
-      if (registryTracker == null)
-      {
-         BundleContext context = getRegisteredBean(BundleContext.class, BEAN_SYSTEM_BUNDLE_CONTEXT);
-         registryTracker = new ServiceTracker(context, DeploymentRegistryService.class.getName(), null);
-         registryTracker.open();
-      }
-      DeploymentRegistryService service = (DeploymentRegistryService)registryTracker.getService();
-      if (service == null)
-         throw new IllegalStateException("Cannot obtain DeploymentRegistryService");
-      return service;
-   }
-   
    static class PreInstalledControllerContext extends AbstractControllerContext
    {
       public PreInstalledControllerContext(Object name, ControllerContextActions actions, Object target)

Added: projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerDeployerServiceImpl.java
===================================================================
--- projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerDeployerServiceImpl.java	                        (rev 0)
+++ projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerDeployerServiceImpl.java	2009-11-02 12:18:46 UTC (rev 95913)
@@ -0,0 +1,60 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.microcontainer.internal;
+
+//$Id$
+
+import org.jboss.deployers.client.spi.main.MainDeployer;
+import org.jboss.osgi.deployment.deployer.DeployerService;
+import org.jboss.osgi.microcontainer.AbstractMicrocontainerDeployerService;
+import org.osgi.framework.BundleContext;
+
+/**
+ * An implementation of the {@link DeployerService} which is installed as a bundle.
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 23-Jan-2009
+ */
+public class MicrocontainerDeployerServiceImpl extends AbstractMicrocontainerDeployerService
+{
+   private BundleContext context;
+   private MainDeployer mainDeployer;
+   
+   public MicrocontainerDeployerServiceImpl(BundleContext context, MainDeployer mainDeployer)
+   {
+      this.context = context;
+      this.mainDeployer = mainDeployer;
+   }
+
+   @Override
+   public BundleContext getBundleContext()
+   {
+      return context;
+   }
+
+   @Override
+   public MainDeployer getMainDeployer()
+   {
+      return mainDeployer;
+   }
+   
+}
\ No newline at end of file


Property changes on: projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerDeployerServiceImpl.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Modified: projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceActivator.java
===================================================================
--- projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceActivator.java	2009-11-02 11:03:54 UTC (rev 95912)
+++ projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceActivator.java	2009-11-02 12:18:46 UTC (rev 95913)
@@ -23,10 +23,17 @@
 
 //$Id$
 
+import java.util.Properties;
+
+import org.jboss.deployers.client.spi.main.MainDeployer;
+import org.jboss.osgi.deployment.deployer.DeployerService;
 import org.jboss.osgi.microcontainer.MicrocontainerCapabilityMarker;
 import org.jboss.osgi.spi.service.MicrocontainerService;
 import org.osgi.framework.BundleActivator;
 import org.osgi.framework.BundleContext;
+import org.osgi.framework.Constants;
+import org.osgi.framework.ServiceReference;
+import org.osgi.util.tracker.ServiceTracker;
 
 /**
  * A BundleActivator that registers the {@link MicrocontainerService}
@@ -55,6 +62,27 @@
          Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
          mcService = new MicrocontainerServiceImpl(context);
          mcService.start();
+         
+         // Track the MicrocontainerService
+         ServiceTracker tracker = new ServiceTracker(context, MicrocontainerService.class.getName(), null)
+         {
+            @Override
+            public Object addingService(ServiceReference reference)
+            {
+               MicrocontainerService mcService = (MicrocontainerService)super.addingService(reference);
+               
+               // Register the DeployerService that uses the MC deployers
+               Properties props = new Properties();
+               props.setProperty("provider", "microcontainer");
+               props.put(Constants.SERVICE_RANKING, Integer.MAX_VALUE);
+               MainDeployer mainDeployer = (MainDeployer)mcService.getRegisteredBean("MainDeployer");
+               MicrocontainerDeployerServiceImpl deployerService = new MicrocontainerDeployerServiceImpl(context, mainDeployer);
+               context.registerService(DeployerService.class.getName(), deployerService, props);
+               
+               return mcService;
+            }
+         };
+         tracker.open();
       }
       finally
       {

Modified: projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceImpl.java
===================================================================
--- projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceImpl.java	2009-11-02 11:03:54 UTC (rev 95912)
+++ projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceImpl.java	2009-11-02 12:18:46 UTC (rev 95913)
@@ -28,30 +28,25 @@
 import java.net.URL;
 import java.util.Arrays;
 import java.util.List;
-import java.util.Properties;
 
 import javax.management.MBeanServer;
 
 import org.jboss.kernel.Kernel;
 import org.jboss.kernel.spi.dependency.KernelController;
-import org.jboss.osgi.common.log.LogServiceTracker;
-import org.jboss.osgi.deployment.deployer.DeployerService;
 import org.jboss.osgi.jbossxb.XMLBindingService;
 import org.jboss.osgi.microcontainer.AbstractMicrocontainerService;
 import org.jboss.osgi.spi.management.MicrocontainerServiceMBean;
 import org.jboss.osgi.spi.service.MicrocontainerService;
 import org.jboss.virtual.VFS;
 import org.osgi.framework.BundleContext;
-import org.osgi.framework.Constants;
 import org.osgi.framework.Filter;
 import org.osgi.framework.InvalidSyntaxException;
 import org.osgi.framework.ServiceReference;
-import org.osgi.service.log.LogService;
 import org.osgi.util.tracker.ServiceTracker;
 
 /**
- * An implementation of the {@link DeployerService} and {@link MicrocontainerService}
- * which is installed as a bundle
+ * An implementation of the {@link MicrocontainerService}
+ * which is installed as a bundle.
  * 
  * @author thomas.diesler at jboss.com
  * @since 23-Jan-2009
@@ -60,12 +55,10 @@
 {
    private BundleContext context;
    private EmbeddedKernelBootstrap deployer;
-   private LogService log;
 
    public MicrocontainerServiceImpl(BundleContext context)
    {
       this.context = context;
-      this.log = new LogServiceTracker(context);
 
       VFS.init();
 
@@ -77,18 +70,6 @@
       return deployer.getKernel();
    }
 
-   @Override
-   public void logDebug(String message)
-   {
-      log.log(LogService.LOG_DEBUG, message);
-   }
-
-   @Override
-   public void logWarning(String message, Exception ex)
-   {
-      log.log(LogService.LOG_WARNING, message, ex);
-   }
-
    void start()
    {
       final MicrocontainerService mcServiceImpl = this;
@@ -142,16 +123,8 @@
                deployer.deploy(deployersURL);
 
                // Register the MicrocontainerService
-               log.log(LogService.LOG_DEBUG, "Register MicrocontainerService");
                context.registerService(MicrocontainerService.class.getName(), mcServiceImpl, null);
 
-               // Register the DeployerService
-               Properties props = new Properties();
-               props.setProperty("provider", "microcontainer");
-               props.put(Constants.SERVICE_RANKING, Integer.MAX_VALUE);
-               log.log(LogService.LOG_DEBUG, "Register DeployerService");
-               context.registerService(DeployerService.class.getName(), mcServiceImpl, props);
-
                // Register the MicrocontainerServiceMBean
                registerMicrocontainerServiceMBean(mbeanServer);
             }

Modified: projects/jboss-osgi/projects/runtime/jbossas/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/runtime/jbossas/trunk/pom.xml	2009-11-02 11:03:54 UTC (rev 95912)
+++ projects/jboss-osgi/projects/runtime/jbossas/trunk/pom.xml	2009-11-02 12:18:46 UTC (rev 95913)
@@ -93,7 +93,7 @@
             jboss-osgi-microcontainer
           </includeArtifactIds>
           <includes>
-            org/jboss/osgi/microcontainer/integration/*.class
+            org/jboss/osgi/microcontainer/*.class
           </includes>
         </configuration>
       </plugin>

Added: projects/jboss-osgi/projects/runtime/jbossas/trunk/src/main/java/org/jboss/osgi/integration/jbossas/MicrocontainerDeployerServiceBean.java
===================================================================
--- projects/jboss-osgi/projects/runtime/jbossas/trunk/src/main/java/org/jboss/osgi/integration/jbossas/MicrocontainerDeployerServiceBean.java	                        (rev 0)
+++ projects/jboss-osgi/projects/runtime/jbossas/trunk/src/main/java/org/jboss/osgi/integration/jbossas/MicrocontainerDeployerServiceBean.java	2009-11-02 12:18:46 UTC (rev 95913)
@@ -0,0 +1,89 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.integration.jbossas;
+
+//$Id$
+
+import java.util.Properties;
+
+import org.jboss.deployers.client.spi.main.MainDeployer;
+import org.jboss.logging.Logger;
+import org.jboss.osgi.deployment.deployer.DeployerService;
+import org.jboss.osgi.microcontainer.AbstractMicrocontainerDeployerService;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Constants;
+import org.osgi.framework.ServiceRegistration;
+
+/**
+ * An implementation of the {@link DeployerService} which is installed as MC bean in jbossas.
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 05-May-2009
+ */
+public class MicrocontainerDeployerServiceBean extends AbstractMicrocontainerDeployerService
+{
+   // Provide logging
+   private static Logger log = Logger.getLogger(MicrocontainerDeployerServiceBean.class);
+
+   private MainDeployer mainDeployer;
+   private BundleContext context;
+   private ServiceRegistration serviceReg;
+
+   public MainDeployer getMainDeployer()
+   {
+      return mainDeployer;
+   }
+
+   public void setMainDeployer(MainDeployer mainDeployer)
+   {
+      this.mainDeployer = mainDeployer;
+   }
+
+   public BundleContext getBundleContext()
+   {
+      return context;
+   }
+
+   public void setBundleContext(BundleContext context)
+   {
+      this.context = context;
+   }
+
+   public void start()
+   {
+      // Register the DeployerService
+      Properties props = new Properties();
+      props.setProperty("provider", "microcontainer");
+      props.put(Constants.SERVICE_RANKING, Integer.MAX_VALUE);
+      serviceReg = context.registerService(DeployerService.class.getName(), this, props);
+      log.debug("DeployerService registered");
+   }
+
+   void stop()
+   {
+      if (serviceReg != null)
+      {
+         serviceReg.unregister();
+         serviceReg = null;
+      }
+   }
+}
\ No newline at end of file


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

Modified: projects/jboss-osgi/projects/runtime/jbossas/trunk/src/main/java/org/jboss/osgi/integration/jbossas/MicrocontainerServiceBean.java
===================================================================
--- projects/jboss-osgi/projects/runtime/jbossas/trunk/src/main/java/org/jboss/osgi/integration/jbossas/MicrocontainerServiceBean.java	2009-11-02 11:03:54 UTC (rev 95912)
+++ projects/jboss-osgi/projects/runtime/jbossas/trunk/src/main/java/org/jboss/osgi/integration/jbossas/MicrocontainerServiceBean.java	2009-11-02 12:18:46 UTC (rev 95913)
@@ -24,22 +24,18 @@
 
 //$Id$
 
-import java.util.Properties;
-
 import javax.management.MBeanServer;
 
 import org.jboss.kernel.Kernel;
 import org.jboss.kernel.spi.dependency.KernelController;
 import org.jboss.logging.Logger;
-import org.jboss.osgi.deployment.deployer.DeployerService;
 import org.jboss.osgi.microcontainer.AbstractMicrocontainerService;
 import org.jboss.osgi.spi.management.MicrocontainerServiceMBean;
 import org.jboss.osgi.spi.service.MicrocontainerService;
 import org.osgi.framework.BundleContext;
-import org.osgi.framework.Constants;
 
 /**
- * An implementation of the {@link DeployerService} and {@link MicrocontainerService}
+ * An implementation of the {@link MicrocontainerService}
  * which is installed as MC bean in jbossas.
  * 
  * @author thomas.diesler at jboss.com
@@ -47,6 +43,7 @@
  */
 public class MicrocontainerServiceBean extends AbstractMicrocontainerService implements MicrocontainerServiceMBean
 {
+   // Provide logging
    private static Logger log = Logger.getLogger(MicrocontainerServiceBean.class);
 
    private BundleContext bundleContext;
@@ -73,18 +70,6 @@
       return kernel;
    }
 
-   @Override
-   public void logDebug(String message)
-   {
-      log.debug(message);
-   }
-
-   @Override
-   public void logWarning(String message, Exception ex)
-   {
-      log.warn(message, ex);
-   }
-
    public void start() throws Exception
    {
       Kernel kernel = getKernel();
@@ -101,13 +86,6 @@
       bundleContext.registerService(MicrocontainerService.class.getName(), this, null);
       log.debug("MicrocontainerService registered");
 
-      // Register the DeployerService
-      Properties props = new Properties();
-      props.setProperty("provider", "microcontainer");
-      props.put(Constants.SERVICE_RANKING, Integer.MAX_VALUE);
-      bundleContext.registerService(DeployerService.class.getName(), this, props);
-      log.debug("DeployerService registered");
-
       // Register the MicrocontainerServiceMBean
       registerMicrocontainerServiceMBean(mbeanServer);
       log.debug("MicrocontainerServiceMBean registered");

Modified: projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-equinox.xml
===================================================================
--- projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-equinox.xml	2009-11-02 11:03:54 UTC (rev 95912)
+++ projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-equinox.xml	2009-11-02 12:18:46 UTC (rev 95913)
@@ -60,6 +60,8 @@
         <entry><key>org.jboss.osgi.jndi.host</key><value>${jboss.bind.address}</value></entry>
         <entry><key>org.jboss.osgi.jndi.rmi.port</key><value>1098</value></entry>
         <entry><key>org.jboss.osgi.jndi.port</key><value>1099</value></entry>
+        <!-- JTA Object Store -->
+        <entry><key>com.arjuna.ats.arjuna.objectstore.objectStoreDir</key><value>${jboss.server.data.dir}/tx-object-store</value></entry>
       </map>
     </property>
     <property name="autoInstall">

Modified: projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-felix.xml
===================================================================
--- projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-felix.xml	2009-11-02 11:03:54 UTC (rev 95912)
+++ projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-felix.xml	2009-11-02 12:18:46 UTC (rev 95913)
@@ -83,6 +83,8 @@
         <entry><key>org.jboss.osgi.jndi.host</key><value>${jboss.bind.address}</value></entry>
         <entry><key>org.jboss.osgi.jndi.rmi.port</key><value>1098</value></entry>
         <entry><key>org.jboss.osgi.jndi.port</key><value>1099</value></entry>
+        <!-- JTA Object Store -->
+        <entry><key>com.arjuna.ats.arjuna.objectstore.objectStoreDir</key><value>${jboss.server.data.dir}/tx-object-store</value></entry>
       </map>
     </property>
     <property name="autoInstall">

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	2009-11-02 11:03:54 UTC (rev 95912)
+++ projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-jbossmc.xml	2009-11-02 12:18:46 UTC (rev 95913)
@@ -64,6 +64,8 @@
         <entry><key>org.jboss.osgi.jndi.host</key><value>${jboss.bind.address}</value></entry>
         <entry><key>org.jboss.osgi.jndi.rmi.port</key><value>1098</value></entry>
         <entry><key>org.jboss.osgi.jndi.port</key><value>1099</value></entry>
+        <!-- JTA Object Store -->
+        <entry><key>com.arjuna.ats.arjuna.objectstore.objectStoreDir</key><value>${jboss.server.data.dir}/tx-object-store</value></entry>
       </map>
     </property>
     <incallback method="addPlugin" />

Modified: projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jta-service-jboss-beans.xml
===================================================================
--- projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jta-service-jboss-beans.xml	2009-11-02 11:03:54 UTC (rev 95912)
+++ projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jta-service-jboss-beans.xml	2009-11-02 12:18:46 UTC (rev 95913)
@@ -6,21 +6,6 @@
 
 <deployment xmlns="urn:jboss:bean-deployer:2.0">
 
-  <!-- 
-  ********************************
-  *                              *  
-  *  Services                    *
-  *                              *
-  ********************************
-  -->
-
-  <!-- Microcontainer Service -->
-  <bean name="jboss.osgi:service=Microcontainer" class="org.jboss.osgi.integration.jbossas.MicrocontainerServiceBean">
-   <property name="bundleContext"><inject bean="jboss.osgi:service=Framework" property="bundleContext"/></property>
-   <property name="mbeanServer"><inject bean="JMXKernel" property="mbeanServer"/></property>
-   <property name="kernel"><inject bean="jboss.kernel:service=Kernel" /></property>
-  </bean>
-
   <!-- Transaction Service -->
   <bean name="jboss.osgi:service=Transaction" class="org.jboss.osgi.integration.jbossas.TransactionServiceBean">
    <property name="bundleContext"><inject bean="jboss.osgi:service=Framework" property="bundleContext"/></property>

Modified: projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/microcontainer-service-jboss-beans.xml
===================================================================
--- projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/microcontainer-service-jboss-beans.xml	2009-11-02 11:03:54 UTC (rev 95912)
+++ projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/microcontainer-service-jboss-beans.xml	2009-11-02 12:18:46 UTC (rev 95913)
@@ -6,14 +6,6 @@
 
 <deployment xmlns="urn:jboss:bean-deployer:2.0">
 
-  <!-- 
-  ********************************
-  *                              *  
-  *  Services                    *
-  *                              *
-  ********************************
-  -->
-
   <!-- Microcontainer Service -->
   <bean name="jboss.osgi:service=Microcontainer" class="org.jboss.osgi.integration.jbossas.MicrocontainerServiceBean">
    <property name="bundleContext"><inject bean="jboss.osgi:service=Framework" property="bundleContext"/></property>
@@ -21,11 +13,10 @@
    <property name="kernel"><inject bean="jboss.kernel:service=Kernel" /></property>
   </bean>
 
-  <!-- Transaction Service -->
-  <bean name="jboss.osgi:service=Transaction" class="org.jboss.osgi.integration.jbossas.TransactionServiceBean">
+  <!-- Microcontainer Deployer Service -->
+  <bean name="jboss.osgi:service=MicrocontainerDeployer" class="org.jboss.osgi.integration.jbossas.MicrocontainerDeployerServiceBean">
    <property name="bundleContext"><inject bean="jboss.osgi:service=Framework" property="bundleContext"/></property>
-   <property name="transactionManager"><inject bean="RealTransactionManager"/></property>
-   <property name="userTransaction"><inject bean="DefaultUserTransactionprovider"/></property>
+   <property name="mainDeployer"><inject bean="MainDeployer"/></property>
   </bean>
 
 </deployment>




More information about the jboss-cvs-commits mailing list