01: package org.apache.turbine.services;
02:
03: /*
04: * Copyright 2001-2005 The Apache Software Foundation.
05: *
06: * Licensed under the Apache License, Version 2.0 (the "License")
07: * you may not use this file except in compliance with the License.
08: * You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing, software
13: * distributed under the License is distributed on an "AS IS" BASIS,
14: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15: * See the License for the specific language governing permissions and
16: * limitations under the License.
17: */
18:
19: import java.util.Properties;
20:
21: import org.apache.commons.configuration.Configuration;
22:
23: /**
24: * <code>Services</code> are <code>Initables</code> that have a name,
25: * and a set of properties.
26: *
27: * @author <a href="mailto:greg@shwoop.com">Greg Ritter</a>
28: * @author <a href="mailto:bmclaugh@algx.net">Brett McLaughlin</a>
29: * @author <a href="mailto:burton@apache.org">Kevin Burton</a>
30: * @author <a href="mailto:krzewski@e-point.pl">Rafal Krzewski</a>
31: * @author <a href="mailto:dlr@collab.net">Daniel Rall</a>
32: * @version $Id: Service.java 264148 2005-08-29 14:21:04Z henning $
33: */
34: public interface Service extends Initable {
35: /** The name of this service. */
36: String SERVICE_NAME = "Service";
37:
38: /**
39: * Provides a Service with a reference to the ServiceBroker that
40: * instantiated this object, so that it can ask for its properties
41: * and access other Services.
42: *
43: * @param broker The ServiceBroker that instantiated this object.
44: */
45: void setServiceBroker(ServiceBroker broker);
46:
47: /**
48: * ServiceBroker uses this method to pass a Service its name.
49: * Service uses its name to ask the broker for an apropriate set
50: * of Properties.
51: *
52: * @param name The name of this Service.
53: */
54: void setName(String name);
55:
56: /**
57: * Returns the name of this Service.
58: *
59: * @return The name of this Service.
60: */
61: String getName();
62:
63: /**
64: * Returns the Properties of this Service. Every Service has at
65: * least one property, which is "classname", containing the name
66: * of the class implementing this service. Note that the service
67: * may chose to alter its properties, therefore they may be
68: * different from those returned by ServiceBroker.
69: *
70: * @return The properties of this Service.
71: */
72: Properties getProperties();
73:
74: /**
75: * Returns the Configuration of this Service. Every Service has at
76: * least one property, which is "classname", containing the name
77: * of the class implementing this service. Note that the service
78: * may chose to alter its configuration, therefore they may be
79: * different from those returned by ServiceBroker.
80: *
81: * @return The Configuration of this Service.
82: */
83: Configuration getConfiguration();
84: }
|