Package org.jboss.as.cli.handlers
Class OperationRequestHandler
- java.lang.Object
-
- org.jboss.as.cli.handlers.OperationRequestHandler
-
- All Implemented Interfaces:
CommandHandler,OperationCommand
public class OperationRequestHandler extends Object implements CommandHandler, OperationCommand
The operation request handler.- Author:
- Alexey Loubyansky
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.jboss.as.cli.OperationCommand
OperationCommand.HandledRequest
-
-
Constructor Summary
Constructors Constructor Description OperationRequestHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.jboss.dmr.ModelNodebuildRequest(CommandContext ctx)CommandArgumentgetArgument(CommandContext ctx, String name)Returns command argument declared by the command handler corresponding to the argument name.List<CommandArgument>getArguments(CommandContext ctx)Returns a collection of the command arguments the handler supports in the current context.voidhandle(CommandContext ctx)Executes the command.booleanhasArgument(CommandContext ctx, int index)Checks whether the command handler accepts an argument with the specified index.booleanhasArgument(CommandContext ctx, String name)Checks whether the command handler recognizes the argument by the name.booleanisAvailable(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)booleanisBatchMode(CommandContext ctx)Whether the command supports batch mode or not.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.jboss.as.cli.OperationCommand
buildHandledRequest, buildRequest
-
-
-
-
Method Detail
-
isBatchMode
public boolean isBatchMode(CommandContext ctx)
Description copied from interface:CommandHandlerWhether 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.- Specified by:
isBatchModein interfaceCommandHandler- Parameters:
ctx- the current context- Returns:
- true if the command can be added to the batch, otherwise - false.
-
handle
public void handle(CommandContext ctx) throws CommandLineException
Description copied from interface:CommandHandlerExecutes the command.- Specified by:
handlein interfaceCommandHandler- 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.
-
isAvailable
public boolean isAvailable(CommandContext ctx)
Description copied from interface:CommandHandlerChecks 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)- Specified by:
isAvailablein interfaceCommandHandler- Parameters:
ctx- current context- Returns:
- true if the command can be executed in the current context, false - otherwise.
-
buildRequest
public org.jboss.dmr.ModelNode buildRequest(CommandContext ctx) throws CommandFormatException
- Specified by:
buildRequestin interfaceOperationCommand- Throws:
CommandFormatException
-
getArgument
public CommandArgument getArgument(CommandContext ctx, String name)
Description copied from interface:CommandHandlerReturns command argument declared by the command handler corresponding to the argument name. Or null if the argument wasn't found among the accepted arguments.- Specified by:
getArgumentin interfaceCommandHandler- 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
public boolean hasArgument(CommandContext ctx, String name)
Description copied from interface:CommandHandlerChecks whether the command handler recognizes the argument by the name.- Specified by:
hasArgumentin interfaceCommandHandler- Parameters:
ctx- the current contextname- argument name to check- Returns:
- true if the handler recognizes the argument, otherwise - false.
-
hasArgument
public boolean hasArgument(CommandContext ctx, int index)
Description copied from interface:CommandHandlerChecks whether the command handler accepts an argument with the specified index.- Specified by:
hasArgumentin interfaceCommandHandler- Parameters:
ctx- the current contextindex- argument index to check- Returns:
- true if the handler accepts an argument with the specified index, otherwise - false.
-
getArguments
public List<CommandArgument> getArguments(CommandContext ctx)
Description copied from interface:CommandHandlerReturns a collection of the command arguments the handler supports in the current context.- Specified by:
getArgumentsin interfaceCommandHandler- Parameters:
ctx- current command line context- Returns:
- list of the command arguments supported in the current context
-
-