Save This Page
Home » commons-chain-1.2-src » org.apache.commons » chain » generic » [javadoc | source]
org.apache.commons.chain.generic
public class: LookupCommand [javadoc | source]
java.lang.Object
   org.apache.commons.chain.generic.LookupCommand

All Implemented Interfaces:
    Filter

Direct Known Subclasses:
    PathInfoMapper, RequestParameterMapper, DispatchLookupCommand, ServletPathMapper

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.

Constructor:
 public LookupCommand() 
 public LookupCommand(CatalogFactory factory) 
    Create an instance and initialize the catalogFactory property to given factory/
    Parameters:
    factory - The Catalog Factory.
    since: Chain - 1.1
Method from org.apache.commons.chain.generic.LookupCommand Summary:
execute,   getCatalog,   getCatalogFactory,   getCatalogName,   getCommand,   getCommandName,   getName,   getNameKey,   isIgnoreExecuteResult,   isIgnorePostprocessResult,   isOptional,   postprocess,   setCatalogFactory,   setCatalogName,   setIgnoreExecuteResult,   setIgnorePostprocessResult,   setName,   setNameKey,   setOptional
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.commons.chain.generic.LookupCommand Detail:
 public boolean execute(Context context) throws Exception 

    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.

 protected Catalog getCatalog(Context context) 
 public CatalogFactory getCatalogFactory() 
 public String getCatalogName() 

    Return the name of the Catalog to be searched, or null to search the default Catalog .

 protected Command getCommand(Context context) 

    Return the Command instance to be delegated to.

 protected String getCommandName(Context context) 

    Return the name of the Command instance to be delegated to.

 public String getName() 

    Return the name of the Command that we will look up and delegate execution to.

 public String getNameKey() 

    Return the context attribute key under which the Command name is stored.

 public boolean isIgnoreExecuteResult() 

    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.

 public boolean isIgnorePostprocessResult() 

    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.

 public boolean isOptional() 

    Return true if locating the specified command is optional.

 public boolean postprocess(Context context,
    Exception exception) 

    If the executed command was itself a Filter , call the postprocess() method of that Filter as well.

 public  void setCatalogFactory(CatalogFactory catalogFactory) 
 public  void setCatalogName(String catalogName) 

    Set the name of the Catalog to be searched, or null to search the default Catalog .

 public  void setIgnoreExecuteResult(boolean ignoreReturn) 

    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

 public  void setIgnorePostprocessResult(boolean ignorePostprocessResult) 

    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

 public  void setName(String name) 

    Set the name of the Command that we will look up and delegate execution to.

 public  void setNameKey(String nameKey) 

    Set the context attribute key under which the Command name is stored.

 public  void setOptional(boolean optional) 

    Set the optional flag for finding the specified command.