1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package ca.pjer.cm.module.discovery.defaultimpl;
19
20 import ca.pjer.cm.api.discovery.DiscoveryService;
21 import ca.pjer.cm.api.discovery.DiscoveryServiceSystemException;
22 import ca.pjer.cm.api.discovery.DiscoveryServiceException;
23
24 import java.util.Enumeration;
25 import java.io.IOException;
26
27 import org.apache.commons.logging.LogFactory;
28 import org.apache.commons.logging.Log;
29
30 /***
31 * <br />
32 * $Id: DiscoveryServiceImpl.java,v 1.1 2004/05/18 23:27:33 pjer Exp $<br />
33 * <br />
34 * $RCSfile: DiscoveryServiceImpl.java,v $<br />
35 * $Revision: 1.1 $<br />
36 * $Author: pjer $<br />
37 * $Date: 2004/05/18 23:27:33 $<br />
38 *
39 * @TODO comment me.<br />
40 */
41 public class DiscoveryServiceImpl implements DiscoveryService {
42 private static final Log log = LogFactory.getLog(DiscoveryServiceImpl.class);
43 private static final ClassLoader CLASS_LOADER = Thread.currentThread().getContextClassLoader();
44
45 public Enumeration discover(String name) throws DiscoveryServiceSystemException, DiscoveryServiceException {
46 Enumeration enumeration = null;
47 try {
48 enumeration = CLASS_LOADER.getResources(name);
49 } catch (IOException e) {
50 String s = "Could not discover [name:" + name + "] : " + e.getMessage();
51 log.error(s);
52 throw new DiscoveryServiceException(s, e);
53 }
54 return enumeration;
55 }
56 }