View Javadoc

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