Class AbstractParentCommand
java.lang.Object
gov.nist.secauto.metaschema.cli.processor.command.AbstractParentCommand
- All Implemented Interfaces:
ICommand
A base class for a command that supports hierarchical command structure with
child commands. This class provides the foundation for implementing complex
CLI commands that can have multiple levels of sub-commands.
This class is thread-safe and supports concurrent access to command handlers.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected final voidaddCommandHandler(ICommand handler) Add a child command.getSubCommandByName(String name) Get a sub-command by it's command name.Get any sub-commands associated with this command.booleanDetermine if this command requires the use of a sub-command.newExecutor(CLIProcessor.CallingContext callingContext, org.apache.commons.cli.CommandLine cmdLine) Create a new executor for this command.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface gov.nist.secauto.metaschema.cli.processor.command.ICommand
gatherOptions, getDescription, getExtraArguments, getName, validateExtraArguments, validateOptions
-
Constructor Details
-
AbstractParentCommand
protected AbstractParentCommand()Construct a new parent command.
-
-
Method Details
-
addCommandHandler
Add a child command.- Parameters:
handler- the command handler for the child command
-
getSubCommandByName
Description copied from interface:ICommandGet a sub-command by it's command name.- Specified by:
getSubCommandByNamein interfaceICommand- Parameters:
name- the requested sub-command name- Returns:
- the command or
nullif no sub-command exists with that name
-
getSubCommands
Description copied from interface:ICommandGet any sub-commands associated with this command.- Specified by:
getSubCommandsin interfaceICommand- Returns:
- the sub-commands
-
isSubCommandRequired
Description copied from interface:ICommandDetermine if this command requires the use of a sub-command.- Specified by:
isSubCommandRequiredin interfaceICommand- Returns:
trueif a sub-command is required orfalseotherwise
-
newExecutor
public ICommandExecutor newExecutor(CLIProcessor.CallingContext callingContext, org.apache.commons.cli.CommandLine cmdLine) Description copied from interface:ICommandCreate a new executor for this command.- Specified by:
newExecutorin interfaceICommand- Parameters:
callingContext- the context of the command executioncmdLine- the parsed command line details- Returns:
- the executor
-