org.safs.model
Class AbstractCommand

java.lang.Object
  extended by org.safs.model.AbstractTestRecord
      extended by org.safs.model.AbstractCommand
All Implemented Interfaces:
TestRecordParametersInterface
Direct Known Subclasses:
Command, ComponentFunction

public abstract class AbstractCommand
extends AbstractTestRecord

Superclass of all command types of classes (versus test table types of classes). Keeps track of the command name and record type for the command.


Field Summary
 
Fields inherited from class org.safs.model.AbstractTestRecord
_parameters, BLOCKID_RECORD_TYPE, BREAKPOINT_RECORD_TYPE, COMPONENT_FUNCTION_FAILOK_RECORD_TYPE, COMPONENT_FUNCTION_RECORD_TYPE, COMPONENT_FUNCTION_WARNOK_RECORD_TYPE, DRIVER_COMMAND_FAILOK_RECORD_TYPE, DRIVER_COMMAND_RECORD_TYPE, DRIVER_COMMAND_WARNOK_RECORD_TYPE, EMPTY_PARAMETER, PROJECT_COMMAND_RECORD_TYPE, SKIPPED_RECORD_TYPE
 
Constructor Summary
protected AbstractCommand(java.lang.String commandName, java.lang.String testRecordID)
          Invoked from subclasses when instancing new commands.
 
Method Summary
protected  java.lang.StringBuffer appendCommandToTestRecord(java.lang.StringBuffer sb, java.lang.String fieldSeparator)
          Called by exportTestRecord() after the testRecordID() and a field separator have been appended to the StringBuffer.
 java.lang.String exportTestRecord(java.lang.String fieldSeparator)
          TestRecordExporter interface implementation.
 java.lang.String getCommandName()
          Returns the string name of the command.
 java.lang.String getTestRecordID()
          Returns the string record type for this command.
 
Methods inherited from class org.safs.model.AbstractTestRecord
addParameter, addParameters, appendParametersToTestRecord, getParameters
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractCommand

protected AbstractCommand(java.lang.String commandName,
                          java.lang.String testRecordID)
Invoked from subclasses when instancing new commands. Neither specified parameter can be null or zero-length.

Parameters:
commandName - -- the name of the command ("SetApplicationMap", etc.)
testRecordID - -- the record type of the command ("T", "C", etc.)
Throws:
java.lang.IllegalArgumentException - if specified parameters are null or zero-length
Method Detail

getCommandName

public java.lang.String getCommandName()
Returns the string name of the command.

Returns:
the name of this command

getTestRecordID

public java.lang.String getTestRecordID()
Returns the string record type for this command.

Returns:
the record type of this command

exportTestRecord

public java.lang.String exportTestRecord(java.lang.String fieldSeparator)
TestRecordExporter interface implementation. This routine will call appendCommandToTestRecord and appendParametersToTestRecord. Subclasses only need to override those as necessary, if at all. The routine does add the newline to complete the record just prior to returning the String to the caller.

Parameters:
fieldSeparator - used to delimit fields in test record
Returns:
String test record ready for export

appendCommandToTestRecord

protected java.lang.StringBuffer appendCommandToTestRecord(java.lang.StringBuffer sb,
                                                           java.lang.String fieldSeparator)
Called by exportTestRecord() after the testRecordID() and a field separator have been appended to the StringBuffer. The default implementation appends getCommandName() only with no additional separator. ComponentFunction, for example, needs to override in order to prepend the window name and component name in front of the command name.

Parameters:
sb - StringBuffer to append fields to
fieldSeparator - character to append in between fields
Returns:
sb StringBuffer appended as appropriate.