Package org.jboss.as.controller
Class ModelOnlyWriteAttributeHandler
- java.lang.Object
-
- org.jboss.as.controller.AbstractWriteAttributeHandler<Void>
-
- org.jboss.as.controller.ModelOnlyWriteAttributeHandler
-
- All Implemented Interfaces:
OperationStepHandler
public class ModelOnlyWriteAttributeHandler extends AbstractWriteAttributeHandler<Void>
Awrite-attributehandler that simply validates the attribute value and stores it in the model.- Author:
- Brian Stansberry (c) 2012 Red Hat Inc.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.jboss.as.controller.AbstractWriteAttributeHandler
AbstractWriteAttributeHandler.HandbackHolder<T>
-
-
Constructor Summary
Constructors Constructor Description ModelOnlyWriteAttributeHandler(Collection<AttributeDefinition> attributeDefinitions)ModelOnlyWriteAttributeHandler(AttributeDefinition... attributeDefinitions)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleanapplyUpdateToRuntime(OperationContext context, org.jboss.dmr.ModelNode operation, String attributeName, org.jboss.dmr.ModelNode resolvedValue, org.jboss.dmr.ModelNode currentValue, AbstractWriteAttributeHandler.HandbackHolder<Void> handbackHolder)Hook to allow subclasses to make runtime changes to effect the attribute value change.protected booleanrequiresRuntime(OperationContext context)Gets whether aOperationContext.Stage.RUNTIMEhandler should be added.protected voidrevertUpdateToRuntime(OperationContext context, org.jboss.dmr.ModelNode operation, String attributeName, org.jboss.dmr.ModelNode valueToRestore, org.jboss.dmr.ModelNode valueToRevert, Void handback)Hook to allow subclasses to revert runtime changes made inAbstractWriteAttributeHandler.applyUpdateToRuntime(OperationContext, ModelNode, String, ModelNode, ModelNode, HandbackHolder).-
Methods inherited from class org.jboss.as.controller.AbstractWriteAttributeHandler
execute, finishModelStage, getAttributeDefinition, recordCapabilitiesAndRequirements, validateUpdatedModel
-
-
-
-
Constructor Detail
-
ModelOnlyWriteAttributeHandler
public ModelOnlyWriteAttributeHandler(AttributeDefinition... attributeDefinitions)
-
ModelOnlyWriteAttributeHandler
public ModelOnlyWriteAttributeHandler(Collection<AttributeDefinition> attributeDefinitions)
-
-
Method Detail
-
requiresRuntime
protected final boolean requiresRuntime(OperationContext context)
Description copied from class:AbstractWriteAttributeHandlerGets whether aOperationContext.Stage.RUNTIMEhandler should be added. This default implementation returns true if the process is anormal serverand the process is notbooting. The rationale for the latter check is if the process is booting, the resource being modified will have been added as a previous step in the same context, and the Stage.RUNTIME handling for that add will see a model the reflects the changes made by this handler and will apply them to the runtime.- Overrides:
requiresRuntimein classAbstractWriteAttributeHandler<Void>- Parameters:
context- operation context- Returns:
trueif a runtime stage handler should be added;falseotherwise.
-
applyUpdateToRuntime
protected boolean applyUpdateToRuntime(OperationContext context, org.jboss.dmr.ModelNode operation, String attributeName, org.jboss.dmr.ModelNode resolvedValue, org.jboss.dmr.ModelNode currentValue, AbstractWriteAttributeHandler.HandbackHolder<Void> handbackHolder) throws OperationFailedException
Description copied from class:AbstractWriteAttributeHandlerHook to allow subclasses to make runtime changes to effect the attribute value change.- Specified by:
applyUpdateToRuntimein classAbstractWriteAttributeHandler<Void>- Parameters:
context- the context of the operationoperation- the operationattributeName- the name of the attribute being modifiedresolvedValue- the new value for the attribute, after anyValueExpressionhas been resolvedcurrentValue- the existing value for the attributehandbackHolder- holder for an arbitrary object to pass toAbstractWriteAttributeHandler.revertUpdateToRuntime(OperationContext, ModelNode, String, ModelNode, ModelNode, Object)if the operation needs to be rolled back- Returns:
trueif the server requires reload to effect the attribute value change;falseif not- Throws:
OperationFailedException
-
revertUpdateToRuntime
protected void revertUpdateToRuntime(OperationContext context, org.jboss.dmr.ModelNode operation, String attributeName, org.jboss.dmr.ModelNode valueToRestore, org.jboss.dmr.ModelNode valueToRevert, Void handback) throws OperationFailedException
Description copied from class:AbstractWriteAttributeHandlerHook to allow subclasses to revert runtime changes made inAbstractWriteAttributeHandler.applyUpdateToRuntime(OperationContext, ModelNode, String, ModelNode, ModelNode, HandbackHolder).- Specified by:
revertUpdateToRuntimein classAbstractWriteAttributeHandler<Void>- Parameters:
context- the context of the operationoperation- the operationattributeName- the name of the attribute being modifiedvalueToRestore- the previous value for the attribute, before this operation was executedvalueToRevert- the new value for the attribute that should be revertedhandback- an object, if any, passed in to thehandbackHolderby theapplyUpdateToRuntimeimplementation- Throws:
OperationFailedException
-
-