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