Package org.jboss.as.controller
Class RestartParentResourceHandlerBase
- java.lang.Object
-
- org.jboss.as.controller.RestartParentResourceHandlerBase
-
- All Implemented Interfaces:
OperationStepHandler
- Direct Known Subclasses:
RestartParentResourceAddHandler
,RestartParentResourceRemoveHandler
public abstract class RestartParentResourceHandlerBase extends Object implements OperationStepHandler
Simple remove handler that, if allowed, restarts a parent resource when a child is removed. Otherwise the server is put into a forced reload.- Author:
- Jason T. Greene
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
RestartParentResourceHandlerBase(String parentKeyName)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
execute(OperationContext context, org.jboss.dmr.ModelNode operation)
Execute this step.protected PathAddress
getParentAddress(PathAddress address)
protected abstract org.jboss.msc.service.ServiceName
getParentServiceName(PathAddress parentAddress)
Gets the name of the parent service.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 boolean
requiresRuntime(OperationContext context)
Gets whether this operation needs to update the runtime.protected void
rollbackRuntime(OperationContext context, org.jboss.dmr.ModelNode operation, Resource resource)
Rollback the update.protected abstract void
updateModel(OperationContext context, org.jboss.dmr.ModelNode operation)
Performs the update to the persistent configuration model.
-
-
-
Constructor Detail
-
RestartParentResourceHandlerBase
protected RestartParentResourceHandlerBase(String parentKeyName)
-
-
Method Detail
-
execute
public void execute(OperationContext context, org.jboss.dmr.ModelNode operation) throws OperationFailedException
Description copied from interface:OperationStepHandler
Execute this step. If the operation fails,context.getFailureDescription()
must be called, or anOperationFailedException
must be thrown. If the operation succeeded and the operation provides a return value,context.getResult()
should be called and the result populated with the outcome. If the handler wishes to take further action once the result of the overall operation execution is known, one of thecontext.completeStep variants
should be called to register a callback. The callback will not be invoked if this method throws an exception.When this method is invoked the
thread context classloader
will be set to be the defining class loader of the class that implements this interface.- Specified by:
execute
in interfaceOperationStepHandler
- Parameters:
context
- the operation contextoperation
- the operation being executed- Throws:
OperationFailedException
- if the operation failed before callingcontext.completeStep()
-
requiresRuntime
protected boolean requiresRuntime(OperationContext context)
Gets whether this operation needs to update the runtime. The default implementation returnstrue
if {@link OperationContext#getProcessType()#isHostController()} is false.- Parameters:
context
- the operation context- Returns:
true
if the operation should update the runtime;false
if it only updates the configuration model
-
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
-
updateModel
protected abstract void updateModel(OperationContext context, org.jboss.dmr.ModelNode operation) throws OperationFailedException
Performs the update to the persistent configuration model.- Parameters:
context
- the operation contextoperation
- the operation- Throws:
OperationFailedException
- if there is a problem updating the model
-
rollbackRuntime
protected void rollbackRuntime(OperationContext context, org.jboss.dmr.ModelNode operation, Resource resource)
Rollback the update.- Parameters:
context
- the operation contextoperation
- the operationresource
- the resource
-
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)
Gets the name of the parent service.- Parameters:
parentAddress
- the address of the parent resource- Returns:
- the service name
-
getParentAddress
protected PathAddress getParentAddress(PathAddress address)
-
-