org.apache.turbine.services.intake
Class TurbineIntakeService

java.lang.Object
  |
  +--org.apache.turbine.services.BaseInitable
        |
        +--org.apache.turbine.services.BaseService
              |
              +--org.apache.turbine.services.TurbineBaseService
                    |
                    +--org.apache.turbine.services.intake.TurbineIntakeService
All Implemented Interfaces:
Initable, IntakeService, Service

public class TurbineIntakeService
extends TurbineBaseService
implements IntakeService

This service provides access to input processing objects based on an XML specification.

Version:
$Id: TurbineIntakeService.java,v 1.5 2002/07/11 16:53:28 mpoeschl Exp $
Author:
John McNally

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.intake.IntakeService
DEFAULT_POOL_CAPACITY, SERVICE_NAME, XML_PATH
 
Fields inherited from interface org.apache.turbine.services.Service
SERVICE_NAME
 
Constructor Summary
TurbineIntakeService()
          Constructor.
 
Method Summary
 void clearPool()
          Clears all instances from the pool.
 void clearPool(java.lang.String name)
          Clears instances of a group from the pool.
 int getCapacity(java.lang.String name)
          Gets the capacity of the pool for a named group.
 java.lang.reflect.Method getFieldGetter(java.lang.String className, java.lang.String propName)
          Gets the Method that can be used to get a property value.
 java.lang.reflect.Method getFieldSetter(java.lang.String className, java.lang.String propName)
          Gets the Method that can be used to set a property.
 Group getGroup(java.lang.String groupName)
          Gets an instance of a named group either from the pool or by calling the Factory Service if the pool is empty.
 java.lang.String getGroupKey(java.lang.String groupName)
          Gets the key (usually a short identifier) for a group.
 java.lang.String getGroupName(java.lang.String groupKey)
          Gets the group name given its key.
 java.lang.String[] getGroupNames()
          Names of all the defined groups.
 int getSize(java.lang.String name)
          Gets the current size of the pool for a group.
 void init(javax.servlet.ServletConfig config)
          Called the first time the Service is used.
 boolean releaseGroup(Group instance)
          Puts a Group back to the pool.
 void setCapacity(java.lang.String name, int capacity)
          Sets the capacity of the pool for a group.
 
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, toString, wait, wait, wait
 
Methods inherited from interface org.apache.turbine.services.Initable
getInit, setInitableBroker
 

Constructor Detail

TurbineIntakeService

public TurbineIntakeService()
Constructor.
Method Detail

init

public void init(javax.servlet.ServletConfig config)
          throws InitializationException
Called the first time the Service is used.
Overrides:
init in class TurbineBaseService
Parameters:
config - A ServletConfig.

getGroup

public Group getGroup(java.lang.String groupName)
               throws TurbineException
Gets an instance of a named group either from the pool or by calling the Factory Service if the pool is empty.
Specified by:
getGroup in interface IntakeService
Parameters:
groupName - the name of the group.
Returns:
a Group instance.
Throws:
TurbineException - if recycling fails.

releaseGroup

public boolean releaseGroup(Group instance)
Puts a Group back to the pool.
Specified by:
releaseGroup in interface IntakeService
Parameters:
instance - the object instance to recycle.
Returns:
true if the instance was accepted.

getCapacity

public int getCapacity(java.lang.String name)
Gets the capacity of the pool for a named group.
Specified by:
getCapacity in interface IntakeService
Parameters:
name - the name of the class.

setCapacity

public void setCapacity(java.lang.String name,
                        int capacity)
Sets the capacity of the pool for a group. Note that the pool will be cleared after the change.
Specified by:
setCapacity in interface IntakeService
Parameters:
name - the name of the group.
capacity - the new capacity.

getSize

public int getSize(java.lang.String name)
Gets the current size of the pool for a group.
Specified by:
getSize in interface IntakeService
Parameters:
name - the name of the group.

clearPool

public void clearPool(java.lang.String name)
Clears instances of a group from the pool.
Specified by:
clearPool in interface IntakeService
Parameters:
name - the name of the group.

clearPool

public void clearPool()
Clears all instances from the pool.
Specified by:
clearPool in interface IntakeService

getGroupNames

public java.lang.String[] getGroupNames()
Names of all the defined groups.
Specified by:
getGroupNames in interface IntakeService
Returns:
array of names.

getGroupKey

public java.lang.String getGroupKey(java.lang.String groupName)
Gets the key (usually a short identifier) for a group.
Specified by:
getGroupKey in interface IntakeService
Parameters:
groupName - the name of the group.
Returns:
the the key.

getGroupName

public java.lang.String getGroupName(java.lang.String groupKey)
Gets the group name given its key.
Specified by:
getGroupName in interface IntakeService
Parameters:
the - the key.
Returns:
groupName the name of the group.

getFieldSetter

public java.lang.reflect.Method getFieldSetter(java.lang.String className,
                                               java.lang.String propName)
Gets the Method that can be used to set a property.
Specified by:
getFieldSetter in interface IntakeService
Parameters:
className - the name of the object.
propName - the name of the property.
Returns:
the setter.

getFieldGetter

public java.lang.reflect.Method getFieldGetter(java.lang.String className,
                                               java.lang.String propName)
Gets the Method that can be used to get a property value.
Specified by:
getFieldGetter in interface IntakeService
Parameters:
className - the name of the object.
propName - the name of the property.
Returns:
the getter.


Copyright © 2000-2002 Apache Software Foundation. All Rights Reserved.