public abstract class DriverConfiguredSTAFInterfaceClass extends java.lang.Object implements ConfigurableToolsInterface
It provides the generic tasks of registering with STAF using the Driver's name as the process name needed by STAF. It does this through the STAFProcessHelpers class so that all associated tools in the process can use the same process name.
Any attempt to launchInterface through this class will also trigger the verification that STAF is running. If it is not, the instance will attempt to launch STAF automatically. Configuration information can be provided via the ConfigureInterface as shown below. Default values will be used if not provided.
[STAF] PATH=Full path to/STAFProc (or bat, script, etc.) CONFIG=Full path to/yourCustom.CFG EMBEDSEM=TRUE
The provided finalizer will unRegister the instance with the STAFProcessHelpers class to retain proper reference counts in STAFProcessHelpers.
Modifier and Type | Field and Description |
---|---|
protected ConfigureInterface |
config
The ConfigurInterface extracted from the Driver for easy access.
|
protected static java.lang.String |
customStr
empty.
|
protected static GetText |
customText
GetText instance handling CUSTOM text resources.
|
protected static java.lang.String |
debugStr
empty.
|
protected static GetText |
debugText
GetText instance handling DEBUG text resources.
|
protected DriverInterface |
driver
The DriverInterface used for all configuration information.
|
static java.lang.String |
DRIVER_TEMP_PROCESS
"SAFS_DCSIC_PING".
|
protected static java.lang.String |
failedStr
"failed".
|
protected static GetText |
failedText
GetText instance handling FAILED text resources.
|
protected static java.lang.String |
genericStr
empty.
|
protected static GetText |
genericText
GetText instance handling GENERIC text resources.
|
protected long |
launchCount
Tracking how many launchInterface calls processed.
|
protected LogUtilities |
log
This LogUtilities is set for logging message if the DriverInterface can't
be initialized.
|
protected java.lang.String |
machine
The "where" of our associated STAF service for this instance.
|
protected static java.lang.String |
otherStr
empty.
|
protected static GetText |
otherText
GetText instance handling ?OTHER? text resources?
|
protected static java.lang.String |
passedStr
empty.
|
protected static GetText |
passedText
GetText instance handling PASSED text resources.
|
protected java.lang.String |
processName
The stored DriverName.
|
protected boolean |
running
true if the client was running or successfully launched.
|
static java.lang.String |
SAFS_RESBUN_NAME
"SAFSTextResourceBundle"
|
protected java.lang.String |
servicename
Storage for STAF service\client name
|
protected long |
shutdownCount
Track how many things must be shutdown before we can attempt to shutdown STAF.
|
protected STAFHelper |
staf
The STAFHelper retrieved from STAFProcessHelpers
during the call to launchInterface.
|
static java.lang.String |
STAFPROC_EXE
"STAFProc".
|
protected static java.lang.String |
warningStr
"failed".
|
protected static GetText |
warningText
GetText instance handling WARNING text resources.
|
protected boolean |
weStartedService
Flag to record whether the associated STAF service was started by this
instance (true); or if it was found already running (false).
|
protected static boolean |
weStartedSTAF
Flag to record whether this JVM (DRIVER) started STAF.
|
Constructor and Description |
---|
DriverConfiguredSTAFInterfaceClass()
Constructor for DriverConfiguredInterfaceClass
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
configureJSTAFServiceEmbeddedJVMOption(java.lang.String options)
Configure SAFS Services to use the embedded 32-bit JVM if:
|
protected void |
extendedGenericMessage(TestRecordData testRecordData,
java.lang.String note,
java.lang.String detail)
Log an extended GENERIC_MESSAGE including filename, linenumber, and detail.
|
protected void |
finalize()
finalize if we are ever destroyed without the JVM shutting down.
|
CoreInterface |
getCoreInterface()
Retrieve the instance of the CoreInterface used to communicate with the framework.
|
java.io.File |
getEmbedded64JVMBinPath()
See if SAFS has an embedded 64 bits JVM with it.
|
java.io.File |
getEmbeddedJVMBinPath()
See if SAFS has an embedded 32 bits JVM with it.
|
void |
getSTAFHelper()
Get our STAFProcessHelper.
|
boolean |
isToolRunning()
TRUE if the underlying tool is running.
|
void |
launchInterface(java.lang.Object configInfo)
Generic extraction of Driver, Config, and STAFHelper objects.
|
void |
logMessage(UniqueStringMessageInfo info)
This method will use try to use the LogUtilities to log message first.
|
void |
setLogUtilities(LogUtilities log)
If the driver can't be set, the log must be set for logging messages.
|
void |
setLogUtilities(LogUtilities log,
boolean copyLogClass)
This method is used to setup the LogUtilities and OPTIONALLY setup to copyLogClass.
|
void |
shutdown()
Each concrete subclass may override to provide their own specific
interface shutdown.
|
protected void |
shutdownService(java.lang.String aname)
Provides a default shutdown implementation for services.
|
protected void |
simpleGenericMessage(TestRecordData testRecordData,
java.lang.String note,
java.lang.String detail)
Log a simple GENERIC_MESSAGE with optional detail.
"your note" "your detail" note and detail should already be localized and will be sent unmodified. |
protected void |
simpleGenericSuccessMessage(TestRecordData testRecordData,
java.lang.String note,
java.lang.String detail)
Log a simple GENERIC_MESSAGE with detail.
|
protected void |
simpleGenericWarningMessage(TestRecordData testRecordData,
java.lang.String note)
Log a simple WARNING_MESSAGE with standard detail.
"your note" "[command] warning in table [filename] at line [linenumber]." note should already be localized. The routine will create the standard warning details. |
protected void |
simpleSuccessMessage(TestRecordData testRecordData,
java.lang.String note,
java.lang.String detail)
Log a simple PASSED_MESSAGE with detail.
|
protected void |
simpleSuccessMessage(TestRecordData testRecordData,
java.lang.String item,
java.lang.String action,
java.lang.String detail)
Log a simple PASSED_MESSAGE with detail.
|
protected void |
simpleSuccessUsingMessage(TestRecordData testRecordData,
java.lang.String note,
java.lang.String item,
java.lang.String detail)
Log a simple PASSED_MESSAGE with detail.
|
protected void |
standardErrorMessage(TestRecordData testRecordData,
java.lang.String problem,
java.lang.String detail)
Log a standard command FAILED_MESSAGE with detail.
|
protected void |
waitForServiceStartCompletion(int seconds) |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
reset
public static final java.lang.String DRIVER_TEMP_PROCESS
public static final java.lang.String STAFPROC_EXE
protected DriverInterface driver
protected LogUtilities log
protected java.lang.String processName
protected java.lang.String servicename
protected ConfigureInterface config
protected STAFHelper staf
protected boolean running
protected boolean weStartedService
protected static boolean weStartedSTAF
protected java.lang.String machine
protected long launchCount
protected long shutdownCount
public static final java.lang.String SAFS_RESBUN_NAME
protected static final java.lang.String genericStr
protected static final java.lang.String passedStr
protected static final java.lang.String failedStr
protected static final java.lang.String warningStr
protected static final java.lang.String otherStr
protected static final java.lang.String customStr
protected static final java.lang.String debugStr
protected static GetText genericText
protected static GetText passedText
protected static GetText failedText
protected static GetText warningText
protected static GetText otherText
protected static GetText customText
protected static GetText debugText
public DriverConfiguredSTAFInterfaceClass()
protected void waitForServiceStartCompletion(int seconds) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
public void setLogUtilities(LogUtilities log)
log
- public void setLogUtilities(LogUtilities log, boolean copyLogClass)
log
- copyLogClass
- set to true to copy everything to the debug log (Log.class)public void logMessage(UniqueStringMessageInfo info)
info
- protected void standardErrorMessage(TestRecordData testRecordData, java.lang.String problem, java.lang.String detail)
Expects testRecordData to already have filename and lineNumber.
protected void extendedGenericMessage(TestRecordData testRecordData, java.lang.String note, java.lang.String detail)
Expects testRecordData to already have filename and lineNumber.
protected void simpleSuccessMessage(TestRecordData testRecordData, java.lang.String note, java.lang.String detail)
Expects testRecordData to already have filename and lineNumber.
protected void simpleGenericSuccessMessage(TestRecordData testRecordData, java.lang.String note, java.lang.String detail)
protected void simpleGenericMessage(TestRecordData testRecordData, java.lang.String note, java.lang.String detail)
public CoreInterface getCoreInterface() throws java.lang.IllegalStateException
GenericToolsInterface
getCoreInterface
in interface GenericToolsInterface
java.lang.IllegalStateException
- if the CoreInterface is null, has not been initialized yet, or is otherwise invalid.protected void simpleGenericWarningMessage(TestRecordData testRecordData, java.lang.String note)
protected void simpleSuccessMessage(TestRecordData testRecordData, java.lang.String item, java.lang.String action, java.lang.String detail)
Expects testRecordData to already have filename and lineNumber.
protected void simpleSuccessUsingMessage(TestRecordData testRecordData, java.lang.String note, java.lang.String item, java.lang.String detail)
Expects testRecordData to already have filename and lineNumber.
public void getSTAFHelper()
If necessary, or desirable, the configuration source can specify the full path to an executable, and the path to any alternate configuration file desired. STAFProc will use its default configuration file if no other is specified.
[STAF] PATH=Full path to/STAFProc.EXE (or shell, bat, script, etc.) CONFIG=Full path to/yourCustom.CFG
java.lang.IllegalArgumentException
- if we are unable to return TRUE.public void launchInterface(java.lang.Object configInfo)
super.launchInterface(configInfo);
popuplates the driver, processName, config, and staf fields with valid objects. These items are properly unregistered/destroyed in the finalize() method.
launchInterface
in interface ConfigurableToolsInterface
configInfo
- can be whatever the final implementation needs it to be. This
might be a String with configuration information, the name of a class, or an instance
of some object used to provide configuration assets.ConfigurableToolsInterface.launchInterface(Object)
public java.io.File getEmbeddedJVMBinPath() throws java.io.FileNotFoundException
java.io.FileNotFoundException
- if we could not locate an embedded JVM Path.public java.io.File getEmbedded64JVMBinPath() throws java.io.FileNotFoundException
java.io.FileNotFoundException
- if we could not locate an embedded JVM Path.public java.lang.String configureJSTAFServiceEmbeddedJVMOption(java.lang.String options)
options
- already retrieved from config filesprotected void shutdownService(java.lang.String aname)
aname
- Generally the servicename or client name used in STAF.
Default values passed in are usually the same as the servicename field.public void shutdown()
This implementation checks to see if weStartedService=true. If so, it will attempt to shutdown the servicename through STAF.
This implementation will also see if weStartedSTAF=true. If so, then it will attempt to decrement shutdownCount. If shutdownCount reaches 0 then it will attempt to shutdown STAF.
shutdown
in interface GenericToolsInterface
GenericToolsInterface.shutdown()
public boolean isToolRunning()
GenericToolsInterface
isToolRunning
in interface GenericToolsInterface
GenericToolsInterface.isToolRunning()
protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
Copyright © SAS Institute. All Rights Reserved.