Class AbstractActiveMQComponentControlHandler<T extends org.apache.activemq.artemis.api.core.management.ActiveMQComponentControl>

  • 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 Detail

      • AbstractActiveMQComponentControlHandler

        protected AbstractActiveMQComponentControlHandler()
    • 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:
        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​(org.apache.activemq.artemis.core.server.ActiveMQServer activeMQServer,
                                                         org.jboss.as.controller.PathAddress address)
        Gets the ActiveMQComponentControl implementation used by this handler.
        Parameters:
        activeMQServer - 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, 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 made
        Throws:
        org.jboss.as.controller.OperationFailedException
      • 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