1 package org.apache.turbine.services.rundata;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 import javax.servlet.ServletConfig;
20
21 import javax.servlet.http.HttpServletRequest;
22 import javax.servlet.http.HttpServletResponse;
23
24 import org.apache.turbine.services.TurbineServices;
25
26 import org.apache.turbine.util.RunData;
27 import org.apache.turbine.util.TurbineException;
28
29 /***
30 * Static wrapper for the RunData service. The name is completely
31 * out of line of the other Turbine Services. So what? All the good
32 * ones were taken.
33 *
34 * @author <a href="mailto:hps@intermeta.de">Henning P. Schmiedehausen</a>
35 * @version $Id: TurbineRunDataFacade.java 264148 2005-08-29 14:21:04Z henning $
36 */
37
38 public abstract class TurbineRunDataFacade
39 {
40 /***
41 * Utility method for accessing the service
42 * implementation
43 *
44 * @return a RunDataService implementation instance
45 */
46 public static RunDataService getService()
47 {
48 return (RunDataService) TurbineServices
49 .getInstance().getService(RunDataService.SERVICE_NAME);
50 }
51
52 /***
53 * Gets a default RunData object.
54 *
55 * @param req a servlet request.
56 * @param res a servlet response.
57 * @param config a servlet config.
58 * @return a new or recycled RunData object.
59 * @throws TurbineException if the operation fails.
60 */
61 public static RunData getRunData(HttpServletRequest req,
62 HttpServletResponse res,
63 ServletConfig config)
64 throws TurbineException
65 {
66 return getService().getRunData(req, res, config);
67 }
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 public static RunData getRunData(String key,
80 HttpServletRequest req,
81 HttpServletResponse res,
82 ServletConfig config)
83 throws TurbineException
84 {
85 return getService().getRunData(key, req, res, config);
86 }
87
88 /***
89 * Puts the used RunData object back to the factory for recycling.
90 *
91 * @param data the used RunData object.
92 * @return true, if pooling is supported and the object was accepted.
93 */
94 public static boolean putRunData(RunData data)
95 {
96 return getService().putRunData(data);
97 }
98 }