|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.dtolabs.rundeck.core.cli.BaseTool
public abstract class BaseTool
BaseTool provides a base lifecyle for a commandline tool, and allows CLIToolOptions
objects to be used for modular options processing.
Constructor Summary | |
---|---|
protected |
BaseTool()
|
Method Summary | |
---|---|
protected void |
addToolOptions(CLIToolOptions option)
Add a new CLIToolOptions object to the options used by this tool. |
void |
exit(int exitcode)
Calls the exit method |
protected org.apache.commons.cli.CommandLine |
getCommandLine()
|
abstract java.lang.String |
getHelpString()
Return the help string used when -h option is specified. |
protected org.apache.commons.cli.Options |
getOptions()
|
protected abstract void |
go()
Perform the actions for the tool |
void |
help()
Writes help message . |
protected void |
initOptions()
initialize any options, will apply this for each CLIToolOptions added to the tool. |
protected abstract boolean |
isUseHelpOption()
Return true if the -h/--help option should be added to the options automatically. |
org.apache.commons.cli.CommandLine |
parseArgs(java.lang.String[] args)
Parse the options, will apply this for each CLIToolOptions added to the tool. |
void |
run(java.lang.String[] args)
Run the tool's lifecycle given the input arguments. |
protected void |
setShouldExit(boolean shouldExit)
Set whether the exit(int) method should call System.exit. |
void |
validateOptions(org.apache.commons.cli.CommandLine cli,
java.lang.String[] args)
Validate the values parsed by the options, will apply this for each CLIToolOptions added to the tool. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.dtolabs.rundeck.core.execution.BaseLogger |
---|
debug, error, log, verbose, warn |
Constructor Detail |
---|
protected BaseTool()
Method Detail |
---|
protected void addToolOptions(CLIToolOptions option)
option
- protected abstract boolean isUseHelpOption()
protected void initOptions()
protected org.apache.commons.cli.Options getOptions()
public void run(java.lang.String[] args) throws CLIToolException
run
in interface CLITool
args
- the cli arg vector
CLIToolException
public org.apache.commons.cli.CommandLine parseArgs(java.lang.String[] args) throws CLIToolOptionsException
parseArgs
in interface CLITool
args
- the cli arg vector
CLIToolOptionsException
public void validateOptions(org.apache.commons.cli.CommandLine cli, java.lang.String[] args) throws CLIToolOptionsException
CLIToolOptionsException
protected abstract void go() throws CLIToolException
CLIToolException
protected org.apache.commons.cli.CommandLine getCommandLine()
public abstract java.lang.String getHelpString()
public void help()
help
in interface CLITool
public void exit(int exitcode)
exit
in interface CLITool
exitcode
- return code to exit withprotected void setShouldExit(boolean shouldExit)
exit(int)
method should call System.exit.
shouldExit
-
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |