[jboss-cvs] JBossAS SVN: r93449 - projects/jboss-osgi/projects/bundles/common/trunk/src/main/java/org/jboss/osgi/common/internal.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Sep 14 03:49:05 EDT 2009


Author: thomas.diesler at jboss.com
Date: 2009-09-14 03:49:04 -0400 (Mon, 14 Sep 2009)
New Revision: 93449

Modified:
   projects/jboss-osgi/projects/bundles/common/trunk/src/main/java/org/jboss/osgi/common/internal/SystemDeployerService.java
Log:
Use PackageAdmin.resolveBundles(null)

Modified: projects/jboss-osgi/projects/bundles/common/trunk/src/main/java/org/jboss/osgi/common/internal/SystemDeployerService.java
===================================================================
--- projects/jboss-osgi/projects/bundles/common/trunk/src/main/java/org/jboss/osgi/common/internal/SystemDeployerService.java	2009-09-14 07:39:10 UTC (rev 93448)
+++ projects/jboss-osgi/projects/bundles/common/trunk/src/main/java/org/jboss/osgi/common/internal/SystemDeployerService.java	2009-09-14 07:49:04 UTC (rev 93449)
@@ -24,9 +24,9 @@
 //$Id$
 
 import java.net.URL;
-import java.util.Collection;
 import java.util.HashMap;
 import java.util.Map;
+import java.util.Map.Entry;
 
 import org.jboss.osgi.common.log.LogServiceTracker;
 import org.jboss.osgi.spi.logging.ExportedPackageHelper;
@@ -68,7 +68,6 @@
    {
       DeploymentRegistryService registry = getDeploymentRegistry();
 
-      // Install the bundles
       Map<BundleDeployment, Bundle> bundleMap = new HashMap<BundleDeployment, Bundle>();
       for (BundleDeployment dep : depArr)
       {
@@ -89,24 +88,19 @@
          }
       }
 
-      // Resolve the bundles through the PackageAdmin
-      PackageAdmin packageAdmin = null;
-      ServiceReference sref = context.getServiceReference(PackageAdmin.class.getName());
-      if (sref != null)
+      // Resolve the installed bundles through the PackageAdmin
+      ServiceReference packageAdminRef = context.getServiceReference(PackageAdmin.class.getName());
+      if (packageAdminRef != null)
       {
-         packageAdmin = (PackageAdmin)context.getService(sref);
-         
-         Collection<Bundle> bundles = bundleMap.values();
-         Bundle[] bundleArr = new Bundle[bundles.size()];
-         bundles.toArray(bundleArr);
-         
-         packageAdmin.resolveBundles(bundleArr);
+         PackageAdmin packageAdmin = (PackageAdmin)context.getService(packageAdminRef);
+         packageAdmin.resolveBundles(null);
       }
       
       // Start the installed bundles
-      for (BundleDeployment dep : depArr)
+      for (Entry<BundleDeployment, Bundle> entry : bundleMap.entrySet())
       {
-         Bundle bundle = bundleMap.get(dep);
+         BundleDeployment dep = entry.getKey();
+         Bundle bundle = entry.getValue();
 
          StartLevel startLevel = getStartLevel();
          if (dep.getStartLevel() > 0)
@@ -117,7 +111,7 @@
          if (dep.isAutoStart())
          {
             int state = bundle.getState();
-            if (state == Bundle.RESOLVED || packageAdmin == null)
+            if (state == Bundle.RESOLVED || packageAdminRef == null)
             {
                try
                {
@@ -138,10 +132,6 @@
                   log.log(LogService.LOG_ERROR, "Cannot start bundle: " + bundle, ex);
                }
             }
-            else
-            {
-               log.log(LogService.LOG_INFO, "Cannot start unresolved bundle: " + bundle);
-            }
          }
       }
    }




More information about the jboss-cvs-commits mailing list