Class TurbineRunDataService
- java.lang.Object
-
- org.apache.turbine.services.BaseInitable
-
- org.apache.turbine.services.BaseService
-
- org.apache.turbine.services.TurbineBaseService
-
- org.apache.turbine.services.rundata.TurbineRunDataService
-
- All Implemented Interfaces:
Initable,RunDataService,Service
public class TurbineRunDataService extends TurbineBaseService implements RunDataService
The RunData Service provides the implementations for RunData and related interfaces required by request processing. It supports different configurations of implementations, which can be selected by specifying a configuration key. It may use pooling, in which case the implementations should implement the Recyclable interface.- Version:
- $Id$
- Author:
- Ilkka Priha, Henning P. Schmiedehausen
-
-
Field Summary
-
Fields inherited from class org.apache.turbine.services.BaseService
configuration, name, serviceBroker
-
Fields inherited from class org.apache.turbine.services.BaseInitable
initableBroker, isInitialized
-
Fields inherited from interface org.apache.turbine.services.rundata.RunDataService
COOKIE_PARSER_KEY, DEFAULT_CONFIG, PARAMETER_PARSER_KEY, RUN_DATA_KEY, SERVICE_NAME
-
Fields inherited from interface org.apache.turbine.services.Service
SERVICE_NAME
-
-
Constructor Summary
Constructors Constructor Description TurbineRunDataService()Constructs a RunData Service.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RunDatagetRunData(String key, HttpServletRequest req, HttpServletResponse res, ServletConfig config)Gets a RunData instance from a specific configuration.RunDatagetRunData(HttpServletRequest req, HttpServletResponse res, ServletConfig config)Gets a default RunData object.voidinit()Initializes the service by setting the pool capacity.booleanputRunData(RunData data)Puts the used RunData object back to the factory for recycling.voidshutdown()Shutdown the service-
Methods inherited from class org.apache.turbine.services.TurbineBaseService
init, init
-
Methods inherited from class org.apache.turbine.services.BaseService
getConfiguration, getName, getProperties, getServiceBroker, setName, setServiceBroker
-
Methods inherited from class org.apache.turbine.services.BaseInitable
getInit, getInitableBroker, setInit, setInitableBroker
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.turbine.services.Initable
getInit, init, setInitableBroker
-
Methods inherited from interface org.apache.turbine.services.Service
getConfiguration, getName, getProperties, setName, setServiceBroker
-
-
-
-
Constructor Detail
-
TurbineRunDataService
public TurbineRunDataService()
Constructs a RunData Service.
-
-
Method Detail
-
init
public void init() throws InitializationException
Initializes the service by setting the pool capacity.- Specified by:
initin interfaceInitable- Overrides:
initin classTurbineBaseService- Throws:
InitializationException- if initialization fails.
-
shutdown
public void shutdown()
Shutdown the service- Specified by:
shutdownin interfaceInitable- Overrides:
shutdownin classTurbineBaseService- See Also:
TurbineBaseService.shutdown()
-
getRunData
public RunData getRunData(HttpServletRequest req, HttpServletResponse res, ServletConfig config) throws TurbineException
Gets a default RunData object.- Specified by:
getRunDatain interfaceRunDataService- Parameters:
req- a servlet request.res- a servlet response.config- a servlet config.- Returns:
- a new or recycled RunData object.
- Throws:
TurbineException- if the operation fails.
-
getRunData
public RunData getRunData(String key, HttpServletRequest req, HttpServletResponse res, ServletConfig config) throws TurbineException, IllegalArgumentException
Gets a RunData instance from a specific configuration.- Specified by:
getRunDatain interfaceRunDataService- Parameters:
key- a configuration key.req- a servlet request.res- a servlet response.config- a servlet config.- Returns:
- a new or recycled RunData object.
- Throws:
TurbineException- if the operation fails.IllegalArgumentException- if any of the parameters are null. TODO The "key" parameter should be removed in favor of just looking up what class via the roleConfig avalon file.
-
putRunData
public boolean putRunData(RunData data)
Puts the used RunData object back to the factory for recycling.- Specified by:
putRunDatain interfaceRunDataService- Parameters:
data- the used RunData object.- Returns:
- true, if pooling is supported and the object was accepted.
-
-