View Javadoc

1   package org.apache.turbine.services;
2   
3   /*
4    * Copyright 2001-2005 The Apache Software Foundation.
5    *
6    * Licensed under the Apache License, Version 2.0 (the "License")
7    * you may not use this file except in compliance with the License.
8    * You may obtain a copy of the License at
9    *
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
35          extends Initable
36  {
37      /*** The name of this service. */
38      String SERVICE_NAME = "Service";
39  
40      /***
41       * Provides a Service with a reference to the ServiceBroker that
42       * instantiated this object, so that it can ask for its properties
43       * and access other Services.
44       *
45       * @param broker The ServiceBroker that instantiated this object.
46       */
47      void setServiceBroker(ServiceBroker broker);
48  
49      /***
50       * ServiceBroker uses this method to pass a Service its name.
51       * Service uses its name to ask the broker for an apropriate set
52       * of Properties.
53       *
54       * @param name The name of this Service.
55       */
56      void setName(String name);
57  
58      /***
59       * Returns the name of this Service.
60       *
61       * @return The name of this Service.
62       */
63      String getName();
64  
65      /***
66       * Returns the Properties of this Service.  Every Service has at
67       * least one property, which is "classname", containing the name
68       * of the class implementing this service.  Note that the service
69       * may chose to alter its properties, therefore they may be
70       * different from those returned by ServiceBroker.
71       *
72       * @return The properties of this Service.
73       */
74      Properties getProperties();
75  
76      /***
77       * Returns the Configuration of this Service.  Every Service has at
78       * least one property, which is "classname", containing the name
79       * of the class implementing this service.  Note that the service
80       * may chose to alter its configuration, therefore they may be
81       * different from those returned by ServiceBroker.
82       *
83       * @return The Configuration of this Service.
84       */
85      Configuration getConfiguration();
86  }