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) |
RestartParentWriteAttributeHandler(String parentKeyName,
AttributeDefinition... definitions) |
RestartParentWriteAttributeHandler(String parentKeyName,
ParameterValidator validator) |
RestartParentWriteAttributeHandler(String parentKeyName,
ParameterValidator unresolvedValidator,
ParameterValidator resolvedValidator) |
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 abstract void |
recreateParentService(OperationContext context,
PathAddress parentAddress,
org.jboss.dmr.ModelNode parentModel,
ServiceVerificationHandler verificationHandler) |
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, getAttributeDefinition, requiresRuntime, validateResolvedValue, validateUnresolvedValue
public RestartParentWriteAttributeHandler(String parentKeyName)
public RestartParentWriteAttributeHandler(String parentKeyName, ParameterValidator validator)
public RestartParentWriteAttributeHandler(String parentKeyName, AttributeDefinition... definitions)
public RestartParentWriteAttributeHandler(String parentKeyName, ParameterValidator unresolvedValidator, ParameterValidator resolvedValidator)
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 restart 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 abstract void recreateParentService(OperationContext context, PathAddress parentAddress, org.jboss.dmr.ModelNode parentModel, ServiceVerificationHandler verificationHandler) throws OperationFailedException
OperationFailedException
protected 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 © 2013 JBoss, a division of Red Hat, Inc.. All Rights Reserved.