org.rhq.core.clientapi.agent.drift
Interface DriftAgentService


public interface DriftAgentService

The interface to agent's drift subsystem which allows the server to request the agent to perform drift-related tasks.

Author:
Jay Shaughnessy

Method Summary
 void ackChangeSet(int resourceId, String driftDefName)
          This method is invoked to inform the agent that the server has successfully persisted the last change set sent to the server for the specified drift definition.
 void ackChangeSetContent(int resourceId, String defName, String token)
          This method is invoked to inform the agent that the server has successfully persisted change set content that was previously sent to the server.
 void detectDrift(int resourceId, org.rhq.core.domain.drift.DriftDefinition driftDefinition)
          Schedule drift detection to occur immediately.
 void pinSnapshot(int resourceId, String defName, org.rhq.core.domain.drift.DriftSnapshot snapshot)
           
 boolean requestDriftFiles(int resourceId, Headers headers, List<? extends org.rhq.core.domain.drift.DriftFile> driftFiles)
          Ask the agent to send the requested drift file content as a zip of all requested files.
 void scheduleDriftDetection(int resourceId, org.rhq.core.domain.drift.DriftDefinition driftDefinition)
          Requests that the agent start performing drift detection for a resource with the specified drift definition.
 void unscheduleDriftDetection(int resourceId, org.rhq.core.domain.drift.DriftDefinition driftDefinition)
          Requests that the agent stop performing the specified drift detection for the resource.
 void updateDriftDetection(int resourceId, org.rhq.core.domain.drift.DriftDefinition driftDefinition)
          Requests that the agent update its processing of the specified driftDefinition.
 void updateDriftDetection(int resourceId, org.rhq.core.domain.drift.DriftDefinition driftDef, org.rhq.core.domain.drift.DriftSnapshot driftSnapshot)
           
 

Method Detail

requestDriftFiles

boolean requestDriftFiles(int resourceId,
                          Headers headers,
                          List<? extends org.rhq.core.domain.drift.DriftFile> driftFiles)
Ask the agent to send the requested drift file content as a zip of all requested files.

Parameters:
driftFiles -
headers - Used to identify the change set to which the requested files belong
Returns:
the results of the immediate scheduling

detectDrift

void detectDrift(int resourceId,
                 org.rhq.core.domain.drift.DriftDefinition driftDefinition)
Schedule drift detection to occur immediately. If any changes are foind, the agent will report thenm back to the server in a separate request from agent to server. This method returns quickly and can be considered a non-blocking operation since the drift detection happens asynchronously.

Because the drift detection happens asynchronously, it cannot be guaranteed that the drift detection will actually happen immediately. Drift detection schedules are maintained by a priority queue and are ordered by their next scan time. The schedule corresponding to resourceId and driftDefinition has its next scan time reset in order to move the schedule to the front of the queue.

Note that when the drift detection occurs is largely dependent on a couple of factors. First there could be other schedules already at the front of the queue that would first be processed if their next scan times have also been reset. Secondly, drift detection occurs at regularly scheduled intervals in its own thread. If this method is called immediately after drift detection has just started, the earliest that the detection would occur is the time it takes for the current detection to finish plus the time period between executions of the drift detector task.

Parameters:
resourceId - The id of the resource for which the request is being made
driftDefinition - Specifies how the detection should be carried out. This includes any filtering rules that should be applied.

scheduleDriftDetection

void scheduleDriftDetection(int resourceId,
                            org.rhq.core.domain.drift.DriftDefinition driftDefinition)
Requests that the agent start performing drift detection for a resource with the specified drift definition. The interval at which the drift detection occurs is specified by the drift definition.

Note that drift detection occurs asynchronously which means that this method should return very quickly which could be before the drift detection for this definition has actually started.

Parameters:
resourceId - The id of the resource for which the request is being made
driftDefinition - Specifies how and when the detection should be carried out
See Also:
DriftDefinition

unscheduleDriftDetection

void unscheduleDriftDetection(int resourceId,
                              org.rhq.core.domain.drift.DriftDefinition driftDefinition)
Requests that the agent stop performing the specified drift detection for the resource. (In effect, a remove operation).

Parameters:
resourceId - The id of the resource for which the request is being made
driftDefinition - The doomed drift definition
See Also:
DriftDefinition

updateDriftDetection

void updateDriftDetection(int resourceId,
                          org.rhq.core.domain.drift.DriftDefinition driftDefinition)
Requests that the agent update its processing of the specified driftDefinition. The filters are unchanged, but something else may have changed (enablement/interval, etc).

Parameters:
driftDefinition - The updated driftDefinition.
See Also:
DriftDefinition

updateDriftDetection

void updateDriftDetection(int resourceId,
                          org.rhq.core.domain.drift.DriftDefinition driftDef,
                          org.rhq.core.domain.drift.DriftSnapshot driftSnapshot)

ackChangeSet

void ackChangeSet(int resourceId,
                  String driftDefName)
This method is invoked to inform the agent that the server has successfully persisted the last change set sent to the server for the specified drift definition. The agent will proceed to purge the older, previous snapshot as well as the the change set zip file.

Note: The agent will not resume drift detection for this drift definition until the server has acknowledged the last change set sent.

Parameters:
resourceId - The id of the resource to which the acknowledged change set belongs.
driftDefName - The name of the drift definition to which the change set belongs.

ackChangeSetContent

void ackChangeSetContent(int resourceId,
                         String defName,
                         String token)
This method is invoked to inform the agent that the server has successfully persisted change set content that was previously sent to the server. The agent will proceed to purge the referenced content zip file.

Parameters:
resourceId - The id of the resource to which the referenced drift definition belongs.
defName - The name of the drift definition to which the content belongs.
token - A token that is used to identify the content zip file

pinSnapshot

void pinSnapshot(int resourceId,
                 String defName,
                 org.rhq.core.domain.drift.DriftSnapshot snapshot)


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