Java Doc for DataSource.java in  » J2EE » Jaffa » org » jaffa » persistence » engines » jdbcengine » datasource » 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 » J2EE » Jaffa » org.jaffa.persistence.engines.jdbcengine.datasource 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.jaffa.persistence.engines.jdbcengine.datasource.DataSource

DataSource
public class DataSource (Code)
Encapsulates the connection to a data storage mechanism



Constructor Summary
 DataSource(Connection connection, Integer hitlistSize, String engineType, Boolean usePreparedStatement, Map statementCache)
     Creates a new data source. The cache for PreparedStatement and CallableStatement objects is maintained outside of this class, since we are going to pool only the connections & not the datasource itself. If the cache is not supplied initially, then the cache will be maintained for the lifecycle of a datasource only, as opposed to the pooled-connection.
Parameters:
  connection - The connection to the database.
Parameters:
  hitlistSize - The size of the hitlist.
Parameters:
  engineType - The engine type as defined in init.xml
Parameters:
  usePreparedStatement - Decides if PreparedStatements are to be used for Inserts, Updates, Deletes, Locks.

Method Summary
public  voidcloseStatement(Statement statement)
     Closes the statement and removes it from the internal collection.
public  voidcommit()
     Commits all changes executed against the persistent store.
public  CollectionexecuteQuery(String sql, ClassMetaData classMetaData, Criteria criteria, int queryTimeout)
     Executes a query against the underlying data source.
public  voidexecuteUpdate(String sql)
     Executes the sql, which should be an update/insert/delete statement.
public  voidexecuteUpdate(PreparedStatement stmt)
     Execute the input PreparedStatement.
public  CallableStatementgetCallableStatement(String sql)
     Returns the CallableStatement object for the input sql.
 ConnectiongetConnection()
     Returns the Connection object, used for creating the DataSource.
public  StringgetEngineType()
    
public  IntegergetHitlistSize()
     Getter for property hitlistSize.
public  PreparedStatementgetPreparedStatement(String sql)
     Returns the PreparedStatement object for the input sql.
public  StatementgetStatement()
     Returns a Statement object.
public  BooleangetUsePreparedStatement()
     Getter for property usePreparedStatement.
public  voidrollback()
     Rollback the changes executed against the persistent store.


Constructor Detail
DataSource
DataSource(Connection connection, Integer hitlistSize, String engineType, Boolean usePreparedStatement, Map statementCache)(Code)
Creates a new data source. The cache for PreparedStatement and CallableStatement objects is maintained outside of this class, since we are going to pool only the connections & not the datasource itself. If the cache is not supplied initially, then the cache will be maintained for the lifecycle of a datasource only, as opposed to the pooled-connection.
Parameters:
  connection - The connection to the database.
Parameters:
  hitlistSize - The size of the hitlist.
Parameters:
  engineType - The engine type as defined in init.xml
Parameters:
  usePreparedStatement - Decides if PreparedStatements are to be used for Inserts, Updates, Deletes, Locks. This property should be set to 'false' if the primary key of a table has 'CHAR' field(s).
Parameters:
  statementCache - the cache used by the connection for all the PreparedStatement and CallableStatement objects.




Method Detail
closeStatement
public void closeStatement(Statement statement) throws SQLException(Code)
Closes the statement and removes it from the internal collection.
Parameters:
  statement - the Statement object to be closed.
throws:
  SQLException - if any database error occurs.



commit
public void commit() throws SQLException(Code)
Commits all changes executed against the persistent store.
throws:
  SQLException - if any database error occurs.



executeQuery
public Collection executeQuery(String sql, ClassMetaData classMetaData, Criteria criteria, int queryTimeout) throws SQLException, PostLoadFailedException, DataSourceCursorRuntimeException, IOException(Code)
Executes a query against the underlying data source. Returns a Collection of persistent objects. The Statement object that is internally used for executing the query, will be automatically closed, once the recordset has been completely traversed.
Parameters:
  sql - The query to execute.
Parameters:
  classMetaData - The ClassMetaData defintion to be used for molding the ResultSet into Persistent objects.
Parameters:
  criteria - The Criteria used for the query. This will provide the values to set the various flags on the Persistent object.
Parameters:
  queryTimeout - This will be used for setting the timeout value on the Statement object; zero means there is no limit.
throws:
  SQLException - if any database error occurs.
throws:
  PostLoadFailedException - if any error is thrown in the PostLoad trigger of the persistent object.
throws:
  DataSourceCursorRuntimeException - if any error occurs while molding the row into the Persistent object.
throws:
  IOException - if any error occurs in reading the data from the database. a Collection of persistent objects.



executeUpdate
public void executeUpdate(String sql) throws SQLException(Code)
Executes the sql, which should be an update/insert/delete statement. The Statement object that is internally used for executing the update, will be immediately closed.
Parameters:
  sql - the sql to execute.
throws:
  SQLException - if any database error occurs.



executeUpdate
public void executeUpdate(PreparedStatement stmt) throws SQLException(Code)
Execute the input PreparedStatement. The calling program is expected to close the ResultSet(s), if any, that might be returned by executing the update.
Parameters:
  stmt - the PreparedStatement to execute.
throws:
  SQLException - if any database error occurs.



getCallableStatement
public CallableStatement getCallableStatement(String sql) throws SQLException(Code)
Returns the CallableStatement object for the input sql. The CallableStatement object will be cached for the connection.
Parameters:
  sql - the sql statement.
throws:
  SQLException - if any database error occurs. the CallableStatement object.



getConnection
Connection getConnection()(Code)
Returns the Connection object, used for creating the DataSource. a Connection.



getEngineType
public String getEngineType()(Code)
Getter for property engineType, as defined in init.xml Value of property engineType.



getHitlistSize
public Integer getHitlistSize()(Code)
Getter for property hitlistSize. Value of property hitlistSize.



getPreparedStatement
public PreparedStatement getPreparedStatement(String sql) throws SQLException(Code)
Returns the PreparedStatement object for the input sql. The PreparedStatement object will be cached for the connection.
Parameters:
  sql - the sql statement which needs to be precompiled.
throws:
  SQLException - if any database error occurs. the PreparedStatement object.



getStatement
public Statement getStatement() throws SQLException(Code)
Returns a Statement object. This object will be added to an internal collection and will be closed when the DataSource is closed. It is a good idea to invoke the closeStatement() method when done with the statement.
throws:
  SQLException - if any database error occurs. the Statement object.



getUsePreparedStatement
public Boolean getUsePreparedStatement()(Code)
Getter for property usePreparedStatement. Value of property usePreparedStatement.



rollback
public void rollback() throws SQLException(Code)
Rollback the changes executed against the persistent store.
throws:
  SQLException - if any database error occurs.



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.