View Javadoc

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