public class ModelOnlyAddStepHandler extends AbstractAddStepHandler
add
operation that only manipulates the model. The original expected use is for
resources that have been dropped from recent versions, but for which configuration manageablity is retained in
order to allow use on legacy hosts in a managed domain. This handler would be used on the host controllers for
the newer version nodes (particularly the master host controller.)Constructor and Description |
---|
ModelOnlyAddStepHandler(AttributeDefinition... attributes)
Creates a new
ModelOnlyStepHandler that stores the given attributes to the model. |
Modifier and Type | Method and Description |
---|---|
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
UnsupportedOperationException . |
protected void |
populateModel(org.jboss.dmr.ModelNode operation,
org.jboss.dmr.ModelNode model)
Call
AttributeDefinition.validateAndSet(org.jboss.dmr.ModelNode, org.jboss.dmr.ModelNode) for each
attribute provided to the constructor
Populate the given node in the persistent configuration model based on the values in the given operation. |
protected boolean |
requiresRuntime(OperationContext context)
Returns
false . |
protected boolean |
requiresRuntimeVerification()
Returns
false . |
protected void |
rollbackRuntime(OperationContext context,
org.jboss.dmr.ModelNode operation,
org.jboss.dmr.ModelNode model,
List<org.jboss.msc.service.ServiceController<?>> controllers)
Throws
UnsupportedOperationException . |
createResource, execute, populateModel, populateModel
public ModelOnlyAddStepHandler(AttributeDefinition... attributes)
ModelOnlyStepHandler
that stores the given attributes to the model.attributes
- the attributesprotected void populateModel(org.jboss.dmr.ModelNode operation, org.jboss.dmr.ModelNode model) throws OperationFailedException
AttributeDefinition.validateAndSet(org.jboss.dmr.ModelNode, org.jboss.dmr.ModelNode)
for each
attribute provided to the constructor
Populate the given node in the persistent configuration model based on the values in the given operation.populateModel
in class AbstractAddStepHandler
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 final boolean requiresRuntime(OperationContext context)
false
.
Gets whether AbstractAddStepHandler.performRuntime(OperationContext, org.jboss.dmr.ModelNode, org.jboss.dmr.ModelNode, ServiceVerificationHandler, java.util.List)
}
should be called. This default implementation always returns true
. Subclasses that perform no runtime
update could override and return false
.requiresRuntime
in class AbstractAddStepHandler
context
- operation contexttrue
if performRuntime
should be invoked; false
otherwise.protected final boolean requiresRuntimeVerification()
false
.
Gets whether the ServiceVerificationHandler
parameter passed to
AbstractAddStepHandler.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
.
requiresRuntimeVerification
in class AbstractAddStepHandler
true
if the service verification step should be added; false
if it's not necessary.protected final 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
UnsupportedOperationException
.
Make any runtime changes necessary to effect the changes indicated by the given operation
. Executes
after AbstractAddStepHandler.populateModel(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.
performRuntime
in class AbstractAddStepHandler
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
AbstractAddStepHandler.rollbackRuntime(OperationContext, ModelNode, ModelNode, java.util.List)
to automatically removed
the newly added servicesOperationFailedException
- if operation
is invalid or updating the runtime otherwise failsprotected final void rollbackRuntime(OperationContext context, org.jboss.dmr.ModelNode operation, org.jboss.dmr.ModelNode model, List<org.jboss.msc.service.ServiceController<?>> controllers)
UnsupportedOperationException
.
Rollback runtime changes made in AbstractAddStepHandler.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.
rollbackRuntime
in class AbstractAddStepHandler
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
AbstractAddStepHandler.performRuntime(OperationContext, org.jboss.dmr.ModelNode, org.jboss.dmr.ModelNode, ServiceVerificationHandler, java.util.List)
Copyright © 2015 JBoss by Red Hat. All rights reserved.