public abstract class AbstractModelUpdateHandler extends Object implements OperationStepHandler
OperationStepHandler
implementations for updating an existing managed resource.Constructor and Description |
---|
AbstractModelUpdateHandler() |
Modifier and Type | Method and Description |
---|---|
void |
execute(OperationContext context,
org.jboss.dmr.ModelNode operation)
{@inheritDoc
|
protected void |
performRuntime(OperationContext context,
org.jboss.dmr.ModelNode operation,
org.jboss.dmr.ModelNode model,
ServiceVerificationHandler verificationHandler,
List<org.jboss.msc.service.ServiceController<?>> newControllers)
Make any runtime changes necessary to effect the changes indicated by the given
operation . |
protected boolean |
requiresRuntime(OperationContext context)
Gets whether
performRuntime(OperationContext, org.jboss.dmr.ModelNode, org.jboss.dmr.ModelNode, ServiceVerificationHandler, java.util.List) }
should be called. |
protected boolean |
requiresRuntimeVerification()
Gets whether the
ServiceVerificationHandler parameter passed to
performRuntime(OperationContext, org.jboss.dmr.ModelNode, org.jboss.dmr.ModelNode, ServiceVerificationHandler, java.util.List)
should be added to the operation context as a step. |
protected void |
rollbackRuntime(OperationContext context,
org.jboss.dmr.ModelNode operation,
org.jboss.dmr.ModelNode model,
List<org.jboss.msc.service.ServiceController<?>> controllers)
Rollback runtime changes made in
performRuntime(OperationContext, org.jboss.dmr.ModelNode, org.jboss.dmr.ModelNode, ServiceVerificationHandler, java.util.List) . |
protected abstract 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.
|
protected void |
updateModel(org.jboss.dmr.ModelNode operation,
Resource resource)
Update the given resource in the persistent configuration model based on the values in the given operation.
|
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 void updateModel(org.jboss.dmr.ModelNode operation, Resource resource) throws OperationFailedException
operation
- the operationresource
- the resource that corresponds to the address of operation
OperationFailedException
- if operation
is invalid or populating the model otherwise failsprotected abstract 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 boolean requiresRuntime(OperationContext context)
performRuntime(OperationContext, org.jboss.dmr.ModelNode, org.jboss.dmr.ModelNode, ServiceVerificationHandler, java.util.List)
}
should be called.context
- operation contexttrue
if performRuntime
should be invoked; false
otherwise.protected boolean requiresRuntimeVerification()
ServiceVerificationHandler
parameter passed to
performRuntime(OperationContext, org.jboss.dmr.ModelNode, org.jboss.dmr.ModelNode, ServiceVerificationHandler, java.util.List)
should be added to the operation context as a step.
This default implementation always returns true
.
true
if the service verification step should be added; false
if it's not necessary.protected void performRuntime(OperationContext context, org.jboss.dmr.ModelNode operation, org.jboss.dmr.ModelNode model, ServiceVerificationHandler verificationHandler, List<org.jboss.msc.service.ServiceController<?>> newControllers) throws OperationFailedException
operation
. Executes
after updateModel(org.jboss.dmr.ModelNode, org.jboss.dmr.ModelNode)
, so the given model
parameter will reflect any changes made in that method.
This default implementation does nothing.
context
- the operation contextoperation
- the operation being executedmodel
- persistent configuration model node that corresponds to the address of operation
verificationHandler
- step handler that can be added as a listener to any new services installed in order to
validate the services installed correctly during the
VERIFY stage
newControllers
- holder for the ServiceController
for any new services installed by the method. The
method should add the ServiceController
for any new services to this list. If the
overall operation needs to be rolled back, the list will be used in
rollbackRuntime(OperationContext, ModelNode, ModelNode, java.util.List)
to automatically removed
the newly added servicesOperationFailedException
- if operation
is invalid or updating the runtime otherwise failsprotected void rollbackRuntime(OperationContext context, org.jboss.dmr.ModelNode operation, org.jboss.dmr.ModelNode model, List<org.jboss.msc.service.ServiceController<?>> controllers)
performRuntime(OperationContext, org.jboss.dmr.ModelNode, org.jboss.dmr.ModelNode, ServiceVerificationHandler, java.util.List)
.
This default implementation removes all services in the given list of controllers
. The contents of
controllers
is the same as what was in the newControllers
parameter passed to performRuntime()
when that method returned.
context
- the operation contextoperation
- the operation being executedmodel
- persistent configuration model node that corresponds to the address of operation
controllers
- holder for the ServiceController
for any new services installed by
performRuntime(OperationContext, org.jboss.dmr.ModelNode, org.jboss.dmr.ModelNode, ServiceVerificationHandler, java.util.List)
Copyright © 2013 JBoss, a division of Red Hat, Inc.. All rights reserved.