Class AbstractModelUpdateHandler

java.lang.Object
org.jboss.as.controller.AbstractModelUpdateHandler
All Implemented Interfaces:
OperationStepHandler
Direct Known Subclasses:
NamespaceAddHandler, SchemaLocationAddHandler

public abstract class AbstractModelUpdateHandler extends Object implements OperationStepHandler
Base class for OperationStepHandler implementations for updating an existing managed resource.
Author:
Emanuel Muckenhuber
  • Constructor Details

    • AbstractModelUpdateHandler

      public AbstractModelUpdateHandler()
  • Method Details

    • execute

      public void execute(OperationContext context, org.jboss.dmr.ModelNode operation) throws OperationFailedException
      {@inheritDoc
      Specified by:
      execute in interface OperationStepHandler
      Parameters:
      context - the operation context
      operation - the operation being executed
      Throws:
      OperationFailedException - if the operation failed before calling context.completeStep()
    • updateModel

      protected void updateModel(org.jboss.dmr.ModelNode operation, Resource resource) throws OperationFailedException
      Update the given resource in the persistent configuration model based on the values in the given operation.
      Parameters:
      operation - the operation
      resource - the resource that corresponds to the address of operation
      Throws:
      OperationFailedException - if operation is invalid or populating the model otherwise fails
    • updateModel

      protected abstract void updateModel(org.jboss.dmr.ModelNode operation, org.jboss.dmr.ModelNode model) throws OperationFailedException
      Update the given node in the persistent configuration model based on the values in the given operation.
      Parameters:
      operation - the operation
      model - persistent configuration model node that corresponds to the address of operation
      Throws:
      OperationFailedException - if operation is invalid or populating the model otherwise fails
    • requiresRuntime

      protected boolean requiresRuntime(OperationContext context)
      Parameters:
      context - operation context
      Returns:
      true if performRuntime should be invoked; false otherwise.
    • performRuntime

      protected void performRuntime(OperationContext context, org.jboss.dmr.ModelNode operation, Resource resource) throws OperationFailedException
      Make any runtime changes necessary to effect the changes indicated by the given operation. Executes after updateModel(org.jboss.dmr.ModelNode, org.jboss.dmr.ModelNode), so the given model parameter will reflect any changes made in that method.

      This default implementation does nothing.

      Parameters:
      context - the operation context
      operation - the operation being executed
      resource - the resource that corresponds to the address of operation
      Throws:
      OperationFailedException - if operation is invalid or updating the runtime otherwise fails
    • rollbackRuntime

      protected void rollbackRuntime(OperationContext context, org.jboss.dmr.ModelNode operation, Resource resource)
      Rollback runtime changes made in performRuntime(OperationContext, org.jboss.dmr.ModelNode, org.jboss.as.controller.registry.Resource).

      This default implementation removes all services in the given list of controllers. The contents of controllers is the same as what was in the newControllers parameter passed to performRuntime() when that method returned.

      Parameters:
      context - the operation context
      operation - the operation being executed
      resource - the resource that corresponds to the address of operation