abstract class CommonDriver
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
private java.lang.String[] |
args
Command line arguments stored for debugging/logging.
|
private java.lang.String[] |
cfg
Configuration file(s) to process.
|
protected java.lang.String |
defCfg
Default configuration filename.
|
protected java.lang.String |
driverName
Driver classname for logging purposes.
|
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<java.lang.String,java.lang.Integer> |
instances
Tracks the number of times a given parameter was specified.
|
private CentralLogger |
LOG
Logger.
|
protected int |
maxCfg
The maximum number of configuration files (and corresponding passwords)
to honor.
|
private java.util.List<java.lang.String> |
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.
|
java.lang.String |
printDriverDetails()
Output diagnostic details for this process.
|
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 |
processPassword()
Provide interactive password prompt if requested.
|
protected static void |
setDefaultExceptionHandler(CentralLogger logger)
Sets a default exception handler for the JVM that registers any uncaught exception to the
CentralLogger logs before being thrown.
|
(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 for interactive clients and use logger for server processes. |
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
protected java.lang.String driverName
private final CentralLogger LOG
private java.lang.String[] args
private java.util.Map<java.lang.String,java.lang.Integer> instances
private java.lang.String[] cfg
private char[][] pwd
private int files
private int pws
private java.util.List<java.lang.String> overrd
protected static void setDefaultExceptionHandler(CentralLogger logger)
logger - An instance of the server/client driver logger.protected void syntax(java.lang.String err,
int rc)
STDOUT for interactive clients and use logger for server processes.
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 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.ConfigurationExceptionabstract void start(BootstrapConfig bc) throws java.lang.Exception
bc - The configuration to use.java.lang.Exceptionpublic java.lang.String printDriverDetails()
public void process(java.lang.String[] args)
args - The array of command-line parameters.