org.rhq.enterprise.server.drift
Class JPADriftServerBean

java.lang.Object
  extended by org.rhq.enterprise.server.drift.JPADriftServerBean
All Implemented Interfaces:
JPADriftServerLocal

public class JPADriftServerBean
extends Object
implements JPADriftServerLocal

The SLSB method implementation needed to support the JPA (RHQ Default) Drift Server Plugin.

Author:
Jay Shaughnessy, John Sanda

Constructor Summary
JPADriftServerBean()
           
 
Method Summary
 void ackChangeSetInNewTransaction(org.rhq.core.domain.auth.Subject subject, int resourceId, Headers headers, List<org.rhq.core.domain.drift.JPADriftFile> driftFilesToRequest)
          For transactioning purposes only, part of storeChangeSet impl.
 String copyChangeSet(org.rhq.core.domain.auth.Subject subject, String changeSetId, int driftDefId, int resourceId)
           
 org.rhq.core.domain.util.PageList<org.rhq.core.domain.drift.JPADriftChangeSet> findDriftChangeSetsByCriteria(org.rhq.core.domain.auth.Subject subject, org.rhq.core.domain.criteria.DriftChangeSetCriteria criteria)
          Standard criteria based fetch method
 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<org.rhq.core.domain.drift.JPADrift> 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.JPADriftFile getDriftFile(org.rhq.core.domain.auth.Subject subject, String sha256)
          Simple get method for a JPADriftFile.
 byte[] getDriftFileAsByteArray(String hash)
           
 String getDriftFileBits(String hash)
           
 String persistChangeSet(org.rhq.core.domain.auth.Subject subject, org.rhq.core.domain.drift.DriftChangeSet<?> changeSet)
           
 org.rhq.core.domain.drift.JPADriftFile persistDriftFile(org.rhq.core.domain.drift.JPADriftFile driftFile)
          SUPPORTS JPA DRIFT SERVER PLUGIN
 void persistDriftFileData(org.rhq.core.domain.drift.JPADriftFile driftFile, InputStream data, long numBytes)
          SUPPORTS JPA DRIFT SERVER PLUGIN
 void purgeByDriftDefinitionName(org.rhq.core.domain.auth.Subject subject, int resourceId, String driftDefName)
          SUPPORTS JPA DRIFT SERVER PLUGIN This is for internal use only - do not call it unless you know what you are doing.
 int purgeOrphanedDriftFiles(org.rhq.core.domain.auth.Subject subject, long purgeMillis)
          SUPPORTS JPA DRIFT SERVER PLUGIN This will remove all drift files that are no longer referenced by drift entries.
 DriftChangeSetSummary storeChangeSet(org.rhq.core.domain.auth.Subject subject, int resourceId, File changeSetZip)
          This method stores the provided change-set file for the resource.
 DriftChangeSetSummary storeChangeSetInNewTransaction(org.rhq.core.domain.auth.Subject subject, int resourceId, File changeSetZip, List<org.rhq.core.domain.drift.JPADriftFile> driftFilesToRequest, Headers[] headers)
          For transactioning purposes only, part of storeChangeSet impl.
 void storeFiles(org.rhq.core.domain.auth.Subject subject, File filesZip)
          This method stores the provided drift files.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JPADriftServerBean

public JPADriftServerBean()
Method Detail

purgeOrphanedDriftFiles

public int purgeOrphanedDriftFiles(org.rhq.core.domain.auth.Subject subject,
                                   long purgeMillis)
Description copied from interface: JPADriftServerLocal
SUPPORTS JPA DRIFT SERVER PLUGIN 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.

Specified by:
purgeOrphanedDriftFiles in interface JPADriftServerLocal
Returns:
number of orphaned drife files that were removed

purgeByDriftDefinitionName

public void purgeByDriftDefinitionName(org.rhq.core.domain.auth.Subject subject,
                                       int resourceId,
                                       String driftDefName)
                                throws Exception
Description copied from interface: JPADriftServerLocal
SUPPORTS JPA DRIFT SERVER PLUGIN This is for internal use only - do not call it unless you know what you are doing. This purges all drift entities and changeset entities associated with the drift definition.

Specified by:
purgeByDriftDefinitionName in interface JPADriftServerLocal
Throws:
Exception

findDriftChangeSetsByCriteria

public org.rhq.core.domain.util.PageList<org.rhq.core.domain.drift.JPADriftChangeSet> findDriftChangeSetsByCriteria(org.rhq.core.domain.auth.Subject subject,
                                                                                                                    org.rhq.core.domain.criteria.DriftChangeSetCriteria criteria)
Description copied from interface: JPADriftServerLocal
Standard criteria based fetch method

Specified by:
findDriftChangeSetsByCriteria in interface JPADriftServerLocal
Returns:
The DriftChangeSets matching the criteria

findDriftCompositesByCriteria

public 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)
Specified by:
findDriftCompositesByCriteria in interface JPADriftServerLocal

findDriftsByCriteria

public org.rhq.core.domain.util.PageList<org.rhq.core.domain.drift.JPADrift> findDriftsByCriteria(org.rhq.core.domain.auth.Subject subject,
                                                                                                  org.rhq.core.domain.criteria.DriftCriteria criteria)
Description copied from interface: JPADriftServerLocal
Standard criteria based fetch method

Specified by:
findDriftsByCriteria in interface JPADriftServerLocal
Returns:
The Drifts matching the criteria

persistChangeSet

public String persistChangeSet(org.rhq.core.domain.auth.Subject subject,
                               org.rhq.core.domain.drift.DriftChangeSet<?> changeSet)
Specified by:
persistChangeSet in interface JPADriftServerLocal

copyChangeSet

public String copyChangeSet(org.rhq.core.domain.auth.Subject subject,
                            String changeSetId,
                            int driftDefId,
                            int resourceId)
Specified by:
copyChangeSet in interface JPADriftServerLocal

getDriftFile

public org.rhq.core.domain.drift.JPADriftFile getDriftFile(org.rhq.core.domain.auth.Subject subject,
                                                           String sha256)
Description copied from interface: JPADriftServerLocal
Simple get method for a JPADriftFile. Does not return the content.

Specified by:
getDriftFile in interface JPADriftServerLocal
Returns:
The JPADriftFile sans content.

persistDriftFile

public org.rhq.core.domain.drift.JPADriftFile persistDriftFile(org.rhq.core.domain.drift.JPADriftFile driftFile)
Description copied from interface: JPADriftServerLocal
SUPPORTS JPA DRIFT SERVER PLUGIN

Specified by:
persistDriftFile in interface JPADriftServerLocal
Returns:

persistDriftFileData

public void persistDriftFileData(org.rhq.core.domain.drift.JPADriftFile driftFile,
                                 InputStream data,
                                 long numBytes)
                          throws Exception
Description copied from interface: JPADriftServerLocal
SUPPORTS JPA DRIFT SERVER PLUGIN

Specified by:
persistDriftFileData in interface JPADriftServerLocal
Throws:
Exception

storeChangeSet

public DriftChangeSetSummary storeChangeSet(org.rhq.core.domain.auth.Subject subject,
                                            int resourceId,
                                            File changeSetZip)
                                     throws Exception
Description copied from interface: JPADriftServerLocal
This method stores the provided change-set file for the resource. The version will be incremented based on the max version of existing change-sets for the resource. The change-set will be processed generating requests for drift file content and/or drift instances as required.

Specified by:
storeChangeSet in interface JPADriftServerLocal
resourceId - The resource for which the change-set is being reported.
changeSetZip - The change-set zip file
Returns:
a summary of the change set that was persisted
Throws:
Exception

storeChangeSetInNewTransaction

public DriftChangeSetSummary storeChangeSetInNewTransaction(org.rhq.core.domain.auth.Subject subject,
                                                            int resourceId,
                                                            File changeSetZip,
                                                            List<org.rhq.core.domain.drift.JPADriftFile> driftFilesToRequest,
                                                            Headers[] headers)
                                                     throws Exception
Description copied from interface: JPADriftServerLocal
For transactioning purposes only, part of storeChangeSet impl. Not to be exposed outside of local interface.

Specified by:
storeChangeSetInNewTransaction in interface JPADriftServerLocal
Throws:
Exception

ackChangeSetInNewTransaction

public void ackChangeSetInNewTransaction(org.rhq.core.domain.auth.Subject subject,
                                         int resourceId,
                                         Headers headers,
                                         List<org.rhq.core.domain.drift.JPADriftFile> driftFilesToRequest)
                                  throws Exception
Description copied from interface: JPADriftServerLocal
For transactioning purposes only, part of storeChangeSet impl. Not to be exposed outside of local interface.

Specified by:
ackChangeSetInNewTransaction in interface JPADriftServerLocal
Throws:
Exception

storeFiles

public void storeFiles(org.rhq.core.domain.auth.Subject subject,
                       File filesZip)
                throws Exception
Description copied from interface: JPADriftServerLocal
This method stores the provided drift files. The files should correspond to requested drift files. The unzipped files will have their sha256 generated. Those not corresponding to needed content will be logged and ignored.

Specified by:
storeFiles in interface JPADriftServerLocal
filesZip - The change-set zip file
Throws:
Exception

getDriftFileBits

public String getDriftFileBits(String hash)
Specified by:
getDriftFileBits in interface JPADriftServerLocal

getDriftFileAsByteArray

public byte[] getDriftFileAsByteArray(String hash)
Specified by:
getDriftFileAsByteArray in interface JPADriftServerLocal


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