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 Details

    • CommandProvider

      public CommandProvider()
  • Method Details

    • getCommands

      protected abstract String[] getCommands(Logging log)
    • 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 the command 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 the command 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 the command running.
      Parameters:
      command -
      Returns:
      Default: ""
    • executeCommand

      public abstract void executeCommand(Logging log, String command, TreeMap<String,Object> options) throws CommandException
      This is the main method of a command. It is called by Command.execute(Logging, String[]).
      Parameters:
      log - All output should go to this Logging instance
      command -
      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
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • compareTo

      public int compareTo(CommandProvider o)
      Specified by:
      compareTo in interface Comparable<CommandProvider>