1 package org.andromda.core.common;
2
3 import java.net.URL;
4 import java.util.ArrayList;
5 import java.util.Collection;
6 import java.util.Enumeration;
7
8
9
10
11
12
13 public class ResourceFinder
14 {
15
16
17
18
19
20
21
22 public static URL[] findResources(final String resource)
23 {
24 ExceptionUtils.checkEmpty("resource", resource);
25 try
26 {
27 final Collection<URL> resources = new ArrayList<URL>();
28 for (final Enumeration<URL> enumeration = ClassUtils.getClassLoader().getResources(resource);
29 enumeration.hasMoreElements();)
30 {
31 resources.add(enumeration.nextElement());
32 }
33
34 return resources.toArray(new URL[resources.size()]);
35 }
36 catch (final Exception exception)
37 {
38 throw new ResourceFinderException(exception);
39 }
40 }
41 }