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