[jboss-osgi-commits] JBoss-OSGI SVN: r93537 - projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/internal.

jboss-osgi-commits at lists.jboss.org jboss-osgi-commits at lists.jboss.org
Tue Sep 15 10:34:53 EDT 2009


Author: thomas.diesler at jboss.com
Date: 2009-09-15 10:34:53 -0400 (Tue, 15 Sep 2009)
New Revision: 93537

Modified:
   projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/internal/OSGiRuntimeImpl.java
   projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/internal/RemoteRuntime.java
Log:
Cleanup remote deployment

Modified: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/internal/OSGiRuntimeImpl.java
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/internal/OSGiRuntimeImpl.java	2009-09-15 14:33:56 UTC (rev 93536)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/internal/OSGiRuntimeImpl.java	2009-09-15 14:34:53 UTC (rev 93537)
@@ -176,7 +176,7 @@
    protected void invokeDeployerService(String method, URL archiveURL) throws Exception
    {
       ObjectName oname = new ObjectName("jboss.osgi:service=DeployerService");
-      getMBeanServer().invoke(oname, method, new Object[] { archiveURL }, new String[] { "java.net.URL" });
+      getMBeanServer().invoke(oname, method, new Object[] { archiveURL }, new String[] { URL.class.getName() });
    }
 
    public InitialContext getInitialContext() throws NamingException

Modified: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/internal/RemoteRuntime.java
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/internal/RemoteRuntime.java	2009-09-15 14:33:56 UTC (rev 93536)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/internal/RemoteRuntime.java	2009-09-15 14:34:53 UTC (rev 93537)
@@ -44,9 +44,9 @@
 import org.jboss.osgi.spi.testing.OSGiRuntime;
 import org.jboss.osgi.spi.testing.OSGiServiceReference;
 import org.jboss.osgi.spi.testing.OSGiTestHelper;
+import org.jboss.osgi.spi.util.BundleDeployment;
 import org.jboss.osgi.spi.util.BundleDeploymentFactory;
 import org.osgi.framework.BundleException;
-import org.osgi.framework.Constants;
 import org.osgi.framework.InvalidSyntaxException;
 
 /**
@@ -67,11 +67,15 @@
 
    public OSGiBundle installBundle(String location) throws BundleException
    {
-      String symbolicName = getManifestEntry(location, Constants.BUNDLE_SYMBOLICNAME);
-      String version = getManifestEntry(location, Constants.BUNDLE_VERSION);
       try
       {
-         deploy(location);
+         URL bundleURL = getTestHelper().getTestArchiveURL(location);
+         BundleDeployment bundleDep = BundleDeploymentFactory.createBundleDeployment(bundleURL);
+         
+         invokeDeployerService("deploy", bundleURL);
+         
+         String symbolicName = bundleDep.getSymbolicName();
+         String version = bundleDep.getVersion().toString();
          ManagedBundleMBean bundleMBean = getRemoteFramework().getBundle(symbolicName, version);
          RemoteBundle bundle = new RemoteBundle(this, bundleMBean, location);
          return registerBundle(location, bundle);
@@ -98,38 +102,16 @@
    public void deploy(String location) throws Exception
    {
       URL archiveURL = getTestHelper().getTestArchiveURL(location);
-      
-      if (isBundleArchive(location))
-         invokeDeployerService("deploy", archiveURL);
-      else
-         invokeMainDeployer("deploy", archiveURL);
+      invokeMainDeployer("deploy", archiveURL);
    }
 
    @Override
    public void undeploy(String location) throws Exception
    {
       URL archiveURL = getTestHelper().getTestArchiveURL(location);
-      
-      if (isBundleArchive(location))
-         invokeDeployerService("undeploy", archiveURL);
-      else
-         invokeMainDeployer("undeploy", archiveURL);
+      invokeMainDeployer("undeploy", archiveURL);
    }
 
-   private boolean isBundleArchive(String location)
-   {
-      try
-      {
-         URL archiveURL = getTestHelper().getTestArchiveURL(location);
-         BundleDeploymentFactory.createBundleDeployment(archiveURL);
-         return true;
-      }
-      catch (BundleException ex)
-      {
-         return false;
-      }
-   }
-
    public OSGiBundle[] getBundles()
    {
       try
@@ -289,6 +271,6 @@
    private void invokeMainDeployer(String method, URL archiveURL) throws Exception
    {
       ObjectName oname = new ObjectName("jboss.system:service=MainDeployer");
-      getMBeanServer().invoke(oname, method, new Object[] { archiveURL }, new String[] { "java.net.URL" });
+      getMBeanServer().invoke(oname, method, new Object[] { archiveURL }, new String[] { URL.class.getName() });
    }
 }



More information about the jboss-osgi-commits mailing list