org.apache.struts.chain.commands.generic
Class WrappingLookupCommand

java.lang.Object
  extended by org.apache.struts.chain.commands.generic.WrappingLookupCommand
All Implemented Interfaces:
org.apache.commons.chain.Command, org.apache.commons.chain.Filter

public class WrappingLookupCommand
extends java.lang.Object
implements org.apache.commons.chain.Filter

Variant on chain LookupCommand which can optionally wrap the context it passes to the looked up command in an alternative class.


Field Summary
 
Fields inherited from interface org.apache.commons.chain.Command
CONTINUE_PROCESSING, PROCESSING_COMPLETE
 
Constructor Summary
WrappingLookupCommand()
          Zero-argument constructor.
 
Method Summary
 boolean execute(org.apache.commons.chain.Context context)
          Invoke the Command for a Context, returning TRUE if processing should halt.
 java.lang.String getCatalogName()
          Return CatalogName property.
protected  org.apache.commons.chain.Command getCommand(org.apache.commons.chain.Context context)
          Return the Command to process for this Context.
protected  org.apache.commons.chain.Context getContext(org.apache.commons.chain.Context context)
          If the wrapperClassName property is not null, return a Context of the type specified by wrapperClassName, instantiated using a single-arg constructor which takes the context passed as an argument to this method.
 java.lang.String getName()
          Retrieve Name property.
 java.lang.String getNameKey()
          Return NameKey property.
 java.lang.String getWrapperClassName()
          Return the WrapperClass property.
 boolean isOptional()
          Test Optional property.
 boolean postprocess(org.apache.commons.chain.Context context, java.lang.Exception exception)
          Process the Exception for any Command that is a filter.
 void setCatalogName(java.lang.String catalogName)
          Set CatalogName property.
 void setName(java.lang.String name)
          Set Name property.
 void setNameKey(java.lang.String nameKey)
          Set NameKey property.
 void setOptional(boolean optional)
          Set Optional property.
 void setWrapperClassName(java.lang.String wrapperClassName)
          Set WrappClassName property.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WrappingLookupCommand

public WrappingLookupCommand()

Zero-argument constructor.

Method Detail

getCatalogName

public java.lang.String getCatalogName()

Return CatalogName property.

Returns:
Value of CatalogName property.

setCatalogName

public void setCatalogName(java.lang.String catalogName)

Set CatalogName property.

Parameters:
catalogName - New value for CatalogName

getName

public java.lang.String getName()

Retrieve Name property.

Returns:
Value of Name property

setName

public void setName(java.lang.String name)

Set Name property.

Parameters:
name - New value for Name

getNameKey

public java.lang.String getNameKey()

Return NameKey property.

Returns:
Value of NameKey property.

setNameKey

public void setNameKey(java.lang.String nameKey)

Set NameKey property.

Parameters:
nameKey - New value for NameKey

isOptional

public boolean isOptional()

Test Optional property.

Returns:
TRUE if Optional is TRUE.

setOptional

public void setOptional(boolean optional)

Set Optional property.

Parameters:
optional - New value for Optional

getWrapperClassName

public java.lang.String getWrapperClassName()

Return the WrapperClass property.

Returns:
The WrapperClass property

setWrapperClassName

public void setWrapperClassName(java.lang.String wrapperClassName)

Set WrappClassName property.

Parameters:
wrapperClassName - The name of a WrapperClass

execute

public boolean execute(org.apache.commons.chain.Context context)
                throws java.lang.Exception

Invoke the Command for a Context, returning TRUE if processing should halt.

Specified by:
execute in interface org.apache.commons.chain.Command
Parameters:
context - Our ActionContext
Returns:
TRUE if processing should halt
Throws:
java.lang.Exception - On any error

postprocess

public boolean postprocess(org.apache.commons.chain.Context context,
                           java.lang.Exception exception)

Process the Exception for any Command that is a filter.

Specified by:
postprocess in interface org.apache.commons.chain.Filter
Parameters:
context - Our ActionContext
exception - The Exception thrown by another Comamnd in a Chain
Returns:
TRUE if there is a Filter to process

getCommand

protected org.apache.commons.chain.Command getCommand(org.apache.commons.chain.Context context)

Return the Command to process for this Context.

Parameters:
context - The Context we are processing
Returns:
The Command to process for this Context

getContext

protected org.apache.commons.chain.Context getContext(org.apache.commons.chain.Context context)
                                               throws java.lang.ClassNotFoundException,
                                                      java.lang.InstantiationException,
                                                      java.lang.reflect.InvocationTargetException,
                                                      java.lang.IllegalAccessException,
                                                      java.lang.NoSuchMethodException

If the wrapperClassName property is not null, return a Context of the type specified by wrapperClassName, instantiated using a single-arg constructor which takes the context passed as an argument to this method.

This method throws an exception if the wrapperClass cannot be found, or if there are any errors instantiating the wrapping context.

Parameters:
context - Context we are processing
Returns:
Context wrapper
Throws:
java.lang.ClassNotFoundException - On failed instantiation
java.lang.InstantiationException - On failed instantiation
java.lang.reflect.InvocationTargetException - On failed instantiation
java.lang.IllegalAccessException - On failed instantiation
java.lang.NoSuchMethodException - On failed instantiation


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