org.apache.turbine.services.intake
Class IntakeTool

java.lang.Object
  extended byorg.apache.turbine.services.intake.IntakeTool
All Implemented Interfaces:
ApplicationTool, Recyclable

public class IntakeTool
extends java.lang.Object
implements ApplicationTool, Recyclable

The main class through which Intake is accessed.

Version:
$Id: IntakeTool.java 534527 2007-05-02 16:10:59Z tv $
Author:
John D. McNally, Henning P. Schmiedehausen, Quinton McCombs

Nested Class Summary
 class IntakeTool.PullHelper
          Inner class to present a nice interface to the template designer
 
Field Summary
static java.lang.String DEFAULT_KEY
          Constant for default key
static java.lang.String INTAKE_GRP
          Constant for the hidden fieldname
 
Constructor Summary
IntakeTool()
          Constructor
 
Method Summary
 void addGroupsToParameters(ValueParser vp)
           
 java.lang.String declareGroup(Group group)
          A convenience method to write out the hidden form fields that notify intake of the group.
 void declareGroup(Group group, java.lang.StringBuffer sb)
          xhtml valid hidden input field(s) that notifies intake of the group's presence.
 java.lang.String declareGroups()
          A convenience method to write out the hidden form fields that notify intake of the relevant groups.
 void dispose()
          Disposes the object after use.
 IntakeTool.PullHelper get(java.lang.String groupName)
          get a specific group
 IntakeTool.PullHelper get(java.lang.String groupName, boolean throwExceptions)
          Get a specific group
 Group get(java.lang.String groupName, java.lang.String key)
          Get a specific group by name and key.
 Group get(java.lang.String groupName, java.lang.String key, boolean create)
          Get a specific group by name and key.
 java.util.Map getGroups()
          Get a Map containing all the groups.
 void init(java.lang.Object runData)
          Prepares intake for a single request
 boolean isAllValid()
          Loops through all of the Groups and checks to see if the data within the Group is valid.
 boolean isDisposed()
          Checks whether the recyclable has been disposed.
 void newForm()
           
 void recycle()
          Recycles the object for a new client.
 void refresh()
          Implementation of ApplicationTool interface is not needed for this tool as it is request scoped
 void remove(Group group)
          Removes group.
 void removeAll()
          Removes all groups.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_KEY

public static final java.lang.String DEFAULT_KEY
Constant for default key

See Also:
Constant Field Values

INTAKE_GRP

public static final java.lang.String INTAKE_GRP
Constant for the hidden fieldname

See Also:
Constant Field Values
Constructor Detail

IntakeTool

public IntakeTool()
Constructor

Method Detail

init

public void init(java.lang.Object runData)
Prepares intake for a single request

Specified by:
init in interface ApplicationTool
Parameters:
runData - initialization data

addGroupsToParameters

public void addGroupsToParameters(ValueParser vp)

declareGroups

public java.lang.String declareGroups()
A convenience method to write out the hidden form fields that notify intake of the relevant groups. It should be used only in templates with 1 form. In multiform templates, the groups that are relevant for each form need to be declared using $intake.newForm() and $intake.declareGroup($group) for the relevant groups in the form.


declareGroup

public java.lang.String declareGroup(Group group)
A convenience method to write out the hidden form fields that notify intake of the group.


declareGroup

public void declareGroup(Group group,
                         java.lang.StringBuffer sb)
xhtml valid hidden input field(s) that notifies intake of the group's presence.


newForm

public void newForm()

refresh

public void refresh()
Implementation of ApplicationTool interface is not needed for this tool as it is request scoped

Specified by:
refresh in interface ApplicationTool

get

public IntakeTool.PullHelper get(java.lang.String groupName)
                          throws IntakeException
get a specific group

Throws:
IntakeException

get

public IntakeTool.PullHelper get(java.lang.String groupName,
                                 boolean throwExceptions)
                          throws IntakeException
Get a specific group

Parameters:
throwExceptions - if false, exceptions will be supressed.
Throws:
IntakeException - could not retrieve group

isAllValid

public boolean isAllValid()
Loops through all of the Groups and checks to see if the data within the Group is valid.


get

public Group get(java.lang.String groupName,
                 java.lang.String key)
          throws IntakeException
Get a specific group by name and key.

Throws:
IntakeException

get

public Group get(java.lang.String groupName,
                 java.lang.String key,
                 boolean create)
          throws IntakeException
Get a specific group by name and key. Also specify whether or not you want to create a new group.

Throws:
IntakeException

remove

public void remove(Group group)
Removes group. Primary use is to remove a group that has been processed by an action and is no longer appropriate in the view (screen).


removeAll

public void removeAll()
Removes all groups. Primary use is to remove groups that have been processed by an action and are no longer appropriate in the view (screen).


getGroups

public java.util.Map getGroups()
Get a Map containing all the groups.

Returns:
the Group Map

recycle

public void recycle()
Recycles the object for a new client. Recycle methods with parameters must be added to implementing object and they will be automatically called by pool implementations when the object is taken from the pool for a new client. The parameters must correspond to the parameters of the constructors of the object. For new objects, constructors can call their corresponding recycle methods whenever applicable. The recycle methods must call their super.

Specified by:
recycle in interface Recyclable

dispose

public void dispose()
Disposes the object after use. The method is called when the object is returned to its pool. The dispose method must call its super.

Specified by:
dispose in interface Recyclable

isDisposed

public boolean isDisposed()
Checks whether the recyclable has been disposed.

Specified by:
isDisposed in interface Recyclable
Returns:
true, if the recyclable is disposed.


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