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
    Modifier
    Constructor
    Description
    protected
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    executeRuntimeStep(org.jboss.as.controller.OperationContext context, org.jboss.dmr.ModelNode operation)
     
    protected final T
    getActiveMQComponentControl(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 T
    getActiveMQComponentControl(ActiveMQBroker activeMQBroker, org.jboss.as.controller.PathAddress address)
    Gets the ActiveMQComponentControl implementation used by this handler.
    protected abstract String
     
    protected Object
    handleOperation(String operationName, org.jboss.as.controller.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, org.jboss.as.controller.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, org.jboss.as.controller.OperationContext context, org.jboss.dmr.ModelNode operation, Object handback)
    Hook to allow subclasses to handle revert changes made in handleOperation(String, OperationContext, ModelNode).
    void
    registerAttributes(org.jboss.as.controller.registry.ManagementResourceRegistration registry)
     
    void
    registerOperations(org.jboss.as.controller.registry.ManagementResourceRegistration registry, org.jboss.as.controller.descriptions.ResourceDescriptionResolver resolver)
     
    protected final void
    Return an ISE with a message saying support for the attribute was not properly implemented.
    protected final void
    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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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:
      executeRuntimeStep in class org.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 the ActiveMQComponentControl implementation used by this handler.
      Parameters:
      activeMQBroker - the ActiveMQ server installed in the runtime
      address - 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 than CommonAttributes.STARTED. Implementations must not call any of the context.completeStep variants.

      This default implementation just throws the exception returned by unsupportedAttribute(String).

      Parameters:
      attributeName - the name of the attribute
      context - the operation context
      operation -
      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 than read-attribute, start and stop. Implementations must not call any of the context.completeStep variants.

      This default implementation just throws the exception returned by unsupportedOperation(String).

      Parameters:
      operationName - the name of the operation
      context - the operation context
      operation - the operation
      Returns:
      an object that can be passed back in handleRevertOperation(String, OperationContext, ModelNode, Object) if the operation should be reverted. A value of null is 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 in handleOperation(String, OperationContext, ModelNode).

      This default implementation does nothing.

      Parameters:
      operationName - the name of the operation
      context - the operation context
      operation - 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 if registerOperations(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 if registerOperations(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 context
      operation - the operation
      forWrite - true if this operation will modify the runtime; false if not.
      Returns:
      the control object
      Throws:
      org.jboss.as.controller.OperationFailedException