org.rhq.core.pc.operation
Class OperationManager

java.lang.Object
  extended by org.rhq.core.pc.agent.AgentService
      extended by org.rhq.core.pc.operation.OperationManager
All Implemented Interfaces:
OperationAgentService, ContainerService

public class OperationManager
extends AgentService
implements OperationAgentService, ContainerService

Manages the scheduling and invocation of operations for all resources across all plugins.

This is an agent service; its interface is made remotely accessible if this is deployed within the agent.

Author:
Ian Springer, John Mazzitelli

Nested Class Summary
 
Nested classes/interfaces inherited from class org.rhq.core.pc.agent.AgentService
AgentService.LifecycleState
 
Constructor Summary
OperationManager()
           
 
Method Summary
 CancelResults cancelOperation(String jobId)
           
protected  OperationFacet getOperationFacet(int resourceId, long facetMethodTimeout)
          Given a resource, this obtains that resource's OperationFacet interface.
protected  org.rhq.core.domain.resource.ResourceType getResourceType(int resourceId)
          Given a resource ID, this obtains that resource's type.
 void initialize()
          Initializes the container service which will effectively tell the service to start doing its work.
 void invokeOperation(String jobId, int resourceId, String operationName, org.rhq.core.domain.configuration.Configuration parameterConfig)
           
protected  void invokeOperation(String jobId, int resourceId, String operationName, org.rhq.core.domain.configuration.Configuration parameterConfig, OperationServerService operationServerService)
          Not tying this call to a particular OperationServerService implementation allows other internal classes to call this method and receive the results, rather than having them sent to the server.
 void setConfiguration(PluginContainerConfiguration configuration)
          Informs the container service how it should be configured by providing the full plugin container configuration.
 void shutdown()
          This will shutdown the operation thread pool and attempt to cancel operations already in progress.
 
Methods inherited from class org.rhq.core.pc.agent.AgentService
addLifecycleListener, getClientInterface, notifyLifecycleListenersOfNewState, remoteInputStream, remoteOutputStream, removeLifecycleListener, setAgentServiceStreamRemoter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OperationManager

public OperationManager()
Method Detail

initialize

public void initialize()
Description copied from interface: ContainerService
Initializes the container service which will effectively tell the service to start doing its work. Implementations of this interface can be assured that prior to this method being called, a non-null configuration will be set via a call to ContainerService.setConfiguration(PluginContainerConfiguration).

Specified by:
initialize in interface ContainerService

shutdown

public void shutdown()
This will shutdown the operation thread pool and attempt to cancel operations already in progress. Note that when this method returns, you are not guaranteed that all operations are finished. If there were one or more long-lived operations that do not want to be canceled (that is, they ignore the thread interrupt they will receive and do not terminate promptly), those operations will still be running when this returns.

Specified by:
shutdown in interface ContainerService
See Also:
ContainerService.shutdown()

setConfiguration

public void setConfiguration(PluginContainerConfiguration configuration)
Description copied from interface: ContainerService
Informs the container service how it should be configured by providing the full plugin container configuration. The plugin container will ensure it passes in a non-null configuration object so implementations of this interface should never have to worry about a null configuration parameter value.

Specified by:
setConfiguration in interface ContainerService

invokeOperation

public void invokeOperation(@NotNull
                            String jobId,
                            int resourceId,
                            @NotNull
                            String operationName,
                            @Nullable
                            org.rhq.core.domain.configuration.Configuration parameterConfig)
                     throws PluginContainerException
Specified by:
invokeOperation in interface OperationAgentService
Throws:
PluginContainerException

invokeOperation

protected void invokeOperation(String jobId,
                               int resourceId,
                               String operationName,
                               org.rhq.core.domain.configuration.Configuration parameterConfig,
                               OperationServerService operationServerService)
                        throws PluginContainerException
Not tying this call to a particular OperationServerService implementation allows other internal classes to call this method and receive the results, rather than having them sent to the server.

Throws:
PluginContainerException

cancelOperation

public CancelResults cancelOperation(String jobId)
Specified by:
cancelOperation in interface OperationAgentService

getOperationFacet

protected OperationFacet getOperationFacet(int resourceId,
                                           long facetMethodTimeout)
                                    throws PluginContainerException
Given a resource, this obtains that resource's OperationFacet interface. If it does not support the operation facet, an exception is thrown. The resource does *not* need to be in the STARTED (i.e. connected) state.

Parameters:
resourceId - identifies the resource that is to have the operation invoked on it
Returns:
the resource's operation facet component
Throws:
PluginContainerException - on error

getResourceType

protected org.rhq.core.domain.resource.ResourceType getResourceType(int resourceId)
                                                             throws PluginContainerException
Given a resource ID, this obtains that resource's type.

Parameters:
resourceId - identifies the resource whose type is to be returned
Returns:
the resource's type, if known
Throws:
PluginContainerException - if cannot determine the resource's type


Copyright © 2008-2012 Red Hat, Inc.. All Rights Reserved.