geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r1138706 - /geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/Configuration.java
Date Thu, 23 Jun 2011 01:07:58 GMT
Author: gawor
Date: Thu Jun 23 01:07:57 2011
New Revision: 1138706

URL: http://svn.apache.org/viewvc?rev=1138706&view=rev
Log:
Use all non-configuration bundles for DelegatingBundle for WABs. This avoids dynamic wires
to be established on configuration bundles when looking up resources

Modified:
    geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/Configuration.java

Modified: geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/Configuration.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/Configuration.java?rev=1138706&r1=1138705&r2=1138706&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/Configuration.java
(original)
+++ geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/Configuration.java
Thu Jun 23 01:07:57 2011
@@ -202,7 +202,7 @@ public class Configuration implements GB
         
         if (configurationData.isUseEnvironment() && configurationManager != null)
{
             try {
-                List<Bundle> bundles = getParentBundles(configurationData, configurationResolver,
configurationManager);            
+                Collection<Bundle> bundles = getBundles(configurationData, configurationResolver,
configurationManager);            
                 this.bundle = new DelegatingBundle(bundles);
             } catch (Exception e) {
                 log.debug("Failed to identify bundle parents for " + configurationData.getId(),
e);
@@ -231,25 +231,43 @@ public class Configuration implements GB
         }
     }
 
-    private List<Bundle> getParentBundles(ConfigurationData configurationData,
+    private Collection<Bundle> getBundles(ConfigurationData configurationData,
                                           ConfigurationResolver configurationResolver,
                                           ConfigurationManager configurationManager) 
-                                          throws MissingDependencyException, InvalidConfigException
{
-        List<Bundle> bundles = new ArrayList<Bundle>();
+        throws MissingDependencyException, InvalidConfigException {
+        
+        Set<Bundle> bundles = new LinkedHashSet<Bundle>();
         bundles.add(configurationData.getBundleContext().getBundle());
       
+        getAllBundles(configurationData, configurationManager, new HashSet<Artifact>(),
bundles);
+                
+        return bundles;
+    }
+
+    /*
+     * Gets all dependent non-configuration bundles.
+     */
+    private void getAllBundles(ConfigurationData configurationData, ConfigurationManager
configurationManager, Set<Artifact> artifacts, Collection<Bundle> bundles) throws
MissingDependencyException, InvalidConfigException {
         LinkedHashSet<Artifact> parents = configurationManager.resolveParentIds(configurationData);
         for (Artifact parent : parents) {
-            String location = getBundleLocation(configurationResolver, parent);
-            Bundle bundle = getBundleByLocation(configurationData.getBundleContext(), location);
-            if (bundle != null) {
-                bundles.add(bundle);
+            if (artifacts.contains(parent)) {
+                continue;
+            }
+            artifacts.add(parent);
+            boolean isConfiguration = configurationManager.isConfiguration(parent);
+            if (isConfiguration) {
+                Configuration configuration = configurationManager.getConfiguration(parent);
+                getAllBundles(configuration.getConfigurationData(), configurationManager,
artifacts, bundles);
+            } else {
+                String location = getBundleLocation(configurationResolver, parent);
+                Bundle bundle = getBundleByLocation(configurationData.getBundleContext(),
location);
+                if (bundle != null) {
+                    bundles.add(bundle);
+                }
             }
         }
-        
-        return bundles;
     }
-
+    
     private static String getBundleLocation(ConfigurationResolver configurationResolver,
Artifact configurationId) {
         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