KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > turbine > services > rundata > TurbineRunDataFacade


1 package org.apache.turbine.services.rundata;
2
3 /*
4  * Copyright 2001-2004 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 JavaDoc;
20
21 import javax.servlet.http.HttpServletRequest JavaDoc;
22 import javax.servlet.http.HttpServletResponse JavaDoc;
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,v 1.3.2.2 2004/05/20 03:06:51 seade Exp $
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 JavaDoc req,
62                                      HttpServletResponse JavaDoc res,
63                                      ServletConfig JavaDoc 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 JavaDoc key,
80                                      HttpServletRequest JavaDoc req,
81                                      HttpServletResponse JavaDoc res,
82                                      ServletConfig JavaDoc 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 }
99
Popular Tags