[jboss-osgi-commits] JBoss-OSGI SVN: r89654 - in projects/jboss-osgi/trunk: bundles/microcontainer/src/main/java/org/jboss/osgi/microcontainer/internal and 2 other directories.
jboss-osgi-commits at lists.jboss.org
jboss-osgi-commits at lists.jboss.org
Tue Jun 2 03:55:22 EDT 2009
Author: thomas.diesler at jboss.com
Date: 2009-06-02 03:55:22 -0400 (Tue, 02 Jun 2009)
New Revision: 89654
Modified:
projects/jboss-osgi/trunk/3rdparty/jboss-xml-binding/src/main/java/org/jboss/osgi/jbossxb/internal/XMLBindingActivator.java
projects/jboss-osgi/trunk/bundles/microcontainer/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceImpl.java
projects/jboss-osgi/trunk/distribution/runtime/conf/jboss-osgi-equinox.properties
projects/jboss-osgi/trunk/distribution/runtime/conf/jboss-osgi-felix.properties
projects/jboss-osgi/trunk/distribution/runtime/conf/jboss-osgi-knopflerfish.properties
projects/jboss-osgi/trunk/distribution/src/main/resources/installer/install-definition.xml
Log:
MC service tracks both jmx AND xml-binding
Modified: projects/jboss-osgi/trunk/3rdparty/jboss-xml-binding/src/main/java/org/jboss/osgi/jbossxb/internal/XMLBindingActivator.java
===================================================================
--- projects/jboss-osgi/trunk/3rdparty/jboss-xml-binding/src/main/java/org/jboss/osgi/jbossxb/internal/XMLBindingActivator.java 2009-06-02 07:16:24 UTC (rev 89653)
+++ projects/jboss-osgi/trunk/3rdparty/jboss-xml-binding/src/main/java/org/jboss/osgi/jbossxb/internal/XMLBindingActivator.java 2009-06-02 07:55:22 UTC (rev 89654)
@@ -71,6 +71,8 @@
{
throw new IllegalStateException("Cannot initialize SaxJBossXBParser", ex);
}
+
+ // Register the XMLBindingService
XMLBindingService service = new XMLBindingService(){};
context.registerService(XMLBindingService.class.getName(), service, null);
log.log(LogService.LOG_INFO, "XMLBindingService registered");
Modified: projects/jboss-osgi/trunk/bundles/microcontainer/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceImpl.java
===================================================================
--- projects/jboss-osgi/trunk/bundles/microcontainer/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceImpl.java 2009-06-02 07:16:24 UTC (rev 89653)
+++ projects/jboss-osgi/trunk/bundles/microcontainer/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceImpl.java 2009-06-02 07:55:22 UTC (rev 89654)
@@ -24,6 +24,8 @@
//$Id$
import java.net.URL;
+import java.util.Arrays;
+import java.util.List;
import java.util.Properties;
import javax.management.MBeanServer;
@@ -35,8 +37,12 @@
import org.jboss.osgi.spi.service.DeployerService;
import org.jboss.osgi.spi.service.MicrocontainerService;
import org.jboss.osgi.spi.service.MicrocontainerServiceMBean;
+import org.jboss.osgi.spi.service.XMLBindingService;
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;
@@ -93,34 +99,61 @@
installBean(controller, BEAN_KERNEL, kernel);
installBean(controller, BEAN_KERNEL_CONTROLLER, controller);
+ // Setup a filter to track both services
+ Filter filter;
+ try
+ {
+ String jmxService = "(" + Constants.OBJECTCLASS + "=" + MBeanServer.class.getName() + ")";
+ String xmlService = "(" + Constants.OBJECTCLASS + "=" + XMLBindingService.class.getName() + ")";
+ filter = context.createFilter("(|" + jmxService + xmlService + ")");
+ }
+ catch (InvalidSyntaxException ex)
+ {
+ throw new IllegalArgumentException("Invalid filter syntax");
+ }
+
// Register the MicrocontainerServiceMBean
- ServiceTracker tracker = new ServiceTracker(context, MBeanServer.class.getName(), null)
+ ServiceTracker tracker = new ServiceTracker(context, filter, null)
{
+ XMLBindingService xmlService;
+ MBeanServer mbeanServer;
+
@Override
- public Object addingService(ServiceReference reference)
+ public Object addingService(ServiceReference sref)
{
- // Install the MBeanServer
- MBeanServer mbeanServer = (MBeanServer)super.addingService(reference);
- installBean(controller, BEAN_MBEAN_SERVER, mbeanServer);
+ Object service = super.addingService(sref);
+
+ List<String> classList = Arrays.asList((String[])sref.getProperty(Constants.OBJECTCLASS));
+ if (classList.contains(MBeanServer.class.getName()))
+ mbeanServer = (MBeanServer)service;
- // Deploy the deployer beans
- URL deployersURL = context.getBundle().getResource("META-INF/base-deployers-beans.xml");
- deployer.deploy(deployersURL);
+ if (classList.contains(XMLBindingService.class.getName()))
+ xmlService = (XMLBindingService)service;
- // Register the MicrocontainerService
- log.log(LogService.LOG_DEBUG, "Register MicrocontainerService");
- context.registerService(MicrocontainerService.class.getName(), mcServiceImpl, null);
+ if (mbeanServer != null && xmlService != null)
+ {
+ // Install the MBeanServer
+ installBean(controller, BEAN_MBEAN_SERVER, mbeanServer);
- // Register the DeployerService
- Properties props = new Properties();
- props.setProperty("provider", "microcontainer");
- log.log(LogService.LOG_DEBUG, "Register DeployerService");
- context.registerService(DeployerService.class.getName(), mcServiceImpl, props);
+ // Deploy the deployer beans
+ URL deployersURL = context.getBundle().getResource("META-INF/base-deployers-beans.xml");
+ deployer.deploy(deployersURL);
- // Register the MicrocontainerServiceMBean
- registerMicrocontainerServiceMBean(mbeanServer);
+ // Register the MicrocontainerService
+ log.log(LogService.LOG_DEBUG, "Register MicrocontainerService");
+ context.registerService(MicrocontainerService.class.getName(), mcServiceImpl, null);
- return mbeanServer;
+ // Register the DeployerService
+ Properties props = new Properties();
+ props.setProperty("provider", "microcontainer");
+ log.log(LogService.LOG_DEBUG, "Register DeployerService");
+ context.registerService(DeployerService.class.getName(), mcServiceImpl, props);
+
+ // Register the MicrocontainerServiceMBean
+ registerMicrocontainerServiceMBean(mbeanServer);
+ }
+
+ return service;
}
};
tracker.open();
Modified: projects/jboss-osgi/trunk/distribution/runtime/conf/jboss-osgi-equinox.properties
===================================================================
--- projects/jboss-osgi/trunk/distribution/runtime/conf/jboss-osgi-equinox.properties 2009-06-02 07:16:24 UTC (rev 89653)
+++ projects/jboss-osgi/trunk/distribution/runtime/conf/jboss-osgi-equinox.properties 2009-06-02 07:55:22 UTC (rev 89654)
@@ -94,5 +94,4 @@
org.jboss.osgi.spi.framework.autoStart=\
file://${osgi.home}/server/minimal/bundles/org.apache.felix.log.jar \
file://${osgi.home}/server/minimal/bundles/jboss-osgi-common.jar \
- file://${osgi.home}/server/minimal/bundles/jboss-osgi-apache-xerces.jar \
file://${osgi.home}/server/minimal/bundles/jboss-osgi-hotdeploy.jar
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/distribution/runtime/conf/jboss-osgi-felix.properties
===================================================================
--- projects/jboss-osgi/trunk/distribution/runtime/conf/jboss-osgi-felix.properties 2009-06-02 07:16:24 UTC (rev 89653)
+++ projects/jboss-osgi/trunk/distribution/runtime/conf/jboss-osgi-felix.properties 2009-06-02 07:55:22 UTC (rev 89654)
@@ -61,5 +61,4 @@
org.jboss.osgi.spi.framework.autoStart=\
file://${osgi.home}/server/minimal/bundles/org.apache.felix.log.jar \
file://${osgi.home}/server/minimal/bundles/jboss-osgi-common.jar \
- file://${osgi.home}/server/minimal/bundles/jboss-osgi-apache-xerces.jar \
file://${osgi.home}/server/minimal/bundles/jboss-osgi-hotdeploy.jar
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/distribution/runtime/conf/jboss-osgi-knopflerfish.properties
===================================================================
--- projects/jboss-osgi/trunk/distribution/runtime/conf/jboss-osgi-knopflerfish.properties 2009-06-02 07:16:24 UTC (rev 89653)
+++ projects/jboss-osgi/trunk/distribution/runtime/conf/jboss-osgi-knopflerfish.properties 2009-06-02 07:55:22 UTC (rev 89654)
@@ -91,5 +91,4 @@
org.jboss.osgi.spi.framework.autoStart=\
file://${osgi.home}/server/minimal/bundles/org.apache.felix.log.jar \
file://${osgi.home}/server/minimal/bundles/jboss-osgi-common.jar \
- file://${osgi.home}/server/minimal/bundles/jboss-osgi-apache-xerces.jar \
file://${osgi.home}/server/minimal/bundles/jboss-osgi-hotdeploy.jar
\ No newline at end of file
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-06-02 07:16:24 UTC (rev 89653)
+++ projects/jboss-osgi/trunk/distribution/src/main/resources/installer/install-definition.xml 2009-06-02 07:55:22 UTC (rev 89654)
@@ -178,7 +178,6 @@
<!-- Server Minimal -->
<fileset dir="@{deploy.artifacts.dir}/lib" targetdir="$INSTALL_PATH/runtime/server/minimal/bundles" override="true">
<include name="org.apache.felix.log.jar" />
- <include name="jboss-osgi-apache-xerces.jar" />
<include name="jboss-osgi-common.jar" />
<include name="jboss-osgi-hotdeploy.jar" />
</fileset>
@@ -216,6 +215,7 @@
<include name="org.apache.felix.http.jetty.jar" />
<include name="org.apache.felix.metatype.jar" />
<!-- all -->
+ <include name="jboss-osgi-apache-xerces.jar" />
<include name="jboss-osgi-jaxb.jar" />
<include name="jboss-osgi-microcontainer.jar" />
<include name="jboss-osgi-xml-binding.jar" />
More information about the jboss-osgi-commits
mailing list