com.ibm.etill.framework.cassette
Class AdminRequest

java.lang.Object
  |
  +--com.ibm.etill.framework.cassette.CassetteRequest
        |
        +--com.ibm.etill.framework.cassette.APIRequest
              |
              +--com.ibm.etill.framework.cassette.AdminRequest
All Implemented Interfaces:
FrameworkReturnCodes, PaymentAPIConstants, Serializable

public class AdminRequest
extends APIRequest
implements PaymentAPIConstants

AdminRequest extends APIRequest and provides a base class for all API requests which operate on Commerce Payments administrative objects. The following data members are added to the hierarchy through this class, along with the required accessor methods:

When AdminRequest objects are sent to a cassette for processing, the Framework will obtain the appropriate object locks while the request is being processed. This ensures thread safety and data integrity across this request and all other operations being simultaneously performed within Commerce Payments. The locks obtained vary by the administrative request type, as described below:

See Also:
AccountAdmin, MerchantAdmin, APIResponse, Order, Serialized Form

 
Constructor Summary
AdminRequest(int token, String cassetteName, String merchantNumber, ParameterTable frameworkKeywords, ParameterTable protocolData)
          Cassettes should never call this constructor.
 
Method Summary
 CassetteAdmin getCassette()
          Returns the CassetteAdmin object of the cassette which will process this request.
 MerchantAdmin getMerchant()
          Returns the MerchantAdmin object to which the subject Order belongs.
 Object getValue(String key)
          Returns the value of a framework command parameter as specified in the command string from the application program.
 Object getValue(String key, Object defaultReturnValue)
          Returns the value of a framework command parameter as specified in the command string from the application program.
 void setExecutionMode()
          Marks this request object as being ready for processing by the cassette.
 void setValidationMode()
          Marks this request object as being ready for validation by the cassette.
 boolean validationMode()
          Indicates whether the cassette is expected to validate or process this request object.
 
Methods inherited from class com.ibm.etill.framework.cassette.APIRequest
getFrameworkKeywords, getProtocolData
 
Methods inherited from class com.ibm.etill.framework.cassette.CassetteRequest
getConnection, getToken, obtainLocks, releaseLocks
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AdminRequest

public AdminRequest(int token,
                    String cassetteName,
                    String merchantNumber,
                    ParameterTable frameworkKeywords,
                    ParameterTable protocolData)
             throws ETillAbortOperation
Cassettes should never call this constructor.

Constructs an AdminRequest object which references or contains all of the specified input parameters. The Framework invokes this constructor every time a new administrative command is received from an application program. Since admin commands should always originate outside of Commerce Payments, cassettes should never call this constructor.

Parameters:
token - an int representing the API command. API event tokens are defined by the Framework in PaymentAPIConstants.
cassetteName - a String containing the name of the cassette which is supposed to process this request.
merchantNumber - a String containing the number of the merchant with which this request is associated.
frameworkKeywords - a ParameterTable that contains the framework command parameters that were specified on the command string.
protocolData - a ParameterTable that contains the protocol data parameters that were specified on the command string. If no such parameters were specified, then this value will be null.
Throws:
ETillAbortOperation - thrown if the cassette or merchant cannot be found.
Method Detail

getValue

public Object getValue(String key)
Returns the value of a framework command parameter as specified in the command string from the application program.
Parameters:
key - - a String containing a framework command parameter keyword. If this keyword is found within the set of parameters specified in the command string by the application, then the associated value will be returned.
Returns:
Object - the value associated with the input keyword. If the keyword was not found in the parameter set, then null is returned.

getValue

public Object getValue(String key,
                       Object defaultReturnValue)
Returns the value of a framework command parameter as specified in the command string from the application program.
Parameters:
key - - a String containing a framework command parameter keyword. If this keyword is found within the set of parameters specified in the command string by the application, then the associated value will be returned.
defaultReturnValue - - the object to be returned if the value is not found in the framework keyword ParameterTable.
Returns:
Object - the value associated with the input keyword. If the keyword was not found in the parameter set, then the object specifed as defaultReturnValue is returned.

getCassette

public CassetteAdmin getCassette()
Returns the CassetteAdmin object of the cassette which will process this request.
Returns:
CassetteAdmin - a reference to the CassetteAdmin object under which this request is processed.

getMerchant

public MerchantAdmin getMerchant()
Returns the MerchantAdmin object to which the subject Order belongs.
Returns:
MerchantAdmin - the framework merchant object to which the subject Order belongs.

setValidationMode

public void setValidationMode()
Marks this request object as being ready for validation by the cassette. The Framework calls this method before calling the Cassette object's service method to validate this request object's contents. The cassette's service method can use the validationMode() method to inquire whether the request needs to be validated or processed.

setExecutionMode

public void setExecutionMode()
Marks this request object as being ready for processing by the cassette. The Framework calls this method before calling the Cassette object's service method to process this request object. The cassette's service method can use the validationMode() method to inquire whether the request needs to be validated or processed.

validationMode

public boolean validationMode()
Indicates whether the cassette is expected to validate or process this request object.
Returns:
boolean - true indicates that this request object is to be validated. false indicates that the object should be processed.