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.AbstractRuntimeOnlyHandler
Base class for
OperationStepHandler implementations for handlers that interact
with an implementation of a ActiveMQComponentControl 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".- Author:
- Brian Stansberry (c) 2011 Red Hat Inc.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidexecuteRuntimeStep(org.jboss.as.controller.OperationContext context, org.jboss.dmr.ModelNode operation) protected final 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 TgetActiveMQComponentControl(ActiveMQBroker activeMQBroker, org.jboss.as.controller.PathAddress address) Gets theActiveMQComponentControlimplementation used by this handler.protected abstract Stringprotected 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, OperationContext, 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 final voidunsupportedAttribute(String attributeName) Return an ISE with a message saying support for the attribute was not properly implemented.protected final voidunsupportedOperation(String operationName) Return an ISE with a message saying support for the operation was not properly implemented.Methods inherited from class org.jboss.as.controller.AbstractRuntimeOnlyHandler
execute, requiresRuntime, resourceMustExist
-
Constructor Details
-
AbstractActiveMQComponentControlHandler
protected AbstractActiveMQComponentControlHandler()
-
-
Method Details
-
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(ActiveMQBroker activeMQBroker, org.jboss.as.controller.PathAddress address) Gets theActiveMQComponentControlimplementation used by this handler.- Parameters:
activeMQBroker- the ActiveMQ server installed in the runtimeaddress- the address being invoked- Returns:
- the runtime ActiveMQ control object associated with the given address
-
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, OperationContext, 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, OperationContext, ModelNode).This default implementation does nothing.
- Parameters:
operationName- the name of the operationcontext- the operation contextoperation- the operation
-
unsupportedAttribute
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
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
-