Java Doc for DefaultStatementFactoryImpl.java in  » Inversion-of-Control » carbon » org » sape » carbon » services » sql » 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 » Inversion of Control » carbon » org.sape.carbon.services.sql 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.sape.carbon.services.sql.DefaultStatementFactoryImpl

DefaultStatementFactoryImpl
public class DefaultStatementFactoryImpl implements StatementFactory,Configurable(Code)
The default implementation for the StatementFactory. The configuration interface for this component is SqlFactoryConfiguration. The Component configuration consists of
  • Statement Set
  • Default Configuration values
Sample configuration for the component
 <!-- Component Configuration for a SQLStatementFactory -->
 <Configuration ConfigurationInterface=
 "org.sape.carbon.services.sql.SqlFactoryConfiguration">
 <FunctionalInterface>
 org.sape.carbon.services.sql.StatementFactory
 </FunctionalInterface>
 <FunctionalImplementationClass>
 org.sape.carbon.services.sql.DefaultStatementFactoryImpl
 </FunctionalImplementationClass>
 <ConnectionFactory>
 ref:///sql/connection/test/StandaloneConnectionFactory
 </ConnectionFactory>
 <!-- Default Values for Statement Properties -->
 <ResultSetType>TYPE_SCROLL_SENSITIVE</ResultSetType>
 <ResultSetConcurrency>CONCUR_UPDATABLE</ResultSetConcurrency>
 <MaxRows>5</MaxRows>
 <!-- Statement Definitions -->
 <Statement>
 <!-- Statement Query Name -->
 <QueryName>selectAccounts</QueryName>
 <Query>SELECT * FROM accounts</Query>
 <!-- Overriding Parameters -->
 <MaxRows>10</MaxRows>
 </Statement>
 <Statement>
 <QueryName>Second</QueryName>
 <Query>SELECT * from TEST</Query>
 </Statement>
 </Configuration>
 

Copyright 2002 Sapient
since:
   carbon 1.0
author:
   Vivekanand Kirubanandan, June 2002
author:
   Greg Hinkle, December 2002
version:
   $Revision: 1.18 $($Author: dvoet $ / $Date: 2003/05/05 21:21:36 $)


Field Summary
final protected static  StringCONNECTION_FACTORY_CONFIGURATION_ERROR
     Holds the error message displayed if the user has not properly configured a connection factory.
final protected static  StringRESULT_SET_CONFIGURATION_ERROR
     Holds the error message displayed if the user has not properly configured the result set type and concurrency.
protected  StatementFactoryConfigurationconfig
     Holds a reference to this factories configuration.
protected  StringstatementFactoryName
     The name of this factory.
protected  MapstatementsMap
     Holds the map of all query name to StatementConfigurations.


Method Summary
protected  CallableStatementbuildCallableStatement(StatementConfiguration statementConfig, Connection connection)
     Builds a callable statement for the given configuration with the connection given.
Parameters:
  statementConfig - configuration to build the statement from
Parameters:
  connection - a connection to execute with.
protected  StringbuildDebugMessage(StatementConfiguration statementConfig)
     Builds a debug message containg the configuration status of the supplied configured statement.
protected  PreparedStatementbuildPreparedStatement(StatementConfiguration statementConfig, Connection connection)
     Builds a prepared statement for the given configuration with the connection given.
Parameters:
  statementConfig - configuration to build the statement from
Parameters:
  connection - a connection to execute with.
public  voidconfigure(ComponentConfiguration configuration)
     Configure the component.
protected  StatementconfigureStatement(Statement statement, StatementConfiguration sqlStatement)
    

Configure the statement based on the configuration specified in the sqlStatement or using the default values.


Parameters:
  statement - A PreparedStatement or aCallableStatement>
Parameters:
  sqlStatement - The configuration information for the statement.
public  CallableStatementcreateCallableStatement(String queryName, Connection connection)
     Creates a callable statement for the given query name with the connection given.
Parameters:
  queryName - query to create a CallableStatement for.
Parameters:
  connection - a connection to execute with.
public  CallableStatementcreateCallableStatement(String queryName)
     Creates a callable statement for the given query name using the default connection in the factories configuration.

When using this interface to create a statement it is important to remember to get back and close the connection that is created.

public  PreparedStatementcreatePreparedStatement(String queryName, Connection connection)
     Creates a prepared statement for the given query name with the connection given.
Parameters:
  queryName - query to create a CallableStatement for.
Parameters:
  connection - a connection to execute with.
public  PreparedStatementcreatePreparedStatement(String queryName)
     Creates a prepared statement for the given query name using the default connection in the factories configuration.

When using this interface to create a statement it is important to remember to get back and close the connection that is created.

protected  StatementConfigurationretrieveConfiguration(String queryName, Class sourceClass)
     Looks up a statement configuration based on the name of the configuration.

Field Detail
CONNECTION_FACTORY_CONFIGURATION_ERROR
final protected static String CONNECTION_FACTORY_CONFIGURATION_ERROR(Code)
Holds the error message displayed if the user has not properly configured a connection factory.



RESULT_SET_CONFIGURATION_ERROR
final protected static String RESULT_SET_CONFIGURATION_ERROR(Code)
Holds the error message displayed if the user has not properly configured the result set type and concurrency.



config
protected StatementFactoryConfiguration config(Code)
Holds a reference to this factories configuration.



statementFactoryName
protected String statementFactoryName(Code)
The name of this factory.



statementsMap
protected Map statementsMap(Code)
Holds the map of all query name to StatementConfigurations.





Method Detail
buildCallableStatement
protected CallableStatement buildCallableStatement(StatementConfiguration statementConfig, Connection connection) throws SQLException(Code)
Builds a callable statement for the given configuration with the connection given.
Parameters:
  statementConfig - configuration to build the statement from
Parameters:
  connection - a connection to execute with. a CallableStatement constructed for the queryName given
throws:
  SQLException - indicates an errorcreating the CallableStatement



buildDebugMessage
protected String buildDebugMessage(StatementConfiguration statementConfig)(Code)
Builds a debug message containg the configuration status of the supplied configured statement.
Parameters:
  statementConfig - statement configuration to build debugmessage for a debug message describing the statement config



buildPreparedStatement
protected PreparedStatement buildPreparedStatement(StatementConfiguration statementConfig, Connection connection) throws SQLException(Code)
Builds a prepared statement for the given configuration with the connection given.
Parameters:
  statementConfig - configuration to build the statement from
Parameters:
  connection - a connection to execute with. a PreparedStatement constructed for the queryName given
throws:
  SQLException - indicates an errorcreating the CallableStatement



configure
public void configure(ComponentConfiguration configuration)(Code)
Configure the component. This is preceded and followed by the suspend and resume operations if they are available on the component.
Parameters:
  configuration - A SqlFactoryConfiguration



configureStatement
protected Statement configureStatement(Statement statement, StatementConfiguration sqlStatement) throws SQLException(Code)

Configure the statement based on the configuration specified in the sqlStatement or using the default values.


Parameters:
  statement - A PreparedStatement or aCallableStatement>
Parameters:
  sqlStatement - The configuration information for the statement. Statement A configured statement
throws:
  SQLException - indicates an error configuring the statement



createCallableStatement
public CallableStatement createCallableStatement(String queryName, Connection connection) throws StatementFactoryException(Code)
Creates a callable statement for the given query name with the connection given.
Parameters:
  queryName - query to create a CallableStatement for.
Parameters:
  connection - a connection to execute with. a CallableStatement constructed for the queryName given
throws:
  StatementFactoryException - indicates an errorcreating the CallableStatement



createCallableStatement
public CallableStatement createCallableStatement(String queryName) throws StatementFactoryException(Code)
Creates a callable statement for the given query name using the default connection in the factories configuration.

When using this interface to create a statement it is important to remember to get back and close the connection that is created. This should be done with:

statement.getConnection().close()
Parameters:
  queryName - query to create a CallableStatement for. a CallableStatement constructed for the queryName given
throws:
  StatementFactoryException - indicates an errorcreating the CallableStatement




createPreparedStatement
public PreparedStatement createPreparedStatement(String queryName, Connection connection) throws StatementFactoryException(Code)
Creates a prepared statement for the given query name with the connection given.
Parameters:
  queryName - query to create a CallableStatement for.
Parameters:
  connection - a connection to execute with. a PreparedStatement constructed for the queryName given
throws:
  StatementFactoryException - indicates an errorcreating the CallableStatement



createPreparedStatement
public PreparedStatement createPreparedStatement(String queryName) throws StatementFactoryException(Code)
Creates a prepared statement for the given query name using the default connection in the factories configuration.

When using this interface to create a statement it is important to remember to get back and close the connection that is created. This should be done with:

statement.getConnection().close()
Parameters:
  queryName - query to create a CallableStatement for. a PreparedStatement constructed for the queryName given
throws:
  StatementFactoryException - indicates an errorcreating the CallableStatement




retrieveConfiguration
protected StatementConfiguration retrieveConfiguration(String queryName, Class sourceClass) throws StatementNotConfiguredException(Code)
Looks up a statement configuration based on the name of the configuration.
Parameters:
  queryName - name of the query to lookup
Parameters:
  sourceClass - class to use when throwing an exception a StatementConfiguration for the given queryName
throws:
  StatementNotConfiguredException - indicates the queryName had noconfigured statement associated with it.



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.