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>
SimpleAbstractWriteAttributeHandlerthat, 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)RestartParentWriteAttributeHandler(String parentKeyName, Collection<AttributeDefinition> definitions)Deprecated, for removal: This API element is subject to removal in a future version.UseRestartParentWriteAttributeHandler(String)instead.RestartParentWriteAttributeHandler(String parentKeyName, AttributeDefinition... definitions)Deprecated, for removal: This API element is subject to removal in a future version.UseRestartParentWriteAttributeHandler(String)instead.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected booleanapplyUpdateToRuntime(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 PathAddressgetParentAddress(PathAddress address)protected abstract org.jboss.msc.service.ServiceNamegetParentServiceName(PathAddress parentAddress)protected booleanisResourceServiceRestartAllowed(OperationContext context, org.jboss.msc.service.ServiceController<?> service)Gets whether a restart of the parent resource's services is allowed.protected voidrecreateParentService(OperationContext context, PathAddress parentAddress, org.jboss.dmr.ModelNode parentModel)Deprecated, for removal: This API element is subject to removal in a future version.Useinsteadprotected voidrecreateParentService(OperationContext context, org.jboss.dmr.ModelNode parentModel)Recreate the parent service(s) using the given model.protected voidremoveServices(OperationContext context, org.jboss.msc.service.ServiceName parentService, org.jboss.dmr.ModelNode parentModel)Removes services.protected voidrevertUpdateToRuntime(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)
-
RestartParentWriteAttributeHandler
@Deprecated(forRemoval=true) public RestartParentWriteAttributeHandler(String parentKeyName, AttributeDefinition... definitions)
Deprecated, for removal: This API element is subject to removal in a future version.UseRestartParentWriteAttributeHandler(String)instead.
-
RestartParentWriteAttributeHandler
@Deprecated(forRemoval=true) public RestartParentWriteAttributeHandler(String parentKeyName, Collection<AttributeDefinition> definitions)
Deprecated, for removal: This API element is subject to removal in a future version.UseRestartParentWriteAttributeHandler(String)instead.
-
-
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:AbstractWriteAttributeHandlerHook to allow subclasses to make runtime changes to effect the attribute value change.- Specified by:
applyUpdateToRuntimein 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 anyValueExpressionhas 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:
trueif the server requires reload to effect the attribute value change;falseif 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:
trueif 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 providedparentModelto 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.UseinsteadRecreate 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:AbstractWriteAttributeHandlerHook to allow subclasses to revert runtime changes made inAbstractWriteAttributeHandler.applyUpdateToRuntime(OperationContext, ModelNode, String, ModelNode, ModelNode, HandbackHolder).- Specified by:
revertUpdateToRuntimein 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 thehandbackHolderby theapplyUpdateToRuntimeimplementation- Throws:
OperationFailedException
-
-