org.apache.geronimo.monitoring.snapshot
Class SnapshotDBHelper

java.lang.Object
  extended by org.apache.geronimo.monitoring.snapshot.SnapshotDBHelper

public class SnapshotDBHelper
extends Object


Constructor Summary
SnapshotDBHelper()
           
SnapshotDBHelper(DataSource activeDS, DataSource archiveDS)
           
 
Method Summary
 boolean addSnapshotToDB(HashMap<String,HashMap<String,Long>> aggregateStats)
           
 ArrayList<HashMap<String,HashMap<String,Object>>> fetchData(Integer numberOfSnapshot, Integer everyNthSnapshot)
          Fetches the data stored from the snapshot thread and returns it in a ArrayList with each element being a HashMap of the attribute mapping to the statistic.
 HashMap<String,HashMap<String,Long>> fetchMaxSnapshotData(Integer numberOfSnapshots)
           
 HashMap<String,HashMap<String,Long>> fetchMinSnapshotData(Integer numberOfSnapshots)
           
 HashMap<String,ArrayList<String>> getAllSnapshotStatAttributes()
           
 Long getSnapshotCount()
           
 TreeMap<Long,Long> getSpecificStatistics(String mbeanName, String statsName, int numberOfSnapshots, int everyNthSnapshot, boolean showArchived)
           
 String prepareInsertSnapshotStatement(String snapshot_time, String statsValueList, int mbeanId)
           
 void setDataSources(DataSource active, DataSource archive)
          Sets the necessary data sources for this helper to talk to the db
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SnapshotDBHelper

public SnapshotDBHelper()

SnapshotDBHelper

public SnapshotDBHelper(DataSource activeDS,
                        DataSource archiveDS)
Method Detail

getAllSnapshotStatAttributes

public HashMap<String,ArrayList<String>> getAllSnapshotStatAttributes()
Returns:
A map: mbeanName --> ArrayList of statistic attributes for that mbean

getSnapshotCount

public Long getSnapshotCount()
Returns:
The number of snapshots present in the active database

fetchMaxSnapshotData

public HashMap<String,HashMap<String,Long>> fetchMaxSnapshotData(Integer numberOfSnapshots)
Parameters:
numberOfSnapshots - - the number of latest snapshots to look at
Returns:
A hashmap which maps an mbean --> a hashmap with an attribute name and its value . All values will be the max.

fetchMinSnapshotData

public HashMap<String,HashMap<String,Long>> fetchMinSnapshotData(Integer numberOfSnapshots)
Parameters:
numberOfSnapshots - - the number of latest snapshots to look at
Returns:
A hashmap which maps an mbean --> a hashmap with an attribute name and its value . All values will be the min.

addSnapshotToDB

public boolean addSnapshotToDB(HashMap<String,HashMap<String,Long>> aggregateStats)
Parameters:
ds -
aggregateStats -
Returns:
Returns a boolean if the snapshot statistics were successfully added to the DB.

prepareInsertSnapshotStatement

public String prepareInsertSnapshotStatement(String snapshot_time,
                                             String statsValueList,
                                             int mbeanId)
Parameters:
snapshot_time -
statsValueList -
mbeanId -
Returns:
Returns an SQL insert statement for one statistic given the correct information.

fetchData

public ArrayList<HashMap<String,HashMap<String,Object>>> fetchData(Integer numberOfSnapshot,
                                                                   Integer everyNthSnapshot)
Fetches the data stored from the snapshot thread and returns it in a ArrayList with each element being a HashMap of the attribute mapping to the statistic. Grabs 'numberOfSnapshots' snapshots. Grabs one snapshot per 'everyNthsnapshot'

Parameters:
numberOfSnapshot -
everyNthSnapshot -
Returns:
ArrayList

getSpecificStatistics

public TreeMap<Long,Long> getSpecificStatistics(String mbeanName,
                                                String statsName,
                                                int numberOfSnapshots,
                                                int everyNthSnapshot,
                                                boolean showArchived)
Parameters:
mbeanName -
statsName -
numberOfSnapshots -
everyNthSnapshot -
Returns:
HashMap which maps from a snapshot_time --> value of the mbean.statsName at that time

setDataSources

public void setDataSources(DataSource active,
                           DataSource archive)
Sets the necessary data sources for this helper to talk to the db

Parameters:
activeDS -
archiveDS -


Copyright © 2003-2008 The Apache Geronimo development community. All Rights Reserved.