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.MODELexcept register aOperationContext.Stage.RUNTIMEstep.- Author:
- Brian Stansberry (c) 2011 Red Hat Inc., Richard Opalka
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractRuntimeOnlyHandler()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidexecute(OperationContext context, org.jboss.dmr.ModelNode operation)Simply adds aOperationContext.Stage.RUNTIMEstep that callsexecuteRuntimeStep(OperationContext, ModelNode).protected abstract voidexecuteRuntimeStep(OperationContext context, org.jboss.dmr.ModelNode operation)Execute this step inOperationContext.Stage.RUNTIME.protected booleanrequiresRuntime(OperationContext context)Gets whether theOperationContext.Stage.RUNTIMEstep should be added to callexecuteRuntimeStep(OperationContext, ModelNode).protected booleanresourceMustExist(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.RUNTIMEstep that callsexecuteRuntimeStep(OperationContext, ModelNode). Execute this step. If the operation fails,context.getFailureDescription()must be called, or anOperationFailedExceptionmust 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 variantsshould 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 classloaderwill be set to be the defining class loader of the class that implements this interface.- Specified by:
executein 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.RUNTIMEstep should be added to callexecuteRuntimeStep(OperationContext, ModelNode). This default implementation will returntruefor a normal server running in normal (non admin-only) mode. If running on a host controller, it will returntrueif 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:
trueif a step to invokeexecuteRuntimeStepshould be added;falseotherwise.- 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, orOperationFailedExceptionmust 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 variantsmust be called.- Parameters:
context- the operation contextoperation- the operation being executed- Throws:
OperationFailedException- if the operation failed before callingcontext.completeStep()
-
-