Source Code Cross Referenced for WinstoneConnection.java in  » Web-Server » Winstone » winstone » jndi » resourceFactories » 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 » Web Server » Winstone » winstone.jndi.resourceFactories 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2003-2006 Rick Knowles <winstone-devel at lists sourceforge net>
003:         * Distributed under the terms of either:
004:         * - the common development and distribution license (CDDL), v1.0; or
005:         * - the GNU Lesser General Public License, v2.1 or later
006:         */
007:        package winstone.jndi.resourceFactories;
008:
009:        import java.sql.CallableStatement;
010:        import java.sql.Connection;
011:        import java.sql.DatabaseMetaData;
012:        import java.sql.PreparedStatement;
013:        import java.sql.SQLException;
014:        import java.sql.SQLWarning;
015:        import java.sql.Savepoint;
016:        import java.sql.Statement;
017:        import java.util.Map;
018:
019:        import winstone.Logger;
020:
021:        /**
022:         * JDBC Connection wrapper for use in the pooling datasource. This just suppresses 
023:         * the close() call, and releases the connection.
024:         * 
025:         * @author <a href="mailto:rick_knowles@hotmail.com">Rick Knowles</a>
026:         * @version $Id: WinstoneConnection.java,v 1.3 2006/02/28 07:32:48 rickknowles Exp $
027:         */
028:        public class WinstoneConnection implements  Connection {
029:            private Connection realConnection;
030:            private WinstoneDataSource datasource;
031:
032:            /**
033:             * Constructor - this sets the real connection and the link back to the pool
034:             */
035:            public WinstoneConnection(Connection connection,
036:                    WinstoneDataSource datasource) {
037:                this .realConnection = connection;
038:                this .datasource = datasource;
039:            }
040:
041:            public void close() throws SQLException {
042:                if ((this .datasource != null)
043:                        && (this .datasource.getLogWriter() != null)) {
044:                    this .datasource
045:                            .getLogWriter()
046:                            .println(
047:                                    WinstoneDataSource.DS_RESOURCES
048:                                            .getString("WinstoneConnection.ReleaseRollback"));
049:                } else {
050:                    Logger.log(Logger.FULL_DEBUG,
051:                            WinstoneDataSource.DS_RESOURCES,
052:                            "WinstoneConnection.ReleaseRollback");
053:                }
054:
055:                Connection realConnectionHolder = null;
056:                try {
057:                    if (this .realConnection != null) {
058:                        realConnectionHolder = this .realConnection;
059:                        this .realConnection = null;
060:
061:                        if (!realConnectionHolder.getAutoCommit())
062:                            realConnectionHolder.rollback();
063:                    }
064:                } finally {
065:                    if ((this .datasource != null)
066:                            && (realConnectionHolder != null)) {
067:                        this .datasource.releaseConnection(this ,
068:                                realConnectionHolder);
069:                        this .datasource = null;
070:                    }
071:                }
072:            }
073:
074:            public boolean isClosed() throws SQLException {
075:                return (this .realConnection == null);
076:            }
077:
078:            public void commit() throws SQLException {
079:                this .realConnection.commit();
080:            }
081:
082:            public void rollback() throws SQLException {
083:                this .realConnection.rollback();
084:            }
085:
086:            public void rollback(Savepoint sp) throws SQLException {
087:                this .realConnection.rollback(sp);
088:            }
089:
090:            public boolean getAutoCommit() throws SQLException {
091:                return this .realConnection.getAutoCommit();
092:            }
093:
094:            public void setAutoCommit(boolean autoCommit) throws SQLException {
095:                this .realConnection.setAutoCommit(autoCommit);
096:            }
097:
098:            public int getHoldability() throws SQLException {
099:                return this .realConnection.getHoldability();
100:            }
101:
102:            public void setHoldability(int hold) throws SQLException {
103:                this .realConnection.setHoldability(hold);
104:            }
105:
106:            public int getTransactionIsolation() throws SQLException {
107:                return this .realConnection.getTransactionIsolation();
108:            }
109:
110:            public void setTransactionIsolation(int level) throws SQLException {
111:                this .realConnection.setTransactionIsolation(level);
112:            }
113:
114:            public void clearWarnings() throws SQLException {
115:                this .realConnection.clearWarnings();
116:            }
117:
118:            public SQLWarning getWarnings() throws SQLException {
119:                return this .realConnection.getWarnings();
120:            }
121:
122:            public boolean isReadOnly() throws SQLException {
123:                return this .realConnection.isReadOnly();
124:            }
125:
126:            public void setReadOnly(boolean ro) throws SQLException {
127:                this .realConnection.setReadOnly(ro);
128:            }
129:
130:            public String getCatalog() throws SQLException {
131:                return this .realConnection.getCatalog();
132:            }
133:
134:            public void setCatalog(String catalog) throws SQLException {
135:                this .realConnection.setCatalog(catalog);
136:            }
137:
138:            public DatabaseMetaData getMetaData() throws SQLException {
139:                return this .realConnection.getMetaData();
140:            }
141:
142:            public Savepoint setSavepoint() throws SQLException {
143:                return this .realConnection.setSavepoint();
144:            }
145:
146:            public Savepoint setSavepoint(String name) throws SQLException {
147:                return this .realConnection.setSavepoint(name);
148:            }
149:
150:            public void releaseSavepoint(Savepoint sp) throws SQLException {
151:                this .realConnection.releaseSavepoint(sp);
152:            }
153:
154:            public Map getTypeMap() throws SQLException {
155:                return this .realConnection.getTypeMap();
156:            }
157:
158:            public void setTypeMap(Map map) throws SQLException {
159:                this .realConnection.setTypeMap(map);
160:            }
161:
162:            public String nativeSQL(String sql) throws SQLException {
163:                return this .realConnection.nativeSQL(sql);
164:            }
165:
166:            public CallableStatement prepareCall(String sql)
167:                    throws SQLException {
168:                return this .realConnection.prepareCall(sql);
169:            }
170:
171:            public CallableStatement prepareCall(String sql, int resultSetType,
172:                    int resultSetConcurrency) throws SQLException {
173:                return this .realConnection.prepareCall(sql, resultSetType,
174:                        resultSetConcurrency);
175:            }
176:
177:            public CallableStatement prepareCall(String sql, int resultSetType,
178:                    int resultSetConcurrency, int resultSetHoldability)
179:                    throws SQLException {
180:                return this .realConnection.prepareCall(sql, resultSetType,
181:                        resultSetConcurrency, resultSetHoldability);
182:            }
183:
184:            public Statement createStatement() throws SQLException {
185:                return this .realConnection.createStatement();
186:            }
187:
188:            public Statement createStatement(int resultSetType,
189:                    int resultSetConcurrency) throws SQLException {
190:                return this .realConnection.createStatement(resultSetType,
191:                        resultSetConcurrency);
192:            }
193:
194:            public Statement createStatement(int resultSetType,
195:                    int resultSetConcurrency, int resultSetHoldability)
196:                    throws SQLException {
197:                return this .realConnection.createStatement(resultSetType,
198:                        resultSetConcurrency, resultSetHoldability);
199:            }
200:
201:            public PreparedStatement prepareStatement(String sql)
202:                    throws SQLException {
203:                return this .realConnection.prepareStatement(sql);
204:            }
205:
206:            public PreparedStatement prepareStatement(String sql,
207:                    int autogeneratedKeys) throws SQLException {
208:                return this .realConnection.prepareStatement(sql,
209:                        autogeneratedKeys);
210:            }
211:
212:            public PreparedStatement prepareStatement(String sql,
213:                    int resultSetType, int resultSetConcurrency)
214:                    throws SQLException {
215:                return this .realConnection.prepareStatement(sql, resultSetType,
216:                        resultSetConcurrency);
217:            }
218:
219:            public PreparedStatement prepareStatement(String sql,
220:                    int resultSetType, int resultSetConcurrency,
221:                    int resultSetHoldability) throws SQLException {
222:                return this .realConnection.prepareStatement(sql, resultSetType,
223:                        resultSetConcurrency, resultSetHoldability);
224:            }
225:
226:            public PreparedStatement prepareStatement(String sql,
227:                    int[] columnIndexes) throws SQLException {
228:                return this .realConnection.prepareStatement(sql, columnIndexes);
229:            }
230:
231:            public PreparedStatement prepareStatement(String sql,
232:                    String[] columnNames) throws SQLException {
233:                return this.realConnection.prepareStatement(sql, columnNames);
234:            }
235:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.