/** * Find the contribution locations by seraching a resource using the given classloader * @param classLoader The classloader that is used to call getResources() * @param resourceName The name of the resource * @return A list of locations that contain the resource */ public static List<String> getContributionLocations(ClassLoader classLoader, String resourceName) { if (classLoader == null) { classLoader = AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() { public ClassLoader run() { return Thread.currentThread().getContextClassLoader(); } }); } Enumeration<URL> resourceURLs = getResources(classLoader, resourceName); List<String> locations = new ArrayList<String>(); while (resourceURLs != null && resourceURLs.hasMoreElements()) { locations.add(getRootLocation(resourceURLs.nextElement(), resourceName)); } return locations; }
/** * Find the contribution locations by seraching a resource using the given classloader * @param classLoader The classloader that is used to call getResources() * @param resourceName The name of the resource * @return A list of locations that contain the resource */ public static List<String> getContributionLocations(ClassLoader classLoader, String resourceName) { if (classLoader == null) { classLoader = AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() { public ClassLoader run() { return Thread.currentThread().getContextClassLoader(); } }); } Enumeration<URL> resourceURLs = getResources(classLoader, resourceName); List<String> locations = new ArrayList<String>(); while (resourceURLs != null && resourceURLs.hasMoreElements()) { locations.add(getRootLocation(resourceURLs.nextElement(), resourceName)); } return locations; }