org.rhq.enterprise.server.plugin.pc.drift
Interface DriftServerPluginFacet


public interface DriftServerPluginFacet

All drift server plugins must implement this facet. The methods here must all be defined in DriftManagerLocal as well. See DriftManagerLocal for jdoc of these methods. Note that the Subject parameter is provided as a convenience to the plugin methods. It is not expected that authz be performed by the plugin code. But, it may be useful to have the user name or session id for logging, or for unknown need to interact with the RHQ SLSBs.

Author:
Jay Shaughnessy, John Sanda

Method Summary
 String copyChangeSet(org.rhq.core.domain.auth.Subject subject, String changeSetId, int driftDefId, int resourceId)
          Creates a copy of the specified, existing change set.
 org.rhq.core.domain.util.PageList<? extends org.rhq.core.domain.drift.DriftChangeSet<?>> findDriftChangeSetsByCriteria(org.rhq.core.domain.auth.Subject subject, org.rhq.core.domain.criteria.DriftChangeSetCriteria criteria)
           Performs criteria-based search for change sets.
 org.rhq.core.domain.util.PageList<org.rhq.core.domain.drift.DriftComposite> findDriftCompositesByCriteria(org.rhq.core.domain.auth.Subject subject, org.rhq.core.domain.criteria.DriftCriteria criteria)
           
 org.rhq.core.domain.util.PageList<? extends org.rhq.core.domain.drift.Drift<?,?>> findDriftsByCriteria(org.rhq.core.domain.auth.Subject subject, org.rhq.core.domain.criteria.DriftCriteria criteria)
          Standard criteria based fetch method
 org.rhq.core.domain.drift.DriftFile getDriftFile(org.rhq.core.domain.auth.Subject subject, String hashId)
          Simple get method for a DriftFile.
 byte[] getDriftFileAsByteArray(org.rhq.core.domain.auth.Subject subject, String hash)
           
 String getDriftFileBits(org.rhq.core.domain.auth.Subject subject, String hash)
          Returns the content associated with the specified hash as a string
 String persistChangeSet(org.rhq.core.domain.auth.Subject subject, org.rhq.core.domain.drift.DriftChangeSet<?> changeSet)
           
 void purgeByDriftDefinitionName(org.rhq.core.domain.auth.Subject subject, int resourceId, String driftDefName)
          When a user wants to completely remove all data related to a drift definition, this method will be called to give the plugin a chance to clean up any data related to the drift definition that is going to be deleted.
 int purgeOrphanedDriftFiles(org.rhq.core.domain.auth.Subject subject, long purgeMillis)
          This will remove all drift files that are no longer referenced by drift entries.
 DriftChangeSetSummary saveChangeSet(org.rhq.core.domain.auth.Subject subject, int resourceId, File changeSetZip)
          Parses the given change set file and persists its data.
 void saveChangeSetFiles(org.rhq.core.domain.auth.Subject subject, File changeSetFilesZip)
           
 

Method Detail

findDriftChangeSetsByCriteria

org.rhq.core.domain.util.PageList<? extends org.rhq.core.domain.drift.DriftChangeSet<?>> findDriftChangeSetsByCriteria(org.rhq.core.domain.auth.Subject subject,
                                                                                                                       org.rhq.core.domain.criteria.DriftChangeSetCriteria criteria)

Performs criteria-based search for change sets.

Note that there are really two types of change sets - a delta change set and a snapshot or coverage change set. A snapshot includes all files that are under drift detection. The delta snapshot just includes references to those files that have changed (here change can be a modification, addition, or deletion of a file).

Implementations of this method can assume that queries for snapshots and for delta change sets will always be made in separate calls; in other words, this method should return either only snapshots (i.e., coverage change sets) or only delta change sets. This assumption/restriction is in place in large part because of how the UI queries change sets.

Parameters:
subject -
criteria -
Returns:
The DriftChangeSets matching the criteria

findDriftCompositesByCriteria

org.rhq.core.domain.util.PageList<org.rhq.core.domain.drift.DriftComposite> findDriftCompositesByCriteria(org.rhq.core.domain.auth.Subject subject,
                                                                                                          org.rhq.core.domain.criteria.DriftCriteria criteria)

findDriftsByCriteria

org.rhq.core.domain.util.PageList<? extends org.rhq.core.domain.drift.Drift<?,?>> findDriftsByCriteria(org.rhq.core.domain.auth.Subject subject,
                                                                                                       org.rhq.core.domain.criteria.DriftCriteria criteria)
Standard criteria based fetch method

Parameters:
subject -
criteria -
Returns:
The Drifts matching the criteria

getDriftFile

org.rhq.core.domain.drift.DriftFile getDriftFile(org.rhq.core.domain.auth.Subject subject,
                                                 String hashId)
                                                 throws Exception
Simple get method for a DriftFile. Does not return the content.

Parameters:
subject -
hashId -
Returns:
The DriftFile sans content.
Throws:
Exception

saveChangeSet

DriftChangeSetSummary saveChangeSet(org.rhq.core.domain.auth.Subject subject,
                                    int resourceId,
                                    File changeSetZip)
                                    throws Exception
Parses the given change set file and persists its data.

Parameters:
subject -
resourceId -
changeSetZip -
Returns:
a summary of what was in the change set file
Throws:
Exception

persistChangeSet

String persistChangeSet(org.rhq.core.domain.auth.Subject subject,
                        org.rhq.core.domain.drift.DriftChangeSet<?> changeSet)
Parameters:
subject -
changeSet -
Returns:
The change set id

copyChangeSet

String copyChangeSet(org.rhq.core.domain.auth.Subject subject,
                     String changeSetId,
                     int driftDefId,
                     int resourceId)
Creates a copy of the specified, existing change set. The new change set will be persisted. The new change set will belong to the specified drift definition.

Parameters:
subject -
changeSetId -
driftDefId -
resourceId -
Returns:

saveChangeSetFiles

void saveChangeSetFiles(org.rhq.core.domain.auth.Subject subject,
                        File changeSetFilesZip)
                        throws Exception
Throws:
Exception

purgeByDriftDefinitionName

void purgeByDriftDefinitionName(org.rhq.core.domain.auth.Subject subject,
                                int resourceId,
                                String driftDefName)
                                throws Exception
When a user wants to completely remove all data related to a drift definition, this method will be called to give the plugin a chance to clean up any data related to the drift definition that is going to be deleted.

Parameters:
Subject -
resourceId - the resource whose drift definition is being purged
driftDefName - identifies the data that is to be purged
Throws:
Exception

purgeOrphanedDriftFiles

int purgeOrphanedDriftFiles(org.rhq.core.domain.auth.Subject subject,
                            long purgeMillis)
This will remove all drift files that are no longer referenced by drift entries. This is a maintenance method to help reclaim space on the backend.

Parameters:
subject -
purgeMillis - only those unused drift files that are older than this (in epoch millis) will be purged.
Returns:
number of orphaned drife files that were removed

getDriftFileBits

String getDriftFileBits(org.rhq.core.domain.auth.Subject subject,
                        String hash)
Returns the content associated with the specified hash as a string

Parameters:
hash - The hash the uniquely identifies the requested content
Returns:
The content as a string

getDriftFileAsByteArray

byte[] getDriftFileAsByteArray(org.rhq.core.domain.auth.Subject subject,
                               String hash)


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