View Javadoc

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