public abstract class HandlerUpdateProperties<T extends Handler> extends Object implements OperationStepHandler
Modifier and Type | Field and Description |
---|---|
static String |
OPERATION_NAME |
Modifier | Constructor and Description |
---|---|
protected |
HandlerUpdateProperties(AttributeDefinition... attributeDefinitions) |
protected |
HandlerUpdateProperties(String... attributes) |
Modifier and Type | Method and Description |
---|---|
protected abstract boolean |
applyUpdateToRuntime(OperationContext context,
String handlerName,
org.jboss.dmr.ModelNode model,
org.jboss.dmr.ModelNode originalModel,
T handler)
Hook to allow subclasses to make runtime changes to effect the attribute value change.
|
protected void |
copy(String name,
org.jboss.dmr.ModelNode from,
org.jboss.dmr.ModelNode to)
Copies the attribute, represented by the
name parameter, from one ModelNode to another if the
from parameter has the attributed defined. |
void |
execute(OperationContext context,
org.jboss.dmr.ModelNode operation)
{@inheritDoc
|
Collection<AttributeDefinition> |
getAttributes()
Returns a collection of attributes used for the write attribute.
|
protected boolean |
requiresRuntime(OperationContext context)
Gets whether a
OperationContext.Stage#RUNTIME handler should be added. |
protected abstract void |
revertUpdateToRuntime(OperationContext context,
String handlerName,
org.jboss.dmr.ModelNode model,
org.jboss.dmr.ModelNode originalModel,
T handler)
Hook to allow subclasses to revert runtime changes made in
#applyUpdateToRuntime(OperationContext, String, ModelNode, ModelNode, T) . |
protected void |
updateModel(org.jboss.dmr.ModelNode operation,
org.jboss.dmr.ModelNode model)
Update the given node in the persistent configuration model based on the values in the given operation.
|
public static final String OPERATION_NAME
protected HandlerUpdateProperties(AttributeDefinition... attributeDefinitions)
protected HandlerUpdateProperties(String... attributes)
public void execute(OperationContext context, org.jboss.dmr.ModelNode operation) throws OperationFailedException
execute
in interface OperationStepHandler
context
- the operation contextoperation
- the operation being executedOperationFailedException
- if the operation failed before calling context.completeStep()
protected final void updateModel(org.jboss.dmr.ModelNode operation, org.jboss.dmr.ModelNode model) throws OperationFailedException
operation
- the operationmodel
- persistent configuration model node that corresponds to the address of operation
OperationFailedException
- if operation
is invalid or populating the model otherwise failsprotected abstract boolean applyUpdateToRuntime(OperationContext context, String handlerName, org.jboss.dmr.ModelNode model, org.jboss.dmr.ModelNode originalModel, T handler) throws OperationFailedException
context
- the context of the operationmodel
- the modeloriginalModel
- the original modelhandler
- the log handlertrue
if the server requires restart to effect the attribute
value change; false
if notOperationFailedException
protected abstract void revertUpdateToRuntime(OperationContext context, String handlerName, org.jboss.dmr.ModelNode model, org.jboss.dmr.ModelNode originalModel, T handler) throws OperationFailedException
#applyUpdateToRuntime(OperationContext, String, ModelNode, ModelNode, T)
.context
- the context of the operationmodel
- the modeloriginalModel
- the original modelhandler
- the log handlerOperationFailedException
protected boolean requiresRuntime(OperationContext context)
OperationContext.Stage#RUNTIME
handler should be added. This default implementation
returns true
if the context type
is OperationContext.Type#SERVER
and context.isBooting()
returns false
.context
- operation contexttrue
if a runtime stage handler should be added; false
otherwise.protected void copy(String name, org.jboss.dmr.ModelNode from, org.jboss.dmr.ModelNode to)
name
parameter, from one ModelNode
to another if the
from
parameter has the attributed defined. If the attribute was not defined, nothing happens.name
- the name of the attribute to copy.from
- the model node to copy the value from.to
- the model node to copy the value to.public final Collection<AttributeDefinition> getAttributes()
Copyright © 2012 JBoss, a division of Red Hat, Inc.. All Rights Reserved.