Package org.jboss.as.controller
Class AbstractRuntimeOnlyHandler
- java.lang.Object
-
- org.jboss.as.controller.AbstractRuntimeOnlyHandler
-
- All Implemented Interfaces:
OperationStepHandler
- Direct Known Subclasses:
PathInfoHandler
public abstract class AbstractRuntimeOnlyHandler extends Object implements OperationStepHandler
Base class for operations that do nothing inOperationContext.Stage.MODEL
except register aOperationContext.Stage.RUNTIME
step.- Author:
- Brian Stansberry (c) 2011 Red Hat Inc., Richard Opalka
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractRuntimeOnlyHandler()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
execute(OperationContext context, org.jboss.dmr.ModelNode operation)
Simply adds aOperationContext.Stage.RUNTIME
step that callsexecuteRuntimeStep(OperationContext, ModelNode)
.protected abstract void
executeRuntimeStep(OperationContext context, org.jboss.dmr.ModelNode operation)
Execute this step inOperationContext.Stage.RUNTIME
.protected boolean
requiresRuntime(OperationContext context)
Gets whether theOperationContext.Stage.RUNTIME
step should be added to callexecuteRuntimeStep(OperationContext, ModelNode)
.protected boolean
resourceMustExist(OperationContext context, org.jboss.dmr.ModelNode operation)
By default the handler will check whether the resource exist before calling @{link #executeRuntimeStep(OperationContext, ModelNode)}.
-
-
-
Method Detail
-
execute
public void execute(OperationContext context, org.jboss.dmr.ModelNode operation) throws OperationFailedException
Simply adds aOperationContext.Stage.RUNTIME
step that callsexecuteRuntimeStep(OperationContext, ModelNode)
. Execute this step. If the operation fails,context.getFailureDescription()
must be called, or anOperationFailedException
must be thrown. If the operation succeeded and the operation provides a return value,context.getResult()
should be called and the result populated with the outcome. If the handler wishes to take further action once the result of the overall operation execution is known, one of thecontext.completeStep variants
should be called to register a callback. The callback will not be invoked if this method throws an exception.When this method is invoked the
thread context classloader
will be set to be the defining class loader of the class that implements this interface.- Specified by:
execute
in interfaceOperationStepHandler
- Parameters:
context
- the operation contextoperation
- the operation being executed- Throws:
OperationFailedException
- if the operation failed before callingcontext.completeStep()
-
requiresRuntime
protected boolean requiresRuntime(OperationContext context)
Gets whether theOperationContext.Stage.RUNTIME
step should be added to callexecuteRuntimeStep(OperationContext, ModelNode)
. This default implementation will returntrue
for a normal server running in normal (non admin-only) mode. If running on a host controller, it will returntrue
if it is the active copy of the host controller subsystem. Subclasses that perform no runtime update could override and returnfalse
. This method is invoked duringOperationContext.Stage.MODEL
.- Parameters:
context
- operation context- Returns:
true
if a step to invokeexecuteRuntimeStep
should be added;false
otherwise.- See Also:
OperationContext.isDefaultRequiresRuntime()
-
resourceMustExist
protected boolean resourceMustExist(OperationContext context, org.jboss.dmr.ModelNode operation)
By default the handler will check whether the resource exist before calling @{link #executeRuntimeStep(OperationContext, ModelNode)}. This method can be overridden in the special case where a runtime operation must be executed without a corresponding resource.- Parameters:
context
- the operation contextoperation
- the operation being executed- Returns:
- true if the resource must exist for this runtime handler to be executed.
-
executeRuntimeStep
protected abstract void executeRuntimeStep(OperationContext context, org.jboss.dmr.ModelNode operation) throws OperationFailedException
Execute this step inOperationContext.Stage.RUNTIME
. If the operation fails,context.getFailureDescroption()
must be called, orOperationFailedException
must be thrown, before calling one of thecontext.completeStep variants
. If the operation succeeded,context.getResult()
should be called and the result populated with the outcome, after which one of thecontext.completeStep variants
must be called.- Parameters:
context
- the operation contextoperation
- the operation being executed- Throws:
OperationFailedException
- if the operation failed before callingcontext.completeStep()
-
-