[jboss-osgi-commits] JBoss-OSGI SVN: r88414 - in projects/jboss-osgi/trunk/runtime: jbossas/src/main/java/org/jboss/osgi/jmx/internal and 1 other directories.

jboss-osgi-commits at lists.jboss.org jboss-osgi-commits at lists.jboss.org
Fri May 8 02:46:28 EDT 2009


Author: thomas.diesler at jboss.com
Date: 2009-05-08 02:46:28 -0400 (Fri, 08 May 2009)
New Revision: 88414

Added:
   projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/jmx/internal/ManagementServiceImpl.java
Removed:
   projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/jmx/internal/MBeanServerServiceImpl.java
Modified:
   projects/jboss-osgi/trunk/runtime/felix/src/main/resources/osgi-deployers-jboss-beans.xml
   projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceImpl.java
Log:
Blueprint/JBossAS - ok

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-08 06:02:20 UTC (rev 88413)
+++ projects/jboss-osgi/trunk/runtime/felix/src/main/resources/osgi-deployers-jboss-beans.xml	2009-05-08 06:46:28 UTC (rev 88414)
@@ -1,7 +1,19 @@
 <?xml version="1.0" encoding="UTF-8"?>
 
+<!--
+  $Id$
+-->
+
 <deployment xmlns="urn:jboss:bean-deployer:2.0">
 
+  <!-- 
+  ********************************
+  *                              *  
+  *  Framework                   *
+  *                              *
+  ********************************
+  -->
+
   <!-- The OSGiFramework -->
   <bean name="jboss.osgi:service=Framework" class="org.jboss.osgi.felix.framework.FelixIntegration">
     <property name="properties">
@@ -76,7 +88,7 @@
   </bean>
 
   <!-- A Service that gives access to the MBeanServer -->
-  <bean name="jboss.osgi:service=MBeanServer" class="org.jboss.osgi.jmx.internal.MBeanServerServiceImpl">
+  <bean name="jboss.osgi:service=Management" class="org.jboss.osgi.jmx.internal.ManagementServiceImpl">
    <property name="systemContext"><inject bean="jboss.osgi:service=Framework" property="bundleContext"/></property>
    <property name="mbeanServer"><inject bean="JMXKernel" property="mbeanServer"/></property>
   </bean>

Deleted: projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/jmx/internal/MBeanServerServiceImpl.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/jmx/internal/MBeanServerServiceImpl.java	2009-05-08 06:02:20 UTC (rev 88413)
+++ projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/jmx/internal/MBeanServerServiceImpl.java	2009-05-08 06:46:28 UTC (rev 88414)
@@ -1,55 +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.jmx.internal;
-
-//$Id$
-
-import javax.management.MBeanServer;
-
-import org.osgi.framework.BundleContext;
-
-/**
- * A service that gives access to the MBeanServer
- * 
- * @author thomas.diesler at jboss.com
- * @since 24-Apr-2009
- */
-public class MBeanServerServiceImpl 
-{
-   private MBeanServer mbeanServer;
-   private BundleContext context;
-   
-   public void setSystemContext(BundleContext context)
-   {
-      this.context = context;
-   }
-
-   public void setMbeanServer(MBeanServer mbeanServer)
-   {
-      this.mbeanServer = mbeanServer;
-   }
-
-   public void start()
-   {
-      context.registerService(MBeanServer.class.getName(), mbeanServer, null);
-   }
-}
\ No newline at end of file

Copied: projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/jmx/internal/ManagementServiceImpl.java (from rev 88408, projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/jmx/internal/MBeanServerServiceImpl.java)
===================================================================
--- projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/jmx/internal/ManagementServiceImpl.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/jmx/internal/ManagementServiceImpl.java	2009-05-08 06:46:28 UTC (rev 88414)
@@ -0,0 +1,55 @@
+/*
+ * 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.jmx.internal;
+
+//$Id$
+
+import javax.management.MBeanServer;
+
+import org.osgi.framework.BundleContext;
+
+/**
+ * A service that gives access to the MBeanServer
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 24-Apr-2009
+ */
+public class ManagementServiceImpl 
+{
+   private MBeanServer mbeanServer;
+   private BundleContext context;
+   
+   public void setSystemContext(BundleContext context)
+   {
+      this.context = context;
+   }
+
+   public void setMbeanServer(MBeanServer mbeanServer)
+   {
+      this.mbeanServer = mbeanServer;
+   }
+
+   public void start()
+   {
+      context.registerService(MBeanServer.class.getName(), mbeanServer, null);
+   }
+}
\ No newline at end of file

Modified: projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceImpl.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceImpl.java	2009-05-08 06:02:20 UTC (rev 88413)
+++ projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceImpl.java	2009-05-08 06:46:28 UTC (rev 88414)
@@ -29,6 +29,7 @@
 import java.util.List;
 
 import javax.management.MBeanServer;
+import javax.management.ObjectName;
 import javax.management.StandardMBean;
 
 import org.jboss.dependency.plugins.AbstractController;
@@ -43,7 +44,6 @@
 import org.jboss.kernel.spi.dependency.KernelControllerContext;
 import org.jboss.osgi.microcontainer.MicrocontainerService;
 import org.jboss.osgi.microcontainer.MicrocontainerServiceMBean;
-import org.jboss.osgi.spi.NotImplementedException;
 import org.osgi.framework.BundleContext;
 
 /**
@@ -57,7 +57,7 @@
    private BundleContext context;
    private MBeanServer mbeanServer;
    private Kernel kernel;
-   
+
    public void setSystemContext(BundleContext context)
    {
       this.context = context;
@@ -75,14 +75,20 @@
 
    public void deploy(URL url) throws Exception
    {
-      throw new NotImplementedException();
+      invokeMainDeployer("deploy", url);
    }
 
    public void undeploy(URL url) throws Exception
    {
-      throw new NotImplementedException();
+      invokeMainDeployer("undeploy", url);
    }
 
+   private void invokeMainDeployer(String method, URL archiveURL) throws Exception
+   {
+      ObjectName oname = new ObjectName("jboss.system:service=MainDeployer");
+      mbeanServer.invoke(oname, method, new Object[] { archiveURL }, new String[] { "java.net.URL" });
+   }
+
    public Kernel getKernel()
    {
       return kernel;
@@ -95,7 +101,7 @@
       AbstractController controller = (AbstractController)getKernel().getController();
       for (ControllerContext ctx : controller.getAllContexts())
       {
-         if (ctx instanceof KernelControllerContext)
+         if (ctx instanceof KernelControllerContext || ctx instanceof PreInstalledControllerContext)
             names.add(ctx.getName().toString());
       }
 
@@ -111,14 +117,15 @@
    public void start()
    {
       context.registerService(MicrocontainerService.class.getName(), this, null);
-      
+
       try
       {
          KernelController controller = kernel.getController();
          ControllerContextActions actions = new AbstractControllerContextActions(new HashMap<ControllerState, ControllerContextAction>());
          controller.install(new PreInstalledControllerContext(BEAN_SYSTEM_BUNDLE_CONTEXT, actions, context));
          controller.install(new PreInstalledControllerContext(BEAN_MBEAN_SERVER, actions, mbeanServer));
-         
+         controller.install(new PreInstalledControllerContext(BEAN_KERNEL, actions, kernel));
+
          StandardMBean mbean = new StandardMBean(this, MicrocontainerServiceMBean.class);
          mbeanServer.registerMBean(mbean, MicrocontainerServiceMBean.MBEAN_MICROCONTAINER_SERVICE);
       }
@@ -127,7 +134,7 @@
          throw new IllegalStateException("Cannot register MicrocontainerServiceMBean", ex);
       }
    }
-   
+
    static class PreInstalledControllerContext extends AbstractControllerContext
    {
       public PreInstalledControllerContext(Object name, ControllerContextActions actions, Object target)




More information about the jboss-osgi-commits mailing list