org.safs.staf.service
Class SAFSFileReader

java.lang.Object
  extended by org.safs.staf.service.SAFSFileReader
All Implemented Interfaces:
com.ibm.staf.service.STAFServiceInterfaceLevel1
Direct Known Subclasses:
SAFSTextFileReader

public class SAFSFileReader
extends java.lang.Object
implements com.ibm.staf.service.STAFServiceInterfaceLevel1

Copyright 2003 SAS Institute GNU General Public License (GPL) http://www.opensource.org/licenses/gpl-license.php

This SAFSFileReader class is our base class for external STAF File reading services.
This service creates and maintains collections of SAFSFile objects. These represent open files.

The intention is to provide shared file services for opening files and sharing the file contents across the system. For example, one process can open the file, and then any number of other processes can read the contents.

The SAFSFileReader provides basic implementations for the following commands:

1.0 SAFSFileReader Service Registration

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/SAFSFileReader [PARMS <Parameters>]

 Other examples:

 SERVICE ADD SERVICE FileReader  LIBRARY JSTAF EXECUTE org/safs/staf/service/SAFSFileReader

 SERVICE ADD SERVICE StepReader  LIBRARY JSTAF EXECUTE org/safs/staf/service/SAFSFileReader PARMS DIR c:\repo\Datapool EXT ".sdd"

 SERVICE ADD SERVICE BenchReader LIBRARY JSTAF EXECUTE org/safs/staf/service/SAFSFileReader PARMS DIR "c:\new repo\Datapool\Bench"

 

1.1 Valid Parameters when registering a SAFSFileReader service:

1.1.1 DIR <default directory>
If provided, the DIR parameter specifies a default directory to use if the OPEN request provides relative path information or no path information at all. File searches will not use environment PATH information. The OPEN request expects a full filename path, or a path relative to this DIR option.

EX: PARMS DIR "c:\testrepo\Datapool"

If the DIR parameter is not provided, then OPEN requests will not attempt relative path searches. The filename provided to the OPEN request must then be an exact full filepath match or the OPEN request will fail.

1.1.2 EXT <default file extension>
If provided, the EXT parameter specifies a default file extension (suffix) to try if the OPEN request does not find the file as provided. You must include any period (.) if it is to be part of any appended suffix.

EX: PARMS EXT .txt

If the EXT parameter is not provided, then OPEN requests will not attempt the additional file search with the appended extension if the provided filename was not found. The filename provided to the OPEN request must then be an exact filename.ext match or the OPEN request will fail.

2.0 SAFSFileReader Commands

Note, there must be a uniquely qualified match for NAME/ID combinations listed below. If the same Process has opened two different files with the same ID from 2 different Handles, then you will have to use HANDLE, instead of NAME.

2.1 OPEN

The OPEN command attempts to open a file for read operations.

Syntax:

OPEN ID < FileID > FILE < Filename > /

2.1.1 ID is a unique name for this file handling instance.

2.1.2 FILE is the filename of the file to open.
If a default Directory was specified when the service was launched, then the filename can be relative to that directory. Otherwise, the full filepath must be specified.
If a default Extension (Ext) was specified when the service was launched, then the filename can be specified without the extension.

2.2 READL

The READL command simply returns the next line of text from the file.
No special processing or handling happens on the text. If we have reached the end of file, the request returns ":EOF:".

Syntax:

[ HANDLE < Handle > | NAME < Process > ] ID < FileID > READL

2.2.1 HANDLE specifies the handle of the process that OPENed the file. You can instead provide the NAME of the process that OPENed the file. If neither is provided then the Handle of the process that originated this request is assumed.

2.2.2 NAME specifies the name of the process that OPENed the file. You can instead provide the HANDLE of the process that OPENed the file. If neither is provided then the Handle of the process that originated this request is assumed.

2.2.3 ID is the unique fileID that was provided when the file was OPENed.

2.3 CLOSE

The CLOSE command closes and releases resources for the file.

Syntax:

[ HANDLE < Handle > | NAME < Process > ] ID < FileID > CLOSE

2.3.1 HANDLE specifies the handle of the process that OPENed the file. You can instead provide the NAME of the process that OPENed the file. If neither is provided then the Handle of the process that originated this request is assumed.

2.3.2 NAME specifies the name of the process that OPENed the file. You can instead provide the HANDLE of the process that OPENed the file. If neither is provided then the Handle of the process that originated this request is assumed.

2.3.3 ID is the unique fileID that was given provided when the file was OPENed.

2.3 QUERY

The QUERY command returns requested information about an open file.

Syntax:

[ HANDLE < Handle > | NAME < Process > ] ID < FileID > QUERY < STATUS | FILENAME | FULLPATH | LASTERROR >

2.3.1 HANDLE specifies the handle of the process that OPENed the file. You can instead provide the NAME of the process that OPENed the file. If neither is provided then the Handle of the process that originated this request is assumed.

2.3.2 NAME specifies the name of the process that OPENed the file. You can instead provide the HANDLE of the process that OPENed the file. If neither is provided then the Handle of the process that originated this request is assumed.

2.3.3 ID is the unique fileID that was given provided when the file was OPENed.

2.3.4 STATUS returns one of "OPEN", "CLOSED", or "EOF". If the "CLOSED" status is returned, that generally means some type of critical failure has occurred. A file that is at EOF is still open. However, this basic reader does not support moving the file pointer backwards. So, essentially, the object is not useful at this point.

2.3.5 FILENAME is the short filename of the file without any path information. Due to the OPEN parameters DIR and EXT, the filename of the file may be different than any relative path information that was provided to the OPEN command.

2.3.6 FULLPATH is the full path to the file. Due to the OPEN parameters DIR and EXT, the full path to the file may be different than any relative path information that was provided to the OPEN command.

2.3.7 LASTERROR is not yet implemented.

2.4 LIST

The LIST command returns info on each open file for the service.

Syntax:

[ HANDLE < Handle > | NAME < Process > ] LIST

2.4.1 HANDLE specifies the handle of the process to query. You can instead provide the NAME of the process to query. If neither is provided then the Handle of the process that originated this request is assumed.

2.4.2 NAME specifies the name of the process to query. You can instead provide the HANDLE of the process to query. If neither is provided then the Handle of the process that originated this request is assumed.

2.5 HELP

The HELP command returns syntax information for the SAFSFileReader service.

Syntax:

HELP

Software Automation Framework Support (SAFS) http://safsdev.sourceforge.net
Software Testing Automation Framework (STAF) http://staf.sourceforge.net


Field Summary
protected static java.lang.String c
          a single colon
protected  java.lang.String dir
           
protected  java.lang.String ext
           
protected  boolean file_extension_available
           
protected  com.ibm.staf.service.STAFCommandParser parser
           
protected static java.lang.String r
          a single newline
protected  boolean relative_path_allowed
           
protected static java.lang.String s
          a single space
protected static java.util.ResourceBundle safsfilereader_resources
           
protected  java.lang.String servicename
           
protected  java.lang.String serviceparams
           
static java.lang.String SFR_RBKEY_ERROR_NOT_INTEGER
           
static java.lang.String SFR_RBKEY_NOT_IMPLEMENTED
           
static java.lang.String SFR_RBKEY_OPEN_FILES
           
static java.lang.String SFR_RBKEY_REQUIRED
           
static java.lang.String SFR_RBKEY_SYNC_ERROR
           
static java.lang.String SFR_RBKEY_UCPATH
           
static java.lang.String SFR_SERVICE_FILE_STATE_CLOSED
           
static java.lang.String SFR_SERVICE_FILE_STATE_EOF
           
static java.lang.String SFR_SERVICE_FILE_STATE_ERROR
           
static java.lang.String SFR_SERVICE_FILE_STATE_OPEN
           
protected  int SFR_SERVICE_INIT_PARMS_MAX
          The maximum number of options/parameters we expect a service initialization request to receive.
static java.lang.String SFR_SERVICE_OPTION_DIR
           
static java.lang.String SFR_SERVICE_OPTION_EXT
           
static java.lang.String SFR_SERVICE_PARM_FILE
           
static java.lang.String SFR_SERVICE_PARM_FILENAME
           
static java.lang.String SFR_SERVICE_PARM_FULLPATH
           
static java.lang.String SFR_SERVICE_PARM_HANDLE
           
static java.lang.String SFR_SERVICE_PARM_ID
           
static java.lang.String SFR_SERVICE_PARM_LASTERROR
           
static java.lang.String SFR_SERVICE_PARM_NAME
           
static java.lang.String SFR_SERVICE_PARM_STATUS
           
protected  int SFR_SERVICE_REQUEST_ARGS_MAX
          The maximum number of options/parameters we expect a running service to receive in a request.
static java.lang.String SFR_SERVICE_REQUEST_CLOSE
           
static java.lang.String SFR_SERVICE_REQUEST_HELP
           
static java.lang.String SFR_SERVICE_REQUEST_LIST
           
static java.lang.String SFR_SERVICE_REQUEST_OPEN
           
static java.lang.String SFR_SERVICE_REQUEST_QUERY
           
static java.lang.String SFR_SERVICE_REQUEST_READL
           
static java.lang.String SFR_SERVICE_SAFSFILE_BUNDLE_NAME
          The fully qualified name of the localizable ResourceBundle for this class.
protected  java.lang.String SFR_SERVICE_SAFSFILE_LISTINFO
          The text substring identifying the file type in each file LIST response.
 
Constructor Summary
SAFSFileReader()
          The constructor used by the SAFSFileReader.
 
Method Summary
 com.ibm.staf.STAFResult acceptRequest(java.lang.String machine, java.lang.String process, int handle, java.lang.String request)
           
protected  void addBaseCommandOptionGroups(com.ibm.staf.service.STAFCommandParser aparser)
           
protected  void addBaseCommandOptionNeeds(com.ibm.staf.service.STAFCommandParser aparser)
           
protected  void addBaseCommandOptions(com.ibm.staf.service.STAFCommandParser aparser)
           
protected  void addBaseServiceInitOptions(com.ibm.staf.service.STAFCommandParser registrar)
           
protected  void addCommandOptionGroups(com.ibm.staf.service.STAFCommandParser aparser)
          Add command option groups as needed.
protected  void addCommandOptionNeeds(com.ibm.staf.service.STAFCommandParser aparser)
          Add command option "requirements.
protected  void addCommandOptions(com.ibm.staf.service.STAFCommandParser aparser)
          Add your own command options in the STAFCommandParser.
protected  void addServiceInitOptions(com.ibm.staf.service.STAFCommandParser registrar)
          Add your initialization options for your service.
protected  void buildBaseCommandList(com.ibm.staf.service.STAFCommandParser aparser)
           
protected  void buildBaseQueryCommandList(com.ibm.staf.service.STAFCommandParser aparser)
           
protected  java.lang.String buildCommandList(java.lang.String requestoptions)
          Add your primary command options to the list of mutually exclusive commands.
protected  java.lang.String buildHELPInfo()
           
protected  java.lang.String buildQueryCommandList(java.lang.String queryoptions)
          Like primary commands, the QUERY command has a list of mutually exclusive options.
protected  java.lang.String getHELPInfo(java.lang.String info)
          Add your HELP text response here.
protected  java.lang.String getLISTInfo()
          Override this function and return your version of SFR_SERVICE_SAFSFILE_LISTINFO.
protected  java.lang.String getOPENInfo(com.ibm.staf.service.STAFCommandParseResult parsedData, java.lang.String info)
          Handle any added OPEN options here.
protected  SAFSFile getParsedDataTextFile(com.ibm.staf.STAFResult result, int handle, java.lang.String fileid, com.ibm.staf.service.STAFCommandParseResult parsedData)
           
protected  java.lang.String getQUERYInfo(SAFSFile textfile, com.ibm.staf.service.STAFCommandParseResult parsedData, java.lang.String info)
          Handle any added QUERY options here.
protected  java.lang.String getSTATUSInfo(SAFSFile textfile, java.lang.String info)
          Provide STATUS information for the QUERY STATUS command.
 int init(java.lang.String name, java.lang.String params)
           
protected  SAFSFile openFile(java.lang.String machine, java.lang.String process, int handle, java.lang.String fileid, java.io.File file, com.ibm.staf.service.STAFCommandParseResult parsedData)
          A subclass must override this function to instantiate its own file type.
protected  com.ibm.staf.STAFResult processRequest(com.ibm.staf.STAFResult result, java.lang.String machine, java.lang.String process, int handle, com.ibm.staf.service.STAFCommandParseResult parseData)
          A subclass must override this function to handle requests not handled by the superclass.
protected  void removeParsedDataTextFile(com.ibm.staf.STAFResult result, java.lang.String myprocess, int handle, java.lang.String fileid, com.ibm.staf.service.STAFCommandParseResult parsedData)
           
protected  int shutdown()
          perform final termination cleanup operations for your service.
 int term()
           
 java.lang.String text(java.lang.String resourcekey)
          Retrieves potentially localized text from the resource bundle Localized subclasses should provide a similar function or override this function.
protected  int validateBaseServiceParseResult(com.ibm.staf.service.STAFCommandParseResult parsedData)
           
protected  int validateServiceParseResult(com.ibm.staf.service.STAFCommandParseResult parsedData)
          Use to validate the Service initialization string after a request for initialization has beenr received.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SFR_SERVICE_SAFSFILE_LISTINFO

protected java.lang.String SFR_SERVICE_SAFSFILE_LISTINFO
The text substring identifying the file type in each file LIST response. Subclasses are expected to override this value for differing file types.


SFR_SERVICE_SAFSFILE_BUNDLE_NAME

public static final java.lang.String SFR_SERVICE_SAFSFILE_BUNDLE_NAME
The fully qualified name of the localizable ResourceBundle for this class. Subclasses are expected to provide their own additional ResourceBundle handling file and subroutine when appropriate.

See Also:
Constant Field Values

SFR_SERVICE_INIT_PARMS_MAX

protected int SFR_SERVICE_INIT_PARMS_MAX
The maximum number of options/parameters we expect a service initialization request to receive. Subclasses are expected to override this value when appropriate.


SFR_SERVICE_REQUEST_ARGS_MAX

protected int SFR_SERVICE_REQUEST_ARGS_MAX
The maximum number of options/parameters we expect a running service to receive in a request. Subclasses are expected to override this value when appropriate.


safsfilereader_resources

protected static java.util.ResourceBundle safsfilereader_resources

SFR_RBKEY_NOT_IMPLEMENTED

public static final java.lang.String SFR_RBKEY_NOT_IMPLEMENTED
See Also:
Constant Field Values

SFR_RBKEY_OPEN_FILES

public static final java.lang.String SFR_RBKEY_OPEN_FILES
See Also:
Constant Field Values

SFR_RBKEY_UCPATH

public static final java.lang.String SFR_RBKEY_UCPATH
See Also:
Constant Field Values

SFR_RBKEY_SYNC_ERROR

public static final java.lang.String SFR_RBKEY_SYNC_ERROR
See Also:
Constant Field Values

SFR_RBKEY_REQUIRED

public static final java.lang.String SFR_RBKEY_REQUIRED
See Also:
Constant Field Values

SFR_RBKEY_ERROR_NOT_INTEGER

public static final java.lang.String SFR_RBKEY_ERROR_NOT_INTEGER
See Also:
Constant Field Values

SFR_SERVICE_OPTION_DIR

public static final java.lang.String SFR_SERVICE_OPTION_DIR
See Also:
Constant Field Values

SFR_SERVICE_OPTION_EXT

public static final java.lang.String SFR_SERVICE_OPTION_EXT
See Also:
Constant Field Values

SFR_SERVICE_REQUEST_OPEN

public static final java.lang.String SFR_SERVICE_REQUEST_OPEN
See Also:
Constant Field Values

SFR_SERVICE_REQUEST_READL

public static final java.lang.String SFR_SERVICE_REQUEST_READL
See Also:
Constant Field Values

SFR_SERVICE_REQUEST_QUERY

public static final java.lang.String SFR_SERVICE_REQUEST_QUERY
See Also:
Constant Field Values

SFR_SERVICE_REQUEST_CLOSE

public static final java.lang.String SFR_SERVICE_REQUEST_CLOSE
See Also:
Constant Field Values

SFR_SERVICE_REQUEST_LIST

public static final java.lang.String SFR_SERVICE_REQUEST_LIST
See Also:
Constant Field Values

SFR_SERVICE_REQUEST_HELP

public static final java.lang.String SFR_SERVICE_REQUEST_HELP
See Also:
Constant Field Values

SFR_SERVICE_PARM_HANDLE

public static final java.lang.String SFR_SERVICE_PARM_HANDLE
See Also:
Constant Field Values

SFR_SERVICE_PARM_NAME

public static final java.lang.String SFR_SERVICE_PARM_NAME
See Also:
Constant Field Values

SFR_SERVICE_PARM_ID

public static final java.lang.String SFR_SERVICE_PARM_ID
See Also:
Constant Field Values

SFR_SERVICE_PARM_FILE

public static final java.lang.String SFR_SERVICE_PARM_FILE
See Also:
Constant Field Values

SFR_SERVICE_PARM_STATUS

public static final java.lang.String SFR_SERVICE_PARM_STATUS
See Also:
Constant Field Values

SFR_SERVICE_PARM_FILENAME

public static final java.lang.String SFR_SERVICE_PARM_FILENAME
See Also:
Constant Field Values

SFR_SERVICE_PARM_FULLPATH

public static final java.lang.String SFR_SERVICE_PARM_FULLPATH
See Also:
Constant Field Values

SFR_SERVICE_PARM_LASTERROR

public static final java.lang.String SFR_SERVICE_PARM_LASTERROR
See Also:
Constant Field Values

SFR_SERVICE_FILE_STATE_OPEN

public static final java.lang.String SFR_SERVICE_FILE_STATE_OPEN
See Also:
Constant Field Values

SFR_SERVICE_FILE_STATE_CLOSED

public static final java.lang.String SFR_SERVICE_FILE_STATE_CLOSED
See Also:
Constant Field Values

SFR_SERVICE_FILE_STATE_EOF

public static final java.lang.String SFR_SERVICE_FILE_STATE_EOF
See Also:
Constant Field Values

SFR_SERVICE_FILE_STATE_ERROR

public static final java.lang.String SFR_SERVICE_FILE_STATE_ERROR
See Also:
Constant Field Values

parser

protected com.ibm.staf.service.STAFCommandParser parser

servicename

protected java.lang.String servicename

serviceparams

protected java.lang.String serviceparams

relative_path_allowed

protected boolean relative_path_allowed

file_extension_available

protected boolean file_extension_available

dir

protected java.lang.String dir

ext

protected java.lang.String ext

c

protected static java.lang.String c
a single colon


s

protected static java.lang.String s
a single space


r

protected static java.lang.String r
a single newline

Constructor Detail

SAFSFileReader

public SAFSFileReader()
The constructor used by the SAFSFileReader. All subclasses MUST invoke this constructor prior to completing their initialization.
Invoke this constructor from the subclass with:

    super();

This constructor will initialize the STAFCommandParser that will be used for all requests sent to the service.

Method Detail

text

public java.lang.String text(java.lang.String resourcekey)
Retrieves potentially localized text from the resource bundle Localized subclasses should provide a similar function or override this function. If the subclass function fails to locate the message in the subclass's ResourceBundle, then the subclass should call the superclass function to look there.

    text = super.text(resourceKey);

Parameters:
resourceKey - the key name of the message to retrieve.

Returns:
the localized text or a localization error string

addCommandOptions

protected void addCommandOptions(com.ibm.staf.service.STAFCommandParser aparser)
Add your own command options in the STAFCommandParser. The format of the call is the OPTION string, the maximum times it can appear in a single request, and whether it is standalone, or whether an associated option value is required, or optional.

    aparser.addOption(A_COMMAND_CONSTANT, 1, STAFCommandParser.VALUENOTALLOWED);
    aparser.addOption(A_COMMAND_CONSTANT, 2, STAFCommandParser.VALUEALLOWED);
    aparser.addOption(A_COMMAND_OPTION, 1, STAFCommandParser.VALUEREQUIRED);
    aparser.addOption(A_COMMAND_OPTION, 9, STAFCommandParser.VALUEALLOWED);
    super.addCommandOptions( aparser );

Parameters:
aparser - the instance of the parser that will handle requests.

buildCommandList

protected java.lang.String buildCommandList(java.lang.String requestoptions)
Add your primary command options to the list of mutually exclusive commands. You must feed these up the superclass chain to enable all superclass commands, too.

    requestoptions += s+ COMMAND1 +s+ COMMAND2 +s+ COMMAND3 +s;
    return super.buildCommandList( requestoptions );

Parameters:
requestoptions - the space-delimited list of commands

addCommandOptionGroups

protected void addCommandOptionGroups(com.ibm.staf.service.STAFCommandParser aparser)
Add command option groups as needed. These are often command keywords that are optional--grouped as one, or the other, but only a certain number (or 1) of the options is valid for any given command.

    options = THIS_ONE +s+ THAT_ONE +s+ ANOTHER_ONE;
    aparser.addOptionGroups( options, 0,1 );
    super.addCommandOptionGroups( aparser );

The example shows 3 options, only one may be specified at a time, none are required.

Parameters:
aparser - the parser instance that will process incoming requests.

addCommandOptionNeeds

protected void addCommandOptionNeeds(com.ibm.staf.service.STAFCommandParser aparser)
Add command option "requirements. This is where you specify which options or items MUST appear together. For example, an OPEN command requires that the user specifies which FILE to open along with the ID to give the new file.

    aparser.addOptionNeeds( OPEN_COMMAND, FILE_OPTION );
    aparser.addOptionNeeds( OPEN_COMMAND, ID_OPTION );
    super.addCommandOptionNeeds( aparser );

The example shows that the OPEN command needs a FILE specified, and an ID specified.

Parameters:
aparser - the parser instance that will process incoming requests.

buildQueryCommandList

protected java.lang.String buildQueryCommandList(java.lang.String queryoptions)
Like primary commands, the QUERY command has a list of mutually exclusive options. You must feed these up the chain so that all superclass QUERY options are made available, too.

    queryoptions += s+ STATUS +s+ FILENAME +s+ FULLPATH +s;
    return super.buildQueryCommandList( queryoptions );

Parameters:
queryoptions - the space-delimited list of options

addServiceInitOptions

protected void addServiceInitOptions(com.ibm.staf.service.STAFCommandParser registrar)
Add your initialization options for your service. These options are like the command options, but these are handled by a different parser. Define what the valid options are for creating the service.

The format of the call is the OPTION string, the maximum times it can appear in a single request, and whether it is standalone, or whether an associated option value is required, or optional.

    aparser.addOption(A_SERCICE_OPTION, 3, STAFCommandParser.VALUENOTALLOWED);
    aparser.addOption(A_SERVICE_OPTION, 1, STAFCommandParser.VALUEREQUIRED);
    super.addServiceInitOptions( registrar );

Parameters:
registrar - the parser handling the service init request.

validateServiceParseResult

protected int validateServiceParseResult(com.ibm.staf.service.STAFCommandParseResult parsedData)
Use to validate the Service initialization string after a request for initialization has beenr received.

This is where you check to see which options exist in the request, and act upon them. Make sure you also forward the validation request up the food chain so the superclasses can validate their service init options, too.

    return super.validateServiceParseResult( parsedData );

Parameters:
parsedData - the result object after parsing was performed

getSTATUSInfo

protected java.lang.String getSTATUSInfo(SAFSFile textfile,
                                         java.lang.String info)
Provide STATUS information for the QUERY STATUS command. The subclass can also call the superclass for more information, but this is not required. This root class has already added info to the string prior to the call into the subclass.

    return super.getSTATUSInfo( textfile, info );

Parameters:
textfile - the instance of the SAFSFile object to play with.

info - the status string that will be displayed for the QUERY STATUS command.

Returns:
the text to be displayed by the QUERY STATUS command.

getQUERYInfo

protected java.lang.String getQUERYInfo(SAFSFile textfile,
                                        com.ibm.staf.service.STAFCommandParseResult parsedData,
                                        java.lang.String info)
Handle any added QUERY options here. This root class has already added info to the string prior to the call into the subclass. You may still forward the request to any superclass "just in case".

    return super.getQUERYInfo( textfile, parsedData, info );

Parameters:
textfile - the instance of the SAFSFile object to play with.

parsedData - the parsed request to interrogate for QUERY option parameter values.

info - the status string that will be displayed for the QUERY STATUS command.

Returns:
the text to be displayed by the QUERY STATUS command.

getLISTInfo

protected java.lang.String getLISTInfo()
Override this function and return your version of SFR_SERVICE_SAFSFILE_LISTINFO. You only have to call the superclass if you are not overriding the value for some reason.

Returns:
the text substring to be inserted with the LIST response for each file listed.

getOPENInfo

protected java.lang.String getOPENInfo(com.ibm.staf.service.STAFCommandParseResult parsedData,
                                       java.lang.String info)
Handle any added OPEN options here. This root class has already added info to the string prior to the call into the subclass. You may still forward the request to any superclass "just in case".

    return super.getOPENInfo( parsedData, info );

Parameters:
parsedData - the parsed request to interrogate for OPEN option parameter values.

info - the status string that will be displayed for the OPEN command.

Returns:
any text to be added to the OPEN response.

getHELPInfo

protected java.lang.String getHELPInfo(java.lang.String info)
Add your HELP text response here. The root class will handle its own HELP substring. You will still forward the request to any superclass to have their HELP options displayed, too.

    info += MY_LONG_INVOLVED_FORMATTED_HELP_TEXT;
    return super.getHELPInfo( info );

Parameters:
info - the response string that will be displayed for the HELP command.

Returns:
any text to be prepend the superclass response.

openFile

protected SAFSFile openFile(java.lang.String machine,
                            java.lang.String process,
                            int handle,
                            java.lang.String fileid,
                            java.io.File file,
                            com.ibm.staf.service.STAFCommandParseResult parsedData)
A subclass must override this function to instantiate its own file type. The file type, obviously, must be a extension of SAFSFile.

Parameters:
machine - the machine initiating the request to open the file.

process - the name of the Process initiating the request to open the file.

handle - the Handle of the Process initiating the request to open the file.

fileid - the unique fileid to be assigned the file. fileids should be uniquely identifiable among all Handles for a given Process.

file - the File object used to open the file.

parsedData - the parsed result containing the OPEN command and any of the user-supplied options that may be needed when opening the file or setting options in the file handler.

Returns:
the instance of the SAFSFile object that has been created.

processRequest

protected com.ibm.staf.STAFResult processRequest(com.ibm.staf.STAFResult result,
                                                 java.lang.String machine,
                                                 java.lang.String process,
                                                 int handle,
                                                 com.ibm.staf.service.STAFCommandParseResult parseData)
A subclass must override this function to handle requests not handled by the superclass. The subclass must also forward any unhandled requests to the superclass function.

    return super.processRequest(result, machine, process, handle, parsedData);

Parameters:
result - the object containing the return code and response string for the request.

machine - the machine initiating the request.

process - the name of the Process initiating the request.

handle - the Handle of the Process initiating the request.

parsedData - the parsed result containing the command and the user-supplied options provided.

Returns:
the result object after processing the request.

shutdown

protected int shutdown()
perform final termination cleanup operations for your service. The service is being shutdown by STAF. You must also forward this shutdown request to your superclass.

    return super.shutdown();


buildHELPInfo

protected final java.lang.String buildHELPInfo()

addBaseCommandOptions

protected final void addBaseCommandOptions(com.ibm.staf.service.STAFCommandParser aparser)

addBaseServiceInitOptions

protected final void addBaseServiceInitOptions(com.ibm.staf.service.STAFCommandParser registrar)

validateBaseServiceParseResult

protected final int validateBaseServiceParseResult(com.ibm.staf.service.STAFCommandParseResult parsedData)

buildBaseCommandList

protected final void buildBaseCommandList(com.ibm.staf.service.STAFCommandParser aparser)

addBaseCommandOptionGroups

protected final void addBaseCommandOptionGroups(com.ibm.staf.service.STAFCommandParser aparser)

buildBaseQueryCommandList

protected final void buildBaseQueryCommandList(com.ibm.staf.service.STAFCommandParser aparser)

addBaseCommandOptionNeeds

protected final void addBaseCommandOptionNeeds(com.ibm.staf.service.STAFCommandParser aparser)

init

public final int init(java.lang.String name,
                      java.lang.String params)
Specified by:
init in interface com.ibm.staf.service.STAFServiceInterfaceLevel1

acceptRequest

public final com.ibm.staf.STAFResult acceptRequest(java.lang.String machine,
                                                   java.lang.String process,
                                                   int handle,
                                                   java.lang.String request)
Specified by:
acceptRequest in interface com.ibm.staf.service.STAFServiceInterfaceLevel1

removeParsedDataTextFile

protected final void removeParsedDataTextFile(com.ibm.staf.STAFResult result,
                                              java.lang.String myprocess,
                                              int handle,
                                              java.lang.String fileid,
                                              com.ibm.staf.service.STAFCommandParseResult parsedData)

getParsedDataTextFile

protected final SAFSFile getParsedDataTextFile(com.ibm.staf.STAFResult result,
                                               int handle,
                                               java.lang.String fileid,
                                               com.ibm.staf.service.STAFCommandParseResult parsedData)

term

public final int term()
Specified by:
term in interface com.ibm.staf.service.STAFServiceInterfaceLevel1