View Javadoc

    1   package org.apache.turbine.services.rundata;
    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 javax.servlet.ServletConfig;
    23  import javax.servlet.http.HttpServletRequest;
    24  import javax.servlet.http.HttpServletResponse;
    25
    26  import org.apache.turbine.services.Service;
    27  import org.apache.turbine.util.RunData;
    28  import org.apache.turbine.util.TurbineException;
    29
    30  /**
    31   * The RunData Service provides the implementations for RunData and
    32   * related interfaces required by request processing. It supports
    33   * different configurations of implementations, which can be selected
    34   * by specifying a configuration key. It may use pooling, in which case
    35   * the implementations should implement the Recyclable interface.
    36   *
    37   * @author <a href="mailto:ilkka.priha@simsoft.fi">Ilkka Priha</a>
    38   * @author <a href="mailto:hps@intermeta.de">Henning P. Schmiedehausen</a>
    39   * @version $Id: RunDataService.java 938645 2010-04-27 20:57:51Z tv $
    40   */
    41  public interface RunDataService
    42      extends Service
    43  {
    44      /** The key under which this service is stored in TurbineServices. */
    45      String SERVICE_NAME = "RunDataService";
    46
    47      /** The default parser configuration key. */
    48      String DEFAULT_CONFIG = "default";
    49
    50      /** The property for the implemention of the RunData object */
    51      String RUN_DATA_KEY = "run.data";
    52
    53      /** The property for the implemention of the ParameterParser. */
    54      String PARAMETER_PARSER_KEY = "parameter.parser";
    55
    56      /** The property for the implemention of the CookieParser. */
    57      String COOKIE_PARSER_KEY = "cookie.parser";
    58
    59      /**
    60       * Gets a default RunData object.
    61       *
    62       * @param req a servlet request.
    63       * @param res a servlet response.
    64       * @param config a servlet config.
    65       * @return a new or recycled RunData object.
    66       * @throws TurbineException if the operation fails.
    67       */
    68      RunData getRunData(HttpServletRequest req,
    69                         HttpServletResponse res,
    70                         ServletConfig config)
    71              throws TurbineException;
    72
    73      /**
    74       * Gets a RunData object from a specific configuration.
    75       *
    76       * @param key a configuration key.
    77       * @param req a servlet request.
    78       * @param res a servlet response.
    79       * @param config a servlet config.
    80       * @return a new or recycled RunData object.
    81       * @throws TurbineException if the operation fails.
    82       */
    83      RunData getRunData(String key,
    84                         HttpServletRequest req,
    85                         HttpServletResponse res,
    86                         ServletConfig config)
    87              throws TurbineException;
    88
    89      /**
    90       * Puts the used RunData object back to the factory for recycling.
    91       *
    92       * @param data the used RunData object.
    93       * @return true, if pooling is supported and the object was accepted.
    94       */
    95      boolean putRunData(RunData data);
    96  }