01: package org.apache.turbine.services.rundata;
02:
03: /*
04: * Licensed to the Apache Software Foundation (ASF) under one
05: * or more contributor license agreements. See the NOTICE file
06: * distributed with this work for additional information
07: * regarding copyright ownership. The ASF licenses this file
08: * to you under the Apache License, Version 2.0 (the
09: * "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 534527 2007-05-02 16:10:59Z tv $
40: */
41: public interface RunDataService extends Service {
42: /** The key under which this service is stored in TurbineServices. */
43: String SERVICE_NAME = "RunDataService";
44:
45: /** The default parser configuration key. */
46: String DEFAULT_CONFIG = "default";
47:
48: /** The property for the implemention of the RunData object */
49: String RUN_DATA_KEY = "run.data";
50:
51: /** The property for the implemention of the ParameterParser. */
52: String PARAMETER_PARSER_KEY = "parameter.parser";
53:
54: /** The property for the implemention of the CookieParser. */
55: String COOKIE_PARSER_KEY = "cookie.parser";
56:
57: /**
58: * Gets a default RunData object.
59: *
60: * @param req a servlet request.
61: * @param res a servlet response.
62: * @param config a servlet config.
63: * @return a new or recycled RunData object.
64: * @throws TurbineException if the operation fails.
65: */
66: RunData getRunData(HttpServletRequest req, HttpServletResponse res,
67: ServletConfig config) throws TurbineException;
68:
69: /**
70: * Gets a RunData object from a specific configuration.
71: *
72: * @param key a configuration key.
73: * @param req a servlet request.
74: * @param res a servlet response.
75: * @param config a servlet config.
76: * @return a new or recycled RunData object.
77: * @throws TurbineException if the operation fails.
78: */
79: RunData getRunData(String key, HttpServletRequest req,
80: HttpServletResponse res, ServletConfig config)
81: throws TurbineException;
82:
83: /**
84: * Puts the used RunData object back to the factory for recycling.
85: *
86: * @param data the used RunData object.
87: * @return true, if pooling is supported and the object was accepted.
88: */
89: boolean putRunData(RunData data);
90: }
|