org.apache.turbine.services.rundata
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

Field Summary
private  java.util.HashMap configurations
          The map of configurations.
static java.lang.String COOKIE_PARSER
          The property for the implemention of CookieParser.
private static java.lang.String DEFAULT_COOKIE_PARSER
           
private static java.lang.String DEFAULT_PARAMETER_PARSER
           
private static java.lang.String DEFAULT_RUN_DATA
          The default implementations.
private  java.lang.reflect.Method getContextPath
          The getContextPath method from servet API >2.0.
static java.lang.String PARAMETER_PARSER
          The property for the implemention of ParameterParser.
static java.lang.String RUN_DATA
          The property for the implemention of RunData.
 
Fields inherited from class org.apache.turbine.services.BaseService
configuration, name, properties, serviceBroker
 
Fields inherited from class org.apache.turbine.services.BaseInitable
initableBroker, isInitialized
 
Fields inherited from interface org.apache.turbine.services.rundata.RunDataService
DEFAULT_CONFIG, SERVICE_NAME
 
Constructor Summary
TurbineRunDataService()
          Constructs a RunData Service.
 
Method Summary
 RunData getRunData(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res, javax.servlet.ServletConfig config)
          Gets a default RunData object.
 RunData getRunData(java.lang.String key, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res, javax.servlet.ServletConfig config)
          Gets a RunData instance from a specific configuration.
 void init()
          Initializes the service by setting the pool capacity.
 boolean putRunData(RunData data)
          Puts the used RunData object back to the factory for recycling.
 
Methods inherited from class org.apache.turbine.services.TurbineBaseService
init, init, init, shutdown
 
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, registerNatives, toString, wait, wait, wait
 
Methods inherited from interface org.apache.turbine.services.Service
getConfiguration, getProperties, setName, setServiceBroker
 
Methods inherited from interface org.apache.turbine.services.Initable
getInit, init, setInitableBroker, shutdown
 

Field Detail

RUN_DATA

public static final java.lang.String RUN_DATA
The property for the implemention of RunData.

PARAMETER_PARSER

public static final java.lang.String PARAMETER_PARSER
The property for the implemention of ParameterParser.

COOKIE_PARSER

public static final java.lang.String COOKIE_PARSER
The property for the implemention of CookieParser.

DEFAULT_RUN_DATA

private static final java.lang.String DEFAULT_RUN_DATA
The default implementations.

DEFAULT_PARAMETER_PARSER

private static final java.lang.String DEFAULT_PARAMETER_PARSER

DEFAULT_COOKIE_PARSER

private static final java.lang.String DEFAULT_COOKIE_PARSER

configurations

private java.util.HashMap configurations
The map of configurations.

getContextPath

private java.lang.reflect.Method getContextPath
The getContextPath method from servet API >2.0.
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:
init in interface Initable
Overrides:
init in class TurbineBaseService
Parameters:
config - initialization configuration.
Throws:
InitializationException - if initialization fails.

getRunData

public RunData getRunData(javax.servlet.http.HttpServletRequest req,
                          javax.servlet.http.HttpServletResponse res,
                          javax.servlet.ServletConfig config)
                   throws TurbineException
Gets a default RunData object.
Specified by:
getRunData in interface RunDataService
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(java.lang.String key,
                          javax.servlet.http.HttpServletRequest req,
                          javax.servlet.http.HttpServletResponse res,
                          javax.servlet.ServletConfig config)
                   throws TurbineException,
                          java.lang.IllegalArgumentException
Gets a RunData instance from a specific configuration.
Specified by:
getRunData in interface RunDataService
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.
java.lang.IllegalArgumentException - if any of the parameters are null.

putRunData

public boolean putRunData(RunData data)
Puts the used RunData object back to the factory for recycling.
Specified by:
putRunData in interface RunDataService
Parameters:
data - the used RunData object.
Returns:
true, if pooling is supported and the object was accepted.


Copyright © 1999-2001 Apache Software Foundation. All Rights Reserved.