org.safs
Class Processor

java.lang.Object
  extended by org.safs.Processor
Direct Known Subclasses:
ComponentFunction, DriverCommand, DriverCommandProcessor, EngineCommandProcessor, JREXStepProcessor, TestStepProcessor

public abstract class Processor
extends java.lang.Object

Abstract Processor, enforces that the 'process' and 'isSupportedRecordType' methods be implemented.

Since:
JUN 03, 2003
JUN 03, 2003 (DBauman) Original Release
SEP 16, 2003 (CANAGL) Implemented use of new SAFSLOGS logging.
NOV 10, 2003 (CANAGL) Added constants for known record types.
Added new abstract isSupportedRecordType()
NOV 13, 2003 (CANAGL) Added support for stored processors or
full or partial class names for processors.
The latter is moving the functionality out of
the TestRecordData class into the individual
Processors for more flexible diffentiation of
processors.
NOV 13, 2003 (DBauman) Added support for breakpoints.
NOV 19, 2003 (CANAGL) Additional refactoring.
AUG 08, 2006 (PHSABO) Added helper functions getSubAreaRectangle and getClippedSubAreaRectangle used by GetGUIImage and FilterImage.
JAN 29, 2007 (CANAGL) Added chainedProcessor support for all Processors.
JAN 25, 2008 (CANAGL) Removed Java 1.5 String.contains dependencies.
JUL 31, 2008 (CANAGL) Added CASEINSENSITIVE static strings for subclasses.
AUG 25, 2008 (CANAGL) Added try/catch in distributeConfigInfo routine.
MAR 26, 2009 (CANAGL) Added safsparams support for clearProxiesAlways.
MAR 08, 2011 (DharmeshPatel) Added RFSMOnly support for RFSM search mode.

Field Summary
protected static boolean breakpointsOn
          All processor instances may enable/disable and force breakpoints where they deem this appropriate.
static java.lang.String CASE_INSENSITIVE_FLAG
           
static java.lang.String CASEINSENSITIVE_FLAG
           
protected static boolean clearProxiesAlways
           
protected static boolean commandLineBreakpoint
           
protected static java.lang.String customStr
           
protected static GetText customText
           
protected static int DEBUG_MESSAGE
          Convenience for local referencing instead of referencing AbstractLogFacility.
protected static java.lang.String debugStr
           
protected static GetText debugText
           
static java.lang.String DEFAULT_CUSTOM_PROCESSOR_PACKAGE
           
static java.lang.String DEFAULT_CUSTOM_PROCESSOR_SUBPACKAGE
           
static java.lang.String DEFAULT_PROCESSOR_PACKAGE
          "org.safs" Default package for Processor subclasses used to execute test data.
protected static int FAILED_MESSAGE
          Log MessageType for local referencing.
protected static int FAILED_OK_MESSAGE
          Log MessageType for local referencing.
protected static java.lang.String failedStr
           
protected static GetText failedText
           
protected static java.lang.String FAILURE_DETAIL
          GetText.text() keyword.
protected static int GENERIC_MESSAGE
          Convenience for local referencing instead of referencing AbstractLogFacility.
protected static java.lang.String genericStr
           
protected static GetText genericText
           
protected static java.lang.String LINE_FAILURE_4
          GetText.text() keyword.
protected  LogUtilities log
           
protected  boolean myBreakpointsOn
          Individual processor instances may enable/disable and force breakpoints where they deem this appropriate.
protected static java.lang.String otherStr
           
protected static GetText otherText
           
protected static java.lang.String PARAM_SIZE_1
          GetText.text() keyword.
protected static java.lang.String PARAM_SIZE_2
          GetText.text() keyword.
protected static java.lang.String PARAM_SIZE_3
          GetText.text() keyword.
protected static java.lang.String PARAM_SIZE_4
          GetText.text() keyword.
protected  java.util.Collection params
          
Purpose: the collection of params
Initialized: constructor
protected static int PASSED_MESSAGE
          Log MessageType for local referencing.
protected static java.lang.String passedStr
           
protected static GetText passedText
           
protected static java.lang.String PRE_TXT_SUCCESS_4
          GetText.text() keyword.
protected static java.lang.String PRE_TXT_SUCCESS_5
          GetText.text() keyword.
protected static boolean processorConfigSet
           
protected  java.util.Map processorMap
          keeps instantiated processors for reuse
protected  boolean recordProcessed
          Status for whether the processor processed the record, if the processor fails to support the record it has been given, then the processor should set this to false, so that any processor chain can continue to the next processor, if one is available.
static java.lang.String RECTYPE_DRIVER_COMMAND
          "C" Record Type Constant
static java.lang.String RECTYPE_DRIVER_COMMAND_F
          "CF" Record Type Constant
static java.lang.String RECTYPE_DRIVER_COMMAND_W
          "CW" Record Type Constant
static java.lang.String RECTYPE_TEST_STEP
          "T" Record Type Constant
static java.lang.String RECTYPE_TEST_STEP_F
          "TF" Record Type Constant
static java.lang.String RECTYPE_TEST_STEP_W
          "TW" Record Type Constant
protected static boolean RFSMCache
           
protected static boolean RFSMOnly
           
static java.lang.String RFT_FIND_SEARCH_MODE_ALGORITHM
          "RFSMOnly"
static java.lang.String RFT_FIND_SEARCH_MODE_CACHE
          "RFSMCache"
static java.lang.String SAFS_CLEARPROXIESALWAYS_ITEM
          "clearProxiesAlways"
static java.lang.String SAFS_COMMANDLINEBREAKPOINT_ITEM
          "commandLineBreakpoint"
static java.lang.String SAFS_COMMANDLINEBREAKPOINT_VARIABLE
          "safs.commandLineBreakpoint"
static java.lang.String SAFS_PARAMS_FILE
          "safsparams.dat"
static java.lang.String SAFS_RESBUN_NAME
           
static java.lang.String SAFS_SECSWAITFORCOMPONENT_ITEM
          "secsWaitForComponent"
static java.lang.String SAFS_SECSWAITFORCOMPONENT_VARIABLE
          "safs.secsWaitForComponent"
static java.lang.String SAFS_SECSWAITFORWINDOW_ITEM
          "secsWaitForWindow"
static java.lang.String SAFS_SECSWAITFORWINDOW_VARIABLE
          "safs.secsWaitForWindow"
static java.lang.String SAFS_TESTDOMAINS_ITEM
          "testDomains" Config setting should contain semi-colon delimited combinations of values: Java;Html;Net;Win
static java.lang.String SAFS_TESTDOMAINS_VARIABLE
          "safs.testDomains"
protected static int secsWaitForComponent
           
protected static int secsWaitForWindow
           
protected static java.lang.String SENT_MSG_3
          GetText.text() keyword.
protected static java.lang.String testDomains
           
protected  TestRecordHelper testRecordData
          
Purpose: holds the testRecordData info
Initialized: constructor
protected static java.lang.String TXT_FAILURE_1
          GetText.text() keyword.
protected static java.lang.String TXT_FAILURE_2
          GetText.text() keyword.
protected static java.lang.String TXT_FAILURE_3
          GetText.text() keyword.
protected static java.lang.String TXT_FAILURE_4
          GetText.text() keyword.
protected static java.lang.String TXT_FAILURE_5
          GetText.text() keyword.
protected static java.lang.String TXT_SUCCESS_1
          GetText.text() keyword.
protected static java.lang.String TXT_SUCCESS_2
          GetText.text() keyword.
protected static java.lang.String TXT_SUCCESS_2a
          GetText.text() keyword.
protected static java.lang.String TXT_SUCCESS_3
          GetText.text() keyword.
protected static java.lang.String TXT_SUCCESS_3a
          GetText.text() keyword.
protected static java.lang.String TXT_SUCCESS_4
          GetText.text() keyword.
protected static java.lang.String TXT_SUCCESS_5
          GetText.text() keyword.
protected static int WARNING_MESSAGE
          Log MessageType for local referencing.
protected static int WARNING_OK_MESSAGE
          Log MessageType for local referencing.
protected static java.lang.String warningStr
           
protected static GetText warningText
           
 
Constructor Summary
Processor()
          
Purpose: constructor
 
Method Summary
protected static void activateBreakpoint(java.lang.String breakpoint_message)
          Activate the SAFSBreakpointException breakpoint.
protected static void checkBreakpoints(java.lang.String breakpoint_message)
          test for enabled breakpoints and active a breakpoint if enabled.
protected  void checkMyBreakpoints(java.lang.String breakpoint_message)
          test for enabled breakpoints and active a breakpoint if enabled.
protected  boolean delay(int millisec)
           
 void distributeConfigInformation()
           
 java.util.Collection getAlternateParams()
           
protected  java.lang.String getAppMapItem(java.lang.String appMapID, java.lang.String section, java.lang.String item)
           
 Processor getChainedProcessor()
          Returns chained processor to interpret test data, if any.
protected  Processor getClassInstance(java.lang.String classname)
          Instance a given Processor from the provided classname.
static boolean getClearProxiesAlways()
           
protected  java.util.ArrayList getCustomProcClassNames()
          Attempts to locate a class for the current customProcInstancePath.
 java.lang.String getCustomProcInstancePath()
          Return the current customProcInstancePath setting.
 LogUtilities getLogUtilities()
           
 java.util.Collection getParams()
           
protected  java.util.ArrayList getProcClassNames()
          Attempts to locate a class for the current procInstancePath.
 Processor getProcInstance()
          Return/Create an instance of the actual processor used to interpret test data.
 java.lang.String getProcInstancePath()
          Return the current procInstancePath setting.
protected  boolean getRequiredField(int findex, java.lang.String fname, java.lang.String fvalue)
          Retrieve a non-empty field value from the testRecordData inputrecord.
static int getSecsWaitForComponent()
           
static int getSecsWaitForWindow()
           
protected  java.lang.String getStandardErrorMessage(java.lang.String failure)
          Retrieve the standard "SOMETHING failure in filename FILENAME at line LINENUMBER" message.
 TestRecordHelper getTestRecordData()
           
protected  java.lang.String getVariable(java.lang.String var)
           
 boolean hasChainedProcessor()
          True if this processor has an instance of a chained processor to interpret test data if this one does not succeed in processing the data.
protected  boolean initProcessorAndProcess(Processor aprocessor, java.util.Collection params)
          Init the processor and process a record Initializes the processor by passing it the currently active LogUtilities, TestRecordHelper, and extracted record parameters.
protected  boolean instanceProcessorAndProcess(java.lang.String instanceName, java.util.Collection params)
          Tries to instance a processor and then process a record.
static boolean isBreakpointsOn()
          test if breakpoints is enabled.
 boolean isComponentFunctionRecord(java.lang.String recordType)
          Convenience routine for isSupportedRecordType to return true if the Processor supports standard Component Function records.
 boolean isDriverCommandRecord(java.lang.String recordType)
          Convenience routine for isSupportedRecordType to return true if the Processor supports standard Driver Command records.
 boolean isEngineCommandRecord(java.lang.String recordType)
          Convenience routine for isSupportedRecordType to return true if the Processor supports standard Engine Command records.
 boolean isMyBreakpointsOn()
          test if breakpoints is enabled.
 boolean isRecordProcessed()
           
static boolean isRFSMCache()
           
static boolean isRFSMOnly()
           
abstract  boolean isSupportedRecordType(java.lang.String recordType)
          Determine support for a particular record type.
protected  void paramsFailedMsg()
          
Purpose: log a FAILED_MESSAGE about the wrong number of parameters; this version is used by DriverCommands
protected  void paramsFailedMsg(java.lang.String windowName, java.lang.String compName)
          
Purpose: log a FAILED_MESSAGE about the wrong number of parameters
 void process()
          The primary method that all subclasses must implement.
protected  boolean processCustomProcessor(java.util.Collection params)
           
protected  boolean processSubclassProcessor(java.util.Collection params)
           
static void setBreakpointsOn(boolean enabled)
          This may be set by any means.
 void setChainedProcessor(Processor aprocessor)
          Set the instance of the chained processor to interpret test data if this one does not succeed in processing the data.
static void setClearProxiesAlways(boolean enabled)
           
static void setCommandLineBreakpoint(boolean enabled)
           
 void setCustomProcInstancePath(java.lang.String pkgname)
          Change the procInstancePath setting.
 void setLogUtilities(LogUtilities log)
           
 void setMyBreakpointsOn(boolean enabled)
          This may be set by any means.
 void setParams(java.util.Collection params)
           
 void setProcInstance(Processor aprocessor)
          Provide a Processor object to interpret test data.
 void setProcInstancePath(java.lang.String pkgname)
          Change the procInstancePath setting.
 void setRecordProcessed(boolean processed)
           
static void setRFSMCache(boolean enable)
           
static void setRFSMOnly(boolean enable)
           
static void setSecsWaitForComponent(int secs)
           
static void setSecsWaitForWindow(int secs)
           
static void setTestDomains(java.lang.String domains)
           
 void setTestRecordData(TestRecordHelper testRecordData)
           
protected  boolean setVariable(java.lang.String var, java.lang.String val)
           
protected  void standardFailureMessage(java.lang.String failure, java.lang.String detail)
          log the more standard FAILED_MESSAGE with detail.
 java.lang.String substituteVariable(java.lang.String str)
          
Purpose: if leading ^ found, then substitue variable.
protected  boolean validateParamSize(int minparams)
          check if params.size() < minparams If params.size() is insufficient we set testRecordData.setStatusCode to GENERAL_SCRIPT_FAILURE and log a paramsFailedMsg and return 'false'.
protected  boolean validProcessorClassName(java.lang.String classname)
          Validate that a given classname is valid and assignable to org.safs.Processor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_PROCESSOR_PACKAGE

public static final java.lang.String DEFAULT_PROCESSOR_PACKAGE
"org.safs" Default package for Processor subclasses used to execute test data.

See Also:
Constant Field Values

DEFAULT_CUSTOM_PROCESSOR_PACKAGE

public static final java.lang.String DEFAULT_CUSTOM_PROCESSOR_PACKAGE
See Also:
Constant Field Values

DEFAULT_CUSTOM_PROCESSOR_SUBPACKAGE

public static final java.lang.String DEFAULT_CUSTOM_PROCESSOR_SUBPACKAGE
See Also:
Constant Field Values

CASEINSENSITIVE_FLAG

public static final java.lang.String CASEINSENSITIVE_FLAG
See Also:
Constant Field Values

CASE_INSENSITIVE_FLAG

public static final java.lang.String CASE_INSENSITIVE_FLAG
See Also:
Constant Field Values

breakpointsOn

protected static boolean breakpointsOn
All processor instances may enable/disable and force breakpoints where they deem this appropriate. The static setting is shared by all processors. By default, breakpoints at all the coded locations are true.


myBreakpointsOn

protected boolean myBreakpointsOn
Individual processor instances may enable/disable and force breakpoints where they deem this appropriate. The setting is specific to individual processors. By default, breakpoints on individual processors is disabled. However, a check is done for the static Processor.isBreakpoints enabled which overrides this setting. Processor breakpoints can be enabled separately when all other global breakpoints are disabled.


TXT_SUCCESS_1

protected static final java.lang.String TXT_SUCCESS_1
GetText.text() keyword.

See Also:
Constant Field Values

TXT_SUCCESS_2

protected static final java.lang.String TXT_SUCCESS_2
GetText.text() keyword.

See Also:
Constant Field Values

TXT_SUCCESS_2a

protected static final java.lang.String TXT_SUCCESS_2a
GetText.text() keyword.

See Also:
Constant Field Values

TXT_SUCCESS_3

protected static final java.lang.String TXT_SUCCESS_3
GetText.text() keyword.

See Also:
Constant Field Values

TXT_SUCCESS_3a

protected static final java.lang.String TXT_SUCCESS_3a
GetText.text() keyword.

See Also:
Constant Field Values

TXT_SUCCESS_4

protected static final java.lang.String TXT_SUCCESS_4
GetText.text() keyword.

See Also:
Constant Field Values

PRE_TXT_SUCCESS_4

protected static final java.lang.String PRE_TXT_SUCCESS_4
GetText.text() keyword.

See Also:
Constant Field Values

TXT_SUCCESS_5

protected static final java.lang.String TXT_SUCCESS_5
GetText.text() keyword.

See Also:
Constant Field Values

PRE_TXT_SUCCESS_5

protected static final java.lang.String PRE_TXT_SUCCESS_5
GetText.text() keyword.

See Also:
Constant Field Values

SENT_MSG_3

protected static final java.lang.String SENT_MSG_3
GetText.text() keyword.

See Also:
Constant Field Values

TXT_FAILURE_1

protected static final java.lang.String TXT_FAILURE_1
GetText.text() keyword.

See Also:
Constant Field Values

TXT_FAILURE_2

protected static final java.lang.String TXT_FAILURE_2
GetText.text() keyword.

See Also:
Constant Field Values

TXT_FAILURE_3

protected static final java.lang.String TXT_FAILURE_3
GetText.text() keyword.

See Also:
Constant Field Values

TXT_FAILURE_4

protected static final java.lang.String TXT_FAILURE_4
GetText.text() keyword.

See Also:
Constant Field Values

LINE_FAILURE_4

protected static final java.lang.String LINE_FAILURE_4
GetText.text() keyword.

See Also:
Constant Field Values

TXT_FAILURE_5

protected static final java.lang.String TXT_FAILURE_5
GetText.text() keyword.

See Also:
Constant Field Values

FAILURE_DETAIL

protected static final java.lang.String FAILURE_DETAIL
GetText.text() keyword.

See Also:
Constant Field Values

PARAM_SIZE_1

protected static final java.lang.String PARAM_SIZE_1
GetText.text() keyword.

See Also:
Constant Field Values

PARAM_SIZE_2

protected static final java.lang.String PARAM_SIZE_2
GetText.text() keyword.

See Also:
Constant Field Values

PARAM_SIZE_3

protected static final java.lang.String PARAM_SIZE_3
GetText.text() keyword.

See Also:
Constant Field Values

PARAM_SIZE_4

protected static final java.lang.String PARAM_SIZE_4
GetText.text() keyword.

See Also:
Constant Field Values

RECTYPE_DRIVER_COMMAND

public static final java.lang.String RECTYPE_DRIVER_COMMAND
"C" Record Type Constant

See Also:
Constant Field Values

RECTYPE_DRIVER_COMMAND_W

public static final java.lang.String RECTYPE_DRIVER_COMMAND_W
"CW" Record Type Constant

See Also:
Constant Field Values

RECTYPE_DRIVER_COMMAND_F

public static final java.lang.String RECTYPE_DRIVER_COMMAND_F
"CF" Record Type Constant

See Also:
Constant Field Values

RECTYPE_TEST_STEP

public static final java.lang.String RECTYPE_TEST_STEP
"T" Record Type Constant

See Also:
Constant Field Values

RECTYPE_TEST_STEP_W

public static final java.lang.String RECTYPE_TEST_STEP_W
"TW" Record Type Constant

See Also:
Constant Field Values

RECTYPE_TEST_STEP_F

public static final java.lang.String RECTYPE_TEST_STEP_F
"TF" Record Type Constant

See Also:
Constant Field Values

DEBUG_MESSAGE

protected static final int DEBUG_MESSAGE
Convenience for local referencing instead of referencing AbstractLogFacility.

See Also:
Constant Field Values

GENERIC_MESSAGE

protected static final int GENERIC_MESSAGE
Convenience for local referencing instead of referencing AbstractLogFacility.

See Also:
Constant Field Values

FAILED_MESSAGE

protected static final int FAILED_MESSAGE
Log MessageType for local referencing. Inherits AbstractLogFacility value.

See Also:
Constant Field Values

FAILED_OK_MESSAGE

protected static final int FAILED_OK_MESSAGE
Log MessageType for local referencing. Inherits AbstractLogFacility value.

See Also:
Constant Field Values

PASSED_MESSAGE

protected static final int PASSED_MESSAGE
Log MessageType for local referencing. Inherits AbstractLogFacility value.

See Also:
Constant Field Values

WARNING_MESSAGE

protected static final int WARNING_MESSAGE
Log MessageType for local referencing. Inherits AbstractLogFacility value.

See Also:
Constant Field Values

WARNING_OK_MESSAGE

protected static final int WARNING_OK_MESSAGE
Log MessageType for local referencing. Inherits AbstractLogFacility value.

See Also:
Constant Field Values

testRecordData

protected TestRecordHelper testRecordData

Purpose: holds the testRecordData info
Initialized: constructor


log

protected LogUtilities log

SAFS_RESBUN_NAME

public static final java.lang.String SAFS_RESBUN_NAME
See Also:
Constant Field Values

genericStr

protected static final java.lang.String genericStr
See Also:
Constant Field Values

passedStr

protected static final java.lang.String passedStr
See Also:
Constant Field Values

failedStr

protected static final java.lang.String failedStr
See Also:
Constant Field Values

warningStr

protected static final java.lang.String warningStr
See Also:
Constant Field Values

otherStr

protected static final java.lang.String otherStr
See Also:
Constant Field Values

customStr

protected static final java.lang.String customStr
See Also:
Constant Field Values

debugStr

protected static final java.lang.String debugStr
See Also:
Constant Field Values

genericText

protected static GetText genericText

passedText

protected static GetText passedText

failedText

protected static GetText failedText

warningText

protected static GetText warningText

otherText

protected static GetText otherText

customText

protected static GetText customText

debugText

protected static GetText debugText

params

protected java.util.Collection params

Purpose: the collection of params
Initialized: constructor


processorMap

protected java.util.Map processorMap
keeps instantiated processors for reuse


recordProcessed

protected boolean recordProcessed
Status for whether the processor processed the record, if the processor fails to support the record it has been given, then the processor should set this to false, so that any processor chain can continue to the next processor, if one is available.


secsWaitForWindow

protected static int secsWaitForWindow

secsWaitForComponent

protected static int secsWaitForComponent

commandLineBreakpoint

protected static boolean commandLineBreakpoint

testDomains

protected static java.lang.String testDomains

clearProxiesAlways

protected static boolean clearProxiesAlways

RFSMOnly

protected static boolean RFSMOnly

RFSMCache

protected static boolean RFSMCache

SAFS_PARAMS_FILE

public static final java.lang.String SAFS_PARAMS_FILE
"safsparams.dat"

See Also:
Constant Field Values

SAFS_CLEARPROXIESALWAYS_ITEM

public static final java.lang.String SAFS_CLEARPROXIESALWAYS_ITEM
"clearProxiesAlways"

See Also:
Constant Field Values

SAFS_TESTDOMAINS_ITEM

public static final java.lang.String SAFS_TESTDOMAINS_ITEM
"testDomains" Config setting should contain semi-colon delimited combinations of values: Java;Html;Net;Win

See Also:
Constant Field Values

SAFS_SECSWAITFORWINDOW_ITEM

public static final java.lang.String SAFS_SECSWAITFORWINDOW_ITEM
"secsWaitForWindow"

See Also:
Constant Field Values

SAFS_SECSWAITFORCOMPONENT_ITEM

public static final java.lang.String SAFS_SECSWAITFORCOMPONENT_ITEM
"secsWaitForComponent"

See Also:
Constant Field Values

SAFS_COMMANDLINEBREAKPOINT_ITEM

public static final java.lang.String SAFS_COMMANDLINEBREAKPOINT_ITEM
"commandLineBreakpoint"

See Also:
Constant Field Values

SAFS_SECSWAITFORWINDOW_VARIABLE

public static final java.lang.String SAFS_SECSWAITFORWINDOW_VARIABLE
"safs.secsWaitForWindow"

See Also:
Constant Field Values

SAFS_SECSWAITFORCOMPONENT_VARIABLE

public static final java.lang.String SAFS_SECSWAITFORCOMPONENT_VARIABLE
"safs.secsWaitForComponent"

See Also:
Constant Field Values

SAFS_COMMANDLINEBREAKPOINT_VARIABLE

public static final java.lang.String SAFS_COMMANDLINEBREAKPOINT_VARIABLE
"safs.commandLineBreakpoint"

See Also:
Constant Field Values

SAFS_TESTDOMAINS_VARIABLE

public static final java.lang.String SAFS_TESTDOMAINS_VARIABLE
"safs.testDomains"

See Also:
Constant Field Values

processorConfigSet

protected static boolean processorConfigSet

RFT_FIND_SEARCH_MODE_ALGORITHM

public static final java.lang.String RFT_FIND_SEARCH_MODE_ALGORITHM
"RFSMOnly"

See Also:
Constant Field Values

RFT_FIND_SEARCH_MODE_CACHE

public static final java.lang.String RFT_FIND_SEARCH_MODE_CACHE
"RFSMCache"

See Also:
Constant Field Values
Constructor Detail

Processor

public Processor()

Purpose: constructor

Method Detail

getClassInstance

protected Processor getClassInstance(java.lang.String classname)
Instance a given Processor from the provided classname.

Parameters:
classname - should not be null or 0 length
Returns:
Processor if the instanced object can be cast to org.safs.Processor; returns null if the object cannot be instanced or cast.

validProcessorClassName

protected boolean validProcessorClassName(java.lang.String classname)
Validate that a given classname is valid and assignable to org.safs.Processor


getProcClassNames

protected java.util.ArrayList getProcClassNames()
Attempts to locate a class for the current procInstancePath. For this superclass implementation, no additional information is appended to the procInstancePath data to attempt to locate a matching Processor class. The user can store a complete alternate classname with setProcInstancePath.

Subclasses should override this method to return additional classnames that are based off a root package name stored in procInstancePath.

Use validProcessorClassName before adding a classname to the list.

Returns:
a list of potential processor classnames to try.

getCustomProcClassNames

protected java.util.ArrayList getCustomProcClassNames()
Attempts to locate a class for the current customProcInstancePath. For this superclass implementation, no additional information is appended to the customProcInstancePath data to attempt to locate a matching Processor class. The user can store a complete alternate classname with setCustomProcInstancePath.

Subclasses, however, can also override this method to return specific classnames that are based off a root package name stored in customProcInstancePath.

Use validProcessorClassName before adding a classname to the list.

Returns:
valid String name for processor class or null if the stored path is not a valid class name. This usually means the stored path is to the package only.

getProcInstance

public Processor getProcInstance()
Return/Create an instance of the actual processor used to interpret test data. If we already have stored a procInstance object; that that will be returned. If all we have is a procInstancePath, then the routine will attempt to instance an object from that Path information. At this level, if no Processor can be instanced, then the subclass will need to override the getProcInstance method to provide the full functionality of instancing an appropriate test record processor. This will likely be different for each processor type.


setProcInstance

public void setProcInstance(Processor aprocessor)
Provide a Processor object to interpret test data.


hasChainedProcessor

public boolean hasChainedProcessor()
True if this processor has an instance of a chained processor to interpret test data if this one does not succeed in processing the data.

Since:
Jan 29, 2007 CANAGL

getChainedProcessor

public Processor getChainedProcessor()
Returns chained processor to interpret test data, if any. Can be null if no chainedProcessor has been set.

Since:
Jan 29, 2007 CANAGL

setChainedProcessor

public void setChainedProcessor(Processor aprocessor)
Set the instance of the chained processor to interpret test data if this one does not succeed in processing the data.

For example, we may store an org.safs.DriverCommandProcessor object to provide default handling of Driver Command records not overridden by some subclass.

Can be set to null to remove any existing chainedProcessor.

Since:
Jan 29, 2007 CANAGL

getProcInstancePath

public java.lang.String getProcInstancePath()
Return the current procInstancePath setting. It is possible for the procInstancePath setting to be overridden by a concrete subclass of TestRecordHelper.getCompInstancePath. Thus, the TestRecordHelper subclass must not provide a non-null value from that method if the user intends to specify alternative paths here.


setProcInstancePath

public void setProcInstancePath(java.lang.String pkgname)
Change the procInstancePath setting. This may be called by some subclasses to provide a full class name or a different package name for instancing a processor to interpret test data.


getCustomProcInstancePath

public java.lang.String getCustomProcInstancePath()
Return the current customProcInstancePath setting. It is possible for the this setting to be overridden by a concrete subclass of TestRecordHelper.getCompInstancePath. Thus, the TestRecordHelper subclass must not provide a non-null value from that method if the user intends to specify alternative paths here.


setCustomProcInstancePath

public void setCustomProcInstancePath(java.lang.String pkgname)
Change the procInstancePath setting. This may be called by some subclasses to provide a full class name or a different package name for instancing a processor to interpret test data.


setBreakpointsOn

public static void setBreakpointsOn(boolean enabled)
This may be set by any means. In a runtime debugging environment this will likely be set by a Driver Command. By default, breakpoints are enabled.


isBreakpointsOn

public static boolean isBreakpointsOn()
test if breakpoints is enabled.


checkBreakpoints

protected static void checkBreakpoints(java.lang.String breakpoint_message)
test for enabled breakpoints and active a breakpoint if enabled.


activateBreakpoint

protected static void activateBreakpoint(java.lang.String breakpoint_message)
Activate the SAFSBreakpointException breakpoint.


setMyBreakpointsOn

public void setMyBreakpointsOn(boolean enabled)
This may be set by any means. In a runtime debugging environment this will likely be set by a Driver Command or during construction. By default, these breakpoints are disabled.


isMyBreakpointsOn

public boolean isMyBreakpointsOn()
test if breakpoints is enabled.

Returns:
true if myBreakpoints on is true.

checkMyBreakpoints

protected void checkMyBreakpoints(java.lang.String breakpoint_message)
test for enabled breakpoints and active a breakpoint if enabled. Subclasses should override this method if they wish to add additional checks for enabled breakpoints.


getTestRecordData

public TestRecordHelper getTestRecordData()

setTestRecordData

public void setTestRecordData(TestRecordHelper testRecordData)

getLogUtilities

public LogUtilities getLogUtilities()

setLogUtilities

public void setLogUtilities(LogUtilities log)

getParams

public java.util.Collection getParams()

setParams

public void setParams(java.util.Collection params)

getAlternateParams

public java.util.Collection getAlternateParams()

isRecordProcessed

public boolean isRecordProcessed()

setRecordProcessed

public void setRecordProcessed(boolean processed)

instanceProcessorAndProcess

protected boolean instanceProcessorAndProcess(java.lang.String instanceName,
                                              java.util.Collection params)
Tries to instance a processor and then process a record. Given a processor class name, the routine attempts to first locate a processor that already may exist in the processorMap. If none is found, then the routine attempts to make an instance of the class. If successful, the instance is stored in the processorMap and forwarded to the initProcessorAndProcess .method for record processing.

Parameters:
aprocessor, - Processor
params, - Collection
Returns:
true if it processed the record, false otherwise

distributeConfigInformation

public void distributeConfigInformation()

initProcessorAndProcess

protected boolean initProcessorAndProcess(Processor aprocessor,
                                          java.util.Collection params)
Init the processor and process a record Initializes the processor by passing it the currently active LogUtilities, TestRecordHelper, and extracted record parameters. It then invokes the .process method of the Processor. This routine is normally called by other routines that first instance or retrieve the processor to init (like instanceProcessorAndProcess).

Parameters:
aprocessor, - Processor
params, - Collection
Returns:
true if it processed the record, false otherwise

delay

protected boolean delay(int millisec)

setVariable

protected boolean setVariable(java.lang.String var,
                              java.lang.String val)
                       throws SAFSException
Throws:
SAFSException

getVariable

protected java.lang.String getVariable(java.lang.String var)
                                throws SAFSException
Throws:
SAFSException

getAppMapItem

protected java.lang.String getAppMapItem(java.lang.String appMapID,
                                         java.lang.String section,
                                         java.lang.String item)

substituteVariable

public java.lang.String substituteVariable(java.lang.String str)

Purpose: if leading ^ found, then substitue variable. It will log a warning message, set statusCode to StatusCodes.GENERAL_SCRIPT_FAILURE and return null if variable not found.
*NOTE* According to the chief architect for the SAFS framework, an engine should not use this method in a driver command or a component function; therefore be careful about it's use. Maybe this method should be moved to StringUtils or some other place so that when and if a java 'controller' is developed, it can be utilized.

Parameters:
str, - String string to search for ^ at beginning
Returns:
str if no ^, or variable value, or null if not found

processSubclassProcessor

protected boolean processSubclassProcessor(java.util.Collection params)

processCustomProcessor

protected boolean processCustomProcessor(java.util.Collection params)

process

public void process()
The primary method that all subclasses must implement. The implementation here simply checks for any chainedProcessor,
invokes chainedProcessor.setParams(this.getParams()),
invokes chainedProcessor.process(),
invokes setRecordProcessed(chainedProcessor.isRecordProcessed()).

Thus, any subclassing Processor should attempt to process it's own commands and then invoke super.process() to try any chained Processor(s).

Otherwise, by default executes setRecordProcessed(false) if no chainedProcessor is present.

Since:
Jan27, 2007 CANAGL

isSupportedRecordType

public abstract boolean isSupportedRecordType(java.lang.String recordType)
Determine support for a particular record type.

Parameters:
recordType - -- String text of record type to match (ignoring case).
Returns:
'true' if the provided recordType is one this Processor can execute. Note, that SAFS record types are normally not case-sensitive. So the comparison to match the provided recordType should ignore case.


isDriverCommandRecord

public boolean isDriverCommandRecord(java.lang.String recordType)
Convenience routine for isSupportedRecordType to return true if the Processor supports standard Driver Command records.


isComponentFunctionRecord

public boolean isComponentFunctionRecord(java.lang.String recordType)
Convenience routine for isSupportedRecordType to return true if the Processor supports standard Component Function records.


isEngineCommandRecord

public boolean isEngineCommandRecord(java.lang.String recordType)
Convenience routine for isSupportedRecordType to return true if the Processor supports standard Engine Command records.


paramsFailedMsg

protected void paramsFailedMsg()
                        throws SAFSException

Purpose: log a FAILED_MESSAGE about the wrong number of parameters; this version is used by DriverCommands

Throws:
SAFSException

paramsFailedMsg

protected void paramsFailedMsg(java.lang.String windowName,
                               java.lang.String compName)
                        throws SAFSException

Purpose: log a FAILED_MESSAGE about the wrong number of parameters

Parameters:
windowName, - String
compName, - String
Throws:
SAFSException

validateParamSize

protected boolean validateParamSize(int minparams)
check if params.size() < minparams If params.size() is insufficient we set testRecordData.setStatusCode to GENERAL_SCRIPT_FAILURE and log a paramsFailedMsg and return 'false'. Otherwise, we simply return 'true'.

Parameters:
minparams - - minimum number of parameters required for processing
Returns:
true if minimum number of parameters exist

getRequiredField

protected boolean getRequiredField(int findex,
                                   java.lang.String fname,
                                   java.lang.String fvalue)
Retrieve a non-empty field value from the testRecordData inputrecord. If successful, fvalue will exit with the retrieved value. On failure, the routine will set testRecordData.setStatusCode to GENERAL_SCRIPT_FAILURE and log a 'bad_param' standardFailureMessage.

Parameters:
findex - - 0-based index of field to extract from input record.
fname - - field name to use in issuing any Invalid Parameter error messages.
fvalue - - String to receive the desired field value on success.
Returns:
true if fvalue was successfully set to a non-empty value. false if it was not and standard failure logging was performed.

getStandardErrorMessage

protected java.lang.String getStandardErrorMessage(java.lang.String failure)
Retrieve the standard "SOMETHING failure in filename FILENAME at line LINENUMBER" message. Expects testRecordData to already have filename and lineNumber.

Parameters:
failure - -- text to appear before the filname and line number info.

standardFailureMessage

protected void standardFailureMessage(java.lang.String failure,
                                      java.lang.String detail)
log the more standard FAILED_MESSAGE with detail. "SOMETHING failure in filename FILENAME at line LINENUMBER"
"DETAIL"
Expects testRecordData to already have filename and lineNumber.

Parameters:
failure - -- the failure text that precedes the 'failure in filename' message.
detail - -- the detail that will be used unmodified.

setSecsWaitForWindow

public static void setSecsWaitForWindow(int secs)

getSecsWaitForWindow

public static int getSecsWaitForWindow()

setSecsWaitForComponent

public static void setSecsWaitForComponent(int secs)

getSecsWaitForComponent

public static int getSecsWaitForComponent()

setCommandLineBreakpoint

public static void setCommandLineBreakpoint(boolean enabled)

setTestDomains

public static void setTestDomains(java.lang.String domains)

setClearProxiesAlways

public static void setClearProxiesAlways(boolean enabled)

getClearProxiesAlways

public static boolean getClearProxiesAlways()

setRFSMOnly

public static void setRFSMOnly(boolean enable)

isRFSMOnly

public static boolean isRFSMOnly()

setRFSMCache

public static void setRFSMCache(boolean enable)

isRFSMCache

public static boolean isRFSMCache()