Source Code Cross Referenced for StatementInterceptor.java in  » Database-JDBC-Connection-Pool » mysql-connector-java-5.1.3 » com » mysql » jdbc » 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 » Database JDBC Connection Pool » mysql connector java 5.1.3 » com.mysql.jdbc 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         Copyright (C) 2007 MySQL AB
003:
004:         This program is free software; you can redistribute it and/or modify
005:         it under the terms of version 2 of the GNU General Public License as 
006:         published by the Free Software Foundation.
007:
008:         There are special exceptions to the terms and conditions of the GPL 
009:         as it is applied to this software. View the full text of the 
010:         exception in file EXCEPTIONS-CONNECTOR-J in the directory of this 
011:         software distribution.
012:
013:         This program is distributed in the hope that it will be useful,
014:         but WITHOUT ANY WARRANTY; without even the implied warranty of
015:         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
016:         GNU General Public License for more details.
017:
018:         You should have received a copy of the GNU General Public License
019:         along with this program; if not, write to the Free Software
020:         Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
021:
022:         */
023:
024:        package com.mysql.jdbc;
025:
026:        import java.sql.SQLException;
027:        import java.util.Properties;
028:
029:        /**
030:         * Implement this interface to be placed "in between" query execution, so that
031:         * you can influence it. (currently experimental).
032:         * 
033:         * StatementInterceptors are "chainable" when configured by the user, the
034:         * results returned by the "current" interceptor will be passed on to the next
035:         * on in the chain, from left-to-right order, as specified by the user in the 
036:         * JDBC configuration property "statementInterceptors".
037:         * 
038:         * @version $Id: $
039:         */
040:
041:        public interface StatementInterceptor {
042:
043:            /**
044:             * Called once per connection that wants to use the interceptor
045:             * 
046:             * The properties are the same ones passed in in the URL or arguments to
047:             * Driver.connect() or DriverManager.getConnection().
048:             * 
049:             * @param conn the connection for which this interceptor is being created
050:             * @param props configuration values as passed to the connection. Note that
051:             * in order to support javax.sql.DataSources, configuration properties specific
052:             * to an interceptor <strong>must</strong> be passed via setURL() on the
053:             * DataSource. StatementInterceptor properties are not exposed via 
054:             * accessor/mutator methods on DataSources.
055:             * 
056:             * @throws SQLException should be thrown if the the StatementInterceptor
057:             * can not initialize itself.
058:             */
059:
060:            public abstract void init(Connection conn, Properties props)
061:                    throws SQLException;
062:
063:            /**
064:             * Called before the given statement is going to be sent to the
065:             * server for processing.
066:             * 
067:             * Interceptors are free to return a result set (which must implement the
068:             * interface com.mysql.jdbc.ResultSetInternalMethods), and if so,
069:             * the server will not execute the query, and the given result set will be
070:             * returned to the application instead.
071:             * 
072:             * This method will be called while the connection-level mutex is held, so
073:             * it will only be called from one thread at a time.
074:             * 
075:             * @param sql the SQL representation of the statement
076:             * @param interceptedStatement the actual statement instance being intercepted
077:             * @param connection the connection the statement is using (passed in to make
078:             * thread-safe implementations straightforward)
079:             * 
080:             * @return a result set that should be returned to the application instead
081:             * of results that are created from actual execution of the intercepted 
082:             * statement.
083:             * 
084:             * @throws SQLException if an error occurs during execution
085:             * 
086:             * @see com.mysql.jdbc.ResultSetInternalMethods
087:             */
088:
089:            public abstract ResultSetInternalMethods preProcess(String sql,
090:                    Statement interceptedStatement, Connection connection)
091:                    throws SQLException;
092:
093:            /**
094:             * Called after the given statement has been sent to the server
095:             * for processing.
096:             * 
097:             * Interceptors are free to inspect the "original" result set, and if a
098:             * different result set is returned by the interceptor, it is used in place
099:             * of the "original" result set. (the result set returned by the interceptor
100:             * must implement the interface
101:             * com.mysql.jdbc.ResultSetInternalMethods).
102:             * 
103:             * This method will be called while the connection-level mutex is held, so
104:             * it will only be called from one thread at a time.
105:             * 
106:             * @param sql the SQL representation of the statement
107:             * @param interceptedStatement the actual statement instance being intercepted
108:             * @param connection the connection the statement is using (passed in to make
109:             * thread-safe implementations straightforward)
110:             * 
111:             * @return a result set that should be returned to the application instead
112:             * of results that are created from actual execution of the intercepted 
113:             * statement.
114:             * 
115:             * @throws SQLException if an error occurs during execution
116:             * 
117:             * @see com.mysql.jdbc.ResultSetInternalMethods
118:             */
119:            public abstract ResultSetInternalMethods postProcess(String sql,
120:                    Statement interceptedStatement,
121:                    ResultSetInternalMethods originalResultSet,
122:                    Connection connection) throws SQLException;
123:
124:            /**
125:             * Should the driver execute this interceptor only for the
126:             * "original" top-level query, and not put it in the execution
127:             * path for queries that may be executed from other interceptors?
128:             * 
129:             * If an interceptor issues queries using the connection it was created for,
130:             * and does not return <code>true</code> for this method, it must ensure 
131:             * that it does not cause infinite recursion.
132:             * 
133:             * @return true if the driver should ensure that this interceptor is only
134:             * executed for the top-level "original" query.
135:             */
136:            public abstract boolean executeTopLevelOnly();
137:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.