Package org.jboss.as.controller
Class AbstractRuntimeOnlyHandler
java.lang.Object
org.jboss.as.controller.AbstractRuntimeOnlyHandler
- All Implemented Interfaces:
OperationStepHandler
- Direct Known Subclasses:
PathInfoHandler
Base class for operations that do nothing in
OperationContext.Stage.MODEL except
register a OperationContext.Stage.RUNTIME step.- Author:
- Brian Stansberry (c) 2011 Red Hat Inc., Richard Opalka
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidexecute(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)}.
-
Constructor Details
-
AbstractRuntimeOnlyHandler
protected AbstractRuntimeOnlyHandler()
-
-
Method Details
-
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
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:
-
resourceMustExist
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()
-