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
-
Method Summary
Modifier and TypeMethodDescriptionprotected final void
addCommandHandler
(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.boolean
Determine 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, wait
Methods 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:ICommand
Get a sub-command by it's command name.- Specified by:
getSubCommandByName
in interfaceICommand
- Parameters:
name
- the requested sub-command name- Returns:
- the command or
null
if no sub-command exists with that name
-
getSubCommands
Description copied from interface:ICommand
Get any sub-commands associated with this command.- Specified by:
getSubCommands
in interfaceICommand
- Returns:
- the sub-commands
-
isSubCommandRequired
Description copied from interface:ICommand
Determine if this command requires the use of a sub-command.- Specified by:
isSubCommandRequired
in interfaceICommand
- Returns:
true
if a sub-command is required orfalse
otherwise
-
newExecutor
public ICommandExecutor newExecutor(CLIProcessor.CallingContext callingContext, org.apache.commons.cli.CommandLine cmdLine) Description copied from interface:ICommand
Create a new executor for this command.- Specified by:
newExecutor
in interfaceICommand
- Parameters:
callingContext
- the context of the command executioncmdLine
- the parsed command line details- Returns:
- the executor
-