Class Command
- java.lang.Object
-
- org.opennms.features.jmxconfiggenerator.commands.Command
-
- Direct Known Subclasses:
GraphCreateCommand
,JmxCommand
,Starter
public abstract class Command extends Object
Overall Command class to group the available commands and provide common methods.
-
-
Field Summary
Fields Modifier and Type Field Description protected ConsoleLogAdapter
LOG
-
Constructor Summary
Constructors Constructor Description Command()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract void
execute()
Each subclass should implement an execute methode to implement its behaviour.protected abstract String
getDescription()
Returns the description (used for the usage) of the command.protected org.kohsuke.args4j.CmdLineParser
getParser()
protected boolean
isHelp()
void
printUsage()
Prints the usage of the command.void
run(org.kohsuke.args4j.CmdLineParser parser)
This method is invoked by the Main method to start the execution of the Command.protected abstract void
validate(org.kohsuke.args4j.CmdLineParser parser)
-
-
-
Field Detail
-
LOG
protected final ConsoleLogAdapter LOG
-
-
Method Detail
-
isHelp
protected boolean isHelp()
-
run
public void run(org.kohsuke.args4j.CmdLineParser parser) throws CmdRunException, org.kohsuke.args4j.CmdLineException
This method is invoked by the Main method to start the execution of the Command.- Parameters:
parser
-- Throws:
IOException
org.kohsuke.args4j.CmdLineException
CmdRunException
-
execute
protected abstract void execute() throws CmdRunException, org.kohsuke.args4j.CmdLineException
Each subclass should implement an execute methode to implement its behaviour.- Throws:
IOException
org.kohsuke.args4j.CmdLineException
CmdRunException
-
validate
protected abstract void validate(org.kohsuke.args4j.CmdLineParser parser) throws org.kohsuke.args4j.CmdLineException
- Throws:
org.kohsuke.args4j.CmdLineException
-
printUsage
public void printUsage()
Prints the usage of the command.
-
getParser
protected org.kohsuke.args4j.CmdLineParser getParser()
-
getDescription
protected abstract String getDescription()
Returns the description (used for the usage) of the command.- Returns:
- the command's description (used for the usage).
-
-