1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.commons.discovery.resource.names;
18
19 import org.apache.commons.discovery.ResourceDiscover;
20 import org.apache.commons.discovery.ResourceNameDiscover;
21 import org.apache.commons.discovery.resource.ClassLoaders;
22
23
24 /***
25 * Provide JDK 1.3 style service discovery...
26 *
27 * The caller will first configure the discoverer by creating a
28 * root Discoverer for the files.
29 *
30 * @author Richard A. Sitze
31 * @author Craig R. McClanahan
32 * @author Costin Manolache
33 * @author James Strachan
34 */
35 public class DiscoverServiceNames
36 extends DiscoverNamesInFile
37 implements ResourceNameDiscover
38 {
39 protected static final String SERVICE_HOME = "META-INF/services/";
40
41 /*** Construct a new service discoverer
42 */
43 public DiscoverServiceNames() {
44 super(SERVICE_HOME, null);
45 }
46
47 /***
48 * Construct a new resource discoverer
49 */
50 public DiscoverServiceNames(String prefix, String suffix) {
51 super((prefix == null) ? SERVICE_HOME : SERVICE_HOME + prefix, suffix);
52 }
53
54 /***
55 * Construct a new resource discoverer
56 */
57 public DiscoverServiceNames(ClassLoaders loaders) {
58 super(loaders, SERVICE_HOME, null);
59 }
60
61 /***
62 * Construct a new resource discoverer
63 */
64 public DiscoverServiceNames(ClassLoaders loaders, String prefix, String suffix) {
65 super(loaders, (prefix == null) ? SERVICE_HOME : SERVICE_HOME + prefix, suffix);
66 }
67
68 /*** Construct a new service discoverer
69 */
70 public DiscoverServiceNames(ResourceDiscover discoverer) {
71 super(discoverer, SERVICE_HOME, null);
72 }
73
74 /*** Construct a new service discoverer
75 */
76 public DiscoverServiceNames(ResourceDiscover discoverer, String prefix, String suffix) {
77 super(discoverer, (prefix == null) ? SERVICE_HOME : SERVICE_HOME + prefix, suffix);
78 }
79 }