Class RestartParentResourceHandlerBase

    • Constructor Detail

      • RestartParentResourceHandlerBase

        protected RestartParentResourceHandlerBase​(String parentKeyName)
    • Method Detail

      • requiresRuntime

        protected boolean requiresRuntime​(OperationContext context)
        Gets whether this operation needs to update the runtime. The default implementation returns true 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 whether the context allows resource service restarts; subclasses could also check the state of the service.
        Parameters:
        context - the operation context
        service - 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 simply instructs the context to remove the parentService. Subclasses could use the provided parentModel to identify and remove other services.
        Parameters:
        context - the operation context
        parentService - the name of the parent service
        parentModel - 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 context
        operation - 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 context
        operation - the operation
        resource - 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 resource
        parentModel - 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.
        Recreate the parent service(s) using the given model.
        Parameters:
        context - the operation context
        parentAddress - the address of the parent resource
        parentModel - 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