You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by xu...@apache.org on 2011/04/29 13:45:08 UTC

svn commit: r1097777 - in /geronimo/server/trunk/plugins/myfaces/geronimo-myfaces/src/main/java/org/apache/geronimo/myfaces/config/resource/osgi: ConfigBundleTrackerCustomizer.java ConfigRegistryImpl.java

Author: xuhaihong
Date: Fri Apr 29 11:45:07 2011
New Revision: 1097777

URL: http://svn.apache.org/viewvc?rev=1097777&view=rev
Log:
return boolean value to the tacker if required

Modified:
    geronimo/server/trunk/plugins/myfaces/geronimo-myfaces/src/main/java/org/apache/geronimo/myfaces/config/resource/osgi/ConfigBundleTrackerCustomizer.java
    geronimo/server/trunk/plugins/myfaces/geronimo-myfaces/src/main/java/org/apache/geronimo/myfaces/config/resource/osgi/ConfigRegistryImpl.java

Modified: geronimo/server/trunk/plugins/myfaces/geronimo-myfaces/src/main/java/org/apache/geronimo/myfaces/config/resource/osgi/ConfigBundleTrackerCustomizer.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/myfaces/geronimo-myfaces/src/main/java/org/apache/geronimo/myfaces/config/resource/osgi/ConfigBundleTrackerCustomizer.java?rev=1097777&r1=1097776&r2=1097777&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/myfaces/geronimo-myfaces/src/main/java/org/apache/geronimo/myfaces/config/resource/osgi/ConfigBundleTrackerCustomizer.java (original)
+++ geronimo/server/trunk/plugins/myfaces/geronimo-myfaces/src/main/java/org/apache/geronimo/myfaces/config/resource/osgi/ConfigBundleTrackerCustomizer.java Fri Apr 29 11:45:07 2011
@@ -55,8 +55,7 @@ public class ConfigBundleTrackerCustomiz
         if (bundle.equals(registryBundle)) {
             return null;
         }
-        registry.addBundle(bundle);
-        return null;
+        return registry.addBundle(bundle) ? Boolean.TRUE : null;
     }
 
     @Override

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=1097777&r1=1097776&r2=1097777&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 Fri Apr 29 11:45:07 2011
@@ -58,24 +58,28 @@ public class ConfigRegistryImpl implemen
         this.activator = activator;
     }
 
-    public void addBundle(Bundle bundle) {
-        findFacesConfigs(bundle);
-        findFaceletsConfigResources(bundle);
+    public boolean addBundle(Bundle bundle) {
+        boolean facesConfigsFound = findFacesConfigs(bundle);
+        boolean faceletsConfigResourcesFound = findFaceletsConfigResources(bundle);
+        return facesConfigsFound || faceletsConfigResourcesFound;
     }
 
-    protected void findFaceletsConfigResources(Bundle bundle) {
+    protected boolean findFaceletsConfigResources(Bundle bundle) {
         Enumeration<URL> metaInfEn = bundle.findEntries("META-INF/", "*.taglib.xml", false);
-        if (metaInfEn != null) {
-            List<URL> faceletsConfigResources = new ArrayList<URL>();
-            while (metaInfEn.hasMoreElements()) {
-                faceletsConfigResources.add(metaInfEn.nextElement());
-            }
-            bundleIdFaceletsConfigResourcesMap.put(bundle.getBundleId(), faceletsConfigResources);
+        if (metaInfEn == null) {
+            return false;
+        }
+        List<URL> faceletsConfigResources = new ArrayList<URL>();
+        while (metaInfEn.hasMoreElements()) {
+            faceletsConfigResources.add(metaInfEn.nextElement());
         }
+        bundleIdFaceletsConfigResourcesMap.put(bundle.getBundleId(), faceletsConfigResources);
+        return true;
     }
 
-    protected void findFacesConfigs(Bundle bundle) {
+    protected boolean findFacesConfigs(Bundle bundle) {
         log(LogService.LOG_DEBUG, "examining bundle for META-INF/faces-config.xml " + bundle.getSymbolicName());
+        boolean facesConfigsFound = false;
         URL url = bundle.getEntry("META-INF/faces-config.xml");
         List<FacesConfig> facesConfigs = null;
         List<URL> facesConfigURLs = null;
@@ -101,10 +105,13 @@ public class ConfigRegistryImpl implemen
         }
         if (facesConfigs != null) {
             bundleIdFacesConfigsMap.put(bundle.getBundleId(), facesConfigs);
+            facesConfigsFound = true;
         }
         if (facesConfigURLs != null) {
             bundleIdFacesConfigURLsMap.put(bundle.getBundleId(), facesConfigURLs);
+            facesConfigsFound = true;
         }
+        return facesConfigsFound;
     }
 
     public void removeBundle(Bundle bundle, Object object) {