geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xuhaih...@apache.org
Subject svn commit: r929357 - /geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/DependencyManager.java
Date Wed, 31 Mar 2010 01:38:01 GMT
Author: xuhaihong
Date: Wed Mar 31 01:38:01 2010
New Revision: 929357

URL: http://svn.apache.org/viewvc?rev=929357&view=rev
Log:
GERONIMO-4933 Some optimization for loaded bundle checking

Modified:
    geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/DependencyManager.java

Modified: geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/DependencyManager.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/DependencyManager.java?rev=929357&r1=929356&r2=929357&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/DependencyManager.java
(original)
+++ geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/DependencyManager.java
Wed Mar 31 01:38:01 2010
@@ -66,8 +66,8 @@ public class DependencyManager implement
     private final RepositoryAdmin repositoryAdmin;
 
     private final ArtifactResolver artifactResolver;
-    
-    private final Map<Bundle, PluginArtifactType> pluginMap = 
+
+    private final Map<Bundle, PluginArtifactType> pluginMap =
         Collections.synchronizedMap(new WeakHashMap<Bundle, PluginArtifactType>());
 
     public DependencyManager(@ParamSpecial(type = SpecialAttributeType.bundleContext) BundleContext
bundleContext,
@@ -112,7 +112,7 @@ public class DependencyManager implement
         }
         return pluginArtifactType;
     }
-    
+
     private void installRepository(Bundle bundle) {
         if (repositoryAdmin != null) {
             URL info = bundle.getEntry("OSGI-INF/obr/repository.xml");
@@ -129,7 +129,7 @@ public class DependencyManager implement
         }
     }
 
-    private PluginArtifactType getCachedPluginMetadata(Bundle bundle) {        
+    private PluginArtifactType getCachedPluginMetadata(Bundle bundle) {
         PluginArtifactType pluginArtifactType = pluginMap.get(bundle);
         if (pluginArtifactType == null) {
             pluginArtifactType = getPluginMetadata(bundle);
@@ -141,7 +141,7 @@ public class DependencyManager implement
         }
         return pluginArtifactType;
     }
-        
+
     private void installed(Bundle bundle) {
         PluginArtifactType pluginArtifactType = getCachedPluginMetadata(bundle);
         if (pluginArtifactType != null) {
@@ -154,11 +154,6 @@ public class DependencyManager implement
                         artifact = artifactResolver.resolveInClassLoader(artifact);
                     }
                     String location = locateBundle(artifact);
-                    for (Bundle test: bundleContext.getBundles()) {
-                        if (location.equals(test.getLocation())) {
-                            continue;
-                        }
-                    }
                     try {
                         bundleContext.installBundle(location);
                     } catch (BundleException e) {
@@ -184,14 +179,12 @@ public class DependencyManager implement
                         artifact = artifactResolver.resolveInClassLoader(artifact);
                     }
                     String location = locateBundle(artifact);
-                        
-                    for (Bundle test: bundleContext.getBundles()) {
-                        if (location.equals(test.getLocation())) {
-                            bundles.add(test);
-                        }
-                    }                        
+                    Bundle b = bundleContext.installBundle(location);
+                    if (b.getState() != Bundle.ACTIVE) {
+                        bundles.add(b);
+                    }
                 }
-                    
+
                 for (Bundle b : bundles) {
                     if (BundleUtils.canStart(b)) {
                         try {
@@ -204,9 +197,9 @@ public class DependencyManager implement
             } catch (Exception e) {
                 log.error("Could not install bundle dependecy", e);
             }
-        }         
+        }
     }
-    
+
     private String locateBundle(Artifact configurationId) throws NoSuchConfigException, IOException,
InvalidConfigException {
         if (System.getProperty("geronimo.build.car") == null) {
             return "mvn:" + configurationId.getGroupId() + "/" + configurationId.getArtifactId()
+ "/" + configurationId.getVersion() + ("jar".equals(configurationId.getType())?  "": "/"
+ configurationId.getType());



Mime
View raw message