org.rhq.enterprise.server.measurement
Class MeasurementDataManagerBean

java.lang.Object
  extended by org.rhq.enterprise.server.measurement.MeasurementDataManagerBean
All Implemented Interfaces:
MeasurementDataManagerLocal, MeasurementDataManagerRemote

public class MeasurementDataManagerBean
extends Object
implements MeasurementDataManagerLocal, MeasurementDataManagerRemote

A manager for MeasurementDatas.

Author:
Heiko W. Rupp, Greg Hinkle, Ian Springer

Constructor Summary
MeasurementDataManagerBean()
           
 
Method Summary
 void addNumericData(Set<org.rhq.core.domain.measurement.MeasurementDataNumeric> data)
          Add metrics data to the database.
 void addTraitData(Set<org.rhq.core.domain.measurement.MeasurementDataTrait> data)
           
 List<org.rhq.core.domain.measurement.MeasurementDataTrait> findCurrentTraitsForResource(org.rhq.core.domain.auth.Subject subject, int resourceId, org.rhq.core.domain.measurement.DisplayType displayType)
          Return the Traits for the passed resource.
 List<List<org.rhq.core.domain.measurement.composite.MeasurementDataNumericHighLowComposite>> findDataForCompatibleGroup(org.rhq.core.domain.auth.Subject subject, int groupId, int definitionId, long beginTime, long endTime, int numPoints)
          Returns a list of numeric data point lists for the given compatible group - one per specified measurement definition.
 List<List<org.rhq.core.domain.measurement.composite.MeasurementDataNumericHighLowComposite>> findDataForContext(org.rhq.core.domain.auth.Subject subject, org.rhq.core.domain.common.EntityContext context, int definitionId, long beginTime, long endTime, int numDataPoints)
           
 List<List<org.rhq.core.domain.measurement.composite.MeasurementDataNumericHighLowComposite>> findDataForResource(org.rhq.core.domain.auth.Subject subject, int resourceId, int[] definitionIds, long beginTime, long endTime, int numDataPoints)
           
 Set<org.rhq.core.domain.measurement.MeasurementData> findLiveData(org.rhq.core.domain.auth.Subject subject, int resourceId, int[] definitionIds)
          Get live metrics for a given MeasurementSchedule
 Map<Integer,List<org.rhq.core.domain.measurement.ui.MetricDisplaySummary>> findNarrowedMetricDisplaySummariesForCompatibleResources(org.rhq.core.domain.auth.Subject subject, Collection<org.rhq.core.domain.resource.Resource> resources, long beginTime, long endTime)
          Get the MetricDisplaySummarys for the resources passed in, that all need to be of the same ResourceType.
 Map<Integer,List<org.rhq.core.domain.measurement.ui.MetricDisplaySummary>> findNarrowedMetricDisplaySummariesForResourcesAndParent(org.rhq.core.domain.auth.Subject subject, int resourceTypeId, int parentId, List<Integer> resourceIds, long begin, long end)
          Return a map of <resource id, List<MetricDisplaySummary>>, where the list contains the MetricDisplaySummary for the (enabled) schedules of the resource
 Map<Integer,List<org.rhq.core.domain.measurement.ui.MetricDisplaySummary>> findNarrowedMetricsDisplaySummariesForAutoGroup(org.rhq.core.domain.auth.Subject subject, int parentId, int cType, long beginTime, long endTime)
           
 Map<Integer,List<org.rhq.core.domain.measurement.ui.MetricDisplaySummary>> findNarrowedMetricsDisplaySummariesForCompGroup(org.rhq.core.domain.auth.Subject subject, org.rhq.core.domain.resource.group.ResourceGroup group, long beginTime, long endTime)
          Get metric display summaries for the resources of the passed compatible group, where the MetricDisplaySummary only contains the metric name and number of alerts.
 List<org.rhq.core.domain.measurement.MeasurementDataNumeric> findRawData(org.rhq.core.domain.auth.Subject subject, int scheduleId, long startTime, long endTime)
           
 List<org.rhq.core.domain.measurement.MeasurementDataTrait> findTraits(org.rhq.core.domain.auth.Subject subject, int resourceId, int definitionId)
          Return all known trait data for the passed schedule, defined by resourceId and definitionId
 org.rhq.core.domain.util.PageList<org.rhq.core.domain.measurement.MeasurementDataTrait> findTraitsByCriteria(org.rhq.core.domain.auth.Subject subject, org.rhq.core.domain.criteria.MeasurementDataTraitCriteria criteria)
          Finds traits that match the specified criteria.
 MeasurementAggregate getAggregate(org.rhq.core.domain.auth.Subject subject, int groupId, int definitionId, long startTime, long endTime)
           
 MeasurementAggregate getAggregate(org.rhq.core.domain.auth.Subject subject, int scheduleId, long startTime, long endTime)
          Get the aggregate values of the numerical values for a given schedule.
 org.rhq.core.domain.measurement.MeasurementDataNumeric getCurrentNumericForSchedule(int scheduleId)
          Return the current numeric value for the passed schedule
 org.rhq.core.domain.measurement.MeasurementDataTrait getCurrentTraitForSchedule(int scheduleId)
          Return the current trait value for the passed schedule
 void mergeMeasurementReport(org.rhq.core.domain.measurement.MeasurementReport report)
           
 int purgeTraits(long oldest)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MeasurementDataManagerBean

public MeasurementDataManagerBean()
Method Detail

purgeTraits

public int purgeTraits(long oldest)
Specified by:
purgeTraits in interface MeasurementDataManagerLocal

mergeMeasurementReport

public void mergeMeasurementReport(org.rhq.core.domain.measurement.MeasurementReport report)
Specified by:
mergeMeasurementReport in interface MeasurementDataManagerLocal

addNumericData

public void addNumericData(Set<org.rhq.core.domain.measurement.MeasurementDataNumeric> data)
Add metrics data to the database. Data that is passed can come from several Schedules, but needs to be of only one type of MeasurementGathering. For good performance it is important that the agent sends batches as big as possible (ok, perhaps not more than 100 items at a time).

Specified by:
addNumericData in interface MeasurementDataManagerLocal
Parameters:
data - the actual data points

addTraitData

public void addTraitData(Set<org.rhq.core.domain.measurement.MeasurementDataTrait> data)
Specified by:
addTraitData in interface MeasurementDataManagerLocal

findNarrowedMetricDisplaySummariesForResourcesAndParent

public Map<Integer,List<org.rhq.core.domain.measurement.ui.MetricDisplaySummary>> findNarrowedMetricDisplaySummariesForResourcesAndParent(org.rhq.core.domain.auth.Subject subject,
                                                                                                                                          int resourceTypeId,
                                                                                                                                          int parentId,
                                                                                                                                          List<Integer> resourceIds,
                                                                                                                                          long begin,
                                                                                                                                          long end)
Return a map of <resource id, List<MetricDisplaySummary>>, where the list contains the MetricDisplaySummary for the (enabled) schedules of the resource

Specified by:
findNarrowedMetricDisplaySummariesForResourcesAndParent in interface MeasurementDataManagerLocal
Parameters:
subject - Subject of the caller
resourceTypeId - ResourceTypeId of the child resources
parentId - ID of the common parent resource
resourceIds - List of primary keys of the resources we are interested in
begin - begin time
end - end time

findNarrowedMetricsDisplaySummariesForCompGroup

public Map<Integer,List<org.rhq.core.domain.measurement.ui.MetricDisplaySummary>> findNarrowedMetricsDisplaySummariesForCompGroup(org.rhq.core.domain.auth.Subject subject,
                                                                                                                                  org.rhq.core.domain.resource.group.ResourceGroup group,
                                                                                                                                  long beginTime,
                                                                                                                                  long endTime)
Description copied from interface: MeasurementDataManagerLocal
Get metric display summaries for the resources of the passed compatible group, where the MetricDisplaySummary only contains the metric name and number of alerts. All other fields are not set.

Specified by:
findNarrowedMetricsDisplaySummariesForCompGroup in interface MeasurementDataManagerLocal
Parameters:
subject - subject of the caller
group - compatible group
Returns:
a Map of resource id, List of summaries for this resource

findNarrowedMetricsDisplaySummariesForAutoGroup

public Map<Integer,List<org.rhq.core.domain.measurement.ui.MetricDisplaySummary>> findNarrowedMetricsDisplaySummariesForAutoGroup(org.rhq.core.domain.auth.Subject subject,
                                                                                                                                  int parentId,
                                                                                                                                  int cType,
                                                                                                                                  long beginTime,
                                                                                                                                  long endTime)
Specified by:
findNarrowedMetricsDisplaySummariesForAutoGroup in interface MeasurementDataManagerLocal

findNarrowedMetricDisplaySummariesForCompatibleResources

public Map<Integer,List<org.rhq.core.domain.measurement.ui.MetricDisplaySummary>> findNarrowedMetricDisplaySummariesForCompatibleResources(org.rhq.core.domain.auth.Subject subject,
                                                                                                                                           Collection<org.rhq.core.domain.resource.Resource> resources,
                                                                                                                                           long beginTime,
                                                                                                                                           long endTime)
Get the MetricDisplaySummarys for the resources passed in, that all need to be of the same ResourceType. Summaries only contain a basic selection of fields for the purpose of filling the Child resource popups.

Specified by:
findNarrowedMetricDisplaySummariesForCompatibleResources in interface MeasurementDataManagerLocal

getCurrentTraitForSchedule

@Nullable
public org.rhq.core.domain.measurement.MeasurementDataTrait getCurrentTraitForSchedule(int scheduleId)
Return the current trait value for the passed schedule

Specified by:
getCurrentTraitForSchedule in interface MeasurementDataManagerLocal
Parameters:
scheduleId - id of a MeasurementSchedule that 'points' to a Trait
Returns:
One trait or null if nothing was found in the db.

getCurrentNumericForSchedule

@Nullable
public org.rhq.core.domain.measurement.MeasurementDataNumeric getCurrentNumericForSchedule(int scheduleId)
Description copied from interface: MeasurementDataManagerLocal
Return the current numeric value for the passed schedule

Specified by:
getCurrentNumericForSchedule in interface MeasurementDataManagerLocal
Parameters:
scheduleId - id of a MeasurementSchedule that 'points' to a MeasurementDataNumeric record
Returns:
One MeasurementDataNumeric or null if nothing was found

getAggregate

public MeasurementAggregate getAggregate(org.rhq.core.domain.auth.Subject subject,
                                         int scheduleId,
                                         long startTime,
                                         long endTime)
Description copied from interface: MeasurementDataManagerLocal
Get the aggregate values of the numerical values for a given schedule. This can only provide aggregates for data in the "live" table

Specified by:
getAggregate in interface MeasurementDataManagerLocal
Specified by:
getAggregate in interface MeasurementDataManagerRemote
Parameters:
subject - the user requesting the aggregate
scheduleId - the id of the MeasurementSchedule for which this aggregate is being requested
Returns:
MeasurementAggregate bean with the data

getAggregate

public MeasurementAggregate getAggregate(org.rhq.core.domain.auth.Subject subject,
                                         int groupId,
                                         int definitionId,
                                         long startTime,
                                         long endTime)
Specified by:
getAggregate in interface MeasurementDataManagerLocal

findCurrentTraitsForResource

public List<org.rhq.core.domain.measurement.MeasurementDataTrait> findCurrentTraitsForResource(org.rhq.core.domain.auth.Subject subject,
                                                                                               int resourceId,
                                                                                               org.rhq.core.domain.measurement.DisplayType displayType)
Return the Traits for the passed resource. This method will for each trait only return the 'youngest' entry. If there are no traits found for that resource, an empty list is returned. If displayType is null, no displayType is honoured, else the traits will be filtered for the given displayType

Specified by:
findCurrentTraitsForResource in interface MeasurementDataManagerLocal
Specified by:
findCurrentTraitsForResource in interface MeasurementDataManagerRemote
Parameters:
resourceId - Id of the resource we are interested in
displayType - A display type for filtering or null for all traits.
Returns:
a List of MeasurementDataTrait

findDataForCompatibleGroup

public List<List<org.rhq.core.domain.measurement.composite.MeasurementDataNumericHighLowComposite>> findDataForCompatibleGroup(org.rhq.core.domain.auth.Subject subject,
                                                                                                                               int groupId,
                                                                                                                               int definitionId,
                                                                                                                               long beginTime,
                                                                                                                               long endTime,
                                                                                                                               int numPoints)
Description copied from interface: MeasurementDataManagerLocal
Returns a list of numeric data point lists for the given compatible group - one per specified measurement definition. The data points represent the average min/avg/max values of the members of the group.

Specified by:
findDataForCompatibleGroup in interface MeasurementDataManagerLocal
Specified by:
findDataForCompatibleGroup in interface MeasurementDataManagerRemote

findDataForContext

public List<List<org.rhq.core.domain.measurement.composite.MeasurementDataNumericHighLowComposite>> findDataForContext(org.rhq.core.domain.auth.Subject subject,
                                                                                                                       org.rhq.core.domain.common.EntityContext context,
                                                                                                                       int definitionId,
                                                                                                                       long beginTime,
                                                                                                                       long endTime,
                                                                                                                       int numDataPoints)
Specified by:
findDataForContext in interface MeasurementDataManagerLocal

findDataForResource

public List<List<org.rhq.core.domain.measurement.composite.MeasurementDataNumericHighLowComposite>> findDataForResource(org.rhq.core.domain.auth.Subject subject,
                                                                                                                        int resourceId,
                                                                                                                        int[] definitionIds,
                                                                                                                        long beginTime,
                                                                                                                        long endTime,
                                                                                                                        int numDataPoints)
Specified by:
findDataForResource in interface MeasurementDataManagerLocal
Specified by:
findDataForResource in interface MeasurementDataManagerRemote

findLiveData

public Set<org.rhq.core.domain.measurement.MeasurementData> findLiveData(org.rhq.core.domain.auth.Subject subject,
                                                                         int resourceId,
                                                                         int[] definitionIds)
Description copied from interface: MeasurementDataManagerLocal
Get live metrics for a given MeasurementSchedule

Specified by:
findLiveData in interface MeasurementDataManagerLocal
Specified by:
findLiveData in interface MeasurementDataManagerRemote
Returns:
MeasurementData for this Schedule

findRawData

public List<org.rhq.core.domain.measurement.MeasurementDataNumeric> findRawData(org.rhq.core.domain.auth.Subject subject,
                                                                                int scheduleId,
                                                                                long startTime,
                                                                                long endTime)
Specified by:
findRawData in interface MeasurementDataManagerLocal

findTraits

public List<org.rhq.core.domain.measurement.MeasurementDataTrait> findTraits(org.rhq.core.domain.auth.Subject subject,
                                                                             int resourceId,
                                                                             int definitionId)
Return all known trait data for the passed schedule, defined by resourceId and definitionId

Specified by:
findTraits in interface MeasurementDataManagerLocal
Specified by:
findTraits in interface MeasurementDataManagerRemote
Parameters:
resourceId - PK of a Resource
definitionId - PK of a MeasurementDefinition
Returns:
a List of MeasurementDataTrait objects.

findTraitsByCriteria

public org.rhq.core.domain.util.PageList<org.rhq.core.domain.measurement.MeasurementDataTrait> findTraitsByCriteria(org.rhq.core.domain.auth.Subject subject,
                                                                                                                    org.rhq.core.domain.criteria.MeasurementDataTraitCriteria criteria)
Description copied from interface: MeasurementDataManagerLocal
Finds traits that match the specified criteria.

Specified by:
findTraitsByCriteria in interface MeasurementDataManagerLocal
Specified by:
findTraitsByCriteria in interface MeasurementDataManagerRemote
Parameters:
subject - the user that is requesting the traits
criteria - the criteria by which to filter the traits
Returns:
the traits that match the specified criteria; never null


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