|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.safs.staf.service.SAFSVariableService
public class SAFSVariableService
Copyright 2003 SAS Institute GNU General Public License (GPL) http://www.opensource.org/licenses/gpl-license.php
This SAFSVariablesService class is an external STAF service run by the JSTAF Service Proxy.
This acts as a SAFS-aware wrapper for the STAF Variables service.
In a true SAFS environment, Variables (DDVariables) are nearly always tightly integrated with the centralized AppMap service. This is because we allow the retrieval of Variable values to "look thru" to AppMap "constants". And we allow the AppMap to provide dynamic values via Variables for items that are otherwise normally static.
Thus, in a single request for a variable or AppMap value, the search can ping back and forth between Variable and AppMap services until the request is satisfied or we have exhausted the search chain.
Another important issue is that SAFS variables use a different syntax for identifying variables:
Lastly(?), the RESOLVE command will have to process the EXPRESSIONS supported by SAFS.
Oh, additionally, SAFS variable names are not case-sensitive.
The SAFSVariablesService service provides the following commands:
SAFSMAPS | Get/Set the associated AppMap service name |
HANDLEID | Return the handle used by this service |
SET | Set a variable value |
GET | Get a variable value |
LIST | Retrieves the list of all variables/values |
RESET | Reset and clear all storage--delete everything. |
RESOLVE | Resolve variables and expressions in a string. |
DELETE | Delete a variable |
COUNT | Return the count of variables currently stored |
HELP | Get HELP on command syntax. |
Each instance of the service must be registered via the STAF Service service.
Example showing comandline registration:
STAF LOCAL SERVICE ADD SERVICE <servicename> LIBRARY JSTAF / EXECUTE org/safs/staf/service/SAFSVariablesService [PARMS <Parameters>] SERVICE ADD SERVICE safsvars LIBRARY JSTAF EXECUTE org/safs/staf/service/SAFSVariablesService / PARMS SAFSMAPS "altMapService"
By default, the service expects a default "SAFSMAPS" SAFSAppMapService to handle AppMap calls.
1.1 Valid Parameters when registering the service:
1.1.1 SAFSMAPS <servicename>
The SAFSMAPS parameter specifies the name of the service that will provide
SAFS AppMap services to this Variables service. If not provided, the Variables service
expects a "SAFSMAPS" service to handle requests.
EX: <PARMS> SAFSMAPS "altMapService"
Get or Set the name of the SAFSMAPS service handling AppMap requests for variable resolution.
Syntax:
SAFSMAPS <no parameter> - returns the current SAFSMAPS setting.
SAFSMAPS <servicename> - sets an alternate AppMap service.
2.1.1 <servicename> is the name of an alternate SAFSAppMapService to associate for variables resolution. By default, thes "SAFSMAPS" service is used.
Returns the HANDLE associated with the SAFSVariableService.
Syntax:
HANDLEID
Sets the value of a SAFS variable.
Syntax:
SET <name> VALUE <value>
2.3.1 <name> the name of the variable to "set"
2.3.2 <value> the value to assign the variable
Returns the value of a SAFS variable.
Syntax:
GET <name>
2.4.1 <<name> the name of the variable to resolve
Delete a variable from storage.
Syntax:
DELETE <name>
2.5.1 <name> the name of the variable to delete
The LIST command returns info on each open AppMap for the service.
Syntax:
LIST
The COUNT command returns the count of variables currently stored.
Syntax:
COUNT
When implemented, this will reset (DELETE) all stored variables
Syntax:
RESET
This will resolve variable values and SAFS expressions in a multi-field, delimited string (a test record). Returns the input strings in a RC:STRING format. The RC is a numeric STAF return code -- hopefully 0 (Ok). Followed by a colon(:), then the actual processed test record.
Syntax:
RESOLVE <string> [SEPARATOR <char>] [NOEXPRESSIONS]
2.9.1 <string> the string (input record) to process for variables and expressions. Note, if the CARET (^) identifying a DDVariable cannot be sent intact the service will accept the string "_DDV_" in place of each intended CARET character and convert it internally before processing.
2.9.2 SEPARATOR <char> an optional single character to use as the field delimiter when processing the input string or record as separate fields, left to right.
2.9.3 NOEXPRESSIONS an optional value to indicate how the input record will have the variables and expressions processed. By default, Expressions are assumed ON. With NOEXPRESSIONS, the input record is handled in the older Substitute/Extract method: only the setting and getting of individual variable values occurs.
The HELP command returns this syntax information for service requests.
Syntax:
HELP
Software Automation Framework Support (SAFS) http://safsdev.sourceforge.net
Software Testing Automation Framework (STAF) http://staf.sourceforge.net
SAFSAppMapService
Field Summary | |
---|---|
protected static com.ibm.staf.STAFHandle |
client
|
protected static int |
clients
|
protected SafsExpression |
exp
|
protected com.ibm.staf.service.STAFCommandParser |
parser
|
protected boolean |
service_maps_available
|
protected java.lang.String |
servicemaps
|
protected java.lang.String |
servicename
|
protected java.lang.String |
serviceparms
|
static java.lang.String |
SVS_CARET
|
static java.lang.String |
SVS_FALSE_CARET
|
int |
SVS_SERVICE_INIT_ARGS_MAX
|
static java.lang.String |
SVS_SERVICE_PROCESS_NAME
|
int |
SVS_SERVICE_REQUEST_ARGS_MAX
|
static java.lang.String |
SVS_SERVICE_REQUEST_COUNT
|
static java.lang.String |
SVS_SERVICE_REQUEST_DELETE
|
static java.lang.String |
SVS_SERVICE_REQUEST_GET
|
static java.lang.String |
SVS_SERVICE_REQUEST_HANDLEID
|
static java.lang.String |
SVS_SERVICE_REQUEST_HELP
|
static java.lang.String |
SVS_SERVICE_REQUEST_LIST
|
static java.lang.String |
SVS_SERVICE_REQUEST_NOEXPRESSIONS
|
static java.lang.String |
SVS_SERVICE_REQUEST_RESET
|
static java.lang.String |
SVS_SERVICE_REQUEST_RESOLVE
|
static java.lang.String |
SVS_SERVICE_REQUEST_SAFSMAPS
|
static java.lang.String |
SVS_SERVICE_REQUEST_SEPARATOR
|
static java.lang.String |
SVS_SERVICE_REQUEST_SET
|
static java.lang.String |
SVS_SERVICE_REQUEST_VALUE
|
Constructor Summary | |
---|---|
SAFSVariableService()
Initialize the class, primarily, the parser used to parse service requests. |
Method Summary | |
---|---|
com.ibm.staf.STAFResult |
acceptRequest(java.lang.String machine,
java.lang.String process,
int handle,
java.lang.String request)
Handle service request from STAF |
protected java.lang.String |
getHELPInfo()
our HELP text |
java.lang.String |
getValue(java.lang.String varname)
Get the value of a named variable. |
int |
init(java.lang.String name,
java.lang.String params)
Handle initializing this instance of the service for STAF |
java.lang.String |
setValue(java.lang.String varname,
java.lang.String varvalue)
Set the value of a named variable. |
int |
term()
Handle the request to shutdown the service from STAF |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public int SVS_SERVICE_REQUEST_ARGS_MAX
public int SVS_SERVICE_INIT_ARGS_MAX
public static final java.lang.String SVS_SERVICE_PROCESS_NAME
public static final java.lang.String SVS_SERVICE_REQUEST_SAFSMAPS
public static final java.lang.String SVS_SERVICE_REQUEST_HANDLEID
public static final java.lang.String SVS_SERVICE_REQUEST_COUNT
public static final java.lang.String SVS_SERVICE_REQUEST_GET
public static final java.lang.String SVS_SERVICE_REQUEST_SET
public static final java.lang.String SVS_SERVICE_REQUEST_VALUE
public static final java.lang.String SVS_SERVICE_REQUEST_LIST
public static final java.lang.String SVS_SERVICE_REQUEST_RESET
public static final java.lang.String SVS_SERVICE_REQUEST_RESOLVE
public static final java.lang.String SVS_SERVICE_REQUEST_SEPARATOR
public static final java.lang.String SVS_SERVICE_REQUEST_NOEXPRESSIONS
public static final java.lang.String SVS_SERVICE_REQUEST_DELETE
public static final java.lang.String SVS_SERVICE_REQUEST_HELP
public static final java.lang.String SVS_CARET
public static final java.lang.String SVS_FALSE_CARET
protected com.ibm.staf.service.STAFCommandParser parser
protected java.lang.String servicemaps
protected java.lang.String servicename
protected java.lang.String serviceparms
protected boolean service_maps_available
protected static int clients
protected static com.ibm.staf.STAFHandle client
protected SafsExpression exp
Constructor Detail |
---|
public SAFSVariableService()
Method Detail |
---|
protected java.lang.String getHELPInfo()
public final int init(java.lang.String name, java.lang.String params)
init
in interface com.ibm.staf.service.STAFServiceInterfaceLevel1
public final java.lang.String getValue(java.lang.String varname)
SimpleVarsInterface
getValue
in interface SimpleVarsInterface
SimpleVarsInterface.getValue(String)
public final java.lang.String setValue(java.lang.String varname, java.lang.String varvalue)
SimpleVarsInterface
setValue
in interface SimpleVarsInterface
SimpleVarsInterface.setValue(String, String)
public final com.ibm.staf.STAFResult acceptRequest(java.lang.String machine, java.lang.String process, int handle, java.lang.String request)
acceptRequest
in interface com.ibm.staf.service.STAFServiceInterfaceLevel1
public final int term()
term
in interface com.ibm.staf.service.STAFServiceInterfaceLevel1
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |