| |
|
| java.lang.Object com.commsen.stopwatch.storages.AbstractDatabaseStorage
All known Subclasses: com.commsen.stopwatch.storages.DefaultHSQLStorage, com.commsen.stopwatch.storages.DefaultHSQLInMemoryStorage,
AbstractDatabaseStorage | abstract public class AbstractDatabaseStorage implements StopwatchStorage(Code) | | Abstract class representig database storage. It has predefined methods to
crete table(s) as well as insert, update and delete records.
The default implementation is limited to the very basic measurment data - time and count.
If any other info is to be stored, the extending class should overwrite appropriate
getXxxxQuery() method(s)
author: Milen Dyankov |
Method Summary | |
public void | close() | public boolean | completeRecord(long id, Object[] parameters) | public void | freeze() | protected String | getAllByGroupReportQuery() | public Report[] | getAllByGroupReports() This method simply calls
AbstractDatabaseStorage.prepareReports(PreparedStatement,Object[]) passing
AbstractDatabaseStorage.allByGroupReportStatement as statement and no parameters (null value). | protected String | getAllByLabelReportQuery() | public Report[] | getAllByLabelReports() This method simply calls
AbstractDatabaseStorage.prepareReports(PreparedStatement,Object[]) passing
AbstractDatabaseStorage.allByLabelReportStatement as statement and no parameters (null value). | protected String | getAllReportQuery() | protected String | getCheckTableQuery() | abstract protected String | getConnectionString() | protected String | getCreateTableQuery() Called to obtain the query to be executed when table needs to be created. | protected String | getDeleteQuery() | abstract protected String | getDriver() | protected String | getGroupBy() | protected String | getGroupLabelLoadQuery() | protected String | getGroupLoadQuery() | protected String | getGroupReportQuery() | public Report[] | getGroupReports(String group) This method simply calls
AbstractDatabaseStorage.prepareReports(PreparedStatement,Object[]) passing
AbstractDatabaseStorage.groupReportStatement as statement and group as parameter. | public String | getInsertQuery() | protected String | getLabelLoadQuery() | protected String | getLabelReportQuery() | public Report[] | getLabelReports(String label) This method simply calls
AbstractDatabaseStorage.prepareReports(PreparedStatement,Object[]) passing
AbstractDatabaseStorage.labelReportStatement as statement and label as parameter. | abstract protected String | getLastIdentityQuery() | public long[] | getLoad(String group, String label, int field, int value) | protected String | getLoadQuery() | abstract protected Logger | getLogger() | protected String | getOrderBy() | abstract protected String | getPassword() | public Report | getReport(String group, String label) This method simply calls
AbstractDatabaseStorage.prepareReports(PreparedStatement,Object[]) passing
AbstractDatabaseStorage.singleReportStatement as statement and group and label as parameters. | public Report[] | getReports() This method simply calls
AbstractDatabaseStorage.prepareReports(PreparedStatement,Object[]) passing
AbstractDatabaseStorage.allReportStatement as statement and no parameters (null value). | abstract protected String | getReturnColumns() Called to obtain the columns to be returned. | protected String | getSingleReportQuery() | abstract protected String | getTableName() | protected String | getTruncTableQuery() | protected String | getUpdateQuery() | abstract protected String | getUser() | protected boolean | isDebug() Checks if debug log level is enabled in both Stopwatch and Log4j. | abstract public boolean | isDebugEnabled() | public long | newCompleteRecord(Object[] startParameters, Object[] endParameters) | public long | newRecord(Object[] parameters) | public void | open() | protected Report[] | prepareReports(PreparedStatement statement, Object[] params) This method simply executes given statement with given params .
All report queries call this method to obtain array of reports. | public boolean | removeRecord(long id) | public void | unfreeze() |
selectConnection | Connection selectConnection(Code) | | Detabase connection used to execute all select queries
|
updateConnection | Connection updateConnection(Code) | | Detabase connection used to execute all update queries
|
getConnectionString | abstract protected String getConnectionString()(Code) | | Called to obtain the connection string
the connection string |
getCreateTableQuery | protected String getCreateTableQuery()(Code) | | 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
)
SQL query to create table |
getDriver | abstract protected String getDriver()(Code) | | Called to obtain the JDBC driver to use
the fully qualified class name |
getGroupBy | protected String getGroupBy()(Code) | | The group by clause used in all report queries
Default is: _group, _label
part of SQL query |
getGroupLabelLoadQuery | protected String getGroupLabelLoadQuery()(Code) | | |
getLastIdentityQuery | abstract protected String getLastIdentityQuery()(Code) | | |
getLogger | abstract protected Logger getLogger()(Code) | | Returns the logger for this class
the logger for this class |
getOrderBy | protected String getOrderBy()(Code) | | The order by clause used in all report queries
Default is: _group, _label
part of SQL query |
getPassword | abstract protected String getPassword()(Code) | | Called to obtain the database password
database password |
getReturnColumns | abstract protected String getReturnColumns()(Code) | | Called to obtain the columns to be returned. The columns returned by this method are
used in all report queries.
part of SQL query |
getTableName | abstract protected String getTableName()(Code) | | Provides the table name
table name |
getUser | abstract protected String getUser()(Code) | | Called to obtain the database user name
database user name |
isDebug | protected boolean isDebug()(Code) | | Checks if debug log level is enabled in both Stopwatch and Log4j.
true if debug log level is enabled, false otherwise. |
prepareReports | protected Report[] prepareReports(PreparedStatement statement, Object[] params) throws SQLException(Code) | | 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.
Parameters: statement - the prepared statement to execute Parameters: params - the params to passed to the prepared statement array of Report throws: SQLException - on database connection error or other errors |
|
|
|