|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.chain.generic.LookupCommand
Look up a specified Command
(which could also be a 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
.
Constructor Summary | |
LookupCommand()
|
Method Summary | |
boolean |
execute(Context context)
Look up the specified command, and (if found) execute it. |
String |
getCatalogName()
Return the name of the Catalog to be searched, or
null to search the default Catalog . |
String |
getName()
Return the name of the Command that we will look up and
delegate execution to. |
String |
getNameKey()
Return the context attribute key under which the Command
name is stored. |
boolean |
isOptional()
Return true if locating the specified command
is optional. |
boolean |
postprocess(Context context,
Exception exception)
If the executed command was itself a Filter , call the
postprocess() method of that Filter as well. |
void |
setCatalogName(String catalogName)
Set the name of the Catalog to be searched, or
null to search the default Catalog . |
void |
setName(String name)
Set the name of the Command that we will look up and
delegate execution to. |
void |
setNameKey(String nameKey)
Set the context attribute key under which the Command
name is stored. |
void |
setOptional(boolean optional)
Set the optional flag for finding the specified command. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public LookupCommand()
Method Detail |
public String getCatalogName()
public void setCatalogName(String catalogName)
Set the name of the Catalog
to be searched, or
null
to search the default Catalog
.
catalogName
- The new Catalog
name or null
public String getName()
Return the name of the Command
that we will look up and
delegate execution to.
public void setName(String name)
Set the name of the Command
that we will look up and
delegate execution to.
name
- The new command namepublic String getNameKey()
Return the context attribute key under which the Command
name is stored.
public void setNameKey(String nameKey)
Set the context attribute key under which the Command
name is stored.
nameKey
- The new context attribute keypublic boolean isOptional()
Return true
if locating the specified command
is optional.
public void setOptional(boolean optional)
Set the optional flag for finding the specified command.
optional
- The new optional flagpublic boolean execute(Context context) throws Exception
Look up the specified command, and (if found) execute it.
execute
in interface Command
context
- The context for this request
true
if the processing of this Context
has been completed, or false
if the processing
of this Context
should be delegated to a subsequent
Command
in an enclosing Chain
IllegalArgumentException
- if no such Command
can be found and the optional
property is set
to false
Exception
- general purpose exception return
to indicate abnormal terminationpublic boolean postprocess(Context context, Exception exception)
If the executed command was itself a Filter
, call the
postprocess()
method of that Filter
as well.
postprocess
in interface Filter
context
- The context for this requestexception
- Any Exception
thrown by command execution
exception
was "handled" by this
method (and therefore need not be rethrown), return true
;
otherwise return false
Exception
- if thrown by the postprocess()
method
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |