[jboss-cvs] JBossAS SVN: r97285 - projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Dec 2 08:12:06 EST 2009
Author: thomas.diesler at jboss.com
Date: 2009-12-02 08:12:06 -0500 (Wed, 02 Dec 2009)
New Revision: 97285
Modified:
projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/OSGiRuntimeImpl.java
projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/RemoteBundle.java
Log:
Cache remote bundle headers
Modified: projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/OSGiRuntimeImpl.java
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/OSGiRuntimeImpl.java 2009-12-02 13:09:54 UTC (rev 97284)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/OSGiRuntimeImpl.java 2009-12-02 13:12:06 UTC (rev 97285)
@@ -98,11 +98,13 @@
{
log.debug("Add capability: " + capability);
+ // Install the capability bundles
for (BundleInfo info : capability.getBundles())
{
String location = info.getLocation();
String symName = info.getSymbolicName();
- if (bundles.get(location) == null && getBundle(symName, null) == null)
+ Version version = info.getVersion();
+ if (bundles.get(location) == null && getBundle(symName, version) == null)
{
OSGiBundle bundle = installBundle(location);
bundle.start();
@@ -116,7 +118,7 @@
}
else
{
- log.debug("Skip capability : " + capability);
+ log.debug("Skip capability: " + capability);
}
}
@@ -316,9 +318,9 @@
this.oname = oname;
}
- public void deploy(Deployment[] bundleDeps) throws BundleException
+ public void deploy(Deployment[] deps) throws BundleException
{
- invokeDeployerMBean(oname, "deploy", bundleDeps, Deployment[].class.getName());
+ invokeDeployerMBean(oname, "deploy", deps, Deployment[].class.getName());
}
public void deploy(URL url) throws BundleException
@@ -326,9 +328,9 @@
invokeDeployerMBean(oname, "deploy", url, URL.class.getName());
}
- public void undeploy(Deployment[] bundleDeps) throws BundleException
+ public void undeploy(Deployment[] deps) throws BundleException
{
- invokeDeployerMBean(oname, "undeploy", bundleDeps, Deployment[].class.getName());
+ invokeDeployerMBean(oname, "undeploy", deps, Deployment[].class.getName());
}
public void undeploy(URL url) throws BundleException
@@ -346,16 +348,18 @@
{
throw rte;
}
- catch (MBeanException ex)
- {
- Exception target = ex.getTargetException();
- if (target instanceof BundleException)
- throw (BundleException)target;
-
- throw new BundleException("Cannot " + method + ": " + arg, target);
- }
catch (Exception ex)
{
+ if (ex instanceof MBeanException)
+ {
+ ex = ((MBeanException)ex).getTargetException();
+ if (ex instanceof BundleException)
+ throw (BundleException)ex;
+ }
+
+ if (arg instanceof Deployment[])
+ arg = Arrays.asList((Deployment[])arg);
+
throw new BundleException("Cannot " + method + ": " + arg, ex);
}
}
Modified: projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/RemoteBundle.java
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/RemoteBundle.java 2009-12-02 13:09:54 UTC (rev 97284)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/RemoteBundle.java 2009-12-02 13:12:06 UTC (rev 97285)
@@ -27,6 +27,7 @@
import org.jboss.osgi.spi.management.ManagedBundleMBean;
import org.jboss.osgi.spi.util.BundleInfo;
+import org.jboss.osgi.spi.util.UnmodifiableDictionary;
import org.jboss.osgi.testing.OSGiBundle;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleException;
@@ -52,6 +53,7 @@
private long bundleId;
private String symbolicName;
+ private Dictionary<String, String> headers;
private Version version;
public RemoteBundle(OSGiRuntimeImpl runtime, ManagedBundleMBean bundle, BundleInfo bundleInfo)
@@ -66,11 +68,14 @@
super(runtime);
this.bundle = bundle;
- // Initialize cached properties to avoid remote access
+ // The getHeaders methods must continue to provide the manifest header
+ // information after the bundle enters the UNINSTALLED state.
+
bundleId = bundle.getBundleId();
symbolicName = bundle.getSymbolicName();
+ headers = bundle.getHeaders();
- String versionStr = getHeaders().get(Constants.BUNDLE_VERSION);
+ String versionStr = headers.get(Constants.BUNDLE_VERSION);
version = Version.parseVersion(versionStr);
}
@@ -105,10 +110,10 @@
}
@Override
+ @SuppressWarnings("unchecked")
public Dictionary<String, String> getHeaders()
{
- assertNotUninstalled();
- return bundle.getHeaders();
+ return new UnmodifiableDictionary(headers);
}
@Override
More information about the jboss-cvs-commits
mailing list