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 |
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, validateUpdatedModelpublic 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
AbstractWriteAttributeHandlerapplyUpdateToRuntime 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 any ValueExpression has been resolvedcurrentValue - 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 notOperationFailedExceptionprotected 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; falseprotected 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
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 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
AbstractWriteAttributeHandlerAbstractWriteAttributeHandler.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
implementationOperationFailedExceptionCopyright © 2019 JBoss by Red Hat. All rights reserved.