com.commsen.stopwatch.storages
Class MemoryHSQLInMemoryStorage

java.lang.Object
  extended by com.commsen.stopwatch.storages.AbstractDatabaseStorage
      extended by com.commsen.stopwatch.storages.DefaultHSQLInMemoryStorage
          extended by com.commsen.stopwatch.storages.MemoryHSQLInMemoryStorage
All Implemented Interfaces:
StopwatchStorage

public class MemoryHSQLInMemoryStorage
extends DefaultHSQLInMemoryStorage

TODO Dokumentacja

Author:
Milen Dyankov

Field Summary
 
Fields inherited from class com.commsen.stopwatch.storages.AbstractDatabaseStorage
allByGroupReportStatement, allByLabelReportStatement, allReportStatement, deletePreparedStatement, groupLabelLoadStatement, groupLoadStatement, groupReportStatement, insertPreparedStatement, labelLoadStatement, labelReportStatement, lastIdentityStatement, loadStatement, properties, singleReportStatement, updatePreparedStatement
 
Constructor Summary
MemoryHSQLInMemoryStorage()
           
 
Method Summary
 boolean completeRecord(long id, java.lang.Object[] parameters)
          Instructs the storage to complete (at least remember the time) the record identified by given parameters.
protected  java.lang.String getCreateTableQuery()
          Called to obtain the query to be executed when table needs to be created.
 java.lang.String getInsertQuery()
           
protected  org.apache.log4j.Logger getLogger()
          Returns the logger for this class
protected  java.lang.String getReturnColumns()
          Called to obtain the columns to be returned.
protected  java.lang.String getTableName()
          Provides the table name
protected  java.lang.String getUpdateQuery()
           
 long newRecord(java.lang.Object[] parameters)
          Instructs the storage to create new record and store passed parameters.
protected  Report[] prepareReports(java.sql.PreparedStatement preparedStatement, java.lang.Object[] params)
          This method simply executes given statement with given params.
 
Methods inherited from class com.commsen.stopwatch.storages.DefaultHSQLInMemoryStorage
close, freeze, getConnectionString, getDriver, getLastIdentityQuery, getPassword, getTruncTableQuery, getUser, isDebugEnabled, setDebugEnabled
 
Methods inherited from class com.commsen.stopwatch.storages.AbstractDatabaseStorage
getAllByGroupReportQuery, getAllByGroupReports, getAllByLabelReportQuery, getAllByLabelReports, getAllReportQuery, getCheckTableQuery, getDeleteQuery, getGroupBy, getGroupLabelLoadQuery, getGroupLoadQuery, getGroupReportQuery, getGroupReports, getLabelLoadQuery, getLabelReportQuery, getLabelReports, getLoad, getLoadQuery, getOrderBy, getProperties, getReport, getReports, getSingleReportQuery, isDebug, newCompleteRecord, open, removeRecord, setProperties, unfreeze
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MemoryHSQLInMemoryStorage

public MemoryHSQLInMemoryStorage()
Method Detail

getTableName

protected java.lang.String getTableName()
Description copied from class: AbstractDatabaseStorage
Provides the table name

Overrides:
getTableName in class DefaultHSQLInMemoryStorage
Returns:
table name

getCreateTableQuery

protected java.lang.String getCreateTableQuery()
Description copied from class: AbstractDatabaseStorage
Called to obtain the query to be executed when table needs to be created.

Default is:

 create table AbstractDatabaseStorage.getTableName() (
        _id INT GENERATED BY DEFAULT AS IDENTITY,
        _group VARCHAR,
        _label VARCHAR,
        _start TIMESTAMP,
        _end TIMESTAMP
 )
 

Overrides:
getCreateTableQuery in class AbstractDatabaseStorage
Returns:
SQL query to create table

getReturnColumns

protected java.lang.String getReturnColumns()
Description copied from class: AbstractDatabaseStorage
Called to obtain the columns to be returned. The columns returned by this method are used in all report queries.

Overrides:
getReturnColumns in class DefaultHSQLInMemoryStorage
Returns:
part of SQL query

getInsertQuery

public java.lang.String getInsertQuery()
Overrides:
getInsertQuery in class AbstractDatabaseStorage

getUpdateQuery

protected java.lang.String getUpdateQuery()
Overrides:
getUpdateQuery in class AbstractDatabaseStorage

newRecord

public long newRecord(java.lang.Object[] parameters)
               throws StopwatchStorageException
Description copied from interface: StopwatchStorage
Instructs the storage to create new record and store passed parameters. Engines should know what parameters storage expects.

Specified by:
newRecord in interface StopwatchStorage
Overrides:
newRecord in class AbstractDatabaseStorage
Returns:
the id of newly created record
Throws:
StopwatchStorageException
See Also:
StopwatchStorage.newRecord(java.lang.Object[])

completeRecord

public boolean completeRecord(long id,
                              java.lang.Object[] parameters)
                       throws StopwatchStorageException
Description copied from interface: StopwatchStorage
Instructs the storage to complete (at least remember the time) the record identified by given parameters. Engines should know what parameters storage expects. Most storages will assume that parameters passed uniquely identify only one record.

Specified by:
completeRecord in interface StopwatchStorage
Overrides:
completeRecord in class AbstractDatabaseStorage
Parameters:
id - of the database record to be updated
parameters - used to find the record
Returns:
true if record was completed successfuly, false otherwise
Throws:
StopwatchStorageException - on error
See Also:
StopwatchStorage.completeRecord(long, Object[])

prepareReports

protected Report[] prepareReports(java.sql.PreparedStatement preparedStatement,
                                  java.lang.Object[] params)
                           throws java.sql.SQLException
Description copied from class: AbstractDatabaseStorage
This method simply executes given statement with given params. All report queries call this method to obtain array of reports. This method should be overwriten by extending classes that need to provide more measurment information then basic time and count.

Overrides:
prepareReports in class AbstractDatabaseStorage
Parameters:
preparedStatement -
params - the params to passed to the prepared statement
Returns:
array of reports
Throws:
java.sql.SQLException

getLogger

protected org.apache.log4j.Logger getLogger()
Description copied from class: AbstractDatabaseStorage
Returns the logger for this class

Overrides:
getLogger in class DefaultHSQLInMemoryStorage
Returns:
the logger for this class


Copyright © 2006-2008 Commsen International. All Rights Reserved.