com.commsen.stopwatch.storages
Class DefaultHSQLInMemoryStorage

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

public class DefaultHSQLInMemoryStorage
extends AbstractDatabaseStorage

Default stopwatch storage. It uses in-memory HSQL database.

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
DefaultHSQLInMemoryStorage()
           
 
Method Summary
 void close()
          Called when engine is about to be stopped or for some other reason will no more use this storage.
 void freeze()
          Called when engine is about to be paused or for some other reason will temporary not use this storage.
protected  java.lang.String getConnectionString()
          Called to obtain the connection string
protected  java.lang.String getDriver()
          Called to obtain the JDBC driver to use
protected  java.lang.String getLastIdentityQuery()
           
protected  org.apache.log4j.Logger getLogger()
          Returns the logger for this class
protected  java.lang.String getPassword()
          Called to obtain the database password
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 getTruncTableQuery()
          Called to obtain the query to be executed when table needs to be truncated
protected  java.lang.String getUser()
          Called to obtain the database user name
 boolean isDebugEnabled()
           
 void setDebugEnabled(boolean debugEnabled)
          Instructs the storage to disable/enable debug information.
 
Methods inherited from class com.commsen.stopwatch.storages.AbstractDatabaseStorage
completeRecord, getAllByGroupReportQuery, getAllByGroupReports, getAllByLabelReportQuery, getAllByLabelReports, getAllReportQuery, getCheckTableQuery, getCreateTableQuery, getDeleteQuery, getGroupBy, getGroupLabelLoadQuery, getGroupLoadQuery, getGroupReportQuery, getGroupReports, getInsertQuery, getLabelLoadQuery, getLabelReportQuery, getLabelReports, getLoad, getLoadQuery, getOrderBy, getProperties, getReport, getReports, getSingleReportQuery, getUpdateQuery, isDebug, newCompleteRecord, newRecord, open, prepareReports, removeRecord, setProperties, unfreeze
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultHSQLInMemoryStorage

public DefaultHSQLInMemoryStorage()
Method Detail

getDriver

protected java.lang.String getDriver()
Description copied from class: AbstractDatabaseStorage
Called to obtain the JDBC driver to use

Specified by:
getDriver in class AbstractDatabaseStorage
Returns:
the fully qualified class name

getConnectionString

protected java.lang.String getConnectionString()
Description copied from class: AbstractDatabaseStorage
Called to obtain the connection string

Specified by:
getConnectionString in class AbstractDatabaseStorage
Returns:
the connection string

getUser

protected java.lang.String getUser()
Description copied from class: AbstractDatabaseStorage
Called to obtain the database user name

Specified by:
getUser in class AbstractDatabaseStorage
Returns:
database user name

getPassword

protected java.lang.String getPassword()
Description copied from class: AbstractDatabaseStorage
Called to obtain the database password

Specified by:
getPassword in class AbstractDatabaseStorage
Returns:
database password

getLastIdentityQuery

protected java.lang.String getLastIdentityQuery()
Specified by:
getLastIdentityQuery in class AbstractDatabaseStorage

getTableName

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

Specified by:
getTableName in class AbstractDatabaseStorage
Returns:
table name

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.

Specified by:
getReturnColumns in class AbstractDatabaseStorage
Returns:
part of SQL query

getTruncTableQuery

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

Default is: delete from AbstractDatabaseStorage.getTableName()

Overrides:
getTruncTableQuery in class AbstractDatabaseStorage
Returns:
SQL query to truncate table

freeze

public void freeze()
            throws StopwatchStorageException
Description copied from interface: StopwatchStorage
Called when engine is about to be paused or for some other reason will temporary not use this storage. Gives storage a chance to free resources.

Specified by:
freeze in interface StopwatchStorage
Overrides:
freeze in class AbstractDatabaseStorage
Throws:
StopwatchStorageException - if there is a problem with freezing the storage.
See Also:
StopwatchStorage.freeze()

close

public void close()
           throws StopwatchStorageException
Description copied from interface: StopwatchStorage
Called when engine is about to be stopped or for some other reason will no more use this storage. Gives storage a chance to clean up.

Specified by:
close in interface StopwatchStorage
Overrides:
close in class AbstractDatabaseStorage
Throws:
StopwatchStorageException
See Also:
StopwatchStorage.close()

getLogger

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

Specified by:
getLogger in class AbstractDatabaseStorage
Returns:
the logger for this class

isDebugEnabled

public boolean isDebugEnabled()
Specified by:
isDebugEnabled in class AbstractDatabaseStorage
Returns:
Returns the debugEnabled.
See Also:
StopwatchEngine.setDebugEnabled(boolean)

setDebugEnabled

public void setDebugEnabled(boolean debugEnabled)
Description copied from interface: StopwatchStorage
Instructs the storage to disable/enable debug information. The reason for this exist is to be able to minimize the performance impact Stopwatch may have on the measured application. Generating debug info consumes additional CPU units, which may become a problem if Stopwatch is heavily used. Setting this to false (it is false by default) should cause no debug info being generated even when log4j's level is set to DEBUG.

Parameters:
debugEnabled - The debugEnabled to set.


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