01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
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: * Provide JDK 1.3 style service discovery...
25: *
26: * The caller will first configure the discoverer by creating a
27: * root Discoverer for the files.
28: *
29: * @author Richard A. Sitze
30: * @author Craig R. McClanahan
31: * @author Costin Manolache
32: * @author James Strachan
33: */
34: public class DiscoverServiceNames extends DiscoverNamesInFile implements
35: ResourceNameDiscover {
36: protected static final String SERVICE_HOME = "META-INF/services/";
37:
38: /** Construct a new service discoverer
39: */
40: public DiscoverServiceNames() {
41: super (SERVICE_HOME, null);
42: }
43:
44: /**
45: * Construct a new resource discoverer
46: */
47: public DiscoverServiceNames(String prefix, String suffix) {
48: super ((prefix == null) ? SERVICE_HOME : SERVICE_HOME + prefix,
49: suffix);
50: }
51:
52: /**
53: * Construct a new resource discoverer
54: */
55: public DiscoverServiceNames(ClassLoaders loaders) {
56: super (loaders, SERVICE_HOME, null);
57: }
58:
59: /**
60: * Construct a new resource discoverer
61: */
62: public DiscoverServiceNames(ClassLoaders loaders, String prefix,
63: String suffix) {
64: super (loaders, (prefix == null) ? SERVICE_HOME : SERVICE_HOME
65: + 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,
77: String prefix, String suffix) {
78: super(discoverer, (prefix == null) ? SERVICE_HOME
79: : SERVICE_HOME + prefix, suffix);
80: }
81: }
|