[jboss-cvs] JBossAS SVN: r89549 - in projects/jboss-osgi/trunk: bundles/jmx/src/main/java/org/jboss/osgi/jmx/internal and 4 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sat May 30 09:22:11 EDT 2009


Author: thomas.diesler at jboss.com
Date: 2009-05-30 09:22:11 -0400 (Sat, 30 May 2009)
New Revision: 89549

Added:
   projects/jboss-osgi/trunk/bundles/common/src/main/java/org/jboss/osgi/common/internal/AbstractCommonServicesActivator.java
   projects/jboss-osgi/trunk/bundles/common/src/main/java/org/jboss/osgi/common/internal/SystemDeployerService.java
   projects/jboss-osgi/trunk/integration/jbossas/src/main/java/org/jboss/osgi/jbossas/integration/CommonServicesBean.java
Removed:
   projects/jboss-osgi/trunk/bundles/common/src/main/java/org/jboss/osgi/common/internal/SimpleDeployerService.java
   projects/jboss-osgi/trunk/integration/jbossas/src/main/java/org/jboss/osgi/jmx/
   projects/jboss-osgi/trunk/integration/jbossas/src/main/java/org/jboss/osgi/jndi/
   projects/jboss-osgi/trunk/integration/jbossas/src/main/java/org/jboss/osgi/microcontainer/
Modified:
   projects/jboss-osgi/trunk/bundles/common/src/main/java/org/jboss/osgi/common/internal/CommonServicesActivator.java
   projects/jboss-osgi/trunk/bundles/jmx/src/main/java/org/jboss/osgi/jmx/internal/JMXConnectorService.java
   projects/jboss-osgi/trunk/distribution/src/main/resources/installer/install-definition.xml
   projects/jboss-osgi/trunk/runtime/felix/src/main/resources/osgi-deployers-jboss-beans.xml
Log:
Implement CommonServiceBean for jbossas

Added: projects/jboss-osgi/trunk/bundles/common/src/main/java/org/jboss/osgi/common/internal/AbstractCommonServicesActivator.java
===================================================================
--- projects/jboss-osgi/trunk/bundles/common/src/main/java/org/jboss/osgi/common/internal/AbstractCommonServicesActivator.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/bundles/common/src/main/java/org/jboss/osgi/common/internal/AbstractCommonServicesActivator.java	2009-05-30 13:22:11 UTC (rev 89549)
@@ -0,0 +1,104 @@
+/*
+ * 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.common.internal;
+
+//$Id$
+
+import java.util.Properties;
+
+import javax.management.JMException;
+import javax.management.MBeanServer;
+import javax.management.StandardMBean;
+
+import org.jboss.osgi.common.service.DeployerService;
+import org.jboss.osgi.common.service.DeployerServiceDelegate;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.log.LogReaderService;
+import org.osgi.util.tracker.ServiceTracker;
+
+
+/**
+ * The common services activator
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 23-Jan-2009
+ */
+public abstract class AbstractCommonServicesActivator
+{
+   protected void trackLogReaderService(BundleContext context)
+   {
+      ServiceTracker logTracker = new ServiceTracker(context, LogReaderService.class.getName(), null)
+      {
+         @Override
+         public Object addingService(ServiceReference reference)
+         {
+            LogReaderService logReader = (LogReaderService)super.addingService(reference);
+            logReader.addLogListener(new LoggingLogListener());
+            return logReader;
+         }
+      };
+      logTracker.open();
+   }
+
+   protected DeployerServiceDelegate registerDeployerServices(BundleContext context)
+   {
+      // Register the SystemDeployerService
+      Properties props = new Properties();
+      props.setProperty("provider", "system");
+      SystemDeployerService service = new SystemDeployerService(context);
+      context.registerService(DeployerService.class.getName(), service, props);
+      
+      // Register the DeployerServiceDelegate
+      DeployerServiceDelegate delegate = new DeployerServiceDelegate(context);
+      context.registerService(DeployerServiceDelegate.class.getName(), delegate, null);
+      return delegate;
+   }
+
+   protected void registerDeployerServiceMBean(MBeanServer mbeanServer, DeployerServiceDelegate delegate)
+   {
+      try
+      {
+         StandardMBean mbean = new StandardMBean(delegate, DeployerService.class);
+         mbeanServer.registerMBean(mbean, DeployerService.MBEAN_DEPLOYER_SERVICE);
+      }
+      catch (JMException ex)
+      {
+         throw new IllegalStateException("Cannot register DeployerService MBean", ex);
+      }
+   }
+
+   protected void unregisterDeployerServiceMBean(MBeanServer mbeanServer)
+   {
+      try
+      {
+         if (mbeanServer.isRegistered(DeployerService.MBEAN_DEPLOYER_SERVICE))
+            mbeanServer.unregisterMBean(DeployerService.MBEAN_DEPLOYER_SERVICE);
+      }
+      catch (JMException ex)
+      {
+         logError("Cannot unregister DeployerService MBean", ex);
+      }
+   }
+
+   protected abstract void logError(String message, Exception ex);
+}
\ No newline at end of file


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

Modified: projects/jboss-osgi/trunk/bundles/common/src/main/java/org/jboss/osgi/common/internal/CommonServicesActivator.java
===================================================================
--- projects/jboss-osgi/trunk/bundles/common/src/main/java/org/jboss/osgi/common/internal/CommonServicesActivator.java	2009-05-30 12:14:08 UTC (rev 89548)
+++ projects/jboss-osgi/trunk/bundles/common/src/main/java/org/jboss/osgi/common/internal/CommonServicesActivator.java	2009-05-30 13:22:11 UTC (rev 89549)
@@ -23,19 +23,14 @@
 
 //$Id$
 
-import java.util.Properties;
 
-import javax.management.JMException;
 import javax.management.MBeanServer;
-import javax.management.StandardMBean;
 
 import org.jboss.osgi.common.log.LogServiceTracker;
-import org.jboss.osgi.common.service.DeployerService;
 import org.jboss.osgi.common.service.DeployerServiceDelegate;
 import org.osgi.framework.BundleActivator;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceReference;
-import org.osgi.service.log.LogReaderService;
 import org.osgi.service.log.LogService;
 import org.osgi.util.tracker.ServiceTracker;
 
@@ -45,10 +40,16 @@
  * @author thomas.diesler at jboss.com
  * @since 23-Jan-2009
  */
-public class CommonServicesActivator implements BundleActivator
+public class CommonServicesActivator extends AbstractCommonServicesActivator implements BundleActivator
 {
    private LogService log;
    
+   @Override
+   protected void logError(String message, Exception ex)
+   {
+      log.log(LogService.LOG_ERROR, message, ex);
+   }
+
    public void start(BundleContext context)
    {
       log = new LogServiceTracker(context);
@@ -56,16 +57,9 @@
       // Track LogReaderService and add/remove LogListener
       trackLogReaderService(context);
       
-      // Register the system DeployerService
-      Properties props = new Properties();
-      props.setProperty("provider", "system");
-      SimpleDeployerService service = new SimpleDeployerService(context);
-      context.registerService(DeployerService.class.getName(), service, props);
+      // Register the system SystemDeployerService and DeployerServiceDelegate
+      DeployerServiceDelegate delegate = registerDeployerServices(context);
       
-      // Register the DeployerServiceDelegate
-      DeployerServiceDelegate delegate = new DeployerServiceDelegate(context);
-      context.registerService(DeployerServiceDelegate.class.getName(), delegate, null);
-      
       // Track the MBeanServer and register the DeployerServiceDelegate
       trackMBeanServer(context, delegate);
    }
@@ -78,15 +72,7 @@
          public Object addingService(ServiceReference reference)
          {
             MBeanServer mbeanServer = (MBeanServer)super.addingService(reference);
-            try
-            {
-               StandardMBean mbean = new StandardMBean(delegate, DeployerService.class);
-               mbeanServer.registerMBean(mbean, DeployerService.MBEAN_DEPLOYER_SERVICE);
-            }
-            catch (JMException ex)
-            {
-               log.log(LogService.LOG_ERROR, "Cannot register DeployerService MBean", ex);
-            }
+            registerDeployerServiceMBean(mbeanServer, delegate);
             return mbeanServer;
          }
 
@@ -94,39 +80,20 @@
          public void removedService(ServiceReference reference, Object service)
          {
             MBeanServer mbeanServer = (MBeanServer)service;
-            try
-            {
-               if (mbeanServer.isRegistered(DeployerService.MBEAN_DEPLOYER_SERVICE))
-                  mbeanServer.unregisterMBean(DeployerService.MBEAN_DEPLOYER_SERVICE);
-            }
-            catch (JMException ex)
-            {
-               log.log(LogService.LOG_ERROR, "Cannot unregister DeployerService MBean", ex);
-            }
-            
+            unregisterDeployerServiceMBean(mbeanServer);
             super.removedService(reference, service);
          }
       };
       jmxTracker.open();
    }
 
-   private void trackLogReaderService(BundleContext context)
+   public void stop(BundleContext context)
    {
-      ServiceTracker logTracker = new ServiceTracker(context, LogReaderService.class.getName(), null)
+      ServiceReference sref = context.getServiceReference(MBeanServer.class.getName());
+      if (sref != null)
       {
-         @Override
-         public Object addingService(ServiceReference reference)
-         {
-            LogReaderService logReader = (LogReaderService)super.addingService(reference);
-            logReader.addLogListener(new LoggingLogListener());
-            return logReader;
-         }
-      };
-      logTracker.open();
+         MBeanServer mbeanServer = (MBeanServer)context.getService(sref);
+         unregisterDeployerServiceMBean(mbeanServer);
+      }
    }
-
-   public void stop(BundleContext context)
-   {
-      // NOTE: The service is automatically unregistered.
-   }
 }
\ No newline at end of file

Deleted: projects/jboss-osgi/trunk/bundles/common/src/main/java/org/jboss/osgi/common/internal/SimpleDeployerService.java
===================================================================
--- projects/jboss-osgi/trunk/bundles/common/src/main/java/org/jboss/osgi/common/internal/SimpleDeployerService.java	2009-05-30 12:14:08 UTC (rev 89548)
+++ projects/jboss-osgi/trunk/bundles/common/src/main/java/org/jboss/osgi/common/internal/SimpleDeployerService.java	2009-05-30 13:22:11 UTC (rev 89549)
@@ -1,159 +0,0 @@
-/*
- * 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.common.internal;
-
-//$Id$
-
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.jboss.osgi.common.log.LogServiceTracker;
-import org.jboss.osgi.common.service.BundleInfo;
-import org.jboss.osgi.common.service.DeployerService;
-import org.jboss.osgi.common.service.ManagedBundleService;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleException;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.log.LogService;
-
-/**
- * A {@link DeployerService} that installs/uninstalls the bundles directly on the OSGi framework without going through the MC registered deployers.
- * 
- * @author thomas.diesler at jboss.com
- * @since 27-May-2009
- */
-public class SimpleDeployerService implements DeployerService
-{
-   private LogServiceTracker log;
-   private BundleContext context;
-
-   private Map<String, Bundle> deployments = new HashMap<String, Bundle>();
-
-   public SimpleDeployerService(BundleContext context)
-   {
-      this.log = new LogServiceTracker(context);
-      this.context = context;
-   }
-
-   public void deploy(BundleInfo[] bundleInfos) throws BundleException
-   {
-      // Install the NEW bundles
-      List<Bundle> bundles = new ArrayList<Bundle>();
-      for (BundleInfo info : bundleInfos)
-      {
-         try
-         {
-            String location = info.getLocation().toExternalForm();
-            Bundle bundle = context.installBundle(location);
-            log.log(LogService.LOG_INFO, "Installed: " + bundle);
-            
-            deployments.put(location, bundle);
-            registerManagedBundle(bundle);
-            bundles.add(bundle);
-         }
-         catch (BundleException ex)
-         {
-            log.log(LogService.LOG_ERROR, "Cannot install bundle: " + info, ex);
-         }
-      }
-
-      // Start the installed bundles
-      for (Bundle bundle : bundles)
-      {
-         try
-         {
-            log.log(LogService.LOG_DEBUG, "Start: " + bundle);
-            bundle.start();
-         }
-         catch (BundleException ex)
-         {
-            log.log(LogService.LOG_ERROR, "Cannot start bundle: " + bundle, ex);
-         }
-      }
-   }
-
-   public void undeploy(BundleInfo[] bundleInfos) throws BundleException
-   {
-      for (BundleInfo info : bundleInfos)
-         undeploy(info.getLocation());
-   }
-
-   // Note, in contrary to deploy(BundleInfo[]) this
-   // method does not start the bundle. The client
-   // is expected to do that
-   public void deploy(URL url) throws BundleException
-   {
-      Bundle bundle = context.installBundle(url.toExternalForm());
-      log.log(LogService.LOG_INFO, "Installed: " + bundle);
-      deployments.put(url.toExternalForm(), bundle);
-      registerManagedBundle(bundle);
-   }
-
-   public boolean undeploy(URL url) throws BundleException 
-   {
-      Bundle bundle = deployments.remove(url.toExternalForm());
-      if (bundle != null)
-      {
-         unregisterManagedBundle(bundle);
-         bundle.uninstall();
-         log.log(LogService.LOG_INFO, "Uninstalled: " + bundle);
-         return true;
-      }
-      else
-      {
-         log.log(LogService.LOG_WARNING, "Cannot find bundle for: " + url);
-         return false;
-      }
-   }
-
-   private void registerManagedBundle(Bundle bundle)
-   {
-      ServiceReference sref = context.getServiceReference(ManagedBundleService.class.getName());
-      if (sref != null)
-      {
-         ManagedBundleService service = (ManagedBundleService)context.getService(sref);
-         service.register(bundle);
-      }
-      else
-      {
-         log.log(LogService.LOG_DEBUG, "No ManagedBundleService. Cannot register managed bundle: " + bundle);
-      }
-   }
-
-   private void unregisterManagedBundle(Bundle bundle)
-   {
-      ServiceReference sref = context.getServiceReference(ManagedBundleService.class.getName());
-      if (sref != null)
-      {
-         ManagedBundleService service = (ManagedBundleService)context.getService(sref);
-         service.unregister(bundle);
-      }
-      else
-      {
-         log.log(LogService.LOG_DEBUG, "No ManagedBundleService. Cannot unregister managed bundle: " + bundle);
-      }
-   }
-}
\ No newline at end of file

Copied: projects/jboss-osgi/trunk/bundles/common/src/main/java/org/jboss/osgi/common/internal/SystemDeployerService.java (from rev 89545, projects/jboss-osgi/trunk/bundles/common/src/main/java/org/jboss/osgi/common/internal/SimpleDeployerService.java)
===================================================================
--- projects/jboss-osgi/trunk/bundles/common/src/main/java/org/jboss/osgi/common/internal/SystemDeployerService.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/bundles/common/src/main/java/org/jboss/osgi/common/internal/SystemDeployerService.java	2009-05-30 13:22:11 UTC (rev 89549)
@@ -0,0 +1,159 @@
+/*
+ * 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.common.internal;
+
+//$Id$
+
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.jboss.osgi.common.log.LogServiceTracker;
+import org.jboss.osgi.common.service.BundleInfo;
+import org.jboss.osgi.common.service.DeployerService;
+import org.jboss.osgi.common.service.ManagedBundleService;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.log.LogService;
+
+/**
+ * A {@link DeployerService} that installs/uninstalls the bundles directly on the OSGi framework without going through the MC registered deployers.
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 27-May-2009
+ */
+public class SystemDeployerService implements DeployerService
+{
+   private LogServiceTracker log;
+   private BundleContext context;
+
+   private Map<String, Bundle> deployments = new HashMap<String, Bundle>();
+
+   public SystemDeployerService(BundleContext context)
+   {
+      this.log = new LogServiceTracker(context);
+      this.context = context;
+   }
+
+   public void deploy(BundleInfo[] bundleInfos) throws BundleException
+   {
+      // Install the NEW bundles
+      List<Bundle> bundles = new ArrayList<Bundle>();
+      for (BundleInfo info : bundleInfos)
+      {
+         try
+         {
+            String location = info.getLocation().toExternalForm();
+            Bundle bundle = context.installBundle(location);
+            log.log(LogService.LOG_INFO, "Installed: " + bundle);
+            
+            deployments.put(location, bundle);
+            registerManagedBundle(bundle);
+            bundles.add(bundle);
+         }
+         catch (BundleException ex)
+         {
+            log.log(LogService.LOG_ERROR, "Cannot install bundle: " + info, ex);
+         }
+      }
+
+      // Start the installed bundles
+      for (Bundle bundle : bundles)
+      {
+         try
+         {
+            log.log(LogService.LOG_DEBUG, "Start: " + bundle);
+            bundle.start();
+         }
+         catch (BundleException ex)
+         {
+            log.log(LogService.LOG_ERROR, "Cannot start bundle: " + bundle, ex);
+         }
+      }
+   }
+
+   public void undeploy(BundleInfo[] bundleInfos) throws BundleException
+   {
+      for (BundleInfo info : bundleInfos)
+         undeploy(info.getLocation());
+   }
+
+   // Note, in contrary to deploy(BundleInfo[]) this
+   // method does not start the bundle. The client
+   // is expected to do that
+   public void deploy(URL url) throws BundleException
+   {
+      Bundle bundle = context.installBundle(url.toExternalForm());
+      log.log(LogService.LOG_INFO, "Installed: " + bundle);
+      deployments.put(url.toExternalForm(), bundle);
+      registerManagedBundle(bundle);
+   }
+
+   public boolean undeploy(URL url) throws BundleException 
+   {
+      Bundle bundle = deployments.remove(url.toExternalForm());
+      if (bundle != null)
+      {
+         unregisterManagedBundle(bundle);
+         bundle.uninstall();
+         log.log(LogService.LOG_INFO, "Uninstalled: " + bundle);
+         return true;
+      }
+      else
+      {
+         log.log(LogService.LOG_WARNING, "Cannot find bundle for: " + url);
+         return false;
+      }
+   }
+
+   private void registerManagedBundle(Bundle bundle)
+   {
+      ServiceReference sref = context.getServiceReference(ManagedBundleService.class.getName());
+      if (sref != null)
+      {
+         ManagedBundleService service = (ManagedBundleService)context.getService(sref);
+         service.register(bundle);
+      }
+      else
+      {
+         log.log(LogService.LOG_DEBUG, "No ManagedBundleService. Cannot register managed bundle: " + bundle);
+      }
+   }
+
+   private void unregisterManagedBundle(Bundle bundle)
+   {
+      ServiceReference sref = context.getServiceReference(ManagedBundleService.class.getName());
+      if (sref != null)
+      {
+         ManagedBundleService service = (ManagedBundleService)context.getService(sref);
+         service.unregister(bundle);
+      }
+      else
+      {
+         log.log(LogService.LOG_DEBUG, "No ManagedBundleService. Cannot unregister managed bundle: " + bundle);
+      }
+   }
+}
\ No newline at end of file

Modified: projects/jboss-osgi/trunk/bundles/jmx/src/main/java/org/jboss/osgi/jmx/internal/JMXConnectorService.java
===================================================================
--- projects/jboss-osgi/trunk/bundles/jmx/src/main/java/org/jboss/osgi/jmx/internal/JMXConnectorService.java	2009-05-30 12:14:08 UTC (rev 89548)
+++ projects/jboss-osgi/trunk/bundles/jmx/src/main/java/org/jboss/osgi/jmx/internal/JMXConnectorService.java	2009-05-30 13:22:11 UTC (rev 89549)
@@ -88,7 +88,7 @@
       }
       catch (Exception ex)
       {
-         log.log(LogService.LOG_ERROR, "Cannot create JMXConnectorServer", ex);
+         throw new IllegalStateException("Cannot create JMXConnectorServer", ex);
       }
    }
 
@@ -99,9 +99,6 @@
 
    public void start()
    {
-      if (jmxConnectorServer == null)
-         throw new IllegalStateException("JMXConnectorServer not available");
-
       ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader();
       try
       {

Modified: projects/jboss-osgi/trunk/distribution/src/main/resources/installer/install-definition.xml
===================================================================
--- projects/jboss-osgi/trunk/distribution/src/main/resources/installer/install-definition.xml	2009-05-30 12:14:08 UTC (rev 89548)
+++ projects/jboss-osgi/trunk/distribution/src/main/resources/installer/install-definition.xml	2009-05-30 13:22:11 UTC (rev 89549)
@@ -285,7 +285,6 @@
         <include name="org.apache.felix.http.jetty.jar" />
         <include name="org.apache.felix.log.jar" />
         <include name="org.apache.felix.metatype.jar" />
-        <include name="jboss-osgi-common.jar" />
         <include name="jboss-osgi-webconsole.jar" />
       </fileset>
       

Added: projects/jboss-osgi/trunk/integration/jbossas/src/main/java/org/jboss/osgi/jbossas/integration/CommonServicesBean.java
===================================================================
--- projects/jboss-osgi/trunk/integration/jbossas/src/main/java/org/jboss/osgi/jbossas/integration/CommonServicesBean.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/integration/jbossas/src/main/java/org/jboss/osgi/jbossas/integration/CommonServicesBean.java	2009-05-30 13:22:11 UTC (rev 89549)
@@ -0,0 +1,79 @@
+/*
+ * 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.jbossas.integration;
+
+//$Id$
+
+import javax.management.MBeanServer;
+
+import org.jboss.logging.Logger;
+import org.jboss.osgi.common.internal.AbstractCommonServicesActivator;
+import org.jboss.osgi.common.service.DeployerServiceDelegate;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The common services activator
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 05-May-2009
+ */
+public class CommonServicesBean extends AbstractCommonServicesActivator
+{
+   private static Logger log = Logger.getLogger(CommonServicesBean.class);
+   
+   private BundleContext context;
+   public MBeanServer mbeanServer;
+   
+   public void setSystemContext(BundleContext context)
+   {
+      this.context = context;
+   }
+
+   public void setMbeanServer(MBeanServer mbeanServer)
+   {
+      this.mbeanServer = mbeanServer;
+   }
+
+   @Override
+   protected void logError(String message, Exception ex)
+   {
+      log.error(message, ex);
+   }
+
+   public void start()
+   {
+      // Track LogReaderService and add/remove LogListener
+      trackLogReaderService(context);
+      
+      // Register the SystemDeployerService and DeployerServiceDelegate
+      DeployerServiceDelegate delegate = registerDeployerServices(context);
+      
+      // Register the DeployerServiceDelegate as MBean
+      registerDeployerServiceMBean(mbeanServer, delegate);
+   }
+
+   public void stop()
+   {
+      // Unregister the DeployerServiceDelegate as MBean
+      unregisterDeployerServiceMBean(mbeanServer);
+   }
+}
\ No newline at end of file


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

Modified: projects/jboss-osgi/trunk/runtime/felix/src/main/resources/osgi-deployers-jboss-beans.xml
===================================================================
--- projects/jboss-osgi/trunk/runtime/felix/src/main/resources/osgi-deployers-jboss-beans.xml	2009-05-30 12:14:08 UTC (rev 89548)
+++ projects/jboss-osgi/trunk/runtime/felix/src/main/resources/osgi-deployers-jboss-beans.xml	2009-05-30 13:22:11 UTC (rev 89549)
@@ -27,9 +27,8 @@
           <value>
             org.apache.xerces.dom,
             org.jboss.logging,
-            org.jboss.osgi.jndi,
-            org.jboss.osgi.jmx,
-            org.jboss.osgi.microcontainer,
+            org.jboss.osgi.common.service,
+            org.jboss.osgi.jbossas.integration,
             org.jboss.osgi.spi;version=1.0,
             org.jboss.osgi.spi.logging;version=1.0,
             org.jboss.osgi.spi.management;version=1.0,
@@ -86,19 +85,25 @@
   ********************************
   -->
 
-  <!-- A Service that gives access to the Microcontainer -->
+  <!-- Common Services -->
+  <bean name="jboss.osgi:service=Common" class="org.jboss.osgi.jbossas.integration.CommonServicesBean">
+   <property name="systemContext"><inject bean="jboss.osgi:service=Framework" property="bundleContext"/></property>
+   <property name="mbeanServer"><inject bean="JMXKernel" property="mbeanServer"/></property>
+  </bean>
+
+  <!-- Microcontainer Service -->
   <bean name="jboss.osgi:service=Microcontainer" class="org.jboss.osgi.jbossas.integration.MicrocontainerServiceBean">
    <property name="systemContext"><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>
 
-  <!-- A Service that gives access to JNDI -->
+  <!-- Naming Service -->
   <bean name="jboss.osgi:service=Naming" class="org.jboss.osgi.jbossas.integration.NamingServiceBean">
    <property name="systemContext"><inject bean="jboss.osgi:service=Framework" property="bundleContext"/></property>
   </bean>
 
-  <!-- A Service that gives access to the MBeanServer -->
+  <!-- Management Service -->
   <bean name="jboss.osgi:service=Management" class="org.jboss.osgi.jbossas.integration.ManagementServiceBean">
    <property name="systemContext"><inject bean="jboss.osgi:service=Framework" property="bundleContext"/></property>
    <property name="mbeanServer"><inject bean="JMXKernel" property="mbeanServer"/></property>




More information about the jboss-cvs-commits mailing list