Class AbstractCommandExecutor

java.lang.Object
gov.nist.secauto.metaschema.cli.processor.command.AbstractCommandExecutor
All Implemented Interfaces:
ICommandExecutor

public abstract class AbstractCommandExecutor extends Object implements ICommandExecutor
A base class for implementation that perform the operation supported by a command.
  • Constructor Details

    • AbstractCommandExecutor

      protected AbstractCommandExecutor(@NonNull CLIProcessor.CallingContext callingContext, @NonNull org.apache.commons.cli.CommandLine commandLine)
      Construct a new command executor.
      Parameters:
      callingContext - the context of the command execution
      commandLine - the parsed command line details
  • Method Details

    • getCallingContext

      Get the context of the command execution, which provides access to the execution environment needed for command processing.
      Returns:
      the context
    • getCommandLine

      @NonNull protected org.apache.commons.cli.CommandLine getCommandLine()
      Get the parsed command line details containing the command options and arguments provided by the user during execution.
      Returns:
      the cli details
    • execute

      public abstract void execute() throws CommandExecutionException
      Description copied from interface: ICommandExecutor
      Execute the command operation.
      Specified by:
      execute in interface ICommandExecutor
      Throws:
      CommandExecutionException - if an error occurred while executing the command operation
    • getCommand

      @NonNull protected ICommand getCommand()
      Get the command associated with this execution.
      Returns:
      the command