| java.lang.Object org.apache.commons.chain.generic.LookupCommand
All known Subclasses: org.apache.commons.chain.generic.DispatchLookupCommand,
LookupCommand | public class LookupCommand implements Filter(Code) | | Look up a specified
Command (which could also be a
org.apache.commons.chain.Chain )
in a
Catalog , and delegate execution to it. If the delegated-to
Command is also a
Filter , its postprocess()
method will also be invoked at the appropriate time.
The name of the
Command can be specified either directly (via
the name property) or indirectly (via the nameKey
property). Exactly one of these must be set.
If the optional property is set to true ,
failure to find the specified command in the specified catalog will be
silently ignored. Otherwise, a lookup failure will trigger an
IllegalArgumentException .
author: Craig R. McClanahan version: $Revision: 411876 $ $Date: 2006-06-05 19:02:19 +0100 (Mon, 05 Jun 2006) $ |
LookupCommand | public LookupCommand()(Code) | | Create an instance, setting its catalogFactory property to the
value of CatalogFactory.getInstance() .
since: Chain 1.1 |
LookupCommand | public LookupCommand(CatalogFactory factory)(Code) | | Create an instance and initialize the catalogFactory property
to given factory /
Parameters: factory - The Catalog Factory. since: Chain 1.1 |
execute | public boolean execute(Context context) throws Exception(Code) | | Look up the specified command, and (if found) execute it.
Unless ignoreExecuteResult is set to true ,
return the result of executing the found command. If no command
is found, return false , unless the optional
property is false , in which case an IllegalArgumentException
will be thrown.
Parameters: context - The context for this request exception: IllegalArgumentException - if no such Commandcan be found and the optional property is setto false the result of executing the looked-up command, orfalse if no command is found or if the commandis found but the ignoreExecuteResult property of thisinstance is true throws: Exception - if and error occurs in the looked-up Command. |
getCatalogName | public String getCatalogName()(Code) | | Return the name of the
Catalog to be searched, or
null to search the default
Catalog .
The Catalog name. |
getName | public String getName()(Code) | | Return the name of the
Command that we will look up and
delegate execution to.
The name of the Command. |
getNameKey | public String getNameKey()(Code) | | Return the context attribute key under which the
Command name is stored.
The context key of the Command. |
isIgnoreExecuteResult | public boolean isIgnoreExecuteResult()(Code) | | Return true if this command should ignore
the return value from executing the looked-up command.
Defaults to false , which means that the return result
of executing this lookup will be whatever is returned from that
command.
true if result of the looked up Commandshould be ignored. since: Chain 1.1 |
isIgnorePostprocessResult | public boolean isIgnorePostprocessResult()(Code) | | Return true if this command is a Filter and
should ignore the return value from executing the looked-up Filter's
postprocess() method.
Defaults to false , which means that the return result
of executing this lookup will be whatever is returned from that
Filter.
true if result of the looked up Filter'spostprocess() method should be ignored. since: Chain 1.1 |
isOptional | public boolean isOptional()(Code) | | Return true if locating the specified command
is optional.
true if the Command is optional. |
postprocess | public boolean postprocess(Context context, Exception exception)(Code) | | If the executed command was itself a
Filter , call the
postprocess() method of that
Filter as well.
Parameters: context - The context for this request Parameters: exception - Any Exception thrown by command execution the result of executing the postprocess methodof the looked-up command, unless ignorePostprocessResult istrue . If no command is found, return false ,unless the optional property is false , in whichcase IllegalArgumentException will be thrown. |
setCatalogFactory | public void setCatalogFactory(CatalogFactory catalogFactory)(Code) | | Set the
CatalogFactory from which lookups will be
performed.
Parameters: catalogFactory - The Catalog Factory. since: Chain 1.1 |
setCatalogName | public void setCatalogName(String catalogName)(Code) | | Set the name of the
Catalog to be searched, or
null to search the default
Catalog .
Parameters: catalogName - The new Catalog name or null |
setIgnoreExecuteResult | public void setIgnoreExecuteResult(boolean ignoreReturn)(Code) | | Set the rules for whether or not this class will ignore or
pass through the value returned from executing the looked up
command.
If you are looking up a chain which may be "aborted" and
you do not want this class to stop chain processing, then this
value should be set to true
Parameters: ignoreReturn - true if result of thelooked up Command should be ignored. since: Chain 1.1 |
setIgnorePostprocessResult | public void setIgnorePostprocessResult(boolean ignorePostprocessResult)(Code) | | Set the rules for whether or not this class will ignore or
pass through the value returned from executing the looked up
Filter's postprocess() method.
If you are looking up a Filter which may be "aborted" and
you do not want this class to stop chain processing, then this
value should be set to true
Parameters: ignorePostprocessResult - true if result of thelooked up Filter's postprocess() method should be ignored. since: Chain 1.1 |
setName | public void setName(String name)(Code) | | Set the name of the
Command that we will look up and
delegate execution to.
Parameters: name - The new command name |
setNameKey | public void setNameKey(String nameKey)(Code) | | Set the context attribute key under which the
Command name is stored.
Parameters: nameKey - The new context attribute key |
setOptional | public void setOptional(boolean optional)(Code) | | Set the optional flag for finding the specified command.
Parameters: optional - The new optional flag |
|
|