org.rhq.enterprise.server.measurement.util
Class MeasurementDataManagerUtility
java.lang.Object
org.rhq.enterprise.server.measurement.util.MeasurementDataManagerUtility
public class MeasurementDataManagerUtility
- extends java.lang.Object
This is purposefully not TimeZone sensitive. It makes this easier to deal with in clusters with servers in different
timezones, but it means that we can't rely on table maintenance in the middle of the night. That's ok, we're going to
do this like the rest of the maintenance on the hour. It does mean that even with 12 hour tables we may have data in
one from 10 am to 10 pm local instead of 12 to 12.
Due to the leap seconds its possible some tables will technically span more than MILLISECONDS_PER_TABLE of real
time. This is an irrelevant quirk.
- Author:
- Greg Hinkle
|
Method Summary |
MeasurementAggregate |
getAggregateByGroupAndDefinition(long beginTime,
long endTime,
int groupId,
int definitionId)
|
MeasurementAggregate |
getAggregateByScheduleId(long beginTime,
long endTime,
long scheduleId)
|
MeasurementAggregate |
getAggregateByScheduleIds(long beginTime,
long endTime,
int[] scheduleIds)
|
static java.lang.String[] |
getAllRawTables()
|
static java.lang.String[] |
getAllRawTables(int startIndex)
The raw tables starting at the specified index. |
static java.lang.String |
getCurrentRawTable()
|
static java.lang.String |
getDeadTable(long time)
|
static MeasurementDataManagerUtility |
getInstance(java.sql.Connection connection)
|
static MeasurementDataManagerUtility |
getInstance(javax.sql.DataSource dataSource)
|
MeasurementDataNumeric |
getLatestValueForSchedule(int scheduleId)
|
java.util.List<java.util.List<MeasurementDataNumericHighLowComposite>> |
getMeasurementDataAggregatesForSiblingResources(long beginTime,
long endTime,
int[] resourceIds,
int measurementDefinitionId)
|
java.util.List<java.util.List<MeasurementDataNumericHighLowComposite>> |
getMeasurementDataAggregatesForSiblingResources(long beginTime,
long endTime,
int[] resourceIds,
int measurementDefinitionId,
int numDataPoints)
|
java.util.List<java.util.List<MeasurementDataNumericHighLowComposite>> |
getMeasurementDataForResource(long beginTime,
long endTime,
int resourceId,
int[] measurementDefinitionIds)
|
java.util.List<java.util.List<MeasurementDataNumericHighLowComposite>> |
getMeasurementDataForResource(long beginTime,
long endTime,
int resourceId,
int[] measurementDefinitionIds,
int numDataPoints)
|
java.util.List<java.util.List<MeasurementDataNumericHighLowComposite>> |
getMeasurementDataForSiblingResources(long beginTime,
long endTime,
int[] resourceIds,
int measurementDefinitionId)
|
java.util.List<java.util.List<MeasurementDataNumericHighLowComposite>> |
getMeasurementDataForSiblingResources(long beginTime,
long endTime,
int[] resourceIds,
int measurementDefinitionId,
int numDataPoints)
|
static java.lang.String |
getNextRotationTime()
|
long |
getPurge1d()
|
long |
getPurge1h()
|
long |
getPurge6h()
|
long |
getPurgeAlert()
|
long |
getPurgeRt()
|
static long |
getRawTimePeriodStart(long end)
|
static java.lang.String |
getTable(long time)
|
static int |
getTableNameIndex(java.lang.String tableName)
|
static java.lang.String[] |
getTables(long beginTime,
long endTime)
|
static java.lang.String |
getTableString(java.lang.String table,
java.lang.String valuesClause,
java.lang.String otherTables,
java.lang.String conditions)
|
static boolean |
isRawTable(java.lang.String tableName)
|
static boolean |
isRawTimePeriod(long beginTime)
|
static void |
main(java.lang.String[] args)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
STORED_DAYS
public static final int STORED_DAYS
- See Also:
- Constant Field Values
TABLES_PER_DAY
public static final int TABLES_PER_DAY
- See Also:
- Constant Field Values
BUFFER_TABLES
public static final int BUFFER_TABLES
- See Also:
- Constant Field Values
LIVE_TABLES
public static final int LIVE_TABLES
- See Also:
- Constant Field Values
TABLE_COUNT
public static final int TABLE_COUNT
- See Also:
- Constant Field Values
MILLESECONDS_PER_TABLE
public static final long MILLESECONDS_PER_TABLE
- See Also:
- Constant Field Values
RAW_PURGE
public static final long RAW_PURGE
- See Also:
- Constant Field Values
DEFAULT_NUM_DATA_POINTS
public static final int DEFAULT_NUM_DATA_POINTS
- For methods taking a number of data points, the default if the passed value is invalid (<=0).
- See Also:
- Constant Field Values
MeasurementDataManagerUtility
public MeasurementDataManagerUtility()
getInstance
public static MeasurementDataManagerUtility getInstance(javax.sql.DataSource dataSource)
getInstance
public static MeasurementDataManagerUtility getInstance(java.sql.Connection connection)
getTable
public static java.lang.String getTable(long time)
getAllRawTables
public static java.lang.String[] getAllRawTables()
getAllRawTables
public static java.lang.String[] getAllRawTables(int startIndex)
- The raw tables starting at the specified index. Can be useful for getting the tables in a necessary time order (like
oldest data first.
- Parameters:
startIndex - >= 0. If >= TABLE_COUNT normalized via modulo.
- Returns:
- Array of raw table names starting with the table with the specified index.
getTables
public static java.lang.String[] getTables(long beginTime,
long endTime)
getDeadTable
public static java.lang.String getDeadTable(long time)
getCurrentRawTable
public static java.lang.String getCurrentRawTable()
getNextRotationTime
public static java.lang.String getNextRotationTime()
getTableNameIndex
public static int getTableNameIndex(java.lang.String tableName)
getMeasurementDataForResource
public java.util.List<java.util.List<MeasurementDataNumericHighLowComposite>> getMeasurementDataForResource(long beginTime,
long endTime,
int resourceId,
int[] measurementDefinitionIds)
throws MeasurementNotFoundException
- Throws:
MeasurementNotFoundException
getMeasurementDataForResource
public java.util.List<java.util.List<MeasurementDataNumericHighLowComposite>> getMeasurementDataForResource(long beginTime,
long endTime,
int resourceId,
int[] measurementDefinitionIds,
int numDataPoints)
throws MeasurementNotFoundException
- Throws:
MeasurementNotFoundException
getMeasurementDataForSiblingResources
public java.util.List<java.util.List<MeasurementDataNumericHighLowComposite>> getMeasurementDataForSiblingResources(long beginTime,
long endTime,
int[] resourceIds,
int measurementDefinitionId)
throws MeasurementNotFoundException
- Throws:
MeasurementNotFoundException
getMeasurementDataForSiblingResources
public java.util.List<java.util.List<MeasurementDataNumericHighLowComposite>> getMeasurementDataForSiblingResources(long beginTime,
long endTime,
int[] resourceIds,
int measurementDefinitionId,
int numDataPoints)
throws MeasurementNotFoundException
- Throws:
MeasurementNotFoundException
getMeasurementDataAggregatesForSiblingResources
public java.util.List<java.util.List<MeasurementDataNumericHighLowComposite>> getMeasurementDataAggregatesForSiblingResources(long beginTime,
long endTime,
int[] resourceIds,
int measurementDefinitionId)
throws MeasurementNotFoundException
- Throws:
MeasurementNotFoundException
getMeasurementDataAggregatesForSiblingResources
public java.util.List<java.util.List<MeasurementDataNumericHighLowComposite>> getMeasurementDataAggregatesForSiblingResources(long beginTime,
long endTime,
int[] resourceIds,
int measurementDefinitionId,
int numDataPoints)
throws MeasurementNotFoundException
- Throws:
MeasurementNotFoundException
getAggregateByScheduleId
public MeasurementAggregate getAggregateByScheduleId(long beginTime,
long endTime,
long scheduleId)
throws MeasurementNotFoundException
- Throws:
MeasurementNotFoundException
getAggregateByGroupAndDefinition
public MeasurementAggregate getAggregateByGroupAndDefinition(long beginTime,
long endTime,
int groupId,
int definitionId)
throws MeasurementNotFoundException
- Throws:
MeasurementNotFoundException
getAggregateByScheduleIds
public MeasurementAggregate getAggregateByScheduleIds(long beginTime,
long endTime,
int[] scheduleIds)
throws MeasurementNotFoundException
- Throws:
MeasurementNotFoundException
getLatestValueForSchedule
public MeasurementDataNumeric getLatestValueForSchedule(int scheduleId)
getTableString
public static java.lang.String getTableString(java.lang.String table,
java.lang.String valuesClause,
java.lang.String otherTables,
java.lang.String conditions)
getPurge1h
public long getPurge1h()
getPurge6h
public long getPurge6h()
getPurge1d
public long getPurge1d()
getPurgeRt
public long getPurgeRt()
getPurgeAlert
public long getPurgeAlert()
main
public static void main(java.lang.String[] args)
throws java.lang.Exception
- Throws:
java.lang.Exception
getRawTimePeriodStart
public static long getRawTimePeriodStart(long end)
isRawTimePeriod
public static boolean isRawTimePeriod(long beginTime)
isRawTable
public static boolean isRawTable(java.lang.String tableName)
Copyright © 2008-2009 Red Hat, Inc.. All Rights Reserved.