Java Doc for AbstractDatabaseStorage.java in  » Profiler » stopwatch » com » commsen » stopwatch » storages » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Profiler » stopwatch » com.commsen.stopwatch.storages 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


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


Field Summary
protected  PreparedStatementallByGroupReportStatement
    
protected  PreparedStatementallByLabelReportStatement
    
protected  PreparedStatementallReportStatement
    
protected  PreparedStatementdeletePreparedStatement
    
protected  PreparedStatementgroupLabelLoadStatement
    
protected  PreparedStatementgroupLoadStatement
    
protected  PreparedStatementgroupReportStatement
    
protected  PreparedStatementinsertPreparedStatement
    
protected  PreparedStatementlabelLoadStatement
    
protected  PreparedStatementlabelReportStatement
    
protected  PreparedStatementlastIdentityStatement
    
protected  PreparedStatementloadStatement
    
 ConnectionselectConnection
    
protected  PreparedStatementsingleReportStatement
    
 ConnectionupdateConnection
    
protected  PreparedStatementupdatePreparedStatement
    


Method Summary
public  voidclose()
    
public  booleancompleteRecord(long id, Object[] parameters)
    
public  voidfreeze()
    
protected  StringgetAllByGroupReportQuery()
    
public  Report[]getAllByGroupReports()
     This method simply calls AbstractDatabaseStorage.prepareReports(PreparedStatement,Object[]) passing AbstractDatabaseStorage.allByGroupReportStatement as statement and no parameters (null value).
protected  StringgetAllByLabelReportQuery()
    
public  Report[]getAllByLabelReports()
     This method simply calls AbstractDatabaseStorage.prepareReports(PreparedStatement,Object[]) passing AbstractDatabaseStorage.allByLabelReportStatement as statement and no parameters (null value).
protected  StringgetAllReportQuery()
    
protected  StringgetCheckTableQuery()
    
abstract protected  StringgetConnectionString()
    
protected  StringgetCreateTableQuery()
     Called to obtain the query to be executed when table needs to be created.
protected  StringgetDeleteQuery()
    
abstract protected  StringgetDriver()
    
protected  StringgetGroupBy()
    
protected  StringgetGroupLabelLoadQuery()
    
protected  StringgetGroupLoadQuery()
    
protected  StringgetGroupReportQuery()
    
public  Report[]getGroupReports(String group)
     This method simply calls AbstractDatabaseStorage.prepareReports(PreparedStatement,Object[]) passing AbstractDatabaseStorage.groupReportStatement as statement and group as parameter.
public  StringgetInsertQuery()
    
protected  StringgetLabelLoadQuery()
    
protected  StringgetLabelReportQuery()
    
public  Report[]getLabelReports(String label)
     This method simply calls AbstractDatabaseStorage.prepareReports(PreparedStatement,Object[]) passing AbstractDatabaseStorage.labelReportStatement as statement and label as parameter.
abstract protected  StringgetLastIdentityQuery()
    
public  long[]getLoad(String group, String label, int field, int value)
    
protected  StringgetLoadQuery()
    
abstract protected  LoggergetLogger()
    
protected  StringgetOrderBy()
    
abstract protected  StringgetPassword()
    
public  ReportgetReport(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  StringgetReturnColumns()
     Called to obtain the columns to be returned.
protected  StringgetSingleReportQuery()
    
abstract protected  StringgetTableName()
    
protected  StringgetTruncTableQuery()
    
protected  StringgetUpdateQuery()
    
abstract protected  StringgetUser()
    
protected  booleanisDebug()
     Checks if debug log level is enabled in both Stopwatch and Log4j.
abstract public  booleanisDebugEnabled()
    
public  longnewCompleteRecord(Object[] startParameters, Object[] endParameters)
    
public  longnewRecord(Object[] parameters)
    
public  voidopen()
    
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  booleanremoveRecord(long id)
    
public  voidunfreeze()
    

Field Detail
allByGroupReportStatement
protected PreparedStatement allByGroupReportStatement(Code)
Prepared statement initialized in AbstractDatabaseStorage.open() method with query returned by AbstractDatabaseStorage.getAllByGroupReportQuery()



allByLabelReportStatement
protected PreparedStatement allByLabelReportStatement(Code)
Prepared statement initialized in AbstractDatabaseStorage.open() method with query returned by AbstractDatabaseStorage.getAllByLabelReportQuery()



allReportStatement
protected PreparedStatement allReportStatement(Code)
Prepared statement initialized in AbstractDatabaseStorage.open() method with query returned by AbstractDatabaseStorage.getAllReportQuery()



deletePreparedStatement
protected PreparedStatement deletePreparedStatement(Code)
Prepared statement initialized in AbstractDatabaseStorage.open() method with query returned by AbstractDatabaseStorage.getDeleteQuery()



groupLabelLoadStatement
protected PreparedStatement groupLabelLoadStatement(Code)



groupLoadStatement
protected PreparedStatement groupLoadStatement(Code)



groupReportStatement
protected PreparedStatement groupReportStatement(Code)
Prepared statement initialized in AbstractDatabaseStorage.open() method with query returned by AbstractDatabaseStorage.getGroupReportQuery()



insertPreparedStatement
protected PreparedStatement insertPreparedStatement(Code)
Prepared statement initialized in AbstractDatabaseStorage.open() method with query returned by AbstractDatabaseStorage.getInsertQuery()



labelLoadStatement
protected PreparedStatement labelLoadStatement(Code)



labelReportStatement
protected PreparedStatement labelReportStatement(Code)
Prepared statement initialized in AbstractDatabaseStorage.open() method with query returned by AbstractDatabaseStorage.getLabelReportQuery()



lastIdentityStatement
protected PreparedStatement lastIdentityStatement(Code)
Prepared statement initialized in AbstractDatabaseStorage.open() method with query returned by AbstractDatabaseStorage.getLastIdentityQuery()



loadStatement
protected PreparedStatement loadStatement(Code)



selectConnection
Connection selectConnection(Code)
Detabase connection used to execute all select queries



singleReportStatement
protected PreparedStatement singleReportStatement(Code)
Prepared statement initialized in AbstractDatabaseStorage.open() method with query returned by AbstractDatabaseStorage.getSingleReportQuery()



updateConnection
Connection updateConnection(Code)
Detabase connection used to execute all update queries



updatePreparedStatement
protected PreparedStatement updatePreparedStatement(Code)
Prepared statement initialized in AbstractDatabaseStorage.open() method with query returned by AbstractDatabaseStorage.getUpdateQuery()





Method Detail
close
public void close() throws StopwatchStorageException(Code)

See Also:   com.commsen.stopwatch.StopwatchStorage.close



completeRecord
public boolean completeRecord(long id, Object[] parameters) throws StopwatchStorageException(Code)

See Also:   com.commsen.stopwatch.StopwatchStorage.completeRecord(longObject[])



freeze
public void freeze() throws StopwatchStorageException(Code)

See Also:   com.commsen.stopwatch.StopwatchStorage.freeze



getAllByGroupReportQuery
protected String getAllByGroupReportQuery()(Code)
Called to obtain the query to be executed when summary report about all groups is to be generated

Default is:

 select 
AbstractDatabaseStorage.getReturnColumns()  
 from 
AbstractDatabaseStorage.getTableName()  
 where _end is not null
 group by _group
 order by _group
 )
 
SQL query used to generate report



getAllByGroupReports
public Report[] getAllByGroupReports()(Code)
This method simply calls AbstractDatabaseStorage.prepareReports(PreparedStatement,Object[]) passing AbstractDatabaseStorage.allByGroupReportStatement as statement and no parameters (null value).
See Also:   StopwatchStorage.getReports



getAllByLabelReportQuery
protected String getAllByLabelReportQuery()(Code)
Called to obtain the query to be executed when summary report about all labels is to be generated

Default is:

 select 
AbstractDatabaseStorage.getReturnColumns()  
 from 
AbstractDatabaseStorage.getTableName()  
 where _end is not null
 group by _label
 order by _label
 )
 
SQL query used to generate report



getAllByLabelReports
public Report[] getAllByLabelReports()(Code)
This method simply calls AbstractDatabaseStorage.prepareReports(PreparedStatement,Object[]) passing AbstractDatabaseStorage.allByLabelReportStatement as statement and no parameters (null value).
See Also:   StopwatchStorage.getReports



getAllReportQuery
protected String getAllReportQuery()(Code)
Called to obtain the query to be executed when report about all groups and labels is to be generated

Default is:

 select 
AbstractDatabaseStorage.getReturnColumns()  
 from 
AbstractDatabaseStorage.getTableName()  
 where _end is not null
 group by 
AbstractDatabaseStorage.getGroupBy() order by 
AbstractDatabaseStorage.getOrderBy() )
 
SQL query used to generate report



getCheckTableQuery
protected String getCheckTableQuery()(Code)
Provides SQL query which will be executed to check if table exist

Default is: select 1 from AbstractDatabaseStorage.getTableName() SQL query to check if table exist




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



getDeleteQuery
protected String getDeleteQuery()(Code)



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)



getGroupLoadQuery
protected String getGroupLoadQuery()(Code)



getGroupReportQuery
protected String getGroupReportQuery()(Code)
Called to obtain the query to be executed when report about given group and label is to be generated

Default is:

 select 
AbstractDatabaseStorage.getReturnColumns()  
 from 
AbstractDatabaseStorage.getTableName()  
 where _end is not null and _group = ? 
 group by 
AbstractDatabaseStorage.getGroupBy() order by 
AbstractDatabaseStorage.getOrderBy() )
 
SQL query used to generate report



getGroupReports
public Report[] getGroupReports(String group)(Code)
This method simply calls AbstractDatabaseStorage.prepareReports(PreparedStatement,Object[]) passing AbstractDatabaseStorage.groupReportStatement as statement and group as parameter.
See Also:   StopwatchStorage.getGroupReports(java.lang.String)



getInsertQuery
public String getInsertQuery()(Code)



getLabelLoadQuery
protected String getLabelLoadQuery()(Code)



getLabelReportQuery
protected String getLabelReportQuery()(Code)
Called to obtain the query to be executed when report about given group and label is to be generated

Default is:

 select 
AbstractDatabaseStorage.getReturnColumns()  
 from 
AbstractDatabaseStorage.getTableName()  
 where _end is not null and _label = ? 
 group by 
AbstractDatabaseStorage.getGroupBy() order by 
AbstractDatabaseStorage.getOrderBy() )
 
SQL query used to generate report



getLabelReports
public Report[] getLabelReports(String label)(Code)
This method simply calls AbstractDatabaseStorage.prepareReports(PreparedStatement,Object[]) passing AbstractDatabaseStorage.labelReportStatement as statement and label as parameter.
See Also:   StopwatchStorage.getLabelReports(java.lang.String)



getLastIdentityQuery
abstract protected String getLastIdentityQuery()(Code)



getLoad
public long[] getLoad(String group, String label, int field, int value)(Code)

See Also:   com.commsen.stopwatch.StopwatchStorage.getLoad(intint)



getLoadQuery
protected String getLoadQuery()(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



getReport
public Report getReport(String group, String label)(Code)
This method simply calls AbstractDatabaseStorage.prepareReports(PreparedStatement,Object[]) passing AbstractDatabaseStorage.singleReportStatement as statement and group and label as parameters.
See Also:   StopwatchStorage.getReport(java.lang.Stringjava.lang.String)



getReports
public Report[] getReports()(Code)
This method simply calls AbstractDatabaseStorage.prepareReports(PreparedStatement,Object[]) passing AbstractDatabaseStorage.allReportStatement as statement and no parameters (null value).
See Also:   StopwatchStorage.getReports



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



getSingleReportQuery
protected String getSingleReportQuery()(Code)
Called to obtain the query to be executed when report about given group and label is to be generated

Default is:

 select 
AbstractDatabaseStorage.getReturnColumns()  
 from 
AbstractDatabaseStorage.getTableName()  
 where _end is not null and _group = ? and _label = ? 
 group by 
AbstractDatabaseStorage.getGroupBy() order by 
AbstractDatabaseStorage.getOrderBy() )
 
SQL query used to generate report



getTableName
abstract protected String getTableName()(Code)
Provides the table name table name



getTruncTableQuery
protected String getTruncTableQuery()(Code)
Called to obtain the query to be executed when table needs to be truncated

Default is: delete from AbstractDatabaseStorage.getTableName() SQL query to truncate table




getUpdateQuery
protected String getUpdateQuery()(Code)



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.



isDebugEnabled
abstract public boolean isDebugEnabled()(Code)
Returns the debugEnabled.
See Also:   com.commsen.stopwatch.StopwatchEngine.setDebugEnabled(boolean)



newCompleteRecord
public long newCompleteRecord(Object[] startParameters, Object[] endParameters) throws StopwatchStorageException(Code)

See Also:   com.commsen.stopwatch.StopwatchStorage.newRecord(java.lang.Object[])



newRecord
public long newRecord(Object[] parameters) throws StopwatchStorageException(Code)

See Also:   com.commsen.stopwatch.StopwatchStorage.newRecord(java.lang.Object[])



open
public void open() throws StopwatchStorageException(Code)

See Also:   com.commsen.stopwatch.StopwatchStorage.open



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



removeRecord
public boolean removeRecord(long id) throws StopwatchStorageException(Code)

See Also:   com.commsen.stopwatch.StopwatchStorage.removeRecord(long)



unfreeze
public void unfreeze() throws StopwatchStorageException(Code)

See Also:   com.commsen.stopwatch.StopwatchStorage.unfreeze



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.