public abstract class RestartParentResourceHandlerBase extends Object implements OperationStepHandler
Modifier | Constructor and Description |
---|---|
protected |
RestartParentResourceHandlerBase(String parentKeyName) |
Modifier and Type | Method and 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)
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.
|
protected RestartParentResourceHandlerBase(String parentKeyName)
public void execute(OperationContext context, org.jboss.dmr.ModelNode operation) throws OperationFailedException
OperationStepHandler
context.getFailureDescription()
must be called, or an OperationFailedException
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 the
context.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.
execute
in interface OperationStepHandler
context
- the operation contextoperation
- the operation being executedOperationFailedException
- if the operation failed before calling context.completeStep()
protected boolean requiresRuntime(OperationContext context)
true
if OperationContext#getProcessType()#isHostController()
is false.context
- the operation contexttrue
if the operation should update the runtime; false
if it only updates the configuration
modelprotected 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 updateModel(OperationContext context, org.jboss.dmr.ModelNode operation) throws OperationFailedException
context
- the operation contextoperation
- the operationOperationFailedException
- if there is a problem updating the modelprotected void rollbackRuntime(OperationContext context, org.jboss.dmr.ModelNode operation, Resource resource)
context
- the operation contextoperation
- the operationresource
- the resourceprotected 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)
parentAddress
- the address of the parent resourceprotected PathAddress getParentAddress(PathAddress address)
Copyright © 2021 JBoss by Red Hat. All rights reserved.