org.rhq.core.pc.drift
Class DriftManager

java.lang.Object
  extended by org.rhq.core.pc.agent.AgentService
      extended by org.rhq.core.pc.drift.DriftManager
All Implemented Interfaces:
DriftAgentService, ContainerService, DriftClient

public class DriftManager
extends AgentService
implements DriftAgentService, DriftClient, ContainerService


Nested Class Summary
 
Nested classes/interfaces inherited from class org.rhq.core.pc.agent.AgentService
AgentService.LifecycleState
 
Constructor Summary
DriftManager()
           
 
Method Summary
 void ackChangeSet(int resourceId, String defName)
           
 void ackChangeSetContent(int resourceId, String driftDefName, String token)
           
 void detectDrift(int resourceId, org.rhq.core.domain.drift.DriftDefinition driftDefinition)
           
 File getAbsoluteBaseDirectory(int resourceId, org.rhq.core.domain.drift.DriftDefinition driftDefinition)
          Given a drift definition, this examines the def and its associated resource to determine where exactly the base directory is that should be monitoried.
protected  InventoryManager getInventoryManager()
          Returns the manager that can provide data on the inventory.
protected  MeasurementManager getMeasurementManager()
          Returns the manager that can provide data on the measurements/metrics.
 ScheduleQueue getSchedulesQueue()
          This method is provided as a test hook.
 void initialize()
          Initializes the container service which will effectively tell the service to start doing its work.
 boolean isInitialized()
           
 void pinSnapshot(int resourceId, String defName, org.rhq.core.domain.drift.DriftSnapshot snapshot)
           
 void repeatChangeSet(int resourceId, String driftDefName, int version)
           
 void reportMissingBaseDir(int resourceId, org.rhq.core.domain.drift.DriftDefinition driftDefinition)
           
 boolean requestDriftFiles(int resourceId, Headers headers, List<? extends org.rhq.core.domain.drift.DriftFile> driftFiles)
           
 void scanForContentToResend()
          Scans the changesets directory for any change set content zip files.
 void scheduleDriftDetection(int resourceId, org.rhq.core.domain.drift.DriftDefinition driftDefinition)
           
 void sendChangeSetContentToServer(int resourceId, String driftDefName, File contentZipFile)
          Sends requested content to the server.
 void sendChangeSetToServer(DriftDetectionSummary detectionSummary)
           
 void setConfiguration(PluginContainerConfiguration configuration)
          Informs the container service how it should be configured by providing the full plugin container configuration.
 void shutdown()
          Stops the container service which effectively releases all runtime resources such as running threads.
 void unscheduleDriftDetection(int resourceId, org.rhq.core.domain.drift.DriftDefinition driftDefinition)
           
 void updateDriftDetection(int resourceId, org.rhq.core.domain.drift.DriftDefinition driftDefinition)
           
 void updateDriftDetection(int resourceId, org.rhq.core.domain.drift.DriftDefinition driftDef, org.rhq.core.domain.drift.DriftSnapshot driftSnapshot)
           
 
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

DriftManager

public DriftManager()
Method Detail

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

isInitialized

public boolean isInitialized()

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

scanForContentToResend

public void scanForContentToResend()
Scans the changesets directory for any change set content zip files. This method assumes that any content zip files found have not been received or persisted by the server. Each content zip file is resent to the server.


getSchedulesQueue

public ScheduleQueue getSchedulesQueue()
This method is provided as a test hook.

Returns:
The schedule queue

shutdown

public void shutdown()
Description copied from interface: ContainerService
Stops the container service which effectively releases all runtime resources such as running threads.

Specified by:
shutdown in interface ContainerService

sendChangeSetToServer

public void sendChangeSetToServer(DriftDetectionSummary detectionSummary)
Specified by:
sendChangeSetToServer in interface DriftClient

sendChangeSetContentToServer

public void sendChangeSetContentToServer(int resourceId,
                                         String driftDefName,
                                         File contentZipFile)
Description copied from interface: DriftClient
Sends requested content to the server. All of the files in the content directory are zipped up, and the zip file is sent to the server. After the zip file is sent to the server, the content directory is purged.

Specified by:
sendChangeSetContentToServer in interface DriftClient

repeatChangeSet

public void repeatChangeSet(int resourceId,
                            String driftDefName,
                            int version)
Specified by:
repeatChangeSet in interface DriftClient

detectDrift

public void detectDrift(int resourceId,
                        org.rhq.core.domain.drift.DriftDefinition driftDefinition)
Specified by:
detectDrift in interface DriftAgentService

scheduleDriftDetection

public void scheduleDriftDetection(int resourceId,
                                   org.rhq.core.domain.drift.DriftDefinition driftDefinition)
Specified by:
scheduleDriftDetection in interface DriftAgentService

requestDriftFiles

public boolean requestDriftFiles(int resourceId,
                                 Headers headers,
                                 List<? extends org.rhq.core.domain.drift.DriftFile> driftFiles)
Specified by:
requestDriftFiles in interface DriftAgentService

unscheduleDriftDetection

public void unscheduleDriftDetection(int resourceId,
                                     org.rhq.core.domain.drift.DriftDefinition driftDefinition)
Specified by:
unscheduleDriftDetection in interface DriftAgentService

updateDriftDetection

public void updateDriftDetection(int resourceId,
                                 org.rhq.core.domain.drift.DriftDefinition driftDefinition)
Specified by:
updateDriftDetection in interface DriftAgentService

updateDriftDetection

public void updateDriftDetection(int resourceId,
                                 org.rhq.core.domain.drift.DriftDefinition driftDef,
                                 org.rhq.core.domain.drift.DriftSnapshot driftSnapshot)
Specified by:
updateDriftDetection in interface DriftAgentService

reportMissingBaseDir

public void reportMissingBaseDir(int resourceId,
                                 org.rhq.core.domain.drift.DriftDefinition driftDefinition)
Specified by:
reportMissingBaseDir in interface DriftClient

pinSnapshot

public void pinSnapshot(int resourceId,
                        String defName,
                        org.rhq.core.domain.drift.DriftSnapshot snapshot)
Specified by:
pinSnapshot in interface DriftAgentService

ackChangeSet

public void ackChangeSet(int resourceId,
                         String defName)
Specified by:
ackChangeSet in interface DriftAgentService

ackChangeSetContent

public void ackChangeSetContent(int resourceId,
                                String driftDefName,
                                String token)
Specified by:
ackChangeSetContent in interface DriftAgentService

getAbsoluteBaseDirectory

public File getAbsoluteBaseDirectory(int resourceId,
                                     org.rhq.core.domain.drift.DriftDefinition driftDefinition)
Given a drift definition, this examines the def and its associated resource to determine where exactly the base directory is that should be monitoried.

Specified by:
getAbsoluteBaseDirectory in interface DriftClient
Parameters:
resourceId - The id of the resource to which the def belongs
driftDefinition - describes what is to be monitored for drift
Returns:
absolute directory location where the drift def base directory is referring

getInventoryManager

protected InventoryManager getInventoryManager()
Returns the manager that can provide data on the inventory. This is a separate protected method so we can extend our manger class to have a mock manager for testing.

Returns:
the inventory manager

getMeasurementManager

protected MeasurementManager getMeasurementManager()
Returns the manager that can provide data on the measurements/metrics. This is a separate protected method so we can extend our manger class to have a mock manager for testing.

Returns:
the inventory manager


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