Package org.jboss.as.controller
Class RestartParentWriteAttributeHandler
- java.lang.Object
-
- org.jboss.as.controller.AbstractWriteAttributeHandler<org.jboss.dmr.ModelNode>
-
- org.jboss.as.controller.RestartParentWriteAttributeHandler
-
- All Implemented Interfaces:
OperationStepHandler
public abstract class RestartParentWriteAttributeHandler extends AbstractWriteAttributeHandler<org.jboss.dmr.ModelNode>
SimpleAbstractWriteAttributeHandler
that, if allowed, restarts a parent resource when a change is made. Otherwise the server is put into a forced reload.- Author:
- Jason T. Greene.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.jboss.as.controller.AbstractWriteAttributeHandler
AbstractWriteAttributeHandler.HandbackHolder<T>
-
-
Constructor Summary
Constructors Constructor Description RestartParentWriteAttributeHandler(String parentKeyName, Collection<AttributeDefinition> definitions)
RestartParentWriteAttributeHandler(String parentKeyName, AttributeDefinition... definitions)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method 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)
Deprecated, for removal: This API element is subject to removal in a future version.Useinstead
protected void
recreateParentService(OperationContext context, 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 inAbstractWriteAttributeHandler.applyUpdateToRuntime(OperationContext, ModelNode, String, ModelNode, ModelNode, HandbackHolder)
.-
Methods inherited from class org.jboss.as.controller.AbstractWriteAttributeHandler
execute, finishModelStage, getAttributeDefinition, recordCapabilitiesAndRequirements, requiresRuntime, validateUpdatedModel
-
-
-
-
Constructor Detail
-
RestartParentWriteAttributeHandler
public RestartParentWriteAttributeHandler(String parentKeyName, AttributeDefinition... definitions)
-
RestartParentWriteAttributeHandler
public RestartParentWriteAttributeHandler(String parentKeyName, Collection<AttributeDefinition> definitions)
-
-
Method Detail
-
applyUpdateToRuntime
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
Description copied from class:AbstractWriteAttributeHandler
Hook to allow subclasses to make runtime changes to effect the attribute value change.- Specified by:
applyUpdateToRuntime
in classAbstractWriteAttributeHandler<org.jboss.dmr.ModelNode>
- Parameters:
context
- the context of the operationoperation
- the operationattributeName
- the name of the attribute being modifiedresolvedValue
- the new value for the attribute, after anyValueExpression
has been resolvedcurrentValue
- the existing value for the attributehandbackHolder
- holder for an arbitrary object to pass toAbstractWriteAttributeHandler.revertUpdateToRuntime(OperationContext, ModelNode, String, ModelNode, ModelNode, Object)
if the operation needs to be rolled back- Returns:
true
if the server requires reload to effect the attribute value change;false
if not- Throws:
OperationFailedException
-
isResourceServiceRestartAllowed
protected boolean isResourceServiceRestartAllowed(OperationContext context, org.jboss.msc.service.ServiceController<?> service)
Gets whether a restart of the parent resource's services is allowed. This default implementation checks whetherthe context allows resource service restarts
; subclasses could also check the state of theservice
.- Parameters:
context
- the operation contextservice
- the parent service- Returns:
true
if a restart is allowed;false
-
removeServices
protected void removeServices(OperationContext context, org.jboss.msc.service.ServiceName parentService, org.jboss.dmr.ModelNode parentModel) throws OperationFailedException
Removes services. This default implementation simplyinstructs the context to remove the parentService
. Subclasses could use the providedparentModel
to identify and remove other services.- Parameters:
context
- the operation contextparentService
- the name of the parent serviceparentModel
- the model associated with the parent resource, including nodes for any child resources- Throws:
OperationFailedException
- if there is a problem removing the services
-
recreateParentService
protected void recreateParentService(OperationContext context, org.jboss.dmr.ModelNode parentModel) throws OperationFailedException
Recreate the parent service(s) using the given model.- Parameters:
context
- the operation context relative to the parent resourceparentModel
- the current configuration model for the parent resource and its children- Throws:
OperationFailedException
- if there is a problem installing the services
-
recreateParentService
@Deprecated(forRemoval=true) protected void recreateParentService(OperationContext context, PathAddress parentAddress, org.jboss.dmr.ModelNode parentModel) throws OperationFailedException
Deprecated, for removal: This API element is subject to removal in a future version.Useinstead
Recreate the parent service(s) using the given model.- Parameters:
context
- the operation contextparentAddress
- the address of the parent resourceparentModel
- the current configuration model for the parent resource and its children- Throws:
OperationFailedException
- if there is a problem installing the services
-
getParentServiceName
protected abstract org.jboss.msc.service.ServiceName getParentServiceName(PathAddress parentAddress)
-
getParentAddress
protected PathAddress getParentAddress(PathAddress address)
-
revertUpdateToRuntime
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
Description copied from class:AbstractWriteAttributeHandler
Hook to allow subclasses to revert runtime changes made inAbstractWriteAttributeHandler.applyUpdateToRuntime(OperationContext, ModelNode, String, ModelNode, ModelNode, HandbackHolder)
.- Specified by:
revertUpdateToRuntime
in classAbstractWriteAttributeHandler<org.jboss.dmr.ModelNode>
- Parameters:
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 thehandbackHolder
by theapplyUpdateToRuntime
implementation- Throws:
OperationFailedException
-
-