public abstract class RestartParentWriteAttributeHandler extends AbstractWriteAttributeHandler<org.jboss.dmr.ModelNode>
AbstractWriteAttributeHandler
that, if allowed,
restarts a parent resource when a change is made. Otherwise the server is put into a forced reload.AbstractWriteAttributeHandler.HandbackHolder<T>
Constructor and Description |
---|
RestartParentWriteAttributeHandler(String parentKeyName,
AttributeDefinition... definitions) |
RestartParentWriteAttributeHandler(String parentKeyName,
Collection<AttributeDefinition> definitions) |
Modifier and Type | Method and Description |
---|---|
protected boolean |
applyUpdateToRuntime(OperationContext context,
org.jboss.dmr.ModelNode operation,
String attributeName,
org.jboss.dmr.ModelNode resolvedValue,
org.jboss.dmr.ModelNode currentValue,
AbstractWriteAttributeHandler.HandbackHolder<org.jboss.dmr.ModelNode> handbackHolder)
Hook to allow subclasses to make runtime changes to effect the attribute value change.
|
protected PathAddress |
getParentAddress(PathAddress address) |
protected abstract org.jboss.msc.service.ServiceName |
getParentServiceName(PathAddress parentAddress) |
protected boolean |
isResourceServiceRestartAllowed(OperationContext context,
org.jboss.msc.service.ServiceController<?> service)
Gets whether a restart of the parent resource's services is allowed.
|
protected void |
recreateParentService(OperationContext context,
PathAddress parentAddress,
org.jboss.dmr.ModelNode parentModel)
Recreate the parent service(s) using the given model.
|
protected void |
recreateParentService(OperationContext context,
PathAddress parentAddress,
org.jboss.dmr.ModelNode parentModel,
ServiceVerificationHandler verificationHandler)
Deprecated.
|
protected void |
removeServices(OperationContext context,
org.jboss.msc.service.ServiceName parentService,
org.jboss.dmr.ModelNode parentModel)
Removes services.
|
protected void |
revertUpdateToRuntime(OperationContext context,
org.jboss.dmr.ModelNode operation,
String attributeName,
org.jboss.dmr.ModelNode valueToRestore,
org.jboss.dmr.ModelNode resolvedValue,
org.jboss.dmr.ModelNode invalidatedParentModel)
Hook to allow subclasses to revert runtime changes made in
AbstractWriteAttributeHandler.applyUpdateToRuntime(OperationContext, ModelNode, String, ModelNode, ModelNode, HandbackHolder) . |
execute, finishModelStage, getAttributeDefinition, recordCapabilitiesAndRequirements, requiresRuntime, validateUpdatedModel
public RestartParentWriteAttributeHandler(String parentKeyName, AttributeDefinition... definitions)
public RestartParentWriteAttributeHandler(String parentKeyName, Collection<AttributeDefinition> definitions)
protected boolean applyUpdateToRuntime(OperationContext context, org.jboss.dmr.ModelNode operation, String attributeName, org.jboss.dmr.ModelNode resolvedValue, org.jboss.dmr.ModelNode currentValue, AbstractWriteAttributeHandler.HandbackHolder<org.jboss.dmr.ModelNode> handbackHolder) throws OperationFailedException
AbstractWriteAttributeHandler
applyUpdateToRuntime
in class AbstractWriteAttributeHandler<org.jboss.dmr.ModelNode>
context
- the context of the operationoperation
- the operationattributeName
- the name of the attribute being modifiedresolvedValue
- the new value for the attribute, after ModelNode.resolve()
has been called on itcurrentValue
- the existing value for the attributehandbackHolder
- holder for an arbitrary object to pass to
AbstractWriteAttributeHandler.revertUpdateToRuntime(OperationContext, ModelNode, String, ModelNode, ModelNode, Object)
if
the operation needs to be rolled backtrue
if the server requires reload to effect the attribute
value change; false
if notOperationFailedException
protected boolean isResourceServiceRestartAllowed(OperationContext context, org.jboss.msc.service.ServiceController<?> service)
the context allows resource service restarts
;
subclasses could also check the state of the service
.context
- the operation contextservice
- the parent servicetrue
if a restart is allowed; false
protected void removeServices(OperationContext context, org.jboss.msc.service.ServiceName parentService, org.jboss.dmr.ModelNode parentModel) throws OperationFailedException
instructs the context to remove the parentService
.
Subclasses could use the provided parentModel
to identify and remove other services.context
- the operation contextparentService
- the name of the parent serviceparentModel
- the model associated with the parent resource, including nodes for any child resourcesOperationFailedException
- if there is a problem removing the servicesprotected void recreateParentService(OperationContext context, PathAddress parentAddress, org.jboss.dmr.ModelNode parentModel) throws OperationFailedException
To provide compatible behavior with previous releases, this default implementation calls the deprecated
recreateParentService(OperationContext, PathAddress, org.jboss.dmr.ModelNode, ServiceVerificationHandler)
method. It then does nothing with the objects referenced by the verificationHandler
parameter passed to
that method. Subclasses that overrode that method are encouraged to instead override this one.
Subclasses that override this method should not callsuper.recreateParentService(...)
.
context
- the operation contextparentAddress
- the address of the parent resourceparentModel
- the current configuration model for the parent resource and its childrenOperationFailedException
- if there is a problem installing the services@Deprecated protected void recreateParentService(OperationContext context, PathAddress parentAddress, org.jboss.dmr.ModelNode parentModel, ServiceVerificationHandler verificationHandler) throws OperationFailedException
recreateParentService(OperationContext, PathAddress, org.jboss.dmr.ModelNode)
recreateParentService(OperationContext, PathAddress, org.jboss.dmr.ModelNode)
instead.context
- the operation contextparentAddress
- the address of the parent resourceparentModel
- the current configuration model for the parent resource and its childrenverificationHandler
- does nothing; ignoredOperationFailedException
- if there is a problem installing the servicesprotected abstract org.jboss.msc.service.ServiceName getParentServiceName(PathAddress parentAddress)
protected PathAddress getParentAddress(PathAddress address)
protected void revertUpdateToRuntime(OperationContext context, org.jboss.dmr.ModelNode operation, String attributeName, org.jboss.dmr.ModelNode valueToRestore, org.jboss.dmr.ModelNode resolvedValue, org.jboss.dmr.ModelNode invalidatedParentModel) throws OperationFailedException
AbstractWriteAttributeHandler
AbstractWriteAttributeHandler.applyUpdateToRuntime(OperationContext, ModelNode, String, ModelNode, ModelNode, HandbackHolder)
.revertUpdateToRuntime
in class AbstractWriteAttributeHandler<org.jboss.dmr.ModelNode>
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 executedresolvedValue
- the new value for the attribute that should be revertedinvalidatedParentModel
- an object, if any, passed in to the handbackHolder
by the applyUpdateToRuntime
implementationOperationFailedException
Copyright © 2023 JBoss by Red Hat. All rights reserved.