geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r1127218 - in /geronimo/server/trunk: framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/ plugins/myfaces/geronimo-myfaces/src/main/java/org/apache/geronimo/myfaces/config/resource/osgi/
Date Tue, 24 May 2011 18:53:12 GMT
Author: gawor
Date: Tue May 24 18:53:12 2011
New Revision: 1127218

URL: http://svn.apache.org/viewvc?rev=1127218&view=rev
Log:
GERONIMO-5938: Load JSF taglib xml files from bundles - considered wired bundles in addition
to dependencies

Modified:
    geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/DependencyManager.java
    geronimo/server/trunk/plugins/myfaces/geronimo-myfaces/src/main/java/org/apache/geronimo/myfaces/config/resource/osgi/ConfigRegistryImpl.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=1127218&r1=1127217&r2=1127218&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
Tue May 24 18:53:12 2011
@@ -151,16 +151,16 @@ public class DependencyManager implement
         return dependentBundleIds == null ? Collections.<Long> emptySet() : new HashSet<Long>(dependentBundleIds);
     }
 
-    public List<Bundle> getFullDependentBundles(Bundle bundle) {
+    public Set<Bundle> getFullDependentBundles(Bundle bundle) {
         return getFullDependentBundles(bundle.getBundleId());
     }
 
-    public List<Bundle> getFullDependentBundles(Long bundleId) {
+    public Set<Bundle> getFullDependentBundles(Long bundleId) {
         Set<Long> fullDependentBundleIds = getFullDependentBundleIds(bundleId);
         if (fullDependentBundleIds.size() == 0) {
-            return Collections.<Bundle> emptyList();
+            return Collections.<Bundle> emptySet();
         }
-        List<Bundle> dependentBundles = new ArrayList<Bundle>(fullDependentBundleIds.size());
+        Set<Bundle> dependentBundles = new HashSet<Bundle>(fullDependentBundleIds.size());
         for (Long dependentBundleId : fullDependentBundleIds) {
             dependentBundles.add(bundleContext.getBundle(dependentBundleId));
         }

Modified: geronimo/server/trunk/plugins/myfaces/geronimo-myfaces/src/main/java/org/apache/geronimo/myfaces/config/resource/osgi/ConfigRegistryImpl.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/myfaces/geronimo-myfaces/src/main/java/org/apache/geronimo/myfaces/config/resource/osgi/ConfigRegistryImpl.java?rev=1127218&r1=1127217&r2=1127218&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/myfaces/geronimo-myfaces/src/main/java/org/apache/geronimo/myfaces/config/resource/osgi/ConfigRegistryImpl.java
(original)
+++ geronimo/server/trunk/plugins/myfaces/geronimo-myfaces/src/main/java/org/apache/geronimo/myfaces/config/resource/osgi/ConfigRegistryImpl.java
Tue May 24 18:53:12 2011
@@ -34,6 +34,7 @@ import org.apache.geronimo.myfaces.Faces
 import org.apache.geronimo.myfaces.config.resource.osgi.api.ConfigRegistry;
 import org.apache.geronimo.system.configuration.DependencyManager;
 import org.apache.myfaces.config.element.FacesConfig;
+import org.apache.xbean.osgi.bundle.util.BundleUtils;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceReference;
@@ -130,7 +131,8 @@ public class ConfigRegistryImpl implemen
                 return Collections.<FacesConfig> emptyList();
             }
             DependencyManager dependencyManager = (DependencyManager) bundleContext.getService(serviceReference);
-            List<Bundle> dependentBundles = dependencyManager.getFullDependentBundles(bundleId);
+            Set<Bundle> dependentBundles = dependencyManager.getFullDependentBundles(bundleId);
+            addWiredBundles(bundleId, dependentBundles);
             List<FacesConfig> dependentFacesConfigs = new ArrayList<FacesConfig>();
             for (Bundle dependentBundle : dependentBundles) {
                 List<FacesConfig> facesConfigs = bundleIdFacesConfigsMap.get(dependentBundle.getBundleId());
@@ -156,7 +158,8 @@ public class ConfigRegistryImpl implemen
                 return Collections.<URL> emptyList();
             }
             DependencyManager dependencyManager = (DependencyManager) bundleContext.getService(serviceReference);
-            List<Bundle> dependentBundles = dependencyManager.getFullDependentBundles(bundleId);
+            Set<Bundle> dependentBundles = dependencyManager.getFullDependentBundles(bundleId);
+            addWiredBundles(bundleId, dependentBundles);
             List<URL> faceletsConfigResources = new ArrayList<URL>();
             for (Bundle dependentBundle : dependentBundles) {
                 List<URL> faceletConfigResources = bundleIdFaceletsConfigResourcesMap.get(dependentBundle.getBundleId());
@@ -172,6 +175,19 @@ public class ConfigRegistryImpl implemen
         }
     }
 
+    /*
+     * Add any wired bundles if the bundle is a Web Application Bundle.
+     */
+    private void addWiredBundles(Long bundleId, Set<Bundle> dependentBundles) {
+        BundleContext bundleContext = activator.getBundleContext();
+        Bundle bundle = bundleContext.getBundle(bundleId);
+        String contextPath = (String) bundle.getHeaders().get("Web-ContextPath");
+        if (contextPath != null) {
+            Set<Bundle> wiredBundles = BundleUtils.getWiredBundles(bundle);
+            dependentBundles.addAll(wiredBundles);
+        }
+    }
+
     @Override
     public Set<Long> getFacesConfigsBundleIds() {
         return bundleIdFacesConfigsMap.keySet();



Mime
View raw message