public class STAFHelper extends java.lang.Object implements CoreInterface
Modifier and Type | Field and Description |
---|---|
static boolean |
embedQUEUE |
static boolean |
embedSEM
Set to true to embed non-STAF SEM service.
|
static java.lang.String[] |
eventsToReset
The events need to be reset when hook shutdown.
|
static java.lang.reflect.Field |
getQueueMessageField |
static java.lang.String |
LOCAL_MACHINE
the normal "local" machine setting used by STAF
|
static boolean |
no_staf_handles
Set to true to bypass the registering of STAF Handles and STAF altogether.
|
static EmbeddedQueueService |
queue |
static java.lang.String |
ROBOTJ_EVENT_DISPATCH
"SAFS/RobotJDispatch"
|
static java.lang.String |
ROBOTJ_EVENT_DONE
"SAFS/RobotJDone"
|
static java.lang.String |
ROBOTJ_EVENT_READY
"SAFS/RobotJReady"
|
static java.lang.String |
ROBOTJ_EVENT_RESULTS
"SAFS/RobotJResults"
|
static java.lang.String |
ROBOTJ_EVENT_RUNNING
"SAFS/RobotJRunning"
|
static java.lang.String |
ROBOTJ_EVENT_SHUTDOWN
"SAFS/RobotJShutdown"
|
static java.lang.String |
ROBOTJ_EVENT_START
"SAFS/RobotJStart"
|
static java.lang.String |
SAFS_ABBOT_PROCESS
"SAFS/Abbot"
|
static java.lang.String |
SAFS_ABBOT_PROCESS_ID
"SAFS/AbbotID"
|
static java.lang.String |
SAFS_APPMAP_SERVICE
"SAFSMAPS"
|
static java.lang.String |
SAFS_CLASSIC_PROCESS
"SAFS/RobotClassic"
|
static java.lang.String |
SAFS_CLASSIC_PROCESS_ID
"SAFS/RobotClassicID"
|
static java.lang.String |
SAFS_CYCLE_TRD
"SAFS/CYCLE/" trd root
|
static java.lang.String |
SAFS_EVENT_DISPATCH
"Dispatch"
|
static java.lang.String |
SAFS_EVENT_DONE
"Done"
|
static java.lang.String |
SAFS_EVENT_READY
"Ready"
|
static java.lang.String |
SAFS_EVENT_RESULTS
"Results"
|
static java.lang.String |
SAFS_EVENT_RUNNING
"Running"
|
static java.lang.String |
SAFS_EVENT_SHUTDOWN
"Shutdown"
|
static java.lang.String |
SAFS_EVENT_START
"Start"
|
static java.lang.String |
SAFS_GENERIC_PROCESS
"SAFS/Process"
|
static java.lang.String |
SAFS_GENERIC_PROCESS_ID
"SAFS/ProcessID"
|
static java.lang.String |
SAFS_HOOK_TRD
"SAFS/HOOK/" trd root
|
static java.lang.String |
SAFS_HOOK_TRD_MUTEX
"SAFS/Hook/TRD",
Mutex for ALL applications and processes wishing to use SAFS/Hook/TRD data
|
static java.lang.String |
SAFS_INPUT_PROCESS
"SAFSInputService"
|
static java.lang.String |
SAFS_INPUT_SERVICE
"SAFSINPUT"
|
static java.lang.String |
SAFS_LOGGING_SERVICE
"SAFSLOGS"
|
static java.lang.String |
SAFS_LOGGINGLOG_SERVICE |
static java.lang.String |
SAFS_ROBOTJ_PROCESS
"SAFS/RobotJ"
|
static java.lang.String |
SAFS_ROBOTJ_PROCESS_ID
"SAFS/RobotJID"
|
static java.lang.String |
SAFS_SAFSLOGS_PROCESS
"STAF/Service/SAFSLOGS"
|
static java.lang.String |
SAFS_SAFSMAPS_PROCESS
"SAFSAppMapService"
|
static java.lang.String |
SAFS_SAFSVARS_PROCESS
"SAFSVariableService"
|
static java.lang.String |
SAFS_STEP_TRD
"SAFS/STEP/" trd root
|
static java.lang.String |
SAFS_SUITE_TRD
"SAFS/SUITE/" trd root
|
static java.lang.String |
SAFS_VAR_APPMAPNAME
".../appmapname"
|
static java.lang.String |
SAFS_VAR_BENCHDIRECTORY
7 initial preset variables
|
static java.lang.String |
SAFS_VAR_COMMANDLINEBREAKPOINT |
static java.lang.String |
SAFS_VAR_DATAPOOLDIRECTORY |
static java.lang.String |
SAFS_VAR_DIFDIRECTORY |
static java.lang.String |
SAFS_VAR_FAC
".../fac"
|
static java.lang.String |
SAFS_VAR_FILENAME
".../filename"
|
static java.lang.String |
SAFS_VAR_GLOBAL_LAST_LOG_DESC |
static java.lang.String |
SAFS_VAR_GLOBAL_LAST_LOG_MSG |
static java.lang.String |
SAFS_VAR_GLOBAL_LAST_LOG_TYPE |
static java.lang.String |
SAFS_VAR_INPUTRECORD
".../inputrecord"
|
static java.lang.String |
SAFS_VAR_LINENUMBER
".../linenumber"
|
static java.lang.String |
SAFS_VAR_LOGSDIRECTORY |
static java.lang.String |
SAFS_VAR_PROJECTDIRECTORY |
static java.lang.String |
SAFS_VAR_ROOTVERIFYDIRECTORY |
static java.lang.String |
SAFS_VAR_RUNTIMEREPOSITORY |
static java.lang.String |
SAFS_VAR_SAFSACTIVECYCLE |
static java.lang.String |
SAFS_VAR_SAFSACTIVESTEP |
static java.lang.String |
SAFS_VAR_SAFSACTIVESUITE |
static java.lang.String |
SAFS_VAR_SECSWAITFORCOMPONENT |
static java.lang.String |
SAFS_VAR_SECSWAITFORWINDOW |
static java.lang.String |
SAFS_VAR_SEPARATOR
".../separator"
|
static java.lang.String |
SAFS_VAR_STATUSCODE
".../statuscode"
|
static java.lang.String |
SAFS_VAR_STATUSINFO
".../statusinfo"
|
static java.lang.String |
SAFS_VAR_SYSTEMUSERID |
static java.lang.String |
SAFS_VAR_TESTDIRECTORY |
static java.lang.String |
SAFS_VAR_TESTLEVEL
".../testlevel"
|
static java.lang.String |
SAFS_VARIABLE_SERVICE
"SAFSVARS"
|
static EmbeddedSemService |
sem |
static java.lang.String |
STAF_DELAY_SERVICE |
static java.lang.String |
STAF_GLOBALVARS_VERSION |
static java.lang.String |
STAF_SERVICELOADER_V2
"STAF/Service/STAF/ServiceLoader"
|
static java.lang.String |
STAF_SERVICELOADER_V3
"STAF/Service/STAFServiceLoader"
|
static java.lang.String |
STAF_VARIABLE_SERVICE |
protected STAFHelperCompatibleInterface |
stafCompatible
Used to adjust the backward compatibility of STAF 2.6.11
Before using it, please check if it is null
|
static java.lang.Class |
STAFQueueMessageClass |
Constructor and Description |
---|
STAFHelper()
Purpose: constructor, must be 'initialized' by the user. |
STAFHelper(java.lang.String processName)
Purpose: constructor that also initializes with the given processName. |
Modifier and Type | Method and Description |
---|---|
com.ibm.staf.STAFResult |
addService(java.lang.String machine,
java.lang.String servicename,
java.lang.String classpath,
java.lang.String dir,
java.lang.String options)
add and launch standard SAFS services SAFSINPUT, SAFSMAPS and SAFSLOG
|
com.ibm.staf.STAFResult |
addServiceSAFSVARS(java.lang.String machine,
java.lang.String servicename,
java.lang.String classpath,
java.lang.String mapService,
java.lang.String options)
add and launch standard SAFS service, SAFSVARS.
|
static void |
configEmbeddedServices(ConfigureInterface config)
Evaluate [STAF] to determine if any or all Embeddable Services should be launched.
Currently only the EmbeddedSemService and EmbeddedQueue services are handled. |
boolean |
delay(int millisec)
Purpose: delay number of milliseconds Side Effects: uses STAF delay service Assumptions: STAF loaded |
java.lang.String |
getAppMapItem(java.lang.String appMapID,
java.lang.String section,
java.lang.String item)
Purpose: getitem from safsmaps using STAF format used: " getitem "+appMapID+" SECTION "+section+" Item "+item + ""; example: staf local safsmaps getitem "classicc" SECTION "LoginWindow" Item "OKButton" Side Effects: STAF is accessed (safsmaps service) State Read: field 'handle' Assumptions: we are using the SAFSMAPS SERVICE registered in STAF note that currently after each value there are quotes. |
java.lang.String |
getAppMapItem(java.lang.String appMapID,
java.lang.String section,
java.lang.String item,
boolean isDynamic)
Purpose: getitem from safsmaps using STAF, and check if the item has a static recognition string. |
java.util.Collection |
getAppMapNames()
Purpose: get collection of appmap names Assumptions: output of this command: staf local safsmaps list looks like: safsmaps:LIST:2 c:\cycletest\datapool\dealapp.map:C:\CycleTest\Datapool\DealApp.MAP deal:C:\CycleTest\Datapool\DealApp.map |
static java.lang.String |
getEventDispatchString(java.lang.String process_name) |
static java.lang.String |
getEventDoneString(java.lang.String process_name) |
static java.lang.String |
getEventReadyString(java.lang.String process_name) |
static java.lang.String |
getEventResultsString(java.lang.String process_name) |
static java.lang.String |
getEventRunningString(java.lang.String process_name) |
static java.lang.String |
getEventShutdownString(java.lang.String process_name) |
static java.lang.String |
getEventStartString(java.lang.String process_name) |
HandleInterface |
getHandle()
get the handle.
|
int |
getHandleNumber()
get the handle's number
|
java.lang.String |
getLogName() |
java.lang.String |
getMachine()
get the current value of 'machine'
|
java.lang.String |
getNextHookTestEvent(java.lang.String process_name,
java.lang.String trd_name)
Perform the complete engine-side protocol for processing a test record
dispatched from a driver.
|
java.lang.String |
getNextTestEvent()
Deprecated.
This is specific to IBM Rational Functional Tester
|
java.lang.String |
getProcessName()
the String name of the process/hook used at construction
|
java.lang.String |
getQueueMessage(java.lang.String name,
java.lang.Integer waitTime)
Purpose: get a queue message using STAF |
java.util.Collection |
getRunningEngineNames()
Use the embedded
stafCompatible to get all running engine names. |
void |
getSAFSTestRecordData(java.lang.String trd_root,
TestRecordData trd)
Get the SAFSVARS Test Record Data into the given trd_root.
|
java.util.List<java.lang.String> |
getServiceEvents(java.lang.String servicename)
Use the embedded
stafCompatible to get all events related to service name. |
java.lang.String |
getSTAFEnv(java.lang.String env)
getSTAFEnv
returns string value or an empty string.
|
java.lang.String |
getSTAFVariable(java.lang.String var)
Purpose: get the STAF SYSTEM variable value. |
int |
getSTAFVersion() |
static java.lang.String |
getSTAFVersionString(HandleInterface handle) |
java.lang.String |
getVariable(java.lang.String var)
Purpose: getVariable: get a variable from safsvars service |
void |
initialize(java.lang.String hookName)
Purpose: creates the STAFHandle |
boolean |
isInitialized()
have we been initialized (initialized, but not unRegistered)
|
boolean |
isOnlyShutdownPosted(java.lang.String servicename)
This method will check only the
SAFS_EVENT_SHUTDOWN is "posted"and other events in eventsToReset are "reset". |
boolean |
isSAFSINPUTAvailable()
Function isSAFSINPUTAvailable()
|
boolean |
isSAFSLOGSAvailable()
Function isSAFSLOGSAvailable()
|
boolean |
isSAFSMAPSAvailable()
Function isSAFSMAPSAvailable()
|
boolean |
isSAFSVARSAvailable()
Function isSAFSVARSAvailable()
|
boolean |
isServiceAvailable(java.lang.String servicename)
Queries the STAF SERVICE service to see if a particular service is
currently registered and running.
|
boolean |
isServiceLibraryRunning(java.lang.String libname)
Queries the STAF SERVICE service to see if a particular LIBRARY is already running.
|
boolean |
isToolAvailable(java.lang.String toolname)
Queries the STAF HANDLE service to see if a particular process name is
currently registered and running.
|
static java.lang.String |
lentagValue(java.lang.String val)
Purpose: return the value in STAF lentag format, :len:val |
java.lang.String |
localPing()
localPing to know if STAF has been initailized
|
com.ibm.staf.STAFResult |
localStartProcess(java.lang.String appname,
java.lang.String workdir)
start local STAF process to execute "STAF local PROCESS START COMMAND ...".
|
void |
logMessage(java.lang.String facname,
java.lang.String message)
Send a generic message to a running SAFSLOGS log.
If the optional facname is not provided, we will route the message to the first (or only) log reported as running in SAFSLOGS. |
void |
postEvent(java.lang.String event)
Purpose: post a single staf event (sem service) |
int |
postNextHookTestEvent(java.lang.String process_name,
java.lang.String trd_root,
TestRecordData trd)
Perform the complete driver-side protocol for dispatching an engine to process
a test record.
|
void |
pulseEvent(java.lang.String event)
Purpose: pulse a single staf event (sem service) |
void |
reinstateShutdownHook()
Only valid AFTER initialization.
|
void |
releaseSTAFMutex(java.lang.String mutex)
Function STAFreleaseMutex(String mutex)
|
com.ibm.staf.STAFResult |
removeService(java.lang.String machine,
java.lang.String service)
unload a STAF service
|
boolean |
removeShutdownHook()
Only valid AFTER initialization and the automatic registration of the SHUTDOWN_THREAD.
|
void |
resetEvent(java.lang.String event)
Purpose: reset a single staf event (sem service) |
protected void |
resetEvents()
Deprecated.
This is specific to IBM Rational Functional Tester
|
void |
resetHookEvents(java.lang.String process_name)
Reset staf hook events (ready, dispatch, running, results, done, shutdown) for the given process.
|
boolean |
sendQueueMessage(java.lang.String name,
java.lang.String message)
Purpose: send a queue message using STAF |
void |
setHookTestResults(java.lang.String process_name)
setHookTestResults:
makes call to 'setHookTestResultsWTimeout(process_name, 12);'
|
void |
setHookTestResultsWTimeout(java.lang.String process_name,
long timeoutseconds)
setHookTestResultsWTimeout:
makes call to 'postEvent(process_name + Results);'
This routines will drive the RESULTS event true.
|
void |
setLocalMachine()
reset the machine back to "local"
|
void |
setMachine(java.lang.String machine)
set the machine to the specified parameter
|
void |
setSAFSTestRecordData(java.lang.String trd_root,
TestRecordData trd)
Set the SAFSVARS Test Record Data for the given trd_root.
|
boolean |
setSTAFVariable(java.lang.String var,
java.lang.String val)
Purpose: set the STAF SYSTEM variable value. |
void |
setTestResults()
Deprecated.
IBM Rational Functional Tester specific
|
boolean |
setVariable(java.lang.String var,
java.lang.String val)
Purpose: setup a variable with it's value using STAF safsvars service. |
com.ibm.staf.STAFResult |
shutDown(java.lang.String machine)
shutDown STAF machine, Applies to STAF2.X and STAF3.X
|
static void |
shutdownEmbeddedServices()
Currently only the EmbeddedSemService is handled.
|
static void |
startEmbeddedQueueService()
Start the embedded Queue Service.
|
com.ibm.staf.STAFResult |
startProcess(java.lang.String machine,
java.lang.String appname,
java.lang.String workdir)
execute "STAF machine PROCESS START COMMAND ...".
|
java.lang.String |
submit(java.lang.String where,
java.lang.String name,
java.lang.String command)
Purpose: passed on to handle.submit |
protected com.ibm.staf.STAFResult |
submit2(java.lang.String where,
java.lang.String name,
java.lang.String command)
Purpose: passed on to handle.submit2 |
com.ibm.staf.STAFResult |
submit2ForFormatUnchangedService(java.lang.String where,
java.lang.String name,
java.lang.String command)
Purpose: passed on to handle.submit2 Used to call the services with unchangeable format. |
com.ibm.staf.STAFResult |
submit2WithVar(java.lang.String sysName,
java.lang.String srvName,
java.lang.String cmdName,
java.lang.String varName)
Purpose: submit to STAF and record varName.rc and varname.result into variable storage (SAFSVARS). |
void |
unRegister()
unregister, passed along to 'handle'
|
void |
waitEvent(java.lang.String event,
long delaySeconds)
staf event wait indefinitely or for a set number of seconds.
|
boolean |
waitEventMillis(java.lang.String event,
int delayMillis)
staf event wait for n milliseconds.
|
boolean |
waitEventWaiter(java.lang.String event,
long delaySeconds)
staf event wait indefinitely or for a set number of seconds for an event waiter.
|
void |
waitSTAFMutex(java.lang.String mutex,
long delaySeconds)
Function STAFwaitMutex(String mutex, long delaySeconds)
|
public static final java.lang.String STAF_DELAY_SERVICE
public static final java.lang.String STAF_GLOBALVARS_VERSION
public static final java.lang.String STAF_SERVICELOADER_V2
public static final java.lang.String STAF_SERVICELOADER_V3
public static final java.lang.String SAFS_SAFSVARS_PROCESS
public static final java.lang.String SAFS_SAFSMAPS_PROCESS
public static final java.lang.String SAFS_INPUT_PROCESS
public static final java.lang.String SAFS_SAFSLOGS_PROCESS
public static final java.lang.String SAFS_GENERIC_PROCESS
public static final java.lang.String SAFS_GENERIC_PROCESS_ID
public static final java.lang.String SAFS_ROBOTJ_PROCESS
public static final java.lang.String SAFS_ROBOTJ_PROCESS_ID
public static final java.lang.String SAFS_CLASSIC_PROCESS
public static final java.lang.String SAFS_CLASSIC_PROCESS_ID
public static final java.lang.String SAFS_ABBOT_PROCESS
public static final java.lang.String SAFS_ABBOT_PROCESS_ID
public static final java.lang.String SAFS_VARIABLE_SERVICE
public static final java.lang.String SAFS_APPMAP_SERVICE
public static final java.lang.String SAFS_LOGGING_SERVICE
public static final java.lang.String SAFS_LOGGINGLOG_SERVICE
public static final java.lang.String SAFS_INPUT_SERVICE
public static final java.lang.String STAF_VARIABLE_SERVICE
public static final java.lang.String SAFS_HOOK_TRD
public static final java.lang.String SAFS_CYCLE_TRD
public static final java.lang.String SAFS_SUITE_TRD
public static final java.lang.String SAFS_STEP_TRD
public static final java.lang.String SAFS_VAR_INPUTRECORD
public static final java.lang.String SAFS_VAR_STATUSCODE
public static final java.lang.String SAFS_VAR_STATUSINFO
public static final java.lang.String SAFS_VAR_FILENAME
public static final java.lang.String SAFS_VAR_LINENUMBER
public static final java.lang.String SAFS_VAR_SEPARATOR
public static final java.lang.String SAFS_VAR_FAC
public static final java.lang.String SAFS_VAR_TESTLEVEL
public static final java.lang.String SAFS_VAR_APPMAPNAME
public static final java.lang.String SAFS_VAR_BENCHDIRECTORY
public static final java.lang.String SAFS_VAR_DATAPOOLDIRECTORY
public static final java.lang.String SAFS_VAR_DIFDIRECTORY
public static final java.lang.String SAFS_VAR_LOGSDIRECTORY
public static final java.lang.String SAFS_VAR_PROJECTDIRECTORY
public static final java.lang.String SAFS_VAR_TESTDIRECTORY
public static final java.lang.String SAFS_VAR_SYSTEMUSERID
public static final java.lang.String SAFS_VAR_SECSWAITFORWINDOW
public static final java.lang.String SAFS_VAR_SECSWAITFORCOMPONENT
public static final java.lang.String SAFS_VAR_COMMANDLINEBREAKPOINT
public static final java.lang.String SAFS_VAR_SAFSACTIVECYCLE
public static final java.lang.String SAFS_VAR_SAFSACTIVESUITE
public static final java.lang.String SAFS_VAR_SAFSACTIVESTEP
public static final java.lang.String SAFS_VAR_ROOTVERIFYDIRECTORY
public static final java.lang.String SAFS_VAR_RUNTIMEREPOSITORY
public static final java.lang.String SAFS_VAR_GLOBAL_LAST_LOG_MSG
public static final java.lang.String SAFS_VAR_GLOBAL_LAST_LOG_DESC
public static final java.lang.String SAFS_VAR_GLOBAL_LAST_LOG_TYPE
public static final java.lang.String SAFS_HOOK_TRD_MUTEX
public static final java.lang.String ROBOTJ_EVENT_START
public static final java.lang.String ROBOTJ_EVENT_READY
public static final java.lang.String ROBOTJ_EVENT_DISPATCH
public static final java.lang.String ROBOTJ_EVENT_RUNNING
public static final java.lang.String ROBOTJ_EVENT_RESULTS
public static final java.lang.String ROBOTJ_EVENT_DONE
public static final java.lang.String ROBOTJ_EVENT_SHUTDOWN
public static final java.lang.String SAFS_EVENT_START
public static final java.lang.String SAFS_EVENT_READY
public static final java.lang.String SAFS_EVENT_DISPATCH
public static final java.lang.String SAFS_EVENT_RUNNING
public static final java.lang.String SAFS_EVENT_RESULTS
public static final java.lang.String SAFS_EVENT_DONE
public static final java.lang.String SAFS_EVENT_SHUTDOWN
public static boolean no_staf_handles
public static boolean embedSEM
public static boolean embedQUEUE
public static EmbeddedSemService sem
public static EmbeddedQueueService queue
public static final java.lang.String LOCAL_MACHINE
public static java.lang.Class STAFQueueMessageClass
public static java.lang.reflect.Field getQueueMessageField
protected STAFHelperCompatibleInterface stafCompatible
public static java.lang.String[] eventsToReset
public STAFHelper()
public STAFHelper(java.lang.String processName) throws SAFSSTAFRegistrationException
SAFSSTAFRegistrationException
public static void configEmbeddedServices(ConfigureInterface config)
We also will launch an Embedded Debug Log if the System properties or INI file are configured.
public static void startEmbeddedQueueService()
public static void shutdownEmbeddedServices()
public boolean removeShutdownHook()
public void reinstateShutdownHook()
public java.lang.String getProcessName()
getProcessName
in interface CoreInterface
public HandleInterface getHandle()
public int getHandleNumber()
public java.lang.String getMachine()
getMachine
in interface CoreInterface
public void setMachine(java.lang.String machine)
public void setLocalMachine()
public void initialize(java.lang.String hookName) throws SAFSSTAFRegistrationException
hookName,
- StringSAFSSTAFRegistrationException
- (wraps the message from STAFException)public boolean isInitialized()
isInitialized
in interface CoreInterface
public void unRegister() throws SAFSException
SAFSException
public com.ibm.staf.STAFResult submit2ForFormatUnchangedService(java.lang.String where, java.lang.String name, java.lang.String command)
where,
- Stringname,
- Stringcommand,
- Stringprotected com.ibm.staf.STAFResult submit2(java.lang.String where, java.lang.String name, java.lang.String command)
where,
- Stringname,
- Stringcommand,
- Stringpublic com.ibm.staf.STAFResult submit2WithVar(java.lang.String sysName, java.lang.String srvName, java.lang.String cmdName, java.lang.String varName) throws com.ibm.staf.STAFException, SAFSException
sysName,
- StringsrvName,
- StringcmdName,
- StringvarName,
- Stringcom.ibm.staf.STAFException
SAFSException
public java.lang.String submit(java.lang.String where, java.lang.String name, java.lang.String command) throws com.ibm.staf.STAFException
where,
- Stringname,
- Stringcommand,
- Stringcom.ibm.staf.STAFException
#getUnMarshallResult(String)}
,
#getUnMarshallStringResult(String)
public static java.lang.String lentagValue(java.lang.String val)
val,
- Stringpublic java.util.Collection getAppMapNames() throws SAFSException
getAppMapNames
in interface CoreInterface
SAFSException
public boolean isOnlyShutdownPosted(java.lang.String servicename) throws SAFSException
SAFS_EVENT_SHUTDOWN
is "posted"eventsToReset
are "reset".servicename
- SAFSException
public java.util.List<java.lang.String> getServiceEvents(java.lang.String servicename) throws SAFSException
stafCompatible
to get all events related to service name.servicename
- SAFSException
public java.util.Collection getRunningEngineNames() throws SAFSException
stafCompatible
to get all running engine names.SAFSException
public java.lang.String getLogName() throws SAFSException
getLogName
in interface CoreInterface
SAFSException
public java.lang.String getVariable(java.lang.String var) throws SAFSException
getVariable
in interface RuntimeDataInterface
var,
- String, name of variable to get value forSAFSException,
- if not okSAFSException
public void logMessage(java.lang.String facname, java.lang.String message) throws SAFSException
facname
- (Optional) Name of running log to receive message.
If facname is null or empty, we will send the message to the the first (or only)
log reported as running in SAFSLOGS.message
- to be sent to the log.SAFSException
- if there is a STAF submission error or response of any kind.public boolean setVariable(java.lang.String var, java.lang.String val) throws SAFSException
setVariable
in interface RuntimeDataInterface
var,
- String name of variableval,
- String value of variable (can be null or empty)SAFSException
- if var is invalidpublic java.lang.String getSTAFVariable(java.lang.String var) throws SAFSException
var:
- The name of a STAF SYSTEM variableSAFSException
public boolean setSTAFVariable(java.lang.String var, java.lang.String val) throws SAFSException
var:
- The name of a STAF SYSTEM variableval:
- The value to be set to the variableSAFSException
public boolean delay(int millisec)
millisec,
- intpublic java.lang.String getQueueMessage(java.lang.String name, java.lang.Integer waitTime) throws SAFSException
name,
- String , the string name of the queue, if null then omit name part from commandwaitTime,
- Integer, milliseconds to wait, if null, then omit from the get command; indefinate waitSAFSException,
- if timeout or errorSAFSException
public boolean sendQueueMessage(java.lang.String name, java.lang.String message)
name,
- String , the string name of the queuemessage,
- String, the message to send, it will be length tagged.public void pulseEvent(java.lang.String event) throws SAFSException
event,
- StringSAFSException
- if staf has a problempublic void postEvent(java.lang.String event) throws SAFSException
event,
- StringSAFSException
- if staf has a problempublic void resetEvent(java.lang.String event) throws SAFSException
event,
- StringSAFSException
- if staf has a problemprotected void resetEvents() throws SAFSException
SAFSException
- if staf has a problempublic void resetHookEvents(java.lang.String process_name) throws SAFSException
SAFSException
- if staf has a problempublic static java.lang.String getEventStartString(java.lang.String process_name)
public static java.lang.String getEventReadyString(java.lang.String process_name)
public static java.lang.String getEventDispatchString(java.lang.String process_name)
public static java.lang.String getEventRunningString(java.lang.String process_name)
public static java.lang.String getEventResultsString(java.lang.String process_name)
public static java.lang.String getEventDoneString(java.lang.String process_name)
public static java.lang.String getEventShutdownString(java.lang.String process_name)
public void waitEvent(java.lang.String event, long delaySeconds) throws SAFSException
event,
- StringdelaySeconds,
- long, if < 0, then no param used for wait
and the wait will be indefinite.SAFSException
- if staf has a problemwaitEventMillis(String, int)
public boolean waitEventWaiter(java.lang.String event, long delaySeconds) throws SAFSException
event,
- StringdelaySeconds,
- long, if < 0 then we will wait indefinitely (dangerous?).SAFSException
- if staf has a problempublic boolean waitEventMillis(java.lang.String event, int delayMillis) throws SAFSException
event,
- StringdelayMillis,
- int, if <=0 then 1 millis will be defaultedSAFSException
- if staf has a problemwaitEvent(String, long)
public java.lang.String getNextTestEvent() throws SAFSException
SAFSException
- if staf has a problempublic java.lang.String getNextHookTestEvent(java.lang.String process_name, java.lang.String trd_name) throws SAFSException
getNextHookTestEvent:
waitEvent "Dispatch";
resetEvent "Ready";
if(result.rc != 0) throw SAFSException;
result = postEvent "Running"
return getVariable(INPUTRECORD);
process_name
- -- the STAF-registered name of the engine involved.trd_name
- -- the TestRecordData SAFSVARS storage root, normally "SAFS/HOOK/".SAFSException
- if staf has a problempublic int postNextHookTestEvent(java.lang.String process_name, java.lang.String trd_root, TestRecordData trd) throws SAFSException
postNextHookTestEvent:
wait for process_name "Ready"
acquire SAFSVARS trd_root Mutex
set SAFSVARS test record data
"Dispatch" to specified process_name
waitFor "Results" event
retrieve the results from SAFSVARS test record data
pulse the "Done" event
release the SAFSVARS trd_root Mutex
if(result.rc != 0) throw SAFSException;
process_name
- -- the STAF-registered name of the engine to dispatch.trd_root
- -- the TestRecordData SAFSVARS storage root, normally "SAFS/HOOK/".trd
- -- the TestRecordData to place into SAFSVARS for execution by the engine.
SAFSException
- if staf has a problempublic void setSAFSTestRecordData(java.lang.String trd_root, TestRecordData trd) throws SAFSException
setSAFSTestRecordData
in interface CoreInterface
SAFSException
public void getSAFSTestRecordData(java.lang.String trd_root, TestRecordData trd) throws SAFSException
getSAFSTestRecordData
in interface CoreInterface
SAFSException
public void setTestResults() throws SAFSException
SAFSException
- if staf has a problempublic void setHookTestResults(java.lang.String process_name) throws SAFSException
SAFSException
- if staf has a problempublic void setHookTestResultsWTimeout(java.lang.String process_name, long timeoutseconds) throws SAFSException
SAFSException
- if staf has a problempublic java.lang.String getAppMapItem(java.lang.String appMapID, java.lang.String section, java.lang.String item)
getAppMapItem
in interface RuntimeDataInterface
appMapID,
- String (can be null or empty)section,
- String (can be null or empty)item,
- Stringpublic java.lang.String getAppMapItem(java.lang.String appMapID, java.lang.String section, java.lang.String item, boolean isDynamic)
appMapID,
- String (can be null or empty)section,
- String (can be null or empty)item,
- StringisDynamic,
- booleanpublic boolean isToolAvailable(java.lang.String toolname)
For example, the SAFSVARS service process name is "SAFSVariableService".
The routine will do a QUERY ALL on the HANDLE service and then evaluate if the requested tool appears anywhere in the returned list of named processes.
Note, because we do a substring search, we can match on just the most significant portion of the process name.
isToolAvailable
in interface CoreInterface
toolname
- -- The name of the process of interest. Check your documentation
to find the name normally registered by the tool of interest.
This can be just a substring of the full tool name.public boolean isServiceLibraryRunning(java.lang.String libname)
For example, the SAFSVARS service libary name "JSTAF".
The routine will do a LIST on the SERVICE service and then evaluate if the requested Library appears anywhere in the returned list of named services.
libname
- -- The name of the LIBRARY of interest. Check your documentation
to find the name normally registered for the library of interest.
This check is NOT case-sensitive.public boolean isServiceAvailable(java.lang.String servicename)
The routine will do a "LIST" on the SERVICE service and then evaluate if the requested service appears anywhere in the returned list of services.
Note, because we do a substring search, we can match on just the most significant portion of the service name.
isServiceAvailable
in interface CoreInterface
servicename
- unique substring of the service of interest. Check your documentation
to find the name normally registered by the service of interest.
This can be just a substring of the full service name.public boolean isSAFSVARSAvailable()
DESCRIPTION: Queries to see if the "SAFSVARS" service is currently running.
isSAFSVARSAvailable
in interface CoreInterface
public boolean isSAFSMAPSAvailable()
DESCRIPTION:
Queries to see if the "SAFSMAPS" service is running.
PARAMETERS:
(none)
RETURNS:
true or false
Orig Author: Carl Nagle
Orig Date: JUN 19, 2003
History:
JUN 19, 2003 Original Release
JUN 26, 2003 dbauman: ported to java
JUN 07, 2004 Carl Nagle: mod to use isServiceAvailable
isSAFSMAPSAvailable
in interface CoreInterface
public boolean isSAFSLOGSAvailable()
DESCRIPTION: Queries to see if the "SAFSLOGSLog" service is running. This service is launched and used by "SAFSLOGS" durings its initialization.
isSAFSLOGSAvailable
in interface CoreInterface
public boolean isSAFSINPUTAvailable()
DESCRIPTION:
Queries to see if the "SAFSINPUT" service is running.
PARAMETERS:
(none)
RETURNS:
true or false
Orig Author: Carl Nagle
Orig Date: JUN 17, 2004
History:
JUN 17, 2004 Original Release
isSAFSINPUTAvailable
in interface CoreInterface
public void waitSTAFMutex(java.lang.String mutex, long delaySeconds) throws SAFSException
DESCRIPTION: WAIT for a single STAF SEMaphore MUTEX
mutex
- the name of the mutexdelaySeconds
- the number of seconds to wait ( < 0 = wait indefinitely)SAFSException
- if STAFException is caught
public void releaseSTAFMutex(java.lang.String mutex) throws SAFSException
DESCRIPTION: RELEASE a single STAF SEMaphore MUTEX
mutex
- the name of the mutexSAFSException
- if STAFException is caught
public int getSTAFVersion()
public static java.lang.String getSTAFVersionString(HandleInterface handle)
public java.lang.String getSTAFEnv(java.lang.String env)
public java.lang.String localPing() throws com.ibm.staf.STAFException
com.ibm.staf.STAFException
public com.ibm.staf.STAFResult shutDown(java.lang.String machine)
public com.ibm.staf.STAFResult localStartProcess(java.lang.String appname, java.lang.String workdir) throws java.io.IOException
appname
- String, the name of application to runworkdir
- String, the directory serves as working directory for applicationjava.io.IOException
public com.ibm.staf.STAFResult startProcess(java.lang.String machine, java.lang.String appname, java.lang.String workdir) throws java.io.IOException
machine
- String, the name of the machine where the application will runappname
- String, the name of application to runworkdir
- String, the directory serves as working directory for applicationjava.io.IOException
public com.ibm.staf.STAFResult addService(java.lang.String machine, java.lang.String servicename, java.lang.String classpath, java.lang.String dir, java.lang.String options)
machine
- servicename,
- one of three services SAFSINPUT, SAFSMAPS and SAFSLOG.classpath
- dir
- options
- public com.ibm.staf.STAFResult addServiceSAFSVARS(java.lang.String machine, java.lang.String servicename, java.lang.String classpath, java.lang.String mapService, java.lang.String options)
machine
- servicename,
- SAFSVARS or user-defined service that follows the rule of SAFSVARS.classpath
- mapService
- options
- public com.ibm.staf.STAFResult removeService(java.lang.String machine, java.lang.String service)
machine,
- STAF machine nameservice,
- service nameCopyright © SAS Institute. All Rights Reserved.