Source Code Cross Referenced for ConnectionWrapper.java in  » EJB-Server-resin-3.1.5 » resin » com » caucho » tools » profiler » 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 » EJB Server resin 3.1.5 » resin » com.caucho.tools.profiler 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright (c) 1998-2005 Caucho Technology -- all rights reserved
003:         *
004:         * This file is part of Resin(R) Open Source
005:         *
006:         * Each copy or derived work must preserve the copyright notice and this
007:         * notice unmodified.
008:         *
009:         * Resin Open Source is free software; you can redistribute it and/or modify
010:         * it under the terms of the GNU General Public License as published by
011:         * the Free Software Foundation; either version 2 of the License, or
012:         * (at your option) any later version.
013:         *
014:         * Resin Open Source is distributed in the hope that it will be useful,
015:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
016:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, or any warranty
017:         * of NON-INFRINGEMENT.  See the GNU General Public License for more
018:         * details.
019:         *
020:         * You should have received a copy of the GNU General Public License
021:         * along with Resin Open Source; if not, write to the
022:         *   Free SoftwareFoundation, Inc.
023:         *   59 Temple Place, Suite 330
024:         *   Boston, MA 02111-1307  USA
025:         *
026:         * @author Sam
027:         */
028:
029:        package com.caucho.tools.profiler;
030:
031:        import java.sql.*;
032:        import java.util.Map;
033:        import java.util.Properties;
034:
035:        public final class ConnectionWrapper implements  Connection {
036:            private final Connection _connection;
037:            private final ProfilerPoint _profilerPoint;
038:
039:            public ConnectionWrapper(ProfilerPoint profilerPoint,
040:                    Connection connection) {
041:                _profilerPoint = profilerPoint;
042:                _connection = connection;
043:            }
044:
045:            private ProfilerPoint createProfilerPoint(String sql) {
046:                // XXX: need to categorize under _profilerPoint even if it is
047:                // not the parent in the call stack at time of execution
048:                // switch _profilerPoint to DatabaseProfilerPoint, move createPP to DatabasePP
049:                return _profilerPoint.addProfilerPoint(sql);
050:            }
051:
052:            private StatementWrapper wrap(Statement statement) {
053:                return new StatementWrapper(_profilerPoint, statement);
054:            }
055:
056:            private PreparedStatementWrapper wrap(String sql,
057:                    PreparedStatement statement) {
058:                ProfilerPoint profilerPoint = createProfilerPoint(sql);
059:
060:                return new PreparedStatementWrapper(profilerPoint, statement);
061:            }
062:
063:            private CallableStatementWrapper wrap(String sql,
064:                    CallableStatement statement) {
065:                ProfilerPoint profilerPoint = createProfilerPoint(sql);
066:
067:                return new CallableStatementWrapper(profilerPoint, statement);
068:            }
069:
070:            public Statement createStatement() throws SQLException {
071:                return wrap(_connection.createStatement());
072:            }
073:
074:            public Statement createStatement(int resultSetType,
075:                    int resultSetConcurrency, int resultSetHoldability)
076:                    throws SQLException {
077:                return wrap(_connection.createStatement(resultSetType,
078:                        resultSetConcurrency, resultSetHoldability));
079:            }
080:
081:            public Statement createStatement(int resultSetType,
082:                    int resultSetConcurrency) throws SQLException {
083:                return wrap(_connection.createStatement(resultSetType,
084:                        resultSetConcurrency));
085:            }
086:
087:            public PreparedStatement prepareStatement(String sql)
088:                    throws SQLException {
089:                ProfilerPoint profilerPoint = _profilerPoint
090:                        .addProfilerPoint(sql);
091:
092:                return wrap(sql, _connection.prepareStatement(sql));
093:            }
094:
095:            public PreparedStatement prepareStatement(String sql,
096:                    int resultSetType, int resultSetConcurrency,
097:                    int resultSetHoldability) throws SQLException {
098:                ProfilerPoint profilerPoint = _profilerPoint
099:                        .addProfilerPoint(sql);
100:
101:                return wrap(sql, _connection.prepareStatement(sql,
102:                        resultSetType, resultSetConcurrency,
103:                        resultSetHoldability));
104:            }
105:
106:            public CallableStatement prepareCall(String sql)
107:                    throws SQLException {
108:                return wrap(sql, _connection.prepareCall(sql));
109:            }
110:
111:            public CallableStatement prepareCall(String sql, int resultSetType,
112:                    int resultSetConcurrency, int resultSetHoldability)
113:                    throws SQLException {
114:                return wrap(sql, _connection.prepareCall(sql, resultSetType,
115:                        resultSetConcurrency, resultSetHoldability));
116:            }
117:
118:            public PreparedStatement prepareStatement(String sql,
119:                    int autoGeneratedKeys) throws SQLException {
120:                return wrap(sql, _connection.prepareStatement(sql,
121:                        autoGeneratedKeys));
122:            }
123:
124:            public PreparedStatement prepareStatement(String sql,
125:                    int[] columnIndexes) throws SQLException {
126:                return wrap(sql, _connection.prepareStatement(sql,
127:                        columnIndexes));
128:            }
129:
130:            public PreparedStatement prepareStatement(String sql,
131:                    String[] columnNames) throws SQLException {
132:                return wrap(sql, _connection.prepareStatement(sql, columnNames));
133:            }
134:
135:            public PreparedStatement prepareStatement(String sql,
136:                    int resultSetType, int resultSetConcurrency)
137:                    throws SQLException {
138:                return wrap(sql, _connection.prepareStatement(sql,
139:                        resultSetType, resultSetConcurrency));
140:            }
141:
142:            public CallableStatement prepareCall(String sql, int resultSetType,
143:                    int resultSetConcurrency) throws SQLException {
144:                return wrap(sql, _connection.prepareCall(sql, resultSetType,
145:                        resultSetConcurrency));
146:            }
147:
148:            public String nativeSQL(String sql) throws SQLException {
149:                Profiler profiler = _profilerPoint.start();
150:
151:                try {
152:                    return _connection.nativeSQL(sql);
153:                } finally {
154:                    profiler.finish();
155:                }
156:            }
157:
158:            public void setAutoCommit(boolean autoCommit) throws SQLException {
159:                Profiler profiler = _profilerPoint.start();
160:
161:                try {
162:                    _connection.setAutoCommit(autoCommit);
163:                } finally {
164:                    profiler.finish();
165:                }
166:            }
167:
168:            public boolean getAutoCommit() throws SQLException {
169:                Profiler profiler = _profilerPoint.start();
170:
171:                try {
172:                    return _connection.getAutoCommit();
173:                } finally {
174:                    profiler.finish();
175:                }
176:            }
177:
178:            public void commit() throws SQLException {
179:                Profiler profiler = _profilerPoint.start();
180:
181:                try {
182:                    _connection.commit();
183:                } finally {
184:                    profiler.finish();
185:                }
186:            }
187:
188:            public void rollback() throws SQLException {
189:                Profiler profiler = _profilerPoint.start();
190:
191:                try {
192:                    _connection.rollback();
193:                } finally {
194:                    profiler.finish();
195:                }
196:            }
197:
198:            public boolean isClosed() throws SQLException {
199:                Profiler profiler = _profilerPoint.start();
200:
201:                try {
202:                    return _connection.isClosed();
203:                } finally {
204:                    profiler.finish();
205:                }
206:            }
207:
208:            public DatabaseMetaData getMetaData() throws SQLException {
209:                Profiler profiler = _profilerPoint.start();
210:
211:                try {
212:                    return _connection.getMetaData();
213:                } finally {
214:                    profiler.finish();
215:                }
216:            }
217:
218:            public void setReadOnly(boolean readOnly) throws SQLException {
219:                Profiler profiler = _profilerPoint.start();
220:
221:                try {
222:                    _connection.setReadOnly(readOnly);
223:                } finally {
224:                    profiler.finish();
225:                }
226:            }
227:
228:            public boolean isReadOnly() throws SQLException {
229:                Profiler profiler = _profilerPoint.start();
230:
231:                try {
232:                    return _connection.isReadOnly();
233:                } finally {
234:                    profiler.finish();
235:                }
236:            }
237:
238:            public void setCatalog(String catalog) throws SQLException {
239:                Profiler profiler = _profilerPoint.start();
240:
241:                try {
242:                    _connection.setCatalog(catalog);
243:                } finally {
244:                    profiler.finish();
245:                }
246:            }
247:
248:            public String getCatalog() throws SQLException {
249:                Profiler profiler = _profilerPoint.start();
250:
251:                try {
252:                    return _connection.getCatalog();
253:                } finally {
254:                    profiler.finish();
255:                }
256:            }
257:
258:            public void setTransactionIsolation(int level) throws SQLException {
259:                Profiler profiler = _profilerPoint.start();
260:
261:                try {
262:                    _connection.setTransactionIsolation(level);
263:                } finally {
264:                    profiler.finish();
265:                }
266:            }
267:
268:            public int getTransactionIsolation() throws SQLException {
269:                Profiler profiler = _profilerPoint.start();
270:
271:                try {
272:                    return _connection.getTransactionIsolation();
273:                } finally {
274:                    profiler.finish();
275:                }
276:            }
277:
278:            public SQLWarning getWarnings() throws SQLException {
279:                Profiler profiler = _profilerPoint.start();
280:
281:                try {
282:                    return _connection.getWarnings();
283:                } finally {
284:                    profiler.finish();
285:                }
286:            }
287:
288:            public void clearWarnings() throws SQLException {
289:                Profiler profiler = _profilerPoint.start();
290:
291:                try {
292:                    _connection.clearWarnings();
293:                } finally {
294:                    profiler.finish();
295:                }
296:            }
297:
298:            public Map<String, Class<?>> getTypeMap() throws SQLException {
299:                Profiler profiler = _profilerPoint.start();
300:
301:                try {
302:                    return _connection.getTypeMap();
303:                } finally {
304:                    profiler.finish();
305:                }
306:            }
307:
308:            public void setTypeMap(Map<String, Class<?>> map)
309:                    throws SQLException {
310:                Profiler profiler = _profilerPoint.start();
311:
312:                try {
313:                    _connection.setTypeMap(map);
314:                } finally {
315:                    profiler.finish();
316:                }
317:            }
318:
319:            public void setHoldability(int holdability) throws SQLException {
320:                Profiler profiler = _profilerPoint.start();
321:
322:                try {
323:                    _connection.setHoldability(holdability);
324:                } finally {
325:                    profiler.finish();
326:                }
327:            }
328:
329:            public int getHoldability() throws SQLException {
330:                Profiler profiler = _profilerPoint.start();
331:
332:                try {
333:                    return _connection.getHoldability();
334:                } finally {
335:                    profiler.finish();
336:                }
337:            }
338:
339:            public Savepoint setSavepoint() throws SQLException {
340:                Profiler profiler = _profilerPoint.start();
341:
342:                try {
343:                    return _connection.setSavepoint();
344:                } finally {
345:                    profiler.finish();
346:                }
347:            }
348:
349:            public Savepoint setSavepoint(String name) throws SQLException {
350:                Profiler profiler = _profilerPoint.start();
351:
352:                try {
353:                    return _connection.setSavepoint(name);
354:                } finally {
355:                    profiler.finish();
356:                }
357:            }
358:
359:            public void rollback(Savepoint savepoint) throws SQLException {
360:                Profiler profiler = _profilerPoint.start();
361:
362:                try {
363:                    _connection.rollback(savepoint);
364:                } finally {
365:                    profiler.finish();
366:                }
367:            }
368:
369:            public void releaseSavepoint(Savepoint savepoint)
370:                    throws SQLException {
371:                Profiler profiler = _profilerPoint.start();
372:
373:                try {
374:                    _connection.releaseSavepoint(savepoint);
375:                } finally {
376:                    profiler.finish();
377:                }
378:            }
379:
380:            public void close() throws SQLException {
381:                Profiler profiler = _profilerPoint.start();
382:
383:                try {
384:                    _connection.close();
385:                } finally {
386:                    profiler.finish();
387:                }
388:            }
389:
390:            public String toString() {
391:                return "ConnectionWrapper[" + _profilerPoint.getName() + "]";
392:            }
393:
394:            public Clob createClob() throws SQLException {
395:                throw new UnsupportedOperationException("Not supported yet.");
396:            }
397:
398:            public Blob createBlob() throws SQLException {
399:                throw new UnsupportedOperationException("Not supported yet.");
400:            }
401:
402:            public NClob createNClob() throws SQLException {
403:                throw new UnsupportedOperationException("Not supported yet.");
404:            }
405:
406:            public SQLXML createSQLXML() throws SQLException {
407:                throw new UnsupportedOperationException("Not supported yet.");
408:            }
409:
410:            public boolean isValid(int timeout) throws SQLException {
411:                throw new UnsupportedOperationException("Not supported yet.");
412:            }
413:
414:            public void setClientInfo(String name, String value)
415:                    throws SQLClientInfoException {
416:                throw new UnsupportedOperationException("Not supported yet.");
417:            }
418:
419:            public void setClientInfo(Properties properties)
420:                    throws SQLClientInfoException {
421:                throw new UnsupportedOperationException("Not supported yet.");
422:            }
423:
424:            public String getClientInfo(String name) throws SQLException {
425:                throw new UnsupportedOperationException("Not supported yet.");
426:            }
427:
428:            public Properties getClientInfo() throws SQLException {
429:                throw new UnsupportedOperationException("Not supported yet.");
430:            }
431:
432:            public Array createArrayOf(String typeName, Object[] elements)
433:                    throws SQLException {
434:                throw new UnsupportedOperationException("Not supported yet.");
435:            }
436:
437:            public Struct createStruct(String typeName, Object[] attributes)
438:                    throws SQLException {
439:                throw new UnsupportedOperationException("Not supported yet.");
440:            }
441:
442:            public <T> T unwrap(Class<T> iface) throws SQLException {
443:                throw new UnsupportedOperationException("Not supported yet.");
444:            }
445:
446:            public boolean isWrapperFor(Class<?> iface) throws SQLException {
447:                throw new UnsupportedOperationException("Not supported yet.");
448:            }
449:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.