abstract class CommonDriver
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private java.lang.String[] |
cfg
Configuration file(s) to process.
|
protected java.lang.String |
defCfg
Default configuration filename.
|
private int |
files
Number of configuration files actually specified.
|
protected java.lang.String[] |
helptxt
The main text of the syntax display, with each element being displayed
on a separate line.
|
private java.util.Map |
instances
Tracks the number of times a given parameter was specified.
|
protected int |
maxCfg
The maximum number of configuration files (and corresponding passwords)
to honor.
|
private java.util.List |
overrd
List of overrides.
|
private char[][] |
pwd
Passwords used to decrypt corresponding configuration files.
|
private int |
pws
Number of passwords actually specified.
|
Constructor and Description |
---|
CommonDriver() |
Modifier and Type | Method and Description |
---|---|
protected void |
checkConfig(BootstrapConfig bc)
Allows a subclass to check if the given configuration matches any
required values.
|
void |
process(java.lang.String[] args)
The command line entry point.
|
protected int |
processArguments(java.lang.String[] args,
int i)
Process arguments for any data or options that are specific to the
subclass.
|
protected void |
processOverrides(BootstrapConfig bc,
java.util.List list)
Add any new values and replace any duplicated values in the
configuration from a list of strings.
|
protected void |
processPassword()
Provide interactive password prompt if requested.
|
(package private) abstract void |
start(BootstrapConfig bc)
Runs the primary application using the preprocessed configuration and
target object.
|
protected void |
syntax(java.lang.String err,
int rc)
Print syntax on
STDOUT . |
protected void |
testFollowing(java.lang.String[] args,
int current,
int max,
boolean follow,
java.lang.String name)
Check that the number of parameters of a given type are not specified
more than the maximum number of times and that any required following
argument does exist.
|
protected java.lang.String[] helptxt
protected java.lang.String defCfg
protected int maxCfg
private java.util.Map instances
private java.lang.String[] cfg
private char[][] pwd
private int files
private int pws
private java.util.List overrd
protected void syntax(java.lang.String err, int rc)
STDOUT
.
This method does NOT return! It calls System.exit
with the given exit code.
err
- An optional message that is displayed first or
null
.rc
- The exit code to use with System.exit
.protected void processOverrides(BootstrapConfig bc, java.util.List list)
bc
- The configuration object to update.list
- The list of override strings.protected void testFollowing(java.lang.String[] args, int current, int max, boolean follow, java.lang.String name)
On failure of any test, this method displays the syntax message and exits the process (it does not return to the caller in this case).
args
- The command line arguments.current
- The current element being processed.max
- The maximum number instances of the parameter that are
allowed in a single command line.follow
- true
to force testing for the existence of a
single following argument.name
- The parameter name to use in error messages.protected int processArguments(java.lang.String[] args, int i)
process(java.lang.String[])
.args
- The command line arguments.i
- The current element being processed.protected void processPassword()
protected void checkConfig(BootstrapConfig bc) throws ConfigurationException
bc
- The configuration to be checked.ConfigurationException
abstract void start(BootstrapConfig bc) throws java.lang.Exception
bc
- The configuration to use.java.lang.Exception
public void process(java.lang.String[] args)
args
- The array of command-line parameters.