org.safs
Class DriverCommandProcessor

java.lang.Object
  extended by org.safs.Processor
      extended by org.safs.DriverCommandProcessor

public class DriverCommandProcessor
extends Processor


Purpose: DriverCommandProcessor
Lifetime: instantiated by ProcessRequest

Since:
JUN 14, 2003
JUN 14, 2003 (DBauman) Original Release
SEP 10, 2003 (CANAGL) Removed WARNING for "unknown driver command"
SEP 16, 2003 (CANAGL) Implemented use of new SAFSLOGS logging.
OCT 02, 2003 (DBAUMAN) Refactored to daisy-chain here, not in the instances.
NOV 10, 2003 (CANAGL) Added isSupportedRecordType() implementation.
NOV 13, 2003 (CANAGL) Added support for stored processors.
NOV 13, 2003 (DBauman/CANAGL) Added support for breakpoints.
NOV 19, 2003 (CANAGL) Additional refactoring.
FEB 04, 2004 (DBauman) Copy the status code to variable 'customStatusCode'.
FEB 12, 2004 (BNat) Added the Throwable catch block. This throwable catch block takes care of anything higher than Exceptions i.e. Error and Throwable.
FEB 04, 2010 (CANAGL) Added DCDriverFlowCommand support.

Field Summary
protected static boolean dcBreakpointsOn
          All DriverCommandProcessor instances may enable/disable and force breakpoints where they deem this appropriate.
protected  DriverCommand dcCustom
           
protected  DriverCommand dcData
           
protected  DriverCommand dcFile
           
protected  DriverCommand dcFlow
           
protected  DriverCommand dcMisc
           
protected  DriverCommand dcStrg
           
protected  DriverCommand dcTimer
           
static java.lang.String DEFAULT_DRIVER_COMMAND_CLASSNAME
          "DCDriverCommand" Short classname appended to alternative/custom package names.
protected  boolean standardDC
          True if the processor is suppose to use Standard Driver Command processors.
 
Fields inherited from class org.safs.Processor
breakpointsOn, CASE_INSENSITIVE_FLAG, CASEINSENSITIVE_FLAG, clearProxiesAlways, commandLineBreakpoint, customStr, customText, DEBUG_MESSAGE, debugStr, debugText, DEFAULT_CUSTOM_PROCESSOR_PACKAGE, DEFAULT_CUSTOM_PROCESSOR_SUBPACKAGE, DEFAULT_PROCESSOR_PACKAGE, FAILED_MESSAGE, FAILED_OK_MESSAGE, failedStr, failedText, FAILURE_DETAIL, GENERIC_MESSAGE, genericStr, genericText, LINE_FAILURE_4, log, myBreakpointsOn, otherStr, otherText, PARAM_SIZE_1, PARAM_SIZE_2, PARAM_SIZE_3, PARAM_SIZE_4, params, PASSED_MESSAGE, passedStr, passedText, PRE_TXT_SUCCESS_4, PRE_TXT_SUCCESS_5, processorConfigSet, processorMap, recordProcessed, RECTYPE_DRIVER_COMMAND, RECTYPE_DRIVER_COMMAND_F, RECTYPE_DRIVER_COMMAND_W, RECTYPE_TEST_STEP, RECTYPE_TEST_STEP_F, RECTYPE_TEST_STEP_W, RFSMCache, RFSMOnly, RFT_FIND_SEARCH_MODE_ALGORITHM, RFT_FIND_SEARCH_MODE_CACHE, SAFS_CLEARPROXIESALWAYS_ITEM, SAFS_COMMANDLINEBREAKPOINT_ITEM, SAFS_COMMANDLINEBREAKPOINT_VARIABLE, SAFS_PARAMS_FILE, SAFS_RESBUN_NAME, SAFS_SECSWAITFORCOMPONENT_ITEM, SAFS_SECSWAITFORCOMPONENT_VARIABLE, SAFS_SECSWAITFORWINDOW_ITEM, SAFS_SECSWAITFORWINDOW_VARIABLE, SAFS_TESTDOMAINS_ITEM, SAFS_TESTDOMAINS_VARIABLE, secsWaitForComponent, secsWaitForWindow, SENT_MSG_3, testDomains, testRecordData, TXT_FAILURE_1, TXT_FAILURE_2, TXT_FAILURE_3, TXT_FAILURE_4, TXT_FAILURE_5, TXT_SUCCESS_1, TXT_SUCCESS_2, TXT_SUCCESS_2a, TXT_SUCCESS_3, TXT_SUCCESS_3a, TXT_SUCCESS_4, TXT_SUCCESS_5, WARNING_MESSAGE, WARNING_OK_MESSAGE, warningStr, warningText
 
Constructor Summary
DriverCommandProcessor()
          
Purpose: constructor, calls super
 
Method Summary
protected  void checkMyBreakpoints(java.lang.String breakpoint_message)
          test for enabled DC-specific breakpoints in addition to the standard Processor breakpoints.
 java.util.ArrayList getCustomProcClassNames()
          Overrides Processor.getCustomProcClassName The routine returns a list of:
super.getCustomProcClassNames customProcInstancePath.DCDriverCommand customProcInstancePath.custom.DCDriverCommand
 java.util.ArrayList getProcClassNames()
          Overrides Processor.getProcClassNames The routine returns a list of:
super.getProcClassNames procInstancePath.DCDriverCommand
protected  boolean instantiateAndProcessDriverCommand(java.util.Collection params)
          
Purpose: instantiateAndProcessDriverCommand
Side Effects:
State Read: Processor.testRecordData
Assumptions: If it cannot process a local (org.safs) driver command, then
assumes that the driver command is DCDriverCommand with the path
taken from testRecordData.getCompInstancePath()
protected  java.util.Collection interpretFields()
          
Purpose: Interprets the fields of the driver command record and puts the appropriate values into the fields of testRecordData.
static boolean isDCBreakpointsOn()
          test if DC-specific breakpoints are enabled.
 boolean isStandardDriverCommandsEnabled()
           
 boolean isSupportedRecordType(java.lang.String recordType)
          Supports standard DRIVER COMMAND record types (C, CW, CF)
 void process()
          
Purpose: process: process the testRecordData
protected  boolean processStandardDriverCommands(java.util.Collection params)
           
static void setDCBreakpointsOn(boolean enabled)
          This may be set by any means.
 void setStandardDriverCommandsEnabled(boolean enabled)
           
 
Methods inherited from class org.safs.Processor
activateBreakpoint, checkBreakpoints, delay, distributeConfigInformation, getAlternateParams, getAppMapItem, getChainedProcessor, getClassInstance, getClearProxiesAlways, getCustomProcInstancePath, getLogUtilities, getParams, getProcInstance, getProcInstancePath, getRequiredField, getSecsWaitForComponent, getSecsWaitForWindow, getStandardErrorMessage, getTestRecordData, getVariable, hasChainedProcessor, initProcessorAndProcess, instanceProcessorAndProcess, isBreakpointsOn, isComponentFunctionRecord, isDriverCommandRecord, isEngineCommandRecord, isMyBreakpointsOn, isRecordProcessed, isRFSMCache, isRFSMOnly, paramsFailedMsg, paramsFailedMsg, processCustomProcessor, processSubclassProcessor, setBreakpointsOn, setChainedProcessor, setClearProxiesAlways, setCommandLineBreakpoint, setCustomProcInstancePath, setLogUtilities, setMyBreakpointsOn, setParams, setProcInstance, setProcInstancePath, setRecordProcessed, setRFSMCache, setRFSMOnly, setSecsWaitForComponent, setSecsWaitForWindow, setTestDomains, setTestRecordData, setVariable, standardFailureMessage, substituteVariable, validateParamSize, validProcessorClassName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_DRIVER_COMMAND_CLASSNAME

public static final java.lang.String DEFAULT_DRIVER_COMMAND_CLASSNAME
"DCDriverCommand" Short classname appended to alternative/custom package names. This is for dynamic instancing of DriverCommand processors.

See Also:
Constant Field Values

dcBreakpointsOn

protected static boolean dcBreakpointsOn
All DriverCommandProcessor instances may enable/disable and force breakpoints where they deem this appropriate. The static setting is shared by all DriverCommandProcessors. By default, DriverCommandProcessor breakpoints are disabled. However, a check is done for the global Processor.isBreakpoints enabled which overrides this setting. DriverCommand breakpoints can be enabled separately when all other global breakpoints are disabled.


standardDC

protected boolean standardDC
True if the processor is suppose to use Standard Driver Command processors. By default this is enabled.


dcMisc

protected DriverCommand dcMisc

dcFile

protected DriverCommand dcFile

dcData

protected DriverCommand dcData

dcStrg

protected DriverCommand dcStrg

dcFlow

protected DriverCommand dcFlow

dcCustom

protected DriverCommand dcCustom

dcTimer

protected DriverCommand dcTimer
Constructor Detail

DriverCommandProcessor

public DriverCommandProcessor()

Purpose: constructor, calls super

Method Detail

isSupportedRecordType

public boolean isSupportedRecordType(java.lang.String recordType)
Supports standard DRIVER COMMAND record types (C, CW, CF)

Specified by:
isSupportedRecordType in class Processor
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.


setDCBreakpointsOn

public static void setDCBreakpointsOn(boolean enabled)
This may be set by any means. In a runtime debugging environment this will likely be set by a Driver Command.


isDCBreakpointsOn

public static boolean isDCBreakpointsOn()
test if DC-specific breakpoints are enabled.

Returns:
true if dcBreakpointsOn is true.

checkMyBreakpoints

protected void checkMyBreakpoints(java.lang.String breakpoint_message)
test for enabled DC-specific breakpoints in addition to the standard Processor breakpoints. Overrides Process.checkMyBreakpoints.

Overrides:
checkMyBreakpoints in class Processor

setStandardDriverCommandsEnabled

public void setStandardDriverCommandsEnabled(boolean enabled)

isStandardDriverCommandsEnabled

public boolean isStandardDriverCommandsEnabled()

processStandardDriverCommands

protected boolean processStandardDriverCommands(java.util.Collection params)

getProcClassNames

public java.util.ArrayList getProcClassNames()
Overrides Processor.getProcClassNames The routine returns a list of:
super.getProcClassNames procInstancePath.DCDriverCommand

Use validProcessorClassName before adding class names to the list.

Overrides:
getProcClassNames in class Processor
Returns:
a list of potential processor classnames to try.

getCustomProcClassNames

public java.util.ArrayList getCustomProcClassNames()
Overrides Processor.getCustomProcClassName The routine returns a list of:
super.getCustomProcClassNames customProcInstancePath.DCDriverCommand customProcInstancePath.custom.DCDriverCommand

Use validProcessorClassName before adding class names to the list.

Overrides:
getCustomProcClassNames in class Processor
Returns:
a list of potential processor classnames to try.

process

public void process()

Purpose: process: process the testRecordData

At this point the Driver has determined we are dealing with a Driver Command Record.

Field #1: The record type (C).

Subsequent fields would be as follows (with a separator between each field):
Field: #2 #3 - N
============== ==============
COMMAND, [PARAMETER(S),]

COMMAND the driver command


Side Effects: Processor.testRecordData statusCode is set based on the result of the processing
State Read: Processor.testRecordData
Assumptions: an 'SAFSException' is caught here, and if so, the status code is set to StatusCodes.WRONG_NUM_FIELDS, which is the only error which should come from the interpretFields() method which we call. This only happens if we don't have the token (2)
Added by dbauman Feb, 2004 so that a variable remains for the next test with the status code. Copies the status code to variable 'customStatusCode'

Overrides:
process in class Processor

interpretFields

protected java.util.Collection interpretFields()
                                        throws SAFSException

Purpose: Interprets the fields of the driver command record and puts the appropriate values into the fields of testRecordData.
Side Effects: Processor.testRecordData fields are set from the inputRecord.
State Read: Processor.testRecordData, the inputRecord field
Assumptions: The following order:

Field #1: The DRIVER COMMAND record type (C).

Subsequent fields would be as follows (with a separator between each field):
Field: #2 #3 - N
============== ===============
COMMAND, [PARAMETER(S),]

Returns:
Collection of the parameter(s)
Throws:
SAFSException

instantiateAndProcessDriverCommand

protected boolean instantiateAndProcessDriverCommand(java.util.Collection params)
                                              throws SAFSException

Purpose: instantiateAndProcessDriverCommand
Side Effects:
State Read: Processor.testRecordData
Assumptions: If it cannot process a local (org.safs) driver command, then
assumes that the driver command is DCDriverCommand with the path
taken from testRecordData.getCompInstancePath()

for driver commands in different packages, we make use of a HashMap of commands already instantiated, and reuse them if possible, so that we do not have to incurr the cost of instantiating over and over again. field: '#commandMap'

Parameters:
params, - Collection
Returns:
boolean, status
Throws:
SAFSException