geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xuhaih...@apache.org
Subject svn commit: r1203109 - /geronimo/server/trunk/framework/modules/geronimo-hook/src/main/java/org/apache/geronimo/hook/equinox/SharedLibClassLoaderDelegateHook.java
Date Thu, 17 Nov 2011 08:49:04 GMT
Author: xuhaihong
Date: Thu Nov 17 08:49:04 2011
New Revision: 1203109

URL: http://svn.apache.org/viewvc?rev=1203109&view=rev
Log:
Support getResources method for shared library

Modified:
    geronimo/server/trunk/framework/modules/geronimo-hook/src/main/java/org/apache/geronimo/hook/equinox/SharedLibClassLoaderDelegateHook.java

Modified: geronimo/server/trunk/framework/modules/geronimo-hook/src/main/java/org/apache/geronimo/hook/equinox/SharedLibClassLoaderDelegateHook.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-hook/src/main/java/org/apache/geronimo/hook/equinox/SharedLibClassLoaderDelegateHook.java?rev=1203109&r1=1203108&r2=1203109&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-hook/src/main/java/org/apache/geronimo/hook/equinox/SharedLibClassLoaderDelegateHook.java
(original)
+++ geronimo/server/trunk/framework/modules/geronimo-hook/src/main/java/org/apache/geronimo/hook/equinox/SharedLibClassLoaderDelegateHook.java
Thu Nov 17 08:49:04 2011
@@ -18,9 +18,13 @@
 package org.apache.geronimo.hook.equinox;
 
 import java.io.FileNotFoundException;
+import java.io.IOException;
 import java.net.URL;
+import java.util.Collections;
 import java.util.Enumeration;
+import java.util.LinkedHashSet;
 import java.util.List;
+import java.util.Set;
 
 import org.apache.geronimo.hook.BundleHelper;
 import org.apache.geronimo.hook.SharedLibraryRegistry;
@@ -81,7 +85,29 @@ public class SharedLibClassLoaderDelegat
     }
 
     public Enumeration<URL> postFindResources(String name, BundleClassLoader classLoader,
BundleData data) throws FileNotFoundException {
-        return null;
+        SharedLibraryRegistry sharedLibraryRegistry = BundleHelper.getSharedLibraryRegistry();
+        if (sharedLibraryRegistry == null) {
+            return null;
+        }
+        List<Bundle> dependentSharedLibBundles = sharedLibraryRegistry.getDependentSharedLibBundles(data.getBundleID());
+        if (dependentSharedLibBundles == null || dependentSharedLibBundles.isEmpty()) {
+            return null;
+        }
+        Set<URL> foundResources = new LinkedHashSet<URL>();
+        for (Bundle sharedLibBundle : dependentSharedLibBundles) {
+            try {
+                Enumeration<URL> en = sharedLibBundle.getResources(name);
+                if (en == null) {
+                    continue;
+                }
+                while (en.hasMoreElements()) {
+                    foundResources.add(en.nextElement());
+                }
+            } catch (IOException e) {
+                //ignore this bundle
+            }
+        }
+        return Collections.enumeration(foundResources);
     }
 
     public String preFindLibrary(String name, BundleClassLoader classLoader, BundleData data)
throws FileNotFoundException {



Mime
View raw message