public abstract class AbstractCli extends Object
| Modifier and Type | Field and Description |
|---|---|
protected static String |
OPT_HELP
option to print usage.
|
protected static String |
OPT_PROVIDER_PROPERTIES
option for provider properties.
|
protected org.apache.commons.cli.Options |
options
command line options.
|
protected boolean |
outputDsmlv1
whether to output dsml version 1, the default is ldif.
|
| Constructor and Description |
|---|
AbstractCli() |
| Modifier and Type | Method and Description |
|---|---|
protected abstract int |
dispatch(org.apache.commons.cli.CommandLine line)
Dispatch command line data to the active that can perform the operation requested on the command line.
|
protected Map<String,String> |
getArgDesc(Class<?>... classes)
Returns the command line argument descriptions for this CLI.
|
protected abstract String |
getCommandName()
Returns the name of the command for which this class provides a CLI interface.
|
protected Properties |
getPropertiesFromOptions(String domain,
org.apache.commons.cli.CommandLine line)
Reads the options from the supplied command line and returns a properties containing those options.
|
protected ConnectionFactory |
initConnectionFactory(org.apache.commons.cli.CommandLine line)
Initialize a connection factory with command line options.
|
protected void |
initOptions()
Initialize CLI options.
|
int |
performAction(String[] args)
Parses command line options and dispatches to the requested action, or the default action if no action is
specified.
|
protected void |
printExamples()
Prints CLI usage examples.
|
protected void |
printHelp()
Prints CLI help text.
|
protected static final String OPT_HELP
protected static final String OPT_PROVIDER_PROPERTIES
protected final org.apache.commons.cli.Options options
protected boolean outputDsmlv1
public final int performAction(String[] args)
args - command line argumentsprotected void initOptions()
protected ConnectionFactory initConnectionFactory(org.apache.commons.cli.CommandLine line)
line - parsed command line argumentsprotected abstract String getCommandName()
protected abstract int dispatch(org.apache.commons.cli.CommandLine line)
throws Exception
line - parsed command line argumentsException - on errors thrown by actionprotected void printHelp()
protected void printExamples()
protected Map<String,String> getArgDesc(Class<?>... classes)
classes - that contain arguments used by this CLIprotected Properties getPropertiesFromOptions(String domain, org.apache.commons.cli.CommandLine line)
domain - to place property names inline - command lineCopyright © 2003-2019 Virginia Tech. All Rights Reserved.