public abstract class AbstractHornetQComponentControlHandler<T extends org.hornetq.api.core.management.HornetQComponentControl> extends AbstractRuntimeOnlyHandler
OperationStepHandler
implementations for handlers that interact
with an implementation of a HornetQComponentControl
subinterface to perform their function. This base class
handles a "start" and "stop" operation as well as a "read-attribute" call reading runtime attribute "started".Modifier | Constructor and Description |
---|---|
protected |
AbstractHornetQComponentControlHandler() |
Modifier and Type | Method and Description |
---|---|
protected void |
executeRuntimeStep(OperationContext context,
org.jboss.dmr.ModelNode operation)
Execute this step in
OperationContext.Stage.RUNTIME . |
protected abstract String |
getDescriptionPrefix() |
protected abstract T |
getHornetQComponentControl(org.hornetq.core.server.HornetQServer hqServer,
PathAddress address)
Gets the
HornetQComponentControl implementation used by this handler. |
protected T |
getHornetQComponentControl(OperationContext context,
org.jboss.dmr.ModelNode operation,
boolean forWrite)
Gets the runtime HornetQ control object that can help service this request.
|
protected Object |
handleOperation(String operationName,
OperationContext context,
org.jboss.dmr.ModelNode operation)
Hook to allow subclasses to handle operations other than
read-attribute , start and
stop . |
protected void |
handleReadAttribute(String attributeName,
OperationContext context,
org.jboss.dmr.ModelNode operation)
Hook to allow subclasses to handle read-attribute requests for attributes other than
CommonAttributes.STARTED . |
protected void |
handleRevertOperation(String operationName,
OperationContext context,
org.jboss.dmr.ModelNode operation,
Object handback)
Hook to allow subclasses to handle revert changes made in
handleOperation(String, org.jboss.as.controller.OperationContext, org.jboss.dmr.ModelNode) . |
void |
register(ManagementResourceRegistration registry) |
protected void |
unsupportedAttribute(String attributeName)
Return an ISE with a message saying support for the attribute was not properly implemented.
|
protected void |
unsupportedOperation(String operationName)
Return an ISE with a message saying support for the operation was not properly implemented.
|
execute, waitFor
protected AbstractHornetQComponentControlHandler()
protected void executeRuntimeStep(OperationContext context, org.jboss.dmr.ModelNode operation) throws OperationFailedException
AbstractRuntimeOnlyHandler
OperationContext.Stage.RUNTIME
.
If the operation fails, context.getFailureDescroption()
must be called, or OperationFailedException
must be thrown, before calling context.completeStep()
.
If the operation succeeded, context.getResult()
should
be called and the result populated with the outcome, after which context.completeStep()
must be called.executeRuntimeStep
in class AbstractRuntimeOnlyHandler
context
- the operation contextoperation
- the operation being executedOperationFailedException
- if the operation failed before calling context.completeStep()
public void register(ManagementResourceRegistration registry)
protected abstract T getHornetQComponentControl(org.hornetq.core.server.HornetQServer hqServer, PathAddress address)
HornetQComponentControl
implementation used by this handler.hqServer
- the HornetQServer installed in the runtimeaddress
- the address being invokedprotected abstract String getDescriptionPrefix()
protected void handleReadAttribute(String attributeName, OperationContext context, org.jboss.dmr.ModelNode operation) throws OperationFailedException
CommonAttributes.STARTED
.
Implementations must not call OperationContext.completeStep()
.
This default implementation just throws the exception returned by unsupportedAttribute(String)
.
attributeName
- the name of the attributecontext
- the operation contextoperation
- OperationFailedException
protected Object handleOperation(String operationName, OperationContext context, org.jboss.dmr.ModelNode operation) throws OperationFailedException
read-attribute
, start
and
stop
. Implementations must not call OperationContext.completeStep()
.
This default implementation just throws the exception returned by unsupportedOperation(String)
.
operationName
- the name of the operationcontext
- the operation contextoperation
- the operationhandleRevertOperation(String, org.jboss.as.controller.OperationContext, org.jboss.dmr.ModelNode, Object)
if the operation should be reverted. A value of null
is an indication that no reversible
modification was madeOperationFailedException
protected void handleRevertOperation(String operationName, OperationContext context, org.jboss.dmr.ModelNode operation, Object handback)
handleOperation(String, org.jboss.as.controller.OperationContext, org.jboss.dmr.ModelNode)
.
This default implementation does nothing.
operationName
- the name of the operationcontext
- the operation contextoperation
- the operationprotected final void unsupportedAttribute(String attributeName)
register(org.jboss.as.controller.registry.ManagementResourceRegistration)
registers the attribute, so a handler then not recognizing the attribute name would be a bug and this method
returns an exception highlighting that bug.attributeName
- the name of the attributeIllegalStateException
- an exception with a message indicating a bug in this handlerprotected final void unsupportedOperation(String operationName)
register(org.jboss.as.controller.registry.ManagementResourceRegistration)
registers it as a handler, so a handler then not recognizing the operation name would be a bug and this method
returns an exception highlighting that bug.operationName
- the name of the attributeIllegalStateException
- an exception with a message indicating a bug in this handlerprotected final T getHornetQComponentControl(OperationContext context, org.jboss.dmr.ModelNode operation, boolean forWrite)
context
- the operation contextoperation
- the operationforWrite
- true
if this operation will modify the runtime; false
if not.Copyright © 2013 JBoss, a division of Red Hat, Inc.. All rights reserved.