Class AbstractActiveMQComponentControlHandler<T extends org.apache.activemq.artemis.api.core.management.ActiveMQComponentControl>
- java.lang.Object
-
- org.jboss.as.controller.AbstractRuntimeOnlyHandler
-
- org.wildfly.extension.messaging.activemq.AbstractActiveMQComponentControlHandler<T>
-
- All Implemented Interfaces:
org.jboss.as.controller.OperationStepHandler
- Direct Known Subclasses:
AcceptorControlHandler,BridgeControlHandler,BroadcastGroupControlHandler,ClusterConnectionControlHandler
public abstract class AbstractActiveMQComponentControlHandler<T extends org.apache.activemq.artemis.api.core.management.ActiveMQComponentControl> extends org.jboss.as.controller.AbstractRuntimeOnlyHandlerBase class forOperationStepHandlerimplementations for handlers that interact with an implementation of aActiveMQComponentControlsubinterface to perform their function. This base class handles a "start" and "stop" operation as well as a "read-attribute" call reading runtime attribute "started".- Author:
- Brian Stansberry (c) 2011 Red Hat Inc.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractActiveMQComponentControlHandler()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidexecuteRuntimeStep(org.jboss.as.controller.OperationContext context, org.jboss.dmr.ModelNode operation)protected abstract TgetActiveMQComponentControl(org.apache.activemq.artemis.core.server.ActiveMQServer activeMQServer, org.jboss.as.controller.PathAddress address)Gets theActiveMQComponentControlimplementation used by this handler.protected TgetActiveMQComponentControl(org.jboss.as.controller.OperationContext context, org.jboss.dmr.ModelNode operation, boolean forWrite)Gets the runtime ActiveMQ control object that can help service this request.protected abstract StringgetDescriptionPrefix()protected ObjecthandleOperation(String operationName, org.jboss.as.controller.OperationContext context, org.jboss.dmr.ModelNode operation)Hook to allow subclasses to handle operations other thanread-attribute,startandstop.protected voidhandleReadAttribute(String attributeName, org.jboss.as.controller.OperationContext context, org.jboss.dmr.ModelNode operation)Hook to allow subclasses to handle read-attribute requests for attributes other thanCommonAttributes.STARTED.protected voidhandleRevertOperation(String operationName, org.jboss.as.controller.OperationContext context, org.jboss.dmr.ModelNode operation, Object handback)Hook to allow subclasses to handle revert changes made inhandleOperation(String, org.jboss.as.controller.OperationContext, org.jboss.dmr.ModelNode).voidregisterAttributes(org.jboss.as.controller.registry.ManagementResourceRegistration registry)voidregisterOperations(org.jboss.as.controller.registry.ManagementResourceRegistration registry, org.jboss.as.controller.descriptions.ResourceDescriptionResolver resolver)protected voidunsupportedAttribute(String attributeName)Return an ISE with a message saying support for the attribute was not properly implemented.protected voidunsupportedOperation(String operationName)Return an ISE with a message saying support for the operation was not properly implemented.
-
-
-
Method Detail
-
executeRuntimeStep
protected void executeRuntimeStep(org.jboss.as.controller.OperationContext context, org.jboss.dmr.ModelNode operation) throws org.jboss.as.controller.OperationFailedException- Specified by:
executeRuntimeStepin classorg.jboss.as.controller.AbstractRuntimeOnlyHandler- Throws:
org.jboss.as.controller.OperationFailedException
-
registerAttributes
public void registerAttributes(org.jboss.as.controller.registry.ManagementResourceRegistration registry)
-
registerOperations
public void registerOperations(org.jboss.as.controller.registry.ManagementResourceRegistration registry, org.jboss.as.controller.descriptions.ResourceDescriptionResolver resolver)
-
getActiveMQComponentControl
protected abstract T getActiveMQComponentControl(org.apache.activemq.artemis.core.server.ActiveMQServer activeMQServer, org.jboss.as.controller.PathAddress address)
Gets theActiveMQComponentControlimplementation used by this handler.- Parameters:
activeMQServer- the ActiveMQ server installed in the runtimeaddress- the address being invoked- Returns:
- the runtime ActiveMQ control object associated with the given address
-
getDescriptionPrefix
protected abstract String getDescriptionPrefix()
-
handleReadAttribute
protected void handleReadAttribute(String attributeName, org.jboss.as.controller.OperationContext context, org.jboss.dmr.ModelNode operation) throws org.jboss.as.controller.OperationFailedException
Hook to allow subclasses to handle read-attribute requests for attributes other thanCommonAttributes.STARTED. Implementations must not call any of thecontext.completeStep variants.This default implementation just throws the exception returned by
unsupportedAttribute(String).- Parameters:
attributeName- the name of the attributecontext- the operation contextoperation-- Throws:
org.jboss.as.controller.OperationFailedException
-
handleOperation
protected Object handleOperation(String operationName, org.jboss.as.controller.OperationContext context, org.jboss.dmr.ModelNode operation) throws org.jboss.as.controller.OperationFailedException
Hook to allow subclasses to handle operations other thanread-attribute,startandstop. Implementations must not call any of thecontext.completeStep variants.This default implementation just throws the exception returned by
unsupportedOperation(String).- Parameters:
operationName- the name of the operationcontext- the operation contextoperation- the operation- Returns:
- an object that can be passed back in
handleRevertOperation(String, org.jboss.as.controller.OperationContext, org.jboss.dmr.ModelNode, Object)if the operation should be reverted. A value ofnullis an indication that no reversible modification was made - Throws:
org.jboss.as.controller.OperationFailedException
-
handleRevertOperation
protected void handleRevertOperation(String operationName, org.jboss.as.controller.OperationContext context, org.jboss.dmr.ModelNode operation, Object handback)
Hook to allow subclasses to handle revert changes made inhandleOperation(String, org.jboss.as.controller.OperationContext, org.jboss.dmr.ModelNode).This default implementation does nothing.
- Parameters:
operationName- the name of the operationcontext- the operation contextoperation- the operation
-
unsupportedAttribute
protected final void unsupportedAttribute(String attributeName)
Return an ISE with a message saying support for the attribute was not properly implemented. This handler should only be called if for a "read-attribute" operation ifregisterOperations(ManagementResourceRegistration, ResourceDescriptionResolver)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.- Parameters:
attributeName- the name of the attribute- Throws:
IllegalStateException- an exception with a message indicating a bug in this handler
-
unsupportedOperation
protected final void unsupportedOperation(String operationName)
Return an ISE with a message saying support for the operation was not properly implemented. This handler should only be called if for a n operation ifregisterOperations(ManagementResourceRegistration, ResourceDescriptionResolver)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.- Parameters:
operationName- the name of the attribute- Throws:
IllegalStateException- an exception with a message indicating a bug in this handler
-
getActiveMQComponentControl
protected final T getActiveMQComponentControl(org.jboss.as.controller.OperationContext context, org.jboss.dmr.ModelNode operation, boolean forWrite) throws org.jboss.as.controller.OperationFailedException
Gets the runtime ActiveMQ control object that can help service this request.- Parameters:
context- the operation contextoperation- the operationforWrite-trueif this operation will modify the runtime;falseif not.- Returns:
- the control object
- Throws:
org.jboss.as.controller.OperationFailedException
-
-