|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--support143.DriverHelper
Base class driver. Gets us out of static land into happy land. Supports primitive argument processing, which includes boolean flags and untagged strings. Clients should extend this class for more specialized processing.
Field Summary | |
protected java.lang.String[] |
debugCmd
|
protected java.lang.String[] |
helpCmd
|
Constructor Summary | |
DriverHelper(java.lang.String name)
Sole constructor. |
Method Summary | |
protected void |
addArgumentAndHelp(java.lang.String[] cmd)
Adds a pair [argument, help] to the argument processor. |
protected Args |
createArguments(java.lang.String name,
java.lang.String[] args)
Creates the appropriate argument processor. |
protected abstract void |
defineArguments()
Primes argument processor with expected arguments. |
protected void |
defineBasicArguments()
Defines common (basic) arguments generally available to all programs. |
protected void |
exit(int exitValue)
Terminates the program with given exit value. |
protected void |
exit(int exitValue,
java.lang.String helpMsg)
Terminates the program with given exit after dumping help messages. |
Args |
getArguments()
Gets the Args associated with this driver. |
void |
go(java.lang.String[] args)
Starts the system. |
protected abstract void |
initialize()
Starts phase 2 of system. |
protected boolean |
isArgumentPresent(java.lang.String[] cmd)
Checks if a given argument is present in the parsed arguments. |
protected boolean |
needDebug()
Checks if debug is requested. |
protected boolean |
needHelp()
Checks if help is requested. |
protected abstract void |
process()
Starts phase 3. |
protected void |
setup(java.lang.String[] args)
Starts phase 1 of the system. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected java.lang.String[] helpCmd
protected java.lang.String[] debugCmd
Constructor Detail |
public DriverHelper(java.lang.String name)
name
- of programMethod Detail |
public void go(java.lang.String[] args)
args
- command line (presumably) argumentspublic Args getArguments()
protected void setup(java.lang.String[] args)
args
- (presumably) command line argumentsprotected Args createArguments(java.lang.String name, java.lang.String[] args)
name
- to give argument processor.args
- command line argumentsprotected abstract void initialize()
protected abstract void process()
protected abstract void defineArguments()
protected void addArgumentAndHelp(java.lang.String[] cmd)
cmd
- array of arg and help msg.protected boolean isArgumentPresent(java.lang.String[] cmd)
cmd
- array of given argument and incidental help message.protected boolean needHelp()
true
if true, false
otherwise.protected boolean needDebug()
true
if true, false
otherwise.protected void defineBasicArguments()
protected void exit(int exitValue, java.lang.String helpMsg)
exitValue
- reason for exit (passed to OS)helpMsg
- extra message to print along with help.protected void exit(int exitValue)
exitValue
- reason for exit.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |