[jboss-osgi-commits] JBoss-OSGI SVN: r96313 - in projects/jboss-osgi/projects/bundles/webconsole/trunk: src/main/java/org/jboss/osgi/webconsole/internal/plugins and 1 other directory.

jboss-osgi-commits at lists.jboss.org jboss-osgi-commits at lists.jboss.org
Thu Nov 12 14:36:13 EST 2009


Author: thomas.diesler at jboss.com
Date: 2009-11-12 14:36:12 -0500 (Thu, 12 Nov 2009)
New Revision: 96313

Modified:
   projects/jboss-osgi/projects/bundles/webconsole/trunk/pom.xml
   projects/jboss-osgi/projects/bundles/webconsole/trunk/src/main/java/org/jboss/osgi/webconsole/internal/plugins/BundlesPlugin.java
   projects/jboss-osgi/projects/bundles/webconsole/trunk/src/main/java/org/jboss/osgi/webconsole/internal/plugins/InstallActionExt.java
Log:
Update deployment API

Modified: projects/jboss-osgi/projects/bundles/webconsole/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/bundles/webconsole/trunk/pom.xml	2009-11-12 19:30:30 UTC (rev 96312)
+++ projects/jboss-osgi/projects/bundles/webconsole/trunk/pom.xml	2009-11-12 19:36:12 UTC (rev 96313)
@@ -27,7 +27,7 @@
   <parent>
     <groupId>org.jboss.osgi</groupId>
     <artifactId>jboss-osgi-parent</artifactId>
-    <version>1.0.3</version>
+    <version>1.0.4-SNAPSHOT</version>
   </parent>
 
   <!-- SCM -->
@@ -46,9 +46,10 @@
     <version.felix.scr>1.0.0</version.felix.scr>
     <version.felix.webconsole>1.2.10</version.felix.webconsole>
     <version.javax.servlet>2.4</version.javax.servlet>
-    <version.jboss.osgi.spi>1.0.2</version.jboss.osgi.spi>
+    <version.jboss.osgi.deployment>1.0.0-SNAPSHOT</version.jboss.osgi.deployment>
+    <version.jboss.osgi.spi>1.0.3-SNAPSHOT</version.jboss.osgi.spi>
     <version.json>20070829</version.json>
-    <version.osgi>r4v42</version.osgi>
+    <version.osgi>4.2.0</version.osgi>
   </properties>
 
   <!-- Dependencies  -->
@@ -60,6 +61,12 @@
       <scope>provided</scope>
     </dependency>
     <dependency>
+      <groupId>org.jboss.osgi.runtime</groupId>
+      <artifactId>jboss-osgi-deployment</artifactId>
+      <version>${version.jboss.osgi.deployment}</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
       <groupId>javax.servlet</groupId>
       <artifactId>servlet-api</artifactId>
       <version>${version.javax.servlet}</version>

Modified: projects/jboss-osgi/projects/bundles/webconsole/trunk/src/main/java/org/jboss/osgi/webconsole/internal/plugins/BundlesPlugin.java
===================================================================
--- projects/jboss-osgi/projects/bundles/webconsole/trunk/src/main/java/org/jboss/osgi/webconsole/internal/plugins/BundlesPlugin.java	2009-11-12 19:30:30 UTC (rev 96312)
+++ projects/jboss-osgi/projects/bundles/webconsole/trunk/src/main/java/org/jboss/osgi/webconsole/internal/plugins/BundlesPlugin.java	2009-11-12 19:36:12 UTC (rev 96313)
@@ -28,9 +28,9 @@
 import javax.servlet.http.HttpServletRequest;
 
 import org.apache.felix.webconsole.internal.core.BundlesServlet;
-import org.jboss.osgi.spi.service.DeployerService;
-import org.jboss.osgi.spi.service.DeploymentRegistryService;
-import org.jboss.osgi.spi.util.BundleDeployment;
+import org.jboss.osgi.deployment.deployer.DeployerService;
+import org.jboss.osgi.deployment.deployer.Deployment;
+import org.jboss.osgi.deployment.deployer.DeploymentRegistryService;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.BundleException;
@@ -71,7 +71,7 @@
       
       String symbolicName = bundle.getSymbolicName();
       Version version = bundle.getVersion();
-      BundleDeployment dep = registry.getBundleDeployment(symbolicName, version);
+      Deployment dep = registry.getDeployment(symbolicName, version);
       if (dep == null)
       {
          getLog().log(LogService.LOG_WARNING, "Cannot find bundle deployment for: " + bundle);
@@ -80,7 +80,7 @@
       
       try
       {
-         service.undeploy(new BundleDeployment[] { dep });
+         service.undeploy(new Deployment[] { dep });
          return true;
       }
       catch (BundleException be)

Modified: projects/jboss-osgi/projects/bundles/webconsole/trunk/src/main/java/org/jboss/osgi/webconsole/internal/plugins/InstallActionExt.java
===================================================================
--- projects/jboss-osgi/projects/bundles/webconsole/trunk/src/main/java/org/jboss/osgi/webconsole/internal/plugins/InstallActionExt.java	2009-11-12 19:30:30 UTC (rev 96312)
+++ projects/jboss-osgi/projects/bundles/webconsole/trunk/src/main/java/org/jboss/osgi/webconsole/internal/plugins/InstallActionExt.java	2009-11-12 19:36:12 UTC (rev 96313)
@@ -29,13 +29,11 @@
 import java.net.URL;
 
 import org.apache.felix.webconsole.internal.core.InstallAction;
-import org.jboss.osgi.spi.service.DeployerService;
-import org.jboss.osgi.spi.util.BundleDeployment;
-import org.jboss.osgi.spi.util.BundleDeploymentFactory;
+import org.jboss.osgi.deployment.deployer.DeployerService;
+import org.jboss.osgi.deployment.deployer.Deployment;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.BundleException;
-import org.osgi.framework.Constants;
 import org.osgi.framework.ServiceReference;
 import org.osgi.framework.Version;
 import org.osgi.service.log.LogService;
@@ -59,19 +57,19 @@
          return;
       }
       final DeployerService deployer = (DeployerService)context.getService(sref);
-      
+
       Thread t = new InstallHelper(this, "Background Install " + bundleFile, bundleFile, refreshPackages)
       {
          protected Bundle doRun(InputStream bundleStream) throws BundleException
          {
             URL bundleURL = getBundleURL(bundleFile);
-            
-            BundleDeployment dep = BundleDeploymentFactory.createBundleDeployment(bundleURL);
+
+            Deployment dep = deployer.createDeployment(bundleURL);
             dep.setStartLevel(startlevel);
             dep.setAutoStart(doStart);
 
-            deployer.deploy(new BundleDeployment[] { dep });
-            
+            deployer.deploy(new Deployment[] { dep });
+
             Bundle bundle = getBundle(dep);
             if (bundle == null)
                throw new IllegalStateException("Cannot obtain installed bundle: " + dep);
@@ -84,27 +82,23 @@
       t.start();
    }
 
-   private Bundle getBundle(BundleDeployment info)
+   private Bundle getBundle(Deployment dep)
    {
-      String symbolicName = info.getSymbolicName();
-      Version version = Version.parseVersion(info.getVersion());
+      String symbolicName = dep.getSymbolicName();
+      Version version = Version.parseVersion(dep.getVersion());
 
       Bundle bundle = null;
       for (Bundle aux : getBundleContext().getBundles())
       {
-         if (aux.getSymbolicName().equals(symbolicName))
+         if (aux.getSymbolicName().equals(symbolicName) && version.equals(aux.getVersion()))
          {
-            String auxVersion = (String)aux.getHeaders().get(Constants.BUNDLE_VERSION);
-            if (version == null || version.equals(auxVersion))
-            {
-               bundle = aux;
-               break;
-            }
+            bundle = aux;
+            break;
          }
       }
       return bundle;
    }
-   
+
    private URL getBundleURL(final File bundleFile) throws BundleException
    {
       URL bundleURL;



More information about the jboss-osgi-commits mailing list