com.ibm.commerce.programadapter
Class ProgramAdapter

java.lang.Object
  |
  +--com.ibm.commerce.adapter.nonhttp.NonHttpAdapterImpl
        |
        +--com.ibm.commerce.programadapter.ProgramAdapter

public class ProgramAdapter
extends com.ibm.commerce.adapter.nonhttp.NonHttpAdapterImpl

The Program Adapter that can handle generic request objects.

See Also:
Serialized Form

Field Summary
static java.lang.String _STR_CreateAdapter
          Constant to represent the method name for logging purposes.
static java.lang.String _STR_InitFactory
          Constant to represent the method name for logging purposes.
static java.lang.String _STR_SetCommandProperties
          Constant to represent the method name for logging purposes.
static java.lang.String _STR_ThisClass
          Constant to represent the class name for logging purposes.
static java.lang.String _STR_ValidateDeviceFormat
          Constant to represent the method name for logging purposes.
static java.lang.String COPYRIGHT
          IBM Copyright notice field.
 
Constructor Summary
ProgramAdapter()
          Creates the Program Adapter object.
 
Method Summary
 boolean checkDeviceFormat(java.lang.Object req, TypedProperty prop)
          Return true if the input request can be processed by this adapter.
 com.ibm.commerce.adapter.nonhttp.NonHttpAdapter createAdapter(java.lang.Object request, java.lang.Object response, TypedProperty param)
          This method returns an instance of this adapter if the request has the format defined by this adapter.
 void initFactory(org.w3c.dom.Element node)
          Initialize the Adapter factory based on the informtion defined in the DOM XML node.
 boolean preInvokeCommand( CommandContext commandContext)
          This method checks if an exception occurr when validating the request session information.
 boolean processResponse( CommandContext commandContext, TypedProperty resProp)
          This method is called by the web controller after it has successfully finished the execution of the request.
 void setCommandProperties( CommandProperty cmdProp)
          Sets the CommandProperty of the adapter.
  CommandProperty validateDeviceFormat(java.lang.Object req)
          Returns a command property object if the device can be handled by this adapter, otherwise null will be returned.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail
public static final java.lang.String COPYRIGHT
IBM Copyright notice field.
See Also:
Constant Field Values

_STR_ThisClass

public static final java.lang.String _STR_ThisClass
Constant to represent the class name for logging purposes.
See Also:
Constant Field Values

_STR_CreateAdapter

public static final java.lang.String _STR_CreateAdapter
Constant to represent the method name for logging purposes.
See Also:
Constant Field Values

_STR_InitFactory

public static final java.lang.String _STR_InitFactory
Constant to represent the method name for logging purposes.
See Also:
Constant Field Values

_STR_SetCommandProperties

public static final java.lang.String _STR_SetCommandProperties
Constant to represent the method name for logging purposes.
See Also:
Constant Field Values

_STR_ValidateDeviceFormat

public static final java.lang.String _STR_ValidateDeviceFormat
Constant to represent the method name for logging purposes.
See Also:
Constant Field Values
Constructor Detail

ProgramAdapter

public ProgramAdapter()
Creates the Program Adapter object.
Method Detail

checkDeviceFormat

public boolean checkDeviceFormat(java.lang.Object req,
TypedProperty prop)
Return true if the input request can be processed by this adapter.
Returns:
Always will return false.

createAdapter

public com.ibm.commerce.adapter.nonhttp.NonHttpAdapter createAdapter(java.lang.Object request,
                                                                     java.lang.Object response,
TypedProperty param)
This method returns an instance of this adapter if the request has the format defined by this adapter. This method should first call the checkDeviceFormat() method. If it returns true, then it will instantiate an instance of this adapter. The adapter instance returned will be initialized with request, response and request properties initialized.
Parameters:
request - the request object.
response - the response object.
param - the request parameters
Returns:
An instance of this adapter if the request can be processed by this adapter or null if this request cannot be processed by this adapter

initFactory

public void initFactory(org.w3c.dom.Element node)
                 throws java.lang.Exception
Initialize the Adapter factory based on the informtion defined in the DOM XML node. The intialization process creates an program adapter descriptor and passes the XML node to the descriptor for initialization.
Parameters:
node - The XML configuration of the adapter.
Throws:
java.lang.Exception - if there is a problem initializing the adapter.

preInvokeCommand

public boolean preInvokeCommand(CommandContext commandContext)
                         throws ECException
This method checks if an exception occurr when validating the request session information. If a session variable is incorrect, for examplep password, then the request will be redirect to an error response which indicates this. However since the session changes the request, the adapter does not know so it must consult the session to ensure whether an error occurred or not.
Parameters:
commandContext - the command context associated with the command.
Returns:
Always will return true.
Throws:
ECException - Whether there is a problem trying to determine whether an error occurred during the validating of the session.

processResponse

public boolean processResponse(CommandContext commandContext,
TypedProperty resProp)
                        throws ECException
This method is called by the web controller after it has successfully finished the execution of the request. The web controller will execute the view task associated with the command if this method returns true.
Parameters:
commandContext - the command context of the command.
Returns:
Always will return true.
Throws:
ECException - if there is a problem determining whether an exception happened or not.

setCommandProperties

public void setCommandProperties(CommandProperty cmdProp)
Sets the CommandProperty of the adapter. When the command property is set, the command session is created. If there is any problems creating the session context for the request, the default session context will be used. This is DummyProgramAdapterSessionContext.
Parameters:
cmdProp - the command property for the adapter.

validateDeviceFormat

public CommandProperty validateDeviceFormat(java.lang.Object req)
Returns a command property object if the device can be handled by this adapter, otherwise null will be returned.
Returns:
An instance of CommandProperty if this request can be processed by this adapter or null if this request cannot be processed by this adapter