public class EmbeddedHookDriver extends JavaHook
Usage is expected to be:
It is important to note that the JVM arg -Dsafs.project.config is now optional. It is also possible to use -Dtestdesigner.project.config, or nothing. If neither is provided, the engine will look for a "test.ini" file in the startup working directory and also initially assume that might also be the Project Root directory.
Modifier and Type | Field and Description |
---|---|
(package private) EmbeddedHookDriver |
hook |
static java.lang.String |
HOOK_DRIVER_NAME |
(package private) java.lang.Thread |
hookThread |
(package private) JSAFSDriver |
jsafs |
static java.lang.String |
SAFS_PROJECT_CONFIG
"safs.project.config"
System Property identifying the path to an alternate project configuration file (other than safstid.ini in the default project configuration location. JVM command line: -Dsafs.project.config=string|path |
static java.lang.String |
TEST_INI_DEFAULT
"test.ini"
Default project's Configuration filename. |
static java.lang.String |
TESTDESIGNER_PROJECT_CONFIG
"testdesigner.project.config"
System Property identifying the path to an alternate project configuration file (other than safstid.ini in the default project configuration location. This property has a higher priority than SAFS_PROJECT_CONFIG , if both
of them are specified, then its value will be used.JVM command line: -Dtestdesigner.project.config=string|path |
data, DEBUG_MESSAGE, errorText, FAILED_MESSAGE, FAILED_OK_MESSAGE, GENERIC_ERROR, GENERIC_MESSAGE, helper, hookconfig, log, PASSED_MESSAGE, PAUSE_EXECUTION, PAUSE_SWITCH_OFF, PAUSE_SWITCH_ON, process_name, processor, REQUEST_PROCEED_TESTING, REQUEST_USER_STOPPED_SCRIPT_REQUEST, RUNNING_EXECUTION, semaphore_name, SHUTDOWN_RECORD, STAF_ERROR, STEP_EXECUTION, STEP_RETRY_EXECUTION, STEPPING_EXECUTION, STEPPING_RETRY_EXECUTION, trd_name, utils, WARNING_MESSAGE, WARNING_OK_MESSAGE
Constructor and Description |
---|
EmbeddedHookDriver()
Instantiates a default instance with a default "EmbeddedHookDriver" engine name.
|
EmbeddedHookDriver(java.lang.String engineName)
Instantiate an instance using the provided engineName.
|
EmbeddedHookDriver(java.lang.String engineName,
LogUtilities log)
Instantiate an instance using the provided engineName and LogUtilities
Calls initialize()
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
allowSystemExit()
Evaluate if the runtime hook should exit with System.exit(0).
|
protected ConfigureInterface |
config()
return the Configure object so that subclass can get data from configuration files.
|
protected long |
evaluateRuntimeException(java.lang.RuntimeException ex)
Evaluate if the runtime hook should shutdown or continue.
|
protected Processor |
getEngineDriverCommandProcessor()
Subclasses should instantiate an engine-specific DriverCommands Processor here.
|
protected Processor |
getEngineEngineCommandProcessor()
Subclasses should instantiate an engine-specific EngineCommandProcessor Processor here, if any.
|
protected Processor |
getEngineTestStepProcessor()
Subclasses should instantiate an engine-specific TestStepProcessor Processor here, if any.
|
DDGUIUtilities |
getGUIUtilities()
Subclasses should override this method to retrieve/create the DDGUIUtilities instance
needed by the specific engine subclass.
|
LogUtilities |
getLogUtilities()
Use this method to retrieve/create the current/default LogUtilities instance.
|
ProcessRequest |
getRequestProcessor()
This method to retrieve/create the current/default ProcessRequest instance.
|
TestRecordHelper |
getTRDData()
Retrieve the TestRecordHelper used by the subclass.
This will almost always be overridden by an engine-specific subclass. |
protected void |
initConfigPaths()
Override the superclass's method, try to use the existing Configuration of the embedded driver.
|
protected void |
initialize()
Called automatically by the 3 Constructors.
|
JSAFSDriver |
jsafs()
Return the embedded JSAFSDriver (for advanced users).
|
void |
run()
Called to initialize the EmbeddedDriver and make it ready for use.
|
void |
setHelper(java.lang.Object processhelper)
Set our STAFHelper to be the one provided.
|
protected void |
setProcessName(java.lang.String process_name)
Override superclass to delay STAFHelper initialization.
|
boolean |
shutdown()
Perform final engine hook shutdown activities AND shutdown the internal
JSAFSDriver.
|
void |
start()
Insert this SAFS Engine hook into the STAF system.
|
checkConfiguration, driverShutdownRequest, getHelper, getProcessName, getSemaphoreName, getTRDName, hook_shutdown, instantiateHookConfig, setGUIUtilities, setLogUtilities, setRequestProcessor, setSemaphoreName, setTRDData, setTRDName
public static final java.lang.String SAFS_PROJECT_CONFIG
public static final java.lang.String TESTDESIGNER_PROJECT_CONFIG
SAFS_PROJECT_CONFIG
, if both
of them are specified, then its value will be used.public static final java.lang.String TEST_INI_DEFAULT
JSAFSDriver jsafs
EmbeddedHookDriver hook
public static final java.lang.String HOOK_DRIVER_NAME
java.lang.Thread hookThread
public EmbeddedHookDriver()
JavaHook.JavaHook(String)
,
initialize()
public EmbeddedHookDriver(java.lang.String engineName)
engineName
- process_name to use for the driver/engine STAF connection.JavaHook.JavaHook(String)
,
initialize()
public EmbeddedHookDriver(java.lang.String engineName, LogUtilities log)
engineName
- process_name to use for the driver/engine STAF connection.LogUtilities
- to use.JavaHook.JavaHook(String, LogUtilities)
,
initialize()
protected void initialize()
sets the local hook field to the current hook driver instance and creates the internal JSAFSDriver instance.
setHelper(Object)
public JSAFSDriver jsafs()
protected ConfigureInterface config()
public TestRecordHelper getTRDData()
If no TestRecordHelper has been set (data == null), then the implementation is expected to instantiate and return a TestRecordHelper instance appropriate for the engine.
A newly instantiated TestRecordHelper should have critical helpers set:
getTRDData
in class JavaHook
public DDGUIUtilities getGUIUtilities()
A newly instantiated DDGUIUtilities should have critical helpers set:
Note that the call to getTRDData() may force the instantiation of the default TestRecordHelper if one has not already been set.
getGUIUtilities
in class JavaHook
JavaHook.getHelper()
,
getTRDData()
,
DCGUIUtilities
public LogUtilities getLogUtilities()
getLogUtilities
in class JavaHook
JavaHook.getLogUtilities()
,
org.safs.LogUtilities
protected Processor getEngineDriverCommandProcessor()
protected Processor getEngineTestStepProcessor()
protected Processor getEngineEngineCommandProcessor()
public ProcessRequest getRequestProcessor()
If the ProcessRequest has not been set this routine will instance a new org.safs.ProcessRequest and populate it with the LogUtilities via getLogUtilities(), a TestRecordHelper via getTRDData(), and all Processors.
Any newly created ProcessRequest instance will invoke:
and attempt to initialize all Processors with the getLogUtilities() and getTRDData() calls and then chain all Processors appropriately.
Note that the first call to getTRDData() may force the instantiation of the default TestRecordHelper for the subclass, if one has not already been set.
The first call to getLogUtilities() may also force the instantiation of the default LogUtilities, if one has not already been set.
getRequestProcessor
in class JavaHook
TestRecordHelper
,
getTRDData()
,
getLogUtilities()
,
org.safs.LogUtilities
,
getEngineDriverCommandProcessor()
,
getEngineTestStepProcessor()
,
getEngineEngineCommandProcessor()
protected void setProcessName(java.lang.String process_name)
setProcessName
in class JavaHook
public void setHelper(java.lang.Object processhelper)
The user can initialize both the process name and the STAFHelper by calling this routine with a valid process name String or STAFHelper.
If the current instance already has a defined process name, then any process name provided here is ignored and the STAFHelper is initialized with the existing value.
If the user provides a valid STAFHelper; then the process_name will be set to the name used to create the STAFHelper.
NOTE: This will automatically reset the semaphore_name to be the same as the process_name. This is the default mode of operation and should be OK for most applications. However, if the semaphore_name is to be different, then you must also call setSemaphoreName after this call.
protected void initConfigPaths()
public void start()
JavaHook
protected long evaluateRuntimeException(java.lang.RuntimeException ex)
evaluateRuntimeException
in class JavaHook
public void run()
Invokes:
org.safs.tools.drivers.JSAFSDriver#removeShutdownHook()
,
org.safs.tools.drivers.JSAFSDriver#validateRootConfigureParameters(boolean)
,
org.safs.tools.drivers.JSAFSDriver#validateLogParameters()
,
org.safs.tools.drivers.JSAFSDriver#initializeRuntimeInterface()
,
org.safs.tools.drivers.JSAFSDriver#initializePresetVariables()
,
org.safs.tools.drivers.JSAFSDriver#initializeMiscConfigInfo()
,
org.safs.tools.drivers.JSAFSDriver#initializeRuntimeEngines()
,
org.safs.tools.drivers.JSAFSDriver#openTestLogs()
,
org.safs.tools.drivers.JSAFSDriver#statuscounter
protected boolean allowSystemExit()
JavaHook
The default implementation will return true allowing the System.exit(0). Subclasses may wish to override this function to prevent the execution of System.exit(0) when this is not appropriate.
allowSystemExit
in class JavaHook
public boolean shutdown()
This default implementation unregisters our STAFProcessHelper if it is not null. Subclasses may wish to provide additional functionality before calling super.shutdown().
Copyright © SAS Institute. All Rights Reserved.