Package org.jboss.as.cli.handlers
Class BaseOperationCommand
- java.lang.Object
-
- org.jboss.as.cli.handlers.CommandHandlerWithArguments
-
- org.jboss.as.cli.handlers.CommandHandlerWithHelp
-
- org.jboss.as.cli.handlers.BaseOperationCommand
-
- All Implemented Interfaces:
CliEventListener,CommandHandler,OperationCommand
- Direct Known Subclasses:
BatchModeCommandHandler,BatchRunHandler,DeploymentInfoHandler,InstallationReportHandler,JDBCDriverInfoHandler,LsHandler,ReadAttributeHandler,ReadOperationHandler,ReloadHandler,ResourceCompositeOperationHandler,ShutdownHandler
public abstract class BaseOperationCommand extends CommandHandlerWithHelp implements OperationCommand, CliEventListener
- Author:
- Alexey Loubyansky
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.jboss.as.cli.OperationCommand
OperationCommand.HandledRequest
-
-
Field Summary
Fields Modifier and Type Field Description protected AccessRequirementaccessRequirementprotected ArgumentWithValueheadersprotected List<RequestParameterArgument>paramsprotected OperationRequestAddressrequiredAddress-
Fields inherited from class org.jboss.as.cli.handlers.CommandHandlerWithHelp
helpArg
-
-
Constructor Summary
Constructors Constructor Description BaseOperationCommand(CommandContext ctx, String command, boolean connectionRequired)BaseOperationCommand(CommandContext ctx, String command, boolean connectionRequired, boolean needHeaders)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddArgument(CommandArgument arg)protected voidaddHeaders(CommandContext ctx, org.jboss.dmr.ModelNode request)protected voidaddRequiredPath(String requiredPath)Adds a node path which is required to exist before the command can be used.protected voidaddRequiredPath(OperationRequestAddress requiredPath)Adds a node path which is required to exist before the command can be used.org.jboss.dmr.ModelNodebuildRequest(CommandContext ctx)protected abstract org.jboss.dmr.ModelNodebuildRequestWithoutHeaders(CommandContext ctx)protected org.jboss.dmr.ModelNodebuildRequestWOValidation(CommandContext ctx)voidcliEvent(CliEvent event, CommandContext ctx)protected voiddisplayResponseHeaders(CommandContext ctx, org.jboss.dmr.ModelNode response)protected voiddoHandle(CommandContext ctx)protected AttachmentsgetAttachments(CommandContext ctx)protected OperationRequestAddressgetRequiredAddress()protected StringgetRequiredType()protected voidhandleAttachedFile(CommandContext ctx, OperationResponse operationResponse)protected voidhandleResponse(CommandContext ctx, OperationResponse response, boolean composite)protected voidhandleResponse(CommandContext ctx, org.jboss.dmr.ModelNode response, boolean composite)protected booleanisAddressValid(CommandContext ctx)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)protected booleanisDependsOnProfile()protected voidsetParams(CommandContext ctx, org.jboss.dmr.ModelNode request)protected AccessRequirementsetupAccessRequirement(CommandContext ctx)-
Methods inherited from class org.jboss.as.cli.handlers.CommandHandlerWithHelp
displayHelp, handle, isBatchMode, printHelp, printList
-
Methods inherited from class org.jboss.as.cli.handlers.CommandHandlerWithArguments
getArgument, getArguments, getArgumentsMap, hasArgument, hasArgument, recognizeArguments
-
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.CommandHandler
getArgument, getArguments, handle, hasArgument, hasArgument, isBatchMode
-
Methods inherited from interface org.jboss.as.cli.OperationCommand
buildHandledRequest, buildRequest
-
-
-
-
Field Detail
-
params
protected List<RequestParameterArgument> params
-
requiredAddress
protected OperationRequestAddress requiredAddress
-
headers
protected final ArgumentWithValue headers
-
accessRequirement
protected AccessRequirement accessRequirement
-
-
Constructor Detail
-
BaseOperationCommand
public BaseOperationCommand(CommandContext ctx, String command, boolean connectionRequired)
-
BaseOperationCommand
public BaseOperationCommand(CommandContext ctx, String command, boolean connectionRequired, boolean needHeaders)
-
-
Method Detail
-
setupAccessRequirement
protected AccessRequirement setupAccessRequirement(CommandContext ctx)
-
addRequiredPath
protected void addRequiredPath(String requiredPath)
Adds a node path which is required to exist before the command can be used.- Parameters:
requiredPath- node path which is required to exist before the command can be used.
-
addRequiredPath
protected void addRequiredPath(OperationRequestAddress requiredPath)
Adds a node path which is required to exist before the command can be used.- Parameters:
requiredPath- node path which is required to exist before the command can be used.
-
isDependsOnProfile
protected boolean isDependsOnProfile()
-
getRequiredAddress
protected OperationRequestAddress getRequiredAddress()
-
getRequiredType
protected String getRequiredType()
-
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- Overrides:
isAvailablein classCommandHandlerWithHelp- Parameters:
ctx- current context- Returns:
- true if the command can be executed in the current context, false - otherwise.
-
isAddressValid
protected boolean isAddressValid(CommandContext ctx)
-
cliEvent
public void cliEvent(CliEvent event, CommandContext ctx)
- Specified by:
cliEventin interfaceCliEventListener
-
doHandle
protected void doHandle(CommandContext ctx) throws CommandLineException
- Specified by:
doHandlein classCommandHandlerWithHelp- Throws:
CommandLineException
-
buildRequest
public org.jboss.dmr.ModelNode buildRequest(CommandContext ctx) throws CommandFormatException
- Specified by:
buildRequestin interfaceOperationCommand- Throws:
CommandFormatException
-
getAttachments
protected Attachments getAttachments(CommandContext ctx)
-
buildRequestWOValidation
protected org.jboss.dmr.ModelNode buildRequestWOValidation(CommandContext ctx) throws CommandFormatException
- Throws:
CommandFormatException
-
buildRequestWithoutHeaders
protected abstract org.jboss.dmr.ModelNode buildRequestWithoutHeaders(CommandContext ctx) throws CommandFormatException
- Throws:
CommandFormatException
-
addHeaders
protected void addHeaders(CommandContext ctx, org.jboss.dmr.ModelNode request) throws CommandFormatException
- Throws:
CommandFormatException
-
handleResponse
protected void handleResponse(CommandContext ctx, OperationResponse response, boolean composite) throws CommandLineException
- Throws:
CommandLineException
-
handleAttachedFile
protected void handleAttachedFile(CommandContext ctx, OperationResponse operationResponse) throws CommandLineException
- Throws:
CommandLineException
-
handleResponse
protected void handleResponse(CommandContext ctx, org.jboss.dmr.ModelNode response, boolean composite) throws CommandLineException
- Throws:
CommandLineException
-
displayResponseHeaders
protected void displayResponseHeaders(CommandContext ctx, org.jboss.dmr.ModelNode response)
-
addArgument
public void addArgument(CommandArgument arg)
- Overrides:
addArgumentin classCommandHandlerWithArguments
-
setParams
protected void setParams(CommandContext ctx, org.jboss.dmr.ModelNode request) throws CommandFormatException
- Throws:
CommandFormatException
-
-