Package org.jboss.as.cli
Interface CommandHandler
-
- All Known Subinterfaces:
OperationCommand
,OperationCommandWithDescription
- All Known Implementing Classes:
ArchiveHandler
,ASModuleHandler
,AttachmentHandler
,BaseOperationCommand
,BatchClearHandler
,BatchDiscardHandler
,BatchEditLineHandler
,BatchHandler
,BatchHoldbackHandler
,BatchListHandler
,BatchModeCommandHandler
,BatchMoveLineHandler
,BatchRemoveLineHandler
,BatchRunHandler
,CatchHandler
,ClearScreenHandler
,CommandCommandHandler
,CommandHandlerWithArguments
,CommandHandlerWithHelp
,CommandTimeoutHandler
,ConnectionInfoHandler
,DataSourceAddCompositeHandler
,DeployHandler
,DeploymentHandler
,DeploymentInfoHandler
,DeploymentOverlayHandler
,DoneHandler
,EchoDMRHandler
,EchoVariableHandler
,ElseHandler
,EndIfHandler
,EndTryHandler
,FinallyHandler
,ForHandler
,GenericTypeOperationHandler
,HistoryHandler
,IfHandler
,InstallationReportHandler
,JDBCDriverInfoHandler
,LsHandler
,OperationRequestHandler
,PrefixHandler
,PrintWorkingNodeHandler
,QuitHandler
,ReadAttributeHandler
,ReadOperationHandler
,ReloadHandler
,ResourceCompositeOperationHandler
,SetVariableHandler
,ShutdownHandler
,TryHandler
,UndeployHandler
,UnsetVariableHandler
,XADataSourceAddCompositeHandler
public interface CommandHandler
- Author:
- Alexey Loubyansky
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description CommandArgument
getArgument(CommandContext ctx, String name)
Returns command argument declared by the command handler corresponding to the argument name.Collection<CommandArgument>
getArguments(CommandContext ctx)
Returns a collection of the command arguments the handler supports in the current context.void
handle(CommandContext ctx)
Executes the command.boolean
hasArgument(CommandContext ctx, int index)
Checks whether the command handler accepts an argument with the specified index.boolean
hasArgument(CommandContext ctx, String name)
Checks whether the command handler recognizes the argument by the name.boolean
isAvailable(CommandContext ctx)
Checks whether the command is available in the current context (e.g.boolean
isBatchMode(CommandContext ctx)
Whether the command supports batch mode or not.
-
-
-
Method Detail
-
isAvailable
boolean isAvailable(CommandContext ctx)
Checks whether the command is available in the current context (e.g. some commands require connection with the controller, some are available only in the batch mode, etc)- Parameters:
ctx
- current context- Returns:
- true if the command can be executed in the current context, false - otherwise.
-
isBatchMode
boolean isBatchMode(CommandContext ctx)
Whether the command supports batch mode or not. The result could depend on the context, e.g. it won't make sense to add 'some_command --help' to a batch.- Parameters:
ctx
- the current context- Returns:
- true if the command can be added to the batch, otherwise - false.
-
handle
void handle(CommandContext ctx) throws CommandLineException
Executes the command.- Parameters:
ctx
- current command context- Throws:
CommandLineException
- if for any reason the command can't be properly handled the implementation must throw an instance of CommandLineException.
-
getArgument
CommandArgument getArgument(CommandContext ctx, String name)
Returns command argument declared by the command handler corresponding to the argument name. Or null if the argument wasn't found among the accepted arguments.- Parameters:
ctx
- the current contextname
- the name of the argument- Returns:
- command argument corresponding to the argument name or null if the argument name wasn't recognized.
-
hasArgument
boolean hasArgument(CommandContext ctx, String name)
Checks whether the command handler recognizes the argument by the name.- Parameters:
ctx
- the current contextname
- argument name to check- Returns:
- true if the handler recognizes the argument, otherwise - false.
-
hasArgument
boolean hasArgument(CommandContext ctx, int index)
Checks whether the command handler accepts an argument with the specified index.- Parameters:
ctx
- the current contextindex
- argument index to check- Returns:
- true if the handler accepts an argument with the specified index, otherwise - false.
-
getArguments
Collection<CommandArgument> getArguments(CommandContext ctx)
Returns a collection of the command arguments the handler supports in the current context.- Parameters:
ctx
- current command line context- Returns:
- list of the command arguments supported in the current context
-
-