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 08:57:01 UTC

svn commit: r1097704 - in /geronimo/server/trunk/plugins/myfaces: geronimo-myfaces-builder/src/main/java/org/apache/geronimo/myfaces/deployment/ geronimo-myfaces/src/main/java/org/apache/geronimo/myfaces/config/resource/osgi/ geronimo-myfaces/src/main/...

Author: xuhaihong
Date: Fri Apr 29 06:57:00 2011
New Revision: 1097704

URL: http://svn.apache.org/viewvc?rev=1097704&view=rev
Log:
GERONIMO-5938 Load JSF taglib xml files from bundles

Modified:
    geronimo/server/trunk/plugins/myfaces/geronimo-myfaces-builder/src/main/java/org/apache/geronimo/myfaces/deployment/MyFacesModuleBuilderExtension.java
    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
    geronimo/server/trunk/plugins/myfaces/geronimo-myfaces/src/main/java/org/apache/geronimo/myfaces/config/resource/osgi/api/ConfigRegistry.java   (contents, props changed)
    geronimo/server/trunk/plugins/myfaces/geronimo-myfaces/src/main/java/org/apache/geronimo/myfaces/webapp/MyFacesWebAppContext.java

Modified: geronimo/server/trunk/plugins/myfaces/geronimo-myfaces-builder/src/main/java/org/apache/geronimo/myfaces/deployment/MyFacesModuleBuilderExtension.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/myfaces/geronimo-myfaces-builder/src/main/java/org/apache/geronimo/myfaces/deployment/MyFacesModuleBuilderExtension.java?rev=1097704&r1=1097703&r2=1097704&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/myfaces/geronimo-myfaces-builder/src/main/java/org/apache/geronimo/myfaces/deployment/MyFacesModuleBuilderExtension.java (original)
+++ geronimo/server/trunk/plugins/myfaces/geronimo-myfaces-builder/src/main/java/org/apache/geronimo/myfaces/deployment/MyFacesModuleBuilderExtension.java Fri Apr 29 06:57:00 2011
@@ -247,7 +247,7 @@ public class MyFacesModuleBuilderExtensi
         try {
             ref = bundle.getBundleContext().getServiceReference(ConfigRegistry.class.getName());
             ConfigRegistry configRegistry = (ConfigRegistry) bundle.getBundleContext().getService(ref);
-            classloaderFacesConfigs.addAll(configRegistry.getDependentFacesConfigs(bundle));
+            classloaderFacesConfigs.addAll(configRegistry.getDependentFacesConfigs(bundle.getBundleId()));
         } finally {
             if (ref != null) {
                 bundle.getBundleContext().ungetService(ref);
@@ -572,7 +572,7 @@ public class MyFacesModuleBuilderExtensi
                 @Override
                 public boolean foundInJar(Bundle bundle, String zipFileName, ZipEntry zipEntry, InputStream in) throws Exception {
                     String zipEntryName = zipEntry.getName();
-                    if (zipEntryName.endsWith(".tag-lib.xml") && zipEntryName.indexOf('/', "META-INF/".length()) == -1) {
+                    if (zipEntryName.endsWith(".taglib.xml") && zipEntryName.indexOf('/', "META-INF/".length()) == -1) {
                         ConfigurationResource configurationResource = new ConfigurationResource(zipFileName, zipEntry.getName());
                         metaInfConfigurationResources.add(configurationResource);
                     }
@@ -580,14 +580,14 @@ public class MyFacesModuleBuilderExtensi
                 }
             });
         } catch (Exception e) {
-            throw new DeploymentException("Fail to scan tag-lib.xml configuration files", e);
+            throw new DeploymentException("Fail to scan .taglib.xml configuration files", e);
         } finally {
             if (reference != null) {
                 bundle.getBundleContext().ungetService(reference);
             }
         }
         //2 WEB-INF/classes/META-INF folder
-        Enumeration<URL> classesEn = bundle.findEntries(moduleNamePrefix + "WEB-INF/classes/META-INF/", "*.tag-lib.xml", false);
+        Enumeration<URL> classesEn = bundle.findEntries(moduleNamePrefix + "WEB-INF/classes/META-INF/", "*.taglib.xml", false);
         if (classesEn != null) {
             while (classesEn.hasMoreElements()) {
                 String filePath = classesEn.nextElement().getPath();
@@ -595,7 +595,7 @@ public class MyFacesModuleBuilderExtensi
             }
         }
         //3  META-INF folder
-        Enumeration<URL> metaInfEn = bundle.findEntries(moduleNamePrefix + "META-INF/", "*.tag-lib.xml", false);
+        Enumeration<URL> metaInfEn = bundle.findEntries(moduleNamePrefix + "META-INF/", "*.taglib.xml", false);
         if (metaInfEn != null) {
             while (metaInfEn.hasMoreElements()) {
                 String filePath = metaInfEn.nextElement().getPath();

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=1097704&r1=1097703&r2=1097704&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 06:57:00 2011
@@ -16,6 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+
 package org.apache.geronimo.myfaces.config.resource.osgi;
 
 import org.osgi.framework.Bundle;
@@ -24,10 +25,13 @@ import org.osgi.service.log.LogService;
 import org.osgi.util.tracker.BundleTrackerCustomizer;
 
 public class ConfigBundleTrackerCustomizer implements BundleTrackerCustomizer {
+
     // our base Activator (used as a service source)
     private Activator activator;
+
     // the bundle hosting this registry
     private Bundle registryBundle;
+
     // the registry we interact with
     private ConfigRegistryImpl registry;
 
@@ -51,8 +55,8 @@ public class ConfigBundleTrackerCustomiz
         if (bundle.equals(registryBundle)) {
             return null;
         }
-
-        return registry.addBundle(bundle);
+        registry.addBundle(bundle);
+        return 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=1097704&r1=1097703&r2=1097704&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 06:57:00 2011
@@ -17,14 +17,13 @@
  * under the License.
  */
 
-
 package org.apache.geronimo.myfaces.config.resource.osgi;
 
 import java.io.InputStream;
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.Collections;
-import java.util.HashSet;
+import java.util.Enumeration;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -40,16 +39,18 @@ import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceReference;
 import org.osgi.service.log.LogService;
 
-
 /**
  * @version $Rev$ $Date$
  */
 public class ConfigRegistryImpl implements ConfigRegistry {
+
     private final Activator activator;
 
-    private final Set<URL> urls = new HashSet<URL>();
+    private Map<Long, List<FacesConfig>> bundleIdFacesConfigsMap = new ConcurrentHashMap<Long, List<FacesConfig>>();
+
+    private Map<Long, List<URL>> bundleIdFacesConfigURLsMap = new ConcurrentHashMap<Long, List<URL>>();
 
-    private Map<Long, FacesConfig> bundleIdFacesConfigMap = new ConcurrentHashMap<Long, FacesConfig>();
+    private Map<Long, List<URL>> bundleIdFaceletsConfigResourcesMap = new ConcurrentHashMap<Long, List<URL>>();
 
     private FacesConfigDigester facesConfigDigester = new FacesConfigDigester();
 
@@ -57,42 +58,63 @@ public class ConfigRegistryImpl implemen
         this.activator = activator;
     }
 
-    public Object addBundle(Bundle bundle) {
+    public void addBundle(Bundle bundle) {
+        findFacesConfigs(bundle);
+        findFaceletsConfigResources(bundle);
+    }
+
+    protected void 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);
+        }
+    }
+
+    protected void findFacesConfigs(Bundle bundle) {
         log(LogService.LOG_DEBUG, "examining bundle for META-INF/faces-config.xml " + bundle.getSymbolicName());
         URL url = bundle.getEntry("META-INF/faces-config.xml");
+        List<FacesConfig> facesConfigs = null;
+        List<URL> facesConfigURLs = null;
         if (url != null) {
-            log(LogService.LOG_DEBUG, "found META-INF/faces-config.xml");
-            urls.add(url);
-            InputStream in = null;
-            try {
-                in = url.openStream();
-                bundleIdFacesConfigMap.put(bundle.getBundleId(), facesConfigDigester.getFacesConfig(in, url.toExternalForm()));
-            } catch (Exception e) {
-            } finally {
-                IOUtils.close(in);
+            facesConfigs = new ArrayList<FacesConfig>();
+            facesConfigURLs = new ArrayList<URL>();
+            facesConfigs.add(parseFacesConfig(bundle, url));
+            facesConfigURLs.add(url);
+        }
+        Enumeration<URL> metaInfEn = bundle.findEntries("META-INF/", "*.faces-config.xml", false);
+        if (metaInfEn != null) {
+            if (facesConfigs == null) {
+                facesConfigs = new ArrayList<FacesConfig>();
+            }
+            if (facesConfigURLs == null) {
+                facesConfigURLs = new ArrayList<URL>();
+            }
+            while (metaInfEn.hasMoreElements()) {
+                URL currURL = metaInfEn.nextElement();
+                facesConfigURLs.add(currURL);
+                facesConfigs.add(parseFacesConfig(bundle, currURL));
             }
         }
-        return url;
-    }
-
-    public void removeBundle(Bundle bundle, Object object) {
-        log(LogService.LOG_DEBUG, "unregistering bundle for META-INF/faces-config.xml " + bundle.getSymbolicName() + " url: " + object);
-        if (object != null) {
-            urls.remove(object);
+        if (facesConfigs != null) {
+            bundleIdFacesConfigsMap.put(bundle.getBundleId(), facesConfigs);
+        }
+        if (facesConfigURLs != null) {
+            bundleIdFacesConfigURLsMap.put(bundle.getBundleId(), facesConfigURLs);
         }
-        bundleIdFacesConfigMap.remove(bundle.getBundleId());
-    }
-
-    @Override
-    public Set<URL> getRegisteredConfigUrls() {
-        return Collections.unmodifiableSet(urls);
     }
 
-    public Set<URL> getDependentConfigUrls(Bundle bundle) {
-        return null;
+    public void removeBundle(Bundle bundle, Object object) {
+        Long removeBundleId = bundle.getBundleId();
+        bundleIdFacesConfigsMap.remove(removeBundleId);
+        bundleIdFacesConfigURLsMap.remove(removeBundleId);
+        bundleIdFaceletsConfigResourcesMap.remove(removeBundleId);
     }
 
-    public List<FacesConfig> getDependentFacesConfigs(Bundle bundle) {
+    public List<FacesConfig> getDependentFacesConfigs(Long bundleId) {
         BundleContext bundleContext = activator.getBundleContext();
         ServiceReference serviceReference = null;
         try {
@@ -101,12 +123,12 @@ public class ConfigRegistryImpl implemen
                 return Collections.<FacesConfig> emptyList();
             }
             DependencyManager dependencyManager = (DependencyManager) bundleContext.getService(serviceReference);
-            List<Bundle> dependentBundles = dependencyManager.getFullDependentBundles(bundle);
+            List<Bundle> dependentBundles = dependencyManager.getFullDependentBundles(bundleId);
             List<FacesConfig> dependentFacesConfigs = new ArrayList<FacesConfig>();
             for (Bundle dependentBundle : dependentBundles) {
-                FacesConfig facesConfig = bundleIdFacesConfigMap.get(dependentBundle.getBundleId());
-                if (facesConfig != null) {
-                    dependentFacesConfigs.add(facesConfig);
+                List<FacesConfig> facesConfigs = bundleIdFacesConfigsMap.get(dependentBundle.getBundleId());
+                if (facesConfigs != null) {
+                    dependentFacesConfigs.addAll(facesConfigs);
                 }
             }
             return dependentFacesConfigs;
@@ -117,6 +139,56 @@ public class ConfigRegistryImpl implemen
         }
     }
 
+    @Override
+    public List<URL> getDependentFaceletsConfigResources(Long bundleId) {
+        BundleContext bundleContext = activator.getBundleContext();
+        ServiceReference serviceReference = null;
+        try {
+            serviceReference = bundleContext.getServiceReference(DependencyManager.class.getName());
+            if (serviceReference == null) {
+                return Collections.<URL> emptyList();
+            }
+            DependencyManager dependencyManager = (DependencyManager) bundleContext.getService(serviceReference);
+            List<Bundle> dependentBundles = dependencyManager.getFullDependentBundles(bundleId);
+            List<URL> faceletsConfigResources = new ArrayList<URL>();
+            for (Bundle dependentBundle : dependentBundles) {
+                List<URL> faceletConfigResources = bundleIdFaceletsConfigResourcesMap.get(dependentBundle.getBundleId());
+                if (faceletConfigResources != null) {
+                    faceletsConfigResources.addAll(faceletConfigResources);
+                }
+            }
+            return faceletsConfigResources;
+        } finally {
+            if (serviceReference != null) {
+                bundleContext.ungetService(serviceReference);
+            }
+        }
+    }
+
+    @Override
+    public Set<Long> getFacesConfigsBundleIds() {
+        return bundleIdFacesConfigsMap.keySet();
+    }
+
+    @Override
+    public List<FacesConfig> getFacesConfigs(Long bundleId) {
+        return bundleIdFacesConfigsMap.get(bundleId);
+    }
+
+    @Override
+    public Set<Long> getFaceletsConfigResourcesBundleIds() {
+        return bundleIdFaceletsConfigResourcesMap.keySet();
+    }
+
+    @Override
+    public List<URL> getFaceletsConfigResources(Long bundleId) {
+        return bundleIdFaceletsConfigResourcesMap.get(bundleId);
+    }
+
+    @Override
+    public List<URL> getFacesConfigURLs(Long bundleId) {
+        return bundleIdFacesConfigURLsMap.get(bundleId);
+    }
 
     private void log(int level, String message) {
         activator.log(level, message);
@@ -126,5 +198,17 @@ public class ConfigRegistryImpl implemen
         activator.log(level, message, th);
     }
 
-
+    private FacesConfig parseFacesConfig(Bundle bundle, URL url) {
+        log(LogService.LOG_DEBUG, "found META-INF/faces-config.xml");
+        InputStream in = null;
+        try {
+            in = url.openStream();
+            return facesConfigDigester.getFacesConfig(in, url.toExternalForm());
+        } catch (Exception e) {
+            log(LogService.LOG_WARNING, "fail to parse " + url + " in the bundle " + bundle.getSymbolicName() + " due to " + e.getMessage(), e);
+            return null;
+        } finally {
+            IOUtils.close(in);
+        }
+    }
 }

Modified: geronimo/server/trunk/plugins/myfaces/geronimo-myfaces/src/main/java/org/apache/geronimo/myfaces/config/resource/osgi/api/ConfigRegistry.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/myfaces/geronimo-myfaces/src/main/java/org/apache/geronimo/myfaces/config/resource/osgi/api/ConfigRegistry.java?rev=1097704&r1=1097703&r2=1097704&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/myfaces/geronimo-myfaces/src/main/java/org/apache/geronimo/myfaces/config/resource/osgi/api/ConfigRegistry.java (original)
+++ geronimo/server/trunk/plugins/myfaces/geronimo-myfaces/src/main/java/org/apache/geronimo/myfaces/config/resource/osgi/api/ConfigRegistry.java Fri Apr 29 06:57:00 2011
@@ -17,7 +17,6 @@
  * under the License.
  */
 
-
 package org.apache.geronimo.myfaces.config.resource.osgi.api;
 
 import java.net.URL;
@@ -25,23 +24,56 @@ import java.util.List;
 import java.util.Set;
 
 import org.apache.myfaces.config.element.FacesConfig;
-import org.osgi.framework.Bundle;
 
 /**
- * @version $Rev:$ $Date:$
+ * @version $Rev$ $Date$
  */
 public interface ConfigRegistry {
 
     /**
-     * Get the URL list of founded faces-config.xml for all the started bundles
+     * Get the parsed FacesConfig instances from the dependency tree of the specified bundle and its parents
+     * @param bundle
      * @return
      */
-    Set<URL> getRegisteredConfigUrls();
+    List<FacesConfig> getDependentFacesConfigs(Long bundleId);
 
     /**
-     * Get the parsed FacesConfig instances from the dependency tree of the specified bundle
-     * @param bundle
+     * Get the list of tag-lib.xml URLs in the specified bundle and its parents
+     * @param bundleId
+     * @return
+     */
+    List<URL> getDependentFaceletsConfigResources(Long bundleId);
+
+    /**
+     * Get all the bundle Id which have shipped faces-config.xml files in their META-INF directories
+     * @return
+     */
+    Set<Long> getFacesConfigsBundleIds();
+
+    /**
+     * Get the list of parsed faces-config.xml in the specified bundle
+     * @param bundleId
+     * @return
+     */
+    List<FacesConfig> getFacesConfigs(Long bundleId);
+
+    /**
+     * Get the list of faces-config.xml URLs in the specified bundle
+     * @param bundleId
+     * @return
+     */
+    List<URL> getFacesConfigURLs(Long bundleId);
+
+    /**
+     * Get all the bundle Id which have shipped tag-lib.xml files in their META-INF directories
+     * @return
+     */
+    Set<Long> getFaceletsConfigResourcesBundleIds();
+
+    /**
+     * Get the list of tag-lib.xml files in the specified bundle
+     * @param bundleId
      * @return
      */
-    List<FacesConfig> getDependentFacesConfigs(Bundle bundle);
+    List<URL> getFaceletsConfigResources(Long bundleId);
 }

Propchange: geronimo/server/trunk/plugins/myfaces/geronimo-myfaces/src/main/java/org/apache/geronimo/myfaces/config/resource/osgi/api/ConfigRegistry.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/plugins/myfaces/geronimo-myfaces/src/main/java/org/apache/geronimo/myfaces/config/resource/osgi/api/ConfigRegistry.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/server/trunk/plugins/myfaces/geronimo-myfaces/src/main/java/org/apache/geronimo/myfaces/config/resource/osgi/api/ConfigRegistry.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/server/trunk/plugins/myfaces/geronimo-myfaces/src/main/java/org/apache/geronimo/myfaces/webapp/MyFacesWebAppContext.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/myfaces/geronimo-myfaces/src/main/java/org/apache/geronimo/myfaces/webapp/MyFacesWebAppContext.java?rev=1097704&r1=1097703&r2=1097704&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/myfaces/geronimo-myfaces/src/main/java/org/apache/geronimo/myfaces/webapp/MyFacesWebAppContext.java (original)
+++ geronimo/server/trunk/plugins/myfaces/geronimo-myfaces/src/main/java/org/apache/geronimo/myfaces/webapp/MyFacesWebAppContext.java Fri Apr 29 06:57:00 2011
@@ -31,8 +31,12 @@ import org.apache.geronimo.gbean.annotat
 import org.apache.geronimo.gbean.annotation.ParamSpecial;
 import org.apache.geronimo.gbean.annotation.SpecialAttributeType;
 import org.apache.geronimo.myfaces.config.resource.ConfigurationResource;
+import org.apache.geronimo.myfaces.config.resource.osgi.api.ConfigRegistry;
 import org.apache.myfaces.config.element.FacesConfigData;
 import org.osgi.framework.Bundle;
+import org.osgi.framework.ServiceReference;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * @version $Rev$ $Date$
@@ -40,6 +44,8 @@ import org.osgi.framework.Bundle;
 @GBean(name = "MyFaces WebApplication Context", j2eeType = "MyFacesWebAppContext")
 public class MyFacesWebAppContext implements GBeanLifecycle {
 
+    private static final Logger logger = LoggerFactory.getLogger(MyFacesWebAppContext.class);
+
     private static final Map<Bundle, MyFacesWebAppContext> MYFACES_WEBAPP_CONTEXTS = new ConcurrentHashMap<Bundle, MyFacesWebAppContext>();
 
     private FacesConfigData facesConfigData;
@@ -51,19 +57,34 @@ public class MyFacesWebAppContext implem
     private List<URL> faceletConfigResources;
 
     public MyFacesWebAppContext(@ParamAttribute(name = "facesConfigData") FacesConfigData facesConfigData,
-                                                                @ParamAttribute(name = "faceletConfigResources") Set<ConfigurationResource> faceletConfigResources,
-                                                                @ParamSpecial(type = SpecialAttributeType.bundle) Bundle bundle,
-                                                                @ParamSpecial(type = SpecialAttributeType.classLoader) ClassLoader classLoader) {
+            @ParamAttribute(name = "faceletConfigResources") Set<ConfigurationResource> faceletConfigResources, @ParamSpecial(type = SpecialAttributeType.bundle) Bundle bundle,
+            @ParamSpecial(type = SpecialAttributeType.classLoader) ClassLoader classLoader) {
         this.bundle = bundle;
         this.facesConfigData = facesConfigData;
         this.classLoader = classLoader;
+        ServiceReference serviceReference = null;
         this.faceletConfigResources = new ArrayList<URL>(faceletConfigResources.size());
         try {
             for (ConfigurationResource faceletConfigResource : faceletConfigResources) {
                 this.faceletConfigResources.add(faceletConfigResource.getConfigurationResourceURL(bundle));
             }
+            serviceReference = bundle.getBundleContext().getServiceReference(ConfigRegistry.class.getName());
+            if (serviceReference != null) {
+                ConfigRegistry configRegistry = (ConfigRegistry) bundle.getBundleContext().getService(serviceReference);
+                List<URL> dependentFaceletsConfigResources = configRegistry.getDependentFaceletsConfigResources(bundle.getBundleId());
+                if (dependentFaceletsConfigResources != null) {
+                    this.faceletConfigResources.addAll(dependentFaceletsConfigResources);
+                }
+            } else {
+                logger.warn("Fail to find ConfigRegistry service, those *.taglib.xml from dependent bundles will not be registered in current web application " + bundle.getSymbolicName());
+            }
+
         } catch (MalformedURLException e) {
             throw new IllegalArgumentException(e);
+        } finally {
+            if (serviceReference != null) {
+                bundle.getBundleContext().ungetService(serviceReference);
+            }
         }
     }