IBM WebSphere Multichannel Bank Transformation Toolkit Javadoc

com.ibm.btt.cs.html
Class RequestValidationServices

java.lang.Object
  extended by com.ibm.btt.cs.html.RequestValidationServices
All Implemented Interfaces:
java.io.Serializable

public class RequestValidationServices
extends java.lang.Object
implements java.io.Serializable

Back and double post validation requires that we keep a table of operations which are in progress. The table key is a composite key of sessionid.pageid. The data held for each record is a RequestData object, which encapsulates the channelContext and the operation which is running. Double (multiple) post validation is performed by testing that no entry is present for a sessionid.pageid before processing the request. Back button validation is related to processes. This support has not been added yet.

See Also:
Serialized Form

Field Summary
protected  long ageLimit
           
protected  java.util.Hashtable pendingRequestTable
           
 
Constructor Summary
RequestValidationServices()
          Constructor for RequestValidationServices.
 
Method Summary
static void addFieldTo(Context ctx, java.lang.String name, java.lang.Object value)
          This method adds toolkit related fields to a context.
 void addOpToPendingRequest(ChannelContext channelContext, BTTServerOperation addOperation)
          Once a record is added in the pending requests table, this method adds to this record the operation related with the request.
 void addPendingRequest(HtmlRequestData requestData)
          Add request into the pending requests table
 void beginAgingRequest(ChannelContext channelContext)
          If the system has a non-zero age limit, then set a timestamp (actually a date) for the pending request matching the session and page that is passed in.
 boolean deletePendingRequest(java.lang.String compositeKey)
          This method removes an operation which has completed for a given page in a given session.
 java.lang.String getCompositeKey(ChannelContext channelContext)
          Builds the composite key used to identify a request in the pending requests table.
static java.lang.String getNextPageId(java.lang.String sessionId)
          Generate and return the next page ID for a given session.
 BTTServerOperation getOperationInProcess(ChannelContext channelContext)
          Return the operation in process that corresponds to the session id and page id specified in the channelContext
 java.util.Hashtable getPendingRequestTable()
          Utility method that returns the pending requests table.
 boolean isMarkedAsNotAnswered(ChannelContext channelContext)
          checks whether this request is product of a double click.
 boolean isProcessorRequest(ChannelContext channelContext)
          See if the request asks or a processor instead of an operation.
 boolean isRequestAging(ChannelContext channelContext)
          See if a request recently completed for a given page in a given session.
 boolean isSomeOpProcessing(java.lang.String sessionId, java.lang.String pageId)
          Utility method inditating if there is any operation in process for a given session id and page id.
 boolean isUnconsistentProcessor(ChannelContext channelContext)
          See if a request for this processor is still in process or its aging timeout has not been reached yet.
 void markAsAnswered(ChannelContext channelContext)
          Marks the request as answered, which means that there is no other request from the same client.
 void markAsNotAnswered(ChannelContext channelContext)
          Marks the request as not answered, which means that there is another request from the same client which will handle the answering.
protected  void removeExpiredRequests()
          Remove requests that are in the pendingRequestTable which have been there longer than the max aging time set for the system.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pendingRequestTable

protected java.util.Hashtable pendingRequestTable

ageLimit

protected long ageLimit
Constructor Detail

RequestValidationServices

public RequestValidationServices()
Constructor for RequestValidationServices.

Method Detail

addFieldTo

public static void addFieldTo(Context ctx,
                              java.lang.String name,
                              java.lang.Object value)
                       throws java.lang.Exception
This method adds toolkit related fields to a context.

Parameters:
ctx - com.ibm.btt.base.Context
name - java.lang.String
value - java.lang.Object
Throws:
java.lang.Exception

addOpToPendingRequest

public void addOpToPendingRequest(ChannelContext channelContext,
                                  BTTServerOperation addOperation)
                           throws DSEException
Once a record is added in the pending requests table, this method adds to this record the operation related with the request.

Parameters:
channelContext - com.ibm.btt.clientserver.ChannelContext
oper - com.ibm.btt.cs.html.HtmlServerOperation
Throws:
DSEException

addPendingRequest

public void addPendingRequest(HtmlRequestData requestData)
                       throws DSEException
Add request into the pending requests table

Parameters:
requestData - com.ibm.btt.cs.html.HtmlRequestData
Throws:
DSEException

beginAgingRequest

public void beginAgingRequest(ChannelContext channelContext)
                       throws DSEException
If the system has a non-zero age limit, then set a timestamp (actually a date) for the pending request matching the session and page that is passed in. Then if another request from the same session.page comes in, and it is before the aging process ends, we declare a double post and we will not process the request any further.

Parameters:
channelContext - com.ibm.btt.clientserver.ChannelContext
Throws:
DSEException

deletePendingRequest

public boolean deletePendingRequest(java.lang.String compositeKey)
This method removes an operation which has completed for a given page in a given session.

Parameters:
compositeKey - java.lang.String
Returns:
boolean

getCompositeKey

public java.lang.String getCompositeKey(ChannelContext channelContext)
                                 throws DSEException
Builds the composite key used to identify a request in the pending requests table. It is constructed concatenating three keys:

If the request is intended to execute an operation instead of a processor, the operation identifier is just the operation name.
If the request is intended to execute a processor we need more than the processor name because the same page could contain more than one reference to the same processor, each of them asking for different transitions, so the processor name is constructed concatenating processor name and next event name.

Parameters:
channelContext - com.ibm.btt.clientserver.ChannelContext
Returns:
java.lang.String
Throws:
DSEException

getNextPageId

public static java.lang.String getNextPageId(java.lang.String sessionId)
Generate and return the next page ID for a given session.

Parameters:
sessionId - java.lang.String
Returns:
java.lang.String

getOperationInProcess

public BTTServerOperation getOperationInProcess(ChannelContext channelContext)
                                         throws DSEException
Return the operation in process that corresponds to the session id and page id specified in the channelContext

Parameters:
com.ibm.btt.clientserver.ChannelContext -
Throws:
DSEException

isMarkedAsNotAnswered

public boolean isMarkedAsNotAnswered(ChannelContext channelContext)
                              throws DSEException
checks whether this request is product of a double click.

Parameters:
channelContext -
Throws:
DSEException

isProcessorRequest

public boolean isProcessorRequest(ChannelContext channelContext)
                           throws DSEException
See if the request asks or a processor instead of an operation. It looks for a valid event name in the request data received from client. If this field does not exist or it is empty, this request won't be considered as an automaton request.

Parameters:
channelContext - com.ibm.btt.clientserver.ChannelContext
Throws:
DSEException

isRequestAging

public boolean isRequestAging(ChannelContext channelContext)
                       throws DSEException
See if a request recently completed for a given page in a given session.

Parameters:
channelContext - com.ibm.btt.clientserver.ChannelContext
Throws:
DSEException

isSomeOpProcessing

public boolean isSomeOpProcessing(java.lang.String sessionId,
                                  java.lang.String pageId)
                           throws DSEException
Utility method inditating if there is any operation in process for a given session id and page id.

Parameters:
sessionId -
pageId -
Throws:
DSEException

isUnconsistentProcessor

public boolean isUnconsistentProcessor(ChannelContext channelContext)
                                throws DSEException
See if a request for this processor is still in process or its aging timeout has not been reached yet.

Parameters:
channelContext - com.ibm.btt.clientserver.ChannelContext
Throws:
DSEException

markAsNotAnswered

public void markAsNotAnswered(ChannelContext channelContext)
                       throws DSEException
Marks the request as not answered, which means that there is another request from the same client which will handle the answering.

Parameters:
channelContext -
Throws:
DSEException

markAsAnswered

public void markAsAnswered(ChannelContext channelContext)
                    throws DSEException
Marks the request as answered, which means that there is no other request from the same client.

Parameters:
channelContext -
Throws:
DSEException

removeExpiredRequests

protected void removeExpiredRequests()
Remove requests that are in the pendingRequestTable which have been there longer than the max aging time set for the system.


getPendingRequestTable

public java.util.Hashtable getPendingRequestTable()
                                           throws java.lang.Exception
Utility method that returns the pending requests table.

Throws:
java.lang.Exception

IBM WebSphere Multichannel Bank Transformation Toolkit Javadoc

(c) Copyright IBM Corporation 1998, 2009