org.rhq.enterprise.server.measurement
Class MeasurementBaselineManagerBean

java.lang.Object
  extended by org.rhq.enterprise.server.measurement.MeasurementBaselineManagerBean
All Implemented Interfaces:
MeasurementBaselineManagerLocal, MeasurementBaselineManagerRemote

public class MeasurementBaselineManagerBean
extends Object
implements MeasurementBaselineManagerLocal, MeasurementBaselineManagerRemote

A manager for MeasurementBaselines.

Author:
Heiko W. Rupp, John Mazzitelli, Joseph Marques

Constructor Summary
MeasurementBaselineManagerBean()
           
 
Method Summary
 int _calculateAutoBaselinesDELETE(long olderThanTime)
          Deletes baselines that are older than the time specified
 int _calculateAutoBaselinesINSERT(long amountOfData)
          Inserts baselines "as appropriate" for measurements that have at least amountOfData
 org.rhq.core.domain.measurement.MeasurementBaseline calculateAutoBaseline(org.rhq.core.domain.auth.Subject subject, Integer measurementScheduleId, long startDate, long endDate, boolean save)
          Calculate a baseline value for the given metric based on the specified date range, optionally setting the metric's baseline to the calculated value.
 org.rhq.core.domain.measurement.MeasurementBaseline calculateAutoBaseline(org.rhq.core.domain.auth.Subject subject, int groupId, int definitionId, long startDate, long endDate, boolean save)
           
 org.rhq.core.domain.measurement.MeasurementBaseline calculateAutoBaselineForGroupInNewTransaction(org.rhq.core.domain.auth.Subject subject, int groupId, int definitionId, long startDate, long endDate, boolean save)
           
 org.rhq.core.domain.measurement.MeasurementBaseline calculateAutoBaselineInNewTransaction(org.rhq.core.domain.auth.Subject subject, Integer measurementScheduleId, long startDate, long endDate, boolean save)
           
 void calculateAutoBaselines()
          This is the entry point which calls out to all other *calculateAutoBaselines* methods seen in this interface.
 long calculateAutoBaselines(long amountOfData, long baselinesOlderThanTime)
          Calculates baselines for all scheduled measurements.
 void enableAutoBaselineCalculation(org.rhq.core.domain.auth.Subject subject, Integer[] resourceIds, Integer[] definitionIds)
          Unset the user-entered property in baselines so that we can do autobaselines on it again.
 List<org.rhq.core.domain.measurement.MeasurementBaseline> findBaselinesForResource(org.rhq.core.domain.auth.Subject subject, int resourceId)
          Return a list of MeasurementBaseline objects for the Resource represented by the given id.
 org.rhq.core.domain.measurement.MeasurementBaseline getBaselineIfEqual(org.rhq.core.domain.auth.Subject subject, int groupId, int definitionId)
          If the measurement baselines for the corresponding resources are the same, that value will be returned; otherwise null will be returned
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MeasurementBaselineManagerBean

public MeasurementBaselineManagerBean()
Method Detail

calculateAutoBaselines

public void calculateAutoBaselines()
Description copied from interface: MeasurementBaselineManagerLocal
This is the entry point which calls out to all other *calculateAutoBaselines* methods seen in this interface. This is the method that should be called on a regular basis by some sort of job scheduler / timer to determine whether baselines even need to be calculated. This is an inexpensive operation and can be run every minute if needed because it will only calculate baselines for the ones that need it (as configured by the system preferences for how frequently they should be recalculated, and how much data should be used in that recalculation).

Specified by:
calculateAutoBaselines in interface MeasurementBaselineManagerLocal

calculateAutoBaselines

public long calculateAutoBaselines(long amountOfData,
                                   long baselinesOlderThanTime)
Description copied from interface: MeasurementBaselineManagerLocal
Calculates baselines for all scheduled measurements. The measurement data that was collected between the given start and end times is used to calculate the baselines.

Specified by:
calculateAutoBaselines in interface MeasurementBaselineManagerLocal
Parameters:
amountOfData - will use amountOfData to compute new min/max/mean for baselines as appropriate
baselinesOlderThanTime - deletes baselines older than the time specified
Returns:
the time that all the baselines were computed;

_calculateAutoBaselinesDELETE

public int _calculateAutoBaselinesDELETE(long olderThanTime)
                                  throws Exception
Description copied from interface: MeasurementBaselineManagerLocal
Deletes baselines that are older than the time specified

Specified by:
_calculateAutoBaselinesDELETE in interface MeasurementBaselineManagerLocal
Parameters:
olderThanTime - deletes baselines older than the time specified
Returns:
number of rows deleted
Throws:
Exception

_calculateAutoBaselinesINSERT

public int _calculateAutoBaselinesINSERT(long amountOfData)
                                  throws Exception
Description copied from interface: MeasurementBaselineManagerLocal
Inserts baselines "as appropriate" for measurements that have at least amountOfData

Specified by:
_calculateAutoBaselinesINSERT in interface MeasurementBaselineManagerLocal
Parameters:
amountOfData - will use amountOfData to compute new min/max/mean for baselines as appropriate
Returns:
number of rows inserted
Throws:
Exception

getBaselineIfEqual

public org.rhq.core.domain.measurement.MeasurementBaseline getBaselineIfEqual(org.rhq.core.domain.auth.Subject subject,
                                                                              int groupId,
                                                                              int definitionId)
If the measurement baselines for the corresponding resources are the same, that value will be returned; otherwise null will be returned

Specified by:
getBaselineIfEqual in interface MeasurementBaselineManagerLocal

calculateAutoBaseline

public org.rhq.core.domain.measurement.MeasurementBaseline calculateAutoBaseline(org.rhq.core.domain.auth.Subject subject,
                                                                                 Integer measurementScheduleId,
                                                                                 long startDate,
                                                                                 long endDate,
                                                                                 boolean save)
                                                                          throws BaselineCreationException,
                                                                                 MeasurementNotFoundException
Description copied from interface: MeasurementBaselineManagerLocal
Calculate a baseline value for the given metric based on the specified date range, optionally setting the metric's baseline to the calculated value.

Specified by:
calculateAutoBaseline in interface MeasurementBaselineManagerLocal
measurementScheduleId - measurement id to recalc.
startDate - begin date range
endDate - end date range
save - whether or not to save the recalculated baseline
Returns:
the calculated baseline value
Throws:
BaselineCreationException
MeasurementNotFoundException

calculateAutoBaselineInNewTransaction

public org.rhq.core.domain.measurement.MeasurementBaseline calculateAutoBaselineInNewTransaction(org.rhq.core.domain.auth.Subject subject,
                                                                                                 Integer measurementScheduleId,
                                                                                                 long startDate,
                                                                                                 long endDate,
                                                                                                 boolean save)
                                                                                          throws BaselineCreationException,
                                                                                                 MeasurementNotFoundException
Specified by:
calculateAutoBaselineInNewTransaction in interface MeasurementBaselineManagerLocal
Throws:
BaselineCreationException
MeasurementNotFoundException

calculateAutoBaseline

public org.rhq.core.domain.measurement.MeasurementBaseline calculateAutoBaseline(org.rhq.core.domain.auth.Subject subject,
                                                                                 int groupId,
                                                                                 int definitionId,
                                                                                 long startDate,
                                                                                 long endDate,
                                                                                 boolean save)
                                                                          throws BaselineCreationException,
                                                                                 MeasurementNotFoundException
Specified by:
calculateAutoBaseline in interface MeasurementBaselineManagerLocal
Throws:
BaselineCreationException
MeasurementNotFoundException

calculateAutoBaselineForGroupInNewTransaction

public org.rhq.core.domain.measurement.MeasurementBaseline calculateAutoBaselineForGroupInNewTransaction(org.rhq.core.domain.auth.Subject subject,
                                                                                                         int groupId,
                                                                                                         int definitionId,
                                                                                                         long startDate,
                                                                                                         long endDate,
                                                                                                         boolean save)
                                                                                                  throws BaselineCreationException,
                                                                                                         MeasurementNotFoundException
Specified by:
calculateAutoBaselineForGroupInNewTransaction in interface MeasurementBaselineManagerLocal
Throws:
BaselineCreationException
MeasurementNotFoundException

enableAutoBaselineCalculation

public void enableAutoBaselineCalculation(org.rhq.core.domain.auth.Subject subject,
                                          Integer[] resourceIds,
                                          Integer[] definitionIds)
Description copied from interface: MeasurementBaselineManagerLocal
Unset the user-entered property in baselines so that we can do autobaselines on it again.

Specified by:
enableAutoBaselineCalculation in interface MeasurementBaselineManagerLocal
definitionIds - measurement definition IDs

findBaselinesForResource

public List<org.rhq.core.domain.measurement.MeasurementBaseline> findBaselinesForResource(org.rhq.core.domain.auth.Subject subject,
                                                                                          int resourceId)
Description copied from interface: MeasurementBaselineManagerLocal
Return a list of MeasurementBaseline objects for the Resource represented by the given id.

Specified by:
findBaselinesForResource in interface MeasurementBaselineManagerLocal
Specified by:
findBaselinesForResource in interface MeasurementBaselineManagerRemote
Parameters:
subject - the user request to view the baseline history for the given resource
resourceId - the id of the resource whose baselines are to be returned
Returns:
a list of baselines for all measurements scheduled on the given resource


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