com.ibm.retail.AEF.util
Class AEFErrorHandler

java.lang.Object
  |
  +--com.ibm.retail.AEF.util.AEFErrorHandler

public class AEFErrorHandler
extends java.lang.Object

ErrorHandler is a class which the AEF applications can use to handle application errors.


Field Summary
protected  java.lang.Object additionalData
           
protected  com.ibm.retail.si.util.AEFException allExceptions
           
protected  java.lang.String applicationErrorText
           
protected  java.util.ArrayList errorHistory
           
protected  boolean ignoreMaxErrorLevels
           
protected static org.apache.commons.logging.Log log
           
protected  int maxErrorLevels
           
protected  int maxSameError
           
protected  com.ibm.retail.AEF.util.AEFMessage msg
           
protected  int numSameError
           
protected  int sleepInterval
           
 
Constructor Summary
AEFErrorHandler(int errorLevels, java.lang.String errorText)
          Constructor
AEFErrorHandler(int errorLevels, java.lang.String errorText, java.lang.Object data)
          Constructor
AEFErrorHandler(java.lang.String errorText)
          Constructor
AEFErrorHandler(java.lang.String errorText, java.lang.Object data)
          Constructor
 
Method Summary
(package private) static java.lang.String copyright()
           
 java.lang.Object getAdditionalData()
          Gets the additional data pased by the calling application or a NULL.
 com.ibm.retail.si.util.AEFException getAllExceptions()
          Returns the allExceptions variable which contains the exceptions encountered while trying to handle the error.
 java.lang.String getAllFormattedErrorText(boolean includeApplicationText)
          Returns a string which is the formatted error information from all the error handled.
 int getErrorHandlingMode()
          Gets the error handling mode from the Automation Provider.
 com.ibm.retail.si.util.AEFError[] getErrors()
          Returns the array of all the errors handled so far.
 java.lang.String getFormattedErrorText(int index, boolean includeApplicationText)
          Returns a string which is the formatted error information for a specific error.
 int getSleepInterval()
          Returns the number of milliseconds to wait before continuing with the next operation while handling errors.
 int handleError(com.ibm.retail.AEF.thread.ConditionLock lock, com.ibm.retail.AEF.action.AEFAction keySequenceAction, com.ibm.retail.AEF.automation.Condition[] goodConditions, com.ibm.retail.AEF.automation.Condition[] badConditions, int timeout, int satisfiedCondition)
          Returns the index of the condition that satisfied the wait.
 int handleSpecificError(com.ibm.retail.AEF.thread.ConditionLock lock, com.ibm.retail.AEF.action.AEFAction keySequenceAction, com.ibm.retail.AEF.automation.Condition[] goodConditions, com.ibm.retail.AEF.automation.Condition[] badConditions, int timeout, int satisfiedCondition, int errorLevel)
          Returns the index of the condition that satisfied the wait.
 void sleep()
          Causes the Error Helper to wait before continuing with the next operation.
 void sleep(int userInterval)
          Causes the Error Helper to wait before continuing with the next operation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

maxSameError

protected int maxSameError

numSameError

protected int numSameError

maxErrorLevels

protected int maxErrorLevels

ignoreMaxErrorLevels

protected boolean ignoreMaxErrorLevels

applicationErrorText

protected java.lang.String applicationErrorText

allExceptions

protected com.ibm.retail.si.util.AEFException allExceptions

errorHistory

protected java.util.ArrayList errorHistory

sleepInterval

protected int sleepInterval

additionalData

protected java.lang.Object additionalData

log

protected static org.apache.commons.logging.Log log

msg

protected com.ibm.retail.AEF.util.AEFMessage msg
Constructor Detail

AEFErrorHandler

public AEFErrorHandler(int errorLevels,
                       java.lang.String errorText)
Constructor

Parameters:
errorLevels - Determines the maximum number of errors that the handler will try to clear. 0 means to continue to try to correct the error forever.
errorText - Includes any additional text that the application wants to include in the exception if any is thrown by the handler.

AEFErrorHandler

public AEFErrorHandler(int errorLevels,
                       java.lang.String errorText,
                       java.lang.Object data)
Constructor

Parameters:
errorLevels - Determines the maximum number of errors that the handler will try to clear. 0 means to continue to try to correct the error forever.
errorText - Includes any additional text that the application wants to include in the exception if any is thrown by the handler.
data - Includes any additional data that the Error Handler or Helpers may need.

AEFErrorHandler

public AEFErrorHandler(java.lang.String errorText,
                       java.lang.Object data)
Constructor

Parameters:
errorText - Includes any additional text that the application wants to include in the exception if any is thrown by the handler.
data - Includes any additional data that the Error Handler or Helpers may need.

AEFErrorHandler

public AEFErrorHandler(java.lang.String errorText)
Constructor

Parameters:
errorText - Includes any additional text that the application wants to include in the exception if any is thrown by the handler.
Method Detail

copyright

static java.lang.String copyright()

getErrors

public com.ibm.retail.si.util.AEFError[] getErrors()
Returns the array of all the errors handled so far.

Returns:
AEFError[] The array of all the errors handled so far.

getAllFormattedErrorText

public java.lang.String getAllFormattedErrorText(boolean includeApplicationText)
Returns a string which is the formatted error information from all the error handled.

Returns:
String The additional error text.

getFormattedErrorText

public java.lang.String getFormattedErrorText(int index,
                                              boolean includeApplicationText)
Returns a string which is the formatted error information for a specific error.

Returns:
String The formatted error text.

handleError

public int handleError(com.ibm.retail.AEF.thread.ConditionLock lock,
                       com.ibm.retail.AEF.action.AEFAction keySequenceAction,
                       com.ibm.retail.AEF.automation.Condition[] goodConditions,
                       com.ibm.retail.AEF.automation.Condition[] badConditions,
                       int timeout,
                       int satisfiedCondition)
                throws AEFException
Returns the index of the condition that satisfied the wait.

Parameters:
lock - The ConditionLock that returned the error.
keySequenceAction - The key sequence that generated the error.
goodConditions - An array of the conditions that would indicate success after the key sequence is sent.
badConditions - An array of the conditions that would indicate a failure after the key sequence is sent. For the most part, these should be states and not individual errors. The assumption is that most errors would put the application in some sort of error state. The handler would then figure out which error put the application in this state and handle the error.
timeout - An integer used to determine how long to wait for one of the listed conditions before a timeout exception is thrown.
satisfiedCondition - The index of the condition in the badConditions array that was satisfied (needs to be adjusted as it is a negative number).
Returns:
int The index of the condition in the goodConditions array that was satisfied after the error was handled.
Throws:
AEFException - Because of the nature of this method, just about any error code could be returned.
Among the possible AEFException error codes are:
Common Errors

handleSpecificError

public int handleSpecificError(com.ibm.retail.AEF.thread.ConditionLock lock,
                               com.ibm.retail.AEF.action.AEFAction keySequenceAction,
                               com.ibm.retail.AEF.automation.Condition[] goodConditions,
                               com.ibm.retail.AEF.automation.Condition[] badConditions,
                               int timeout,
                               int satisfiedCondition,
                               int errorLevel)
                        throws AEFException
Returns the index of the condition that satisfied the wait.

Parameters:
lock - The ConditionLock that returned the error.
keySequenceAction - The key sequence that generated the error.
goodConditions - An array of the conditions that would indicate success after the key sequence is sent.
badConditions - An array of the conditions that would indicate a failure after the key sequence is sent.
timeout - An integer used to determine how long to wait for one of the listed conditions before a timeout exception is thrown.
satisfiedCondition - The index of the condition in the badConditions array that was satisfied (needs to be adjusted as it is a negative number).
errorLevel - The number of times that this function has been called.
Returns:
int The index of the condition in the goodConditions array that was satisfied after the error was handled.
Throws:
AEFException - Because of the nature of this method, just about any error code could be returned.
Among the possible AEFException error codes are:
Common Errors

getAllExceptions

public com.ibm.retail.si.util.AEFException getAllExceptions()
Returns the allExceptions variable which contains the exceptions encountered while trying to handle the error.

Returns:
AEFException the allExceptions variable

getSleepInterval

public int getSleepInterval()
Returns the number of milliseconds to wait before continuing with the next operation while handling errors. During testing, we found that differences in hardware, and software configuration could lead to timing issues. In many cases, invalid key sequence errors were erroneously generated. In order to compensate for this, JAVA sleep calls were added to the AEFErrorHandler and ErrorHelper classes. The Sleep Interval is configured in config.properties.

Returns:
int The Sleep Interval in milliseconds.

sleep

public void sleep()
Causes the Error Helper to wait before continuing with the next operation. During testing, we found that differences in hardware, and software configuration could lead to timing issues. In many cases, invalid key sequence errors were erroneously generated. In order to compensate for this, sleep calls (using this method) were added to the AEFErrorHandler and ErrorHelper classes. The default Sleep Interval is configured in config.properties.


sleep

public void sleep(int userInterval)
Causes the Error Helper to wait before continuing with the next operation. During testing, we found that differences in hardware, and software configuration could lead to timing issues. In many cases, invalid key sequence errors were erroneously generated. In order to compensate for this, sleep calls (using this method) were added to the AEFErrorHandler and ErrorHelper classes. The default Sleep Interval is configured in config.properties.

Parameters:
userInterval - A user specified interval to be used instead of the default sleep value.

getErrorHandlingMode

public int getErrorHandlingMode()
                         throws AEFException
Gets the error handling mode from the Automation Provider.

Returns:
Int The error handling mode.
Throws:
AEFException - Among the possible AEFException error codes are:
AEFConst.PROPERTY_NOT_SUPPORTED
Common Errors

getAdditionalData

public java.lang.Object getAdditionalData()
Gets the additional data pased by the calling application or a NULL.

Returns:
Object The additional data pased by the calling application or a NULL.


Copyright © 2004 IBM. All Rights Reserved.
Generated: July 19 2004