public class AbstractAddStepHandler extends Object implements OperationStepHandler
OperationStepHandler
implementations that add managed resource.Modifier and Type | Class and Description |
---|---|
static class |
AbstractAddStepHandler.Parameters |
Modifier and Type | Field and Description |
---|---|
protected Collection<? extends AttributeDefinition> |
attributes |
Constructor and Description |
---|
AbstractAddStepHandler()
Constructs an add handler.
|
AbstractAddStepHandler(AbstractAddStepHandler.Parameters parameters) |
AbstractAddStepHandler(AttributeDefinition... attributes)
Constructs an add handler
|
AbstractAddStepHandler(Collection<? extends AttributeDefinition> attributes)
Constructs an add handler
|
AbstractAddStepHandler(RuntimeCapability capability,
AttributeDefinition... attributes)
Constructs an add handler
|
AbstractAddStepHandler(RuntimeCapability capability,
Collection<? extends AttributeDefinition> attributes)
Constructs an add handler
|
AbstractAddStepHandler(Set<RuntimeCapability> capabilities,
AttributeDefinition... attributes)
Constructs an add handler
|
AbstractAddStepHandler(Set<RuntimeCapability> capabilities,
Collection<? extends AttributeDefinition> attributes)
Constructs an add handler.
|
Modifier and Type | Method and Description |
---|---|
protected Resource |
createResource(OperationContext context)
Create the
Resource that the execute(OperationContext, ModelNode)
method operates on. |
protected Resource |
createResource(OperationContext context,
org.jboss.dmr.ModelNode operation)
Create the
Resource that the execute(OperationContext, ModelNode)
method operates on. |
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)
Make any runtime changes necessary to effect the changes indicated by the given
operation . |
protected void |
performRuntime(OperationContext context,
org.jboss.dmr.ModelNode operation,
org.jboss.dmr.ModelNode model,
ServiceVerificationHandler verificationHandler,
List<org.jboss.msc.service.ServiceController<?>> newControllers)
Deprecated.
instead override one of the non-deprecated overloaded variants
|
protected void |
performRuntime(OperationContext context,
org.jboss.dmr.ModelNode operation,
Resource resource)
Make any runtime changes necessary to effect the changes indicated by the given
operation . |
protected void |
populateModel(org.jboss.dmr.ModelNode operation,
org.jboss.dmr.ModelNode model)
Populate the given node in the persistent configuration model based on the values in the given operation.
|
protected void |
populateModel(org.jboss.dmr.ModelNode operation,
Resource resource)
Populate the given resource in the persistent configuration model based on the values in the given operation.
|
protected void |
populateModel(OperationContext context,
org.jboss.dmr.ModelNode operation,
Resource resource)
Populate the given resource in the persistent configuration model based on the values in the given operation.
|
protected void |
recordCapabilitiesAndRequirements(OperationContext context,
org.jboss.dmr.ModelNode operation,
Resource resource)
Record any new
capabilities that are available as
a result of this operation, as well as any requirements for other capabilities that now exist. |
protected boolean |
requiresRuntime(OperationContext context)
Gets whether a
OperationContext.Stage.RUNTIME step should be added to call
performRuntime(OperationContext, org.jboss.dmr.ModelNode, org.jboss.as.controller.registry.Resource) }. |
protected boolean |
requiresRuntimeVerification()
Deprecated.
has no effect
|
protected void |
rollbackRuntime(OperationContext context,
org.jboss.dmr.ModelNode operation,
org.jboss.dmr.ModelNode model,
List<org.jboss.msc.service.ServiceController<?>> controllers)
Deprecated.
|
protected void |
rollbackRuntime(OperationContext context,
org.jboss.dmr.ModelNode operation,
Resource resource)
Rollback runtime changes made in
performRuntime(OperationContext, org.jboss.dmr.ModelNode, org.jboss.as.controller.registry.Resource) . |
protected final Collection<? extends AttributeDefinition> attributes
public AbstractAddStepHandler()
public AbstractAddStepHandler(Collection<? extends AttributeDefinition> attributes)
attributes
- attributes to use in populateModel(OperationContext, org.jboss.dmr.ModelNode, org.jboss.as.controller.registry.Resource)
.attributes to use in populateModel(OperationContext, org.jboss.dmr.ModelNode, org.jboss.as.controller.registry.Resource)
public AbstractAddStepHandler(RuntimeCapability capability, Collection<? extends AttributeDefinition> attributes)
capability
- capability to register in recordCapabilitiesAndRequirements(OperationContext, org.jboss.dmr.ModelNode, org.jboss.as.controller.registry.Resource)
null
is allowedattributes
- attributes to use in populateModel(OperationContext, org.jboss.dmr.ModelNode, org.jboss.as.controller.registry.Resource)
.attributes to use in populateModel(OperationContext, org.jboss.dmr.ModelNode, org.jboss.as.controller.registry.Resource)
public AbstractAddStepHandler(Set<RuntimeCapability> capabilities, Collection<? extends AttributeDefinition> attributes)
capabilities
- capabilities to register in recordCapabilitiesAndRequirements(OperationContext, org.jboss.dmr.ModelNode, org.jboss.as.controller.registry.Resource)
null
is allowedattributes
- attributes to use in populateModel(OperationContext, org.jboss.dmr.ModelNode, org.jboss.as.controller.registry.Resource)
public AbstractAddStepHandler(RuntimeCapability capability, AttributeDefinition... attributes)
capability
- capability to register in recordCapabilitiesAndRequirements(OperationContext, org.jboss.dmr.ModelNode, org.jboss.as.controller.registry.Resource)
null
is allowedattributes
- attributes to use in populateModel(OperationContext, org.jboss.dmr.ModelNode, org.jboss.as.controller.registry.Resource)
public AbstractAddStepHandler(AttributeDefinition... attributes)
attributes
- attributes to use in populateModel(OperationContext, org.jboss.dmr.ModelNode, org.jboss.as.controller.registry.Resource)
public AbstractAddStepHandler(Set<RuntimeCapability> capabilities, AttributeDefinition... attributes)
capabilities
- capabilities to register in recordCapabilitiesAndRequirements(OperationContext, org.jboss.dmr.ModelNode, org.jboss.as.controller.registry.Resource)
null
is allowedattributes
- attributes to use in populateModel(OperationContext, org.jboss.dmr.ModelNode, org.jboss.as.controller.registry.Resource)
public AbstractAddStepHandler(AbstractAddStepHandler.Parameters parameters)
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 Resource createResource(OperationContext context, org.jboss.dmr.ModelNode operation)
Resource
that the execute(OperationContext, ModelNode)
method operates on. This method is invoked during OperationContext.Stage.MODEL
.
This default implementation uses the default resource creation facility exposed by the context
. Subclasses wishing to create a custom resource
type can override this method.
context
- the operation contextoperation
- the operationprotected Resource createResource(OperationContext context)
Resource
that the execute(OperationContext, ModelNode)
method operates on. This method is invoked during OperationContext.Stage.MODEL
.
This default implementation uses the default resource creation facility exposed by the context
. Subclasses wishing to create a custom resource
type can override this method.
context
- the operation contextprotected void populateModel(OperationContext context, org.jboss.dmr.ModelNode operation, Resource resource) throws OperationFailedException
OperationContext.Stage.MODEL
.
This default implementation simply calls populateModel(ModelNode, org.jboss.as.controller.registry.Resource)
.
context
- the operation contextoperation
- the operationresource
- the resource that corresponds to the address of operation
OperationFailedException
- if operation
is invalid or populating the model otherwise failsprotected void populateModel(org.jboss.dmr.ModelNode operation, Resource resource) throws OperationFailedException
OperationContext.Stage.MODEL
.
This default implementation simply calls populateModel(ModelNode, org.jboss.dmr.ModelNode)
.
operation
- the operationresource
- the resource that corresponds to the address of operation
OperationFailedException
- if operation
is invalid or populating the model otherwise failsprotected void populateModel(org.jboss.dmr.ModelNode operation, org.jboss.dmr.ModelNode model) throws OperationFailedException
OperationContext.Stage.MODEL
.
This default implementation invokes AttributeDefinition.validateAndSet(org.jboss.dmr.ModelNode, org.jboss.dmr.ModelNode)
on any attributes passed to the constructor.
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 void recordCapabilitiesAndRequirements(OperationContext context, org.jboss.dmr.ModelNode operation, Resource resource) throws OperationFailedException
capabilities
that are available as
a result of this operation, as well as any requirements for other capabilities that now exist. This method is
invoked during OperationContext.Stage.MODEL
.
Any changes made by this method will automatically be discarded if the operation rolls back.
This default implementation registers any capabilities provided to the constructor and asks any
AttributeDefinition
provided to the constructor to
add capability requirements
.
context
- the context. Will not be null
operation
- the operation that is executing Will not be null
resource
- the resource that has been added. Will reflect any updates made by
populateModel(OperationContext, org.jboss.dmr.ModelNode, org.jboss.as.controller.registry.Resource)
. Will
not be null
OperationFailedException
protected boolean requiresRuntime(OperationContext context)
OperationContext.Stage.RUNTIME
step should be added to call
performRuntime(OperationContext, org.jboss.dmr.ModelNode, org.jboss.as.controller.registry.Resource)
}.
This default implementation will return true
for a normal server running in normal (non admin-only) mode.
If running on a host controller, it will return true
if it is the active copy of the host controller subsystem.
Subclasses that perform no runtime update could override and return false
. This method is
invoked during OperationContext.Stage.MODEL
.context
- operation contexttrue
if performRuntime
should be invoked; false
otherwise.@Deprecated protected boolean requiresRuntimeVerification()
true
protected void performRuntime(OperationContext context, org.jboss.dmr.ModelNode operation, Resource resource) throws OperationFailedException
operation
. Executes
after populateModel(org.jboss.dmr.ModelNode, org.jboss.dmr.ModelNode)
, so the given resource
parameter will reflect any changes made in that method. This method is
invoked during OperationContext.Stage.RUNTIME
. Subclasses that wish to make
changes to runtime services should override either this method or the
performRuntime(OperationContext, org.jboss.dmr.ModelNode, org.jboss.dmr.ModelNode)
variant. Override
this one if you wish to make use of the resource
parameter beyond simply
accessing its model property
.
This default implementation simply calls the
performRuntime(OperationContext, org.jboss.dmr.ModelNode, org.jboss.dmr.ModelNode)
variant.
Subclasses that override this method should not call super.performRuntime(...)
.
context
- the operation contextoperation
- the operation being executedresource
- persistent configuration resource that corresponds to the address of operation
OperationFailedException
- if operation
is invalid or updating the runtime otherwise failsprotected void performRuntime(OperationContext context, org.jboss.dmr.ModelNode operation, org.jboss.dmr.ModelNode model) throws OperationFailedException
operation
. Executes
after populateModel(org.jboss.dmr.ModelNode, org.jboss.dmr.ModelNode)
, so the given resource
parameter will reflect any changes made in that method. This method is
invoked during OperationContext.Stage.RUNTIME
. Subclasses that wish to make
changes to runtime services should override this method or the
performRuntime(OperationContext, org.jboss.dmr.ModelNode, org.jboss.as.controller.registry.Resource)
variant.
To provide compatible behavior with previous releases, this default implementation calls the deprecated
performRuntime(OperationContext, org.jboss.dmr.ModelNode, org.jboss.dmr.ModelNode, ServiceVerificationHandler, java.util.List)
method. It then does nothing with the objects referenced by the verificationHandler
and
controllers
parameters passed to that method. Subclasses that overrode that method are encouraged to
instead override this one or the performRuntime(OperationContext, org.jboss.dmr.ModelNode, org.jboss.as.controller.registry.Resource)
variant. Subclasses that override this method should not callsuper.performRuntime(...)
.
context
- the operation contextoperation
- the operation being executedmodel
- persistent configuration model from the resource that corresponds to the address of operation
OperationFailedException
- if operation
is invalid or updating the runtime otherwise fails@Deprecated 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
performRuntime(OperationContext, org.jboss.dmr.ModelNode, org.jboss.as.controller.registry.Resource)
or performRuntime(OperationContext, org.jboss.dmr.ModelNode, org.jboss.dmr.ModelNode)
.
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
- not used; service verification is performed automaticallynewControllers
- not used; removal of added services during rollback is performed automatically.OperationFailedException
- if operation
is invalid or updating the runtime otherwise failsprotected void rollbackRuntime(OperationContext context, org.jboss.dmr.ModelNode operation, Resource resource)
performRuntime(OperationContext, org.jboss.dmr.ModelNode, org.jboss.as.controller.registry.Resource)
.
Any services that were added in OperationContext.Stage.RUNTIME
will be automatically removed after this
method executes. Called from the OperationContext.ResultHandler
or
OperationContext.RollbackHandler
passed to OperationContext.completeStep(...)
.
To provide compatible behavior with previous releases, this default implementation calls the deprecated
rollbackRuntime(OperationContext, org.jboss.dmr.ModelNode, org.jboss.dmr.ModelNode, java.util.List)
variant, passing in an empty list for the controllers
parameter. Subclasses that overrode that method are
encouraged to instead override this one. Subclasses that override this method should not call
super.rollbackRuntime(...).
context
- the operation contextoperation
- the operation being executedresource
- persistent configuration model node that corresponds to the address of operation
@Deprecated protected void rollbackRuntime(OperationContext context, org.jboss.dmr.ModelNode operation, org.jboss.dmr.ModelNode model, List<org.jboss.msc.service.ServiceController<?>> controllers)
rollbackRuntime(OperationContext, org.jboss.dmr.ModelNode, org.jboss.as.controller.registry.Resource)
rollbackRuntime(OperationContext, org.jboss.dmr.ModelNode, org.jboss.as.controller.registry.Resource)
.
This default implementation does nothing. Subclasses that override this method should not call
super.performRuntime(...)
.
context
- the operation contextoperation
- the operation being executedmodel
- persistent configuration model node that corresponds to the address of operation
controllers
- will always be an empty listCopyright © 2023 JBoss by Red Hat. All rights reserved.