com.ebay.carad.os.vitalsigns.dao
Class SqlDataDAO

java.lang.Object
  extended by com.ebay.carad.os.vitalsigns.dao.SqlDataDAO
All Implemented Interfaces:
IDataDAO

public class SqlDataDAO
extends java.lang.Object
implements IDataDAO

An IDataDAO implementation that stores its data in a SQL DB. Default queries are provided in the form of a Format, but can be substituted for a particular SQL-syntax for other types of databases.

Uses a ISqlDao to perform its' queries.

TODO : add various SQL syntaxes to SqlDataDAO that allow a string like "MySQL.dialect" or "MSSQL.dialect" to determine what default queries to use.

Version:
$Id$
Author:
Jeremy Thomerson
See Also:
setInsertQuery(String), setSelectQuery(String)

Field Summary
private static org.apache.log4j.Logger LOGGER
           
private  java.text.Format mInsertQuery
           
private  java.text.Format mSelectQuery
           
private  ISqlDAO mSqlDAO
           
 
Fields inherited from interface com.ebay.carad.os.vitalsigns.dao.IDataDAO
EMPTY_DATA_POINT_ARRAY, NO_OP_INSTANCE
 
Constructor Summary
SqlDataDAO()
           
 
Method Summary
 DataPoint[] getData(IDashboardReport report)
           
 ISqlDAO getSqlDAO()
           
 void setInsertQuery(java.lang.String query)
          The query to insert a new DataPoint record.
 void setSelectQuery(java.lang.String query)
          The query to select all DataPoint records for a given report.
 void setSqlDAO(ISqlDAO sqlDAO)
           
 void storeReportData(float data, IReportingListenerContainer agent, IDashboardReport report)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOGGER

private static final org.apache.log4j.Logger LOGGER

mSqlDAO

private ISqlDAO mSqlDAO

mInsertQuery

private java.text.Format mInsertQuery

mSelectQuery

private java.text.Format mSelectQuery
Constructor Detail

SqlDataDAO

public SqlDataDAO()
Method Detail

storeReportData

public void storeReportData(float data,
                            IReportingListenerContainer agent,
                            IDashboardReport report)
                     throws ReportingException
Specified by:
storeReportData in interface IDataDAO
Throws:
ReportingException

getData

public DataPoint[] getData(IDashboardReport report)
Specified by:
getData in interface IDataDAO

setSqlDAO

public void setSqlDAO(ISqlDAO sqlDAO)

getSqlDAO

public ISqlDAO getSqlDAO()

setInsertQuery

public void setInsertQuery(java.lang.String query)

The query to insert a new DataPoint record. String is formatted with MessageFormat, so the rules that apply to MessageFormat apply to this String. The parameters given to the format are: new Object[] { new Long(System.currentTimeMillis()), new Integer(report.getID()), new Float(report.getThisRunData()) }.

Parameters:
query - the query to insert a new DataPoint record
See Also:
MessageFormat

setSelectQuery

public void setSelectQuery(java.lang.String query)

The query to select all DataPoint records for a given report. String is formatted with MessageFormat, so the rules that apply to MessageFormat apply to this String. The parameters given to the format are: new Object[] { new Integer(report.getID()) }.

Note that the following column names must be returned by this query:



Copyright © 2004-2009. All Rights Reserved.