Package de.hsh.graja.util.cli
Class CommandProvider
- java.lang.Object
-
- de.hsh.graja.util.cli.CommandProvider
-
- All Implemented Interfaces:
Comparable<CommandProvider>
- Direct Known Subclasses:
AsgmtBuilderCommandProvider
,BackendCommandProvider
,GuiCommandProvider
,StarterCommandProvider
,TransformCommandProvider
,VariabilityCommandProvider
public abstract class CommandProvider extends Object implements Comparable<CommandProvider>
-
-
Constructor Summary
Constructors Constructor Description CommandProvider()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description int
compareTo(CommandProvider o)
boolean
equals(Object obj)
abstract void
executeCommand(Logging log, String command, TreeMap<String,Object> options)
This is themain
method of a command.protected String
getAdditionalAddModulesOption(String command)
For usage printout this method should return a comma-separated list of modules that need to be added on the command line to get thecommand
running.protected String
getAdditionalModulePathOptionExample(String command)
For usage printout this method should return a path-delimiter-separated list of module paths that need to be added on the --module-path command line option to get thecommand
running.protected String
getAdditionalModulePathOptionTemplate(String command)
For usage printout this method should return a path-delimiter-separated list of module paths that need to be added on the --module-path command line option to get thecommand
running.protected abstract String[]
getCommands(Logging log)
String
getName()
int
hashCode()
List<Command>
provideCommands(Logging log, JsonMarshaller marshaller, CliConfig cfg)
protected void
validateCommand(Logging log, String commandString)
-
-
-
Method Detail
-
getAdditionalAddModulesOption
protected String getAdditionalAddModulesOption(String command)
For usage printout this method should return a comma-separated list of modules that need to be added on the command line to get thecommand
running.- Parameters:
command
-- Returns:
- Default: ""
-
getAdditionalModulePathOptionTemplate
protected String getAdditionalModulePathOptionTemplate(String command)
For usage printout this method should return a path-delimiter-separated list of module paths that need to be added on the --module-path command line option to get thecommand
running.- Parameters:
command
-- Returns:
- Default: ""
-
getAdditionalModulePathOptionExample
protected String getAdditionalModulePathOptionExample(String command)
For usage printout this method should return a path-delimiter-separated list of module paths that need to be added on the --module-path command line option to get thecommand
running.- Parameters:
command
-- Returns:
- Default: ""
-
executeCommand
public abstract void executeCommand(Logging log, String command, TreeMap<String,Object> options) throws CommandException
This is themain
method of a command. It is called byCommand.execute(Logging, String[])
.- Parameters:
log
- All output should go to this Logging instancecommand
-options
-- Throws:
Exception
- this signals an error, that usually a caller will react to by exiting the JVM return a value different from 0.CommandException
-
getName
public String getName()
-
provideCommands
public List<Command> provideCommands(Logging log, JsonMarshaller marshaller, CliConfig cfg) throws Exception
- Throws:
Exception
-
validateCommand
protected void validateCommand(Logging log, String commandString) throws IllegalArgumentException
- Throws:
IllegalArgumentException
-
compareTo
public int compareTo(CommandProvider o)
- Specified by:
compareTo
in interfaceComparable<CommandProvider>
-
-