Author: thomas.diesler(a)jboss.com
Date: 2010-03-18 17:12:35 -0400 (Thu, 18 Mar 2010)
New Revision: 102591
Modified:
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/testing/internal/EmbeddedRuntime.java
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/testing/internal/RemoteRuntime.java
Log:
Add more logging
Modified:
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/testing/internal/EmbeddedRuntime.java
===================================================================
---
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/testing/internal/EmbeddedRuntime.java 2010-03-18
21:05:13 UTC (rev 102590)
+++
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/testing/internal/EmbeddedRuntime.java 2010-03-18
21:12:35 UTC (rev 102591)
@@ -60,13 +60,12 @@
// Provide logging
private static final Logger log = Logger.getLogger(EmbeddedRuntime.class);
- private MBeanServer server;
-
public EmbeddedRuntime(OSGiRuntimeHelper helper)
{
super(helper);
}
+ @Override
OSGiBundle installBundleInternal(BundleInfo info) throws BundleException
{
try
@@ -82,6 +81,7 @@
}
}
+ @Override
public OSGiBundle[] getBundles()
{
List<OSGiBundle> absBundles = new ArrayList<OSGiBundle>();
@@ -94,18 +94,21 @@
return bundleArr;
}
+ @Override
public OSGiBundle getBundle(long bundleId)
{
Bundle bundle = getSystemContext().getBundle(bundleId);
return bundle != null ? new EmbeddedBundle(this, bundle) : null;
}
+ @Override
public OSGiServiceReference getServiceReference(String clazz)
{
ServiceReference sref = getSystemContext().getServiceReference(clazz);
return (sref != null ? new EmbeddedServiceReference(sref) : null);
}
+ @Override
public OSGiServiceReference[] getServiceReferences(String clazz, String filter)
{
OSGiServiceReference[] retRefs = null;
@@ -140,7 +143,6 @@
if (value == null)
System.setProperty(entry.getKey(), entry.getValue());
}
-
super.addCapability(capability);
}
@@ -169,23 +171,32 @@
}
}
+ @Override
public MBeanServerConnection getMBeanServer()
{
- if (server == null)
+ MBeanServer mbeanServer = null;
+
+ ArrayList<MBeanServer> serverArr = MBeanServerFactory.findMBeanServer(null);
+ if (serverArr.size() > 1)
+ log.warn("Multiple MBeanServer instances: " + serverArr);
+
+ if (serverArr.size() > 0)
{
- ArrayList<MBeanServer> serverArr =
MBeanServerFactory.findMBeanServer(null);
- if (serverArr.size() > 1)
- throw new IllegalStateException("Multiple MBeanServer instances not
supported");
-
- if (serverArr.size() == 1)
- server = serverArr.get(0);
-
- if (server == null)
- server = MBeanServerFactory.createMBeanServer();
+ mbeanServer = serverArr.get(0);
+ log.debug("Found MBeanServer: " + mbeanServer);
}
- return server;
+
+ if (mbeanServer == null)
+ {
+ log.debug("No MBeanServer, create one ...");
+ mbeanServer = MBeanServerFactory.createMBeanServer();
+ log.debug("Created MBeanServer: " + mbeanServer);
+ }
+
+ return mbeanServer;
}
+ @Override
public boolean isRemoteRuntime()
{
return false;
Modified:
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/testing/internal/RemoteRuntime.java
===================================================================
---
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/testing/internal/RemoteRuntime.java 2010-03-18
21:05:13 UTC (rev 102590)
+++
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/testing/internal/RemoteRuntime.java 2010-03-18
21:12:35 UTC (rev 102591)
@@ -70,6 +70,7 @@
super(helper);
}
+ @Override
OSGiBundle installBundleInternal(BundleInfo info) throws BundleException
{
try
@@ -103,6 +104,7 @@
deployer.undeploy(archiveURL);
}
+ @Override
public OSGiBundle[] getBundles()
{
Set<OSGiBundle> bundles = new HashSet<OSGiBundle>();
@@ -137,6 +139,7 @@
}
}
+ @Override
public OSGiBundle getBundle(long bundleId)
{
for (OSGiBundle bundle : getBundles())
@@ -147,6 +150,7 @@
return null;
}
+ @Override
public OSGiServiceReference getServiceReference(String clazz)
{
CompositeData serviceData;
@@ -168,6 +172,7 @@
return new RemoteServiceReference(serviceData, propertiesData);
}
+ @Override
@SuppressWarnings("unchecked")
public OSGiServiceReference[] getServiceReferences(String clazz, String filter)
{
@@ -201,6 +206,7 @@
return MBeanProxy.get(getMBeanServer(), objectName, ServiceStateMBeanExt.class);
}
+ @Override
public MBeanServerConnection getMBeanServer()
{
if (mbeanServer == null)
@@ -218,6 +224,7 @@
return mbeanServer;
}
+ @Override
public boolean isRemoteRuntime()
{
return true;