[jboss-osgi-commits] JBoss-OSGI SVN: r89536 - in projects/jboss-osgi/trunk: distribution/runtime/conf and 3 other directories.
jboss-osgi-commits at lists.jboss.org
jboss-osgi-commits at lists.jboss.org
Fri May 29 13:37:18 EDT 2009
Author: thomas.diesler at jboss.com
Date: 2009-05-29 13:37:17 -0400 (Fri, 29 May 2009)
New Revision: 89536
Modified:
projects/jboss-osgi/trunk/bundles/common/src/main/java/org/jboss/osgi/common/internal/SimpleDeployerService.java
projects/jboss-osgi/trunk/distribution/runtime/conf/jboss-osgi-felix.properties
projects/jboss-osgi/trunk/distribution/src/main/resources/installer/install-definition.xml
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/capability/HuskyCapability.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/internal/RemoteRuntime.java
Log:
SimpleDeployerService registers ManagedBundle
Modified: 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-29 16:58:50 UTC (rev 89535)
+++ projects/jboss-osgi/trunk/bundles/common/src/main/java/org/jboss/osgi/common/internal/SimpleDeployerService.java 2009-05-29 17:37:17 UTC (rev 89536)
@@ -30,13 +30,19 @@
import java.util.List;
import java.util.Map;
+import javax.management.JMException;
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
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.DeployerServiceTracker;
+import org.jboss.osgi.spi.management.ManagedBundle;
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;
/**
@@ -49,7 +55,7 @@
{
private LogServiceTracker log;
private BundleContext context;
-
+
private Map<URI, Bundle> urlDeployments = new HashMap<URI, Bundle>();
public SimpleDeployerService(BundleContext context)
@@ -68,6 +74,7 @@
{
log.log(LogService.LOG_DEBUG, "Install: " + info.getSymbolicName());
Bundle bundle = context.installBundle(info.getLocation().toExternalForm());
+ registerManagedBundle(bundle);
bundles.add(bundle);
}
catch (BundleException ex)
@@ -116,6 +123,7 @@
log.log(LogService.LOG_DEBUG, "Install: " + url);
Bundle bundle = context.installBundle(url.toExternalForm());
urlDeployments.put(url.toURI(), bundle);
+ registerManagedBundle(bundle);
bundle.start();
}
@@ -128,4 +136,27 @@
bundle.uninstall();
}
}
+
+ private void registerManagedBundle(Bundle bundle)
+ {
+ ServiceReference sref = context.getServiceReference(MBeanServer.class.getName());
+ if (sref == null)
+ {
+ log.log(LogService.LOG_WARNING, "No MBeanServer. Cannot register managed bundle: " + bundle.getSymbolicName());
+ return;
+ }
+
+ MBeanServer mbeanServer = (MBeanServer)context.getService(sref);
+ ManagedBundle mb = new ManagedBundle(bundle);
+ ObjectName oname = mb.getObjectName();
+ try
+ {
+ log.log(LogService.LOG_DEBUG, "Register managed bundle: " + oname);
+ mbeanServer.registerMBean(mb, oname);
+ }
+ catch (JMException ex)
+ {
+ log.log(LogService.LOG_ERROR, "Cannot register managed bundle", ex);
+ }
+ }
}
\ 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-05-29 16:58:50 UTC (rev 89535)
+++ projects/jboss-osgi/trunk/distribution/runtime/conf/jboss-osgi-felix.properties 2009-05-29 17:37:17 UTC (rev 89536)
@@ -73,4 +73,5 @@
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-jmx.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-05-29 16:58:50 UTC (rev 89535)
+++ projects/jboss-osgi/trunk/distribution/src/main/resources/installer/install-definition.xml 2009-05-29 17:37:17 UTC (rev 89536)
@@ -180,11 +180,11 @@
<include name="org.apache.felix.log.jar" />
<include name="jboss-osgi-common.jar" />
<include name="jboss-osgi-hotdeploy.jar" />
+ <include name="jboss-osgi-jmx.jar" />
</fileset>
<fileset dir="@{deploy.artifacts.dir}/lib" targetdir="$INSTALL_PATH/runtime/server/default/bundles" override="true">
<include name="jboss-osgi-common-core.jar" />
- <include name="jboss-osgi-jmx.jar" />
<include name="jboss-osgi-jndi.jar" />
<include name="jboss-osgi-webconsole.jar" />
<include name="org.apache.felix.configadmin.jar" />
@@ -196,7 +196,6 @@
<include name="jboss-osgi-apache-xerces.jar" />
<include name="jboss-osgi-common-core.jar" />
<include name="jboss-osgi-jaxb.jar" />
- <include name="jboss-osgi-jmx.jar" />
<include name="jboss-osgi-jndi.jar" />
<include name="jboss-osgi-microcontainer.jar" />
<include name="jboss-osgi-webconsole.jar" />
Modified: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/capability/HuskyCapability.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/capability/HuskyCapability.java 2009-05-29 16:58:50 UTC (rev 89535)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/capability/HuskyCapability.java 2009-05-29 17:37:17 UTC (rev 89536)
@@ -37,6 +37,7 @@
{
// [TODO] make this a reference
super("org.jboss.osgi.husky.runtime.Connector");
+
addBundle("bundles/jboss-osgi-husky.jar");
}
}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/internal/RemoteRuntime.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/internal/RemoteRuntime.java 2009-05-29 16:58:50 UTC (rev 89535)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/internal/RemoteRuntime.java 2009-05-29 17:37:17 UTC (rev 89536)
@@ -240,13 +240,13 @@
{
public ManagedBundleMBean getBundle(String symbolicName)
{
- ObjectName bundleOName = managedFramework.getBundle(symbolicName);
- if (bundleOName == null)
- throw new IllegalArgumentException("Cannot remote bundle for: " + symbolicName);
+ ObjectName oname = managedFramework.getBundle(symbolicName);
+ if (oname == null)
+ throw new IllegalArgumentException("Cannot get remote bundle for: " + symbolicName);
try
{
- return MBeanProxy.get(ManagedBundleMBean.class, bundleOName, getMBeanServer());
+ return MBeanProxy.get(ManagedBundleMBean.class, oname, getMBeanServer());
}
catch (MBeanProxyException ex)
{
More information about the jboss-osgi-commits
mailing list