View Javadoc

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