public abstract class AbstractResourcePathCommand<REQ extends org.hawkular.cmdgw.api.ResourcePathRequest,RESP extends org.hawkular.cmdgw.api.ResourcePathResponse> extends Object implements Command<REQ,RESP>
Commands initiated by subclasses of ResourcePathRequest.| Modifier and Type | Field and Description |
|---|---|
protected String |
entityType
A natural language name of entity the present command is creating, removing or updating.
|
protected String |
operationName
A natural language name of the operation the present command is performing, such as
Updade, Add
or Remove. |
| Constructor and Description |
|---|
AbstractResourcePathCommand(String operationName,
String entityType) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
assertLocalServer(MonitoredEndpoint<? extends MonitorServiceConfiguration.AbstractEndpointConfiguration> endpoint) |
protected void |
assertNotRename(org.jboss.dmr.ModelNode adr,
String newName) |
protected abstract RESP |
createResponse() |
org.hawkular.bus.common.BasicMessageWithExtraData<RESP> |
execute(org.hawkular.bus.common.BasicMessageWithExtraData<REQ> envelope,
CommandContext context)
Performs the command for the server.
|
protected abstract org.hawkular.bus.common.BinaryData |
execute(org.jboss.as.controller.client.ModelControllerClient controllerClient,
EndpointService<DMRNodeLocation,DMRSession> endpointService,
String modelNodePath,
org.hawkular.bus.common.BasicMessageWithExtraData<REQ> envelope,
RESP response,
CommandContext context,
DMRSession dmrContext)
Do whatever with the already validated parameters.
|
protected String |
getOperationName(org.hawkular.bus.common.BasicMessageWithExtraData<REQ> envelope) |
protected void |
setServerRefreshIndicator(OperationBuilder.OperationResult<?> opResults,
RESP response)
Given the results of an operation, this will set the
ServerRefreshIndicator
found in those results in the given response. |
protected void |
success(org.hawkular.bus.common.BasicMessageWithExtraData<REQ> envelope,
RESP response) |
protected void |
validate(org.hawkular.bus.common.BasicMessageWithExtraData<REQ> envelope)
Checks if the
request has resourcePath field set. |
protected abstract void |
validate(org.hawkular.bus.common.BasicMessageWithExtraData<REQ> envelope,
MonitoredEndpoint<? extends MonitorServiceConfiguration.AbstractEndpointConfiguration> endpoint)
Validation for subclasses.
|
protected abstract void |
validate(String modelNodePath,
org.hawkular.bus.common.BasicMessageWithExtraData<REQ> envelope)
modelNodePath validation for subclasses. |
protected final String entityType
entityType is
supposed to be used in log and exception messages primarily. This field should have values like
"Datasource", "JDBC Driver" or similar.protected final String operationName
Updade, Add
or Remove. operationName is supposed to be used in log and exception messages primarily.protected String getOperationName(org.hawkular.bus.common.BasicMessageWithExtraData<REQ> envelope)
public org.hawkular.bus.common.BasicMessageWithExtraData<RESP> execute(org.hawkular.bus.common.BasicMessageWithExtraData<REQ> envelope, CommandContext context) throws Exception
Commandexecute in interface Command<REQ extends org.hawkular.cmdgw.api.ResourcePathRequest,RESP extends org.hawkular.cmdgw.api.ResourcePathResponse>envelope - the request that describes what needs to be executed eventually with attached BinaryDatacontext - contains data that can help commands do their jobException - if failed to execute the commandprotected abstract org.hawkular.bus.common.BinaryData execute(org.jboss.as.controller.client.ModelControllerClient controllerClient,
EndpointService<DMRNodeLocation,DMRSession> endpointService,
String modelNodePath,
org.hawkular.bus.common.BasicMessageWithExtraData<REQ> envelope,
RESP response,
CommandContext context,
DMRSession dmrContext)
throws Exception
controllerClient - a plain ModelControllerClientendpointService - an EndpointService belonging to the resourcemodelNodePath - a DMR path acquired from ResourcePathRequest.getResourcePath()envelope - the requestresponse - the responsecontext - the CommandContextdmrContext - a DMRSessionBinaryData with binary content if this command returns anyException - if anything goes wrongprotected abstract void validate(String modelNodePath, org.hawkular.bus.common.BasicMessageWithExtraData<REQ> envelope)
modelNodePath validation for subclasses.modelNodePath - a DMR path to checkenvelope - the request the modelNodePath comes fromprotected void validate(org.hawkular.bus.common.BasicMessageWithExtraData<REQ> envelope)
request has resourcePath field set. Subclasses may want to add more request
validations in their overrides.envelope - the request to validateprotected abstract void validate(org.hawkular.bus.common.BasicMessageWithExtraData<REQ> envelope, MonitoredEndpoint<? extends MonitorServiceConfiguration.AbstractEndpointConfiguration> endpoint)
envelope - a DMR path to checkdmrEndpoint - the request the modelNodePath comes fromprotected abstract RESP createResponse()
ResourcePathResponse subclassprotected void success(org.hawkular.bus.common.BasicMessageWithExtraData<REQ> envelope, RESP response)
protected void setServerRefreshIndicator(OperationBuilder.OperationResult<?> opResults, RESP response)
ServerRefreshIndicator
found in those results in the given response.opResults - contains the DMR resultsresponse - the response messageprotected void assertLocalServer(MonitoredEndpoint<? extends MonitorServiceConfiguration.AbstractEndpointConfiguration> endpoint)
protected void assertNotRename(org.jboss.dmr.ModelNode adr,
String newName)
Copyright © 2015–2017 Red Hat, Inc.. All rights reserved.