1 28 29 30 package com.caucho.tools.profiler; 31 32 import javax.sql.XAConnection ; 33 import javax.sql.XADataSource ; 34 import java.io.PrintWriter ; 35 import java.sql.SQLException ; 36 37 public final class XADataSourceWrapper 38 implements XADataSource 39 { 40 private final ProfilerPoint _profilerPoint; 41 private final XADataSource _dataSource; 42 43 public XADataSourceWrapper(ProfilerPoint profilerPoint, 44 XADataSource dataSource) 45 { 46 _profilerPoint = profilerPoint; 47 _dataSource = dataSource; 48 } 49 50 private XAConnectionWrapper wrap(XAConnection connection) 51 { 52 return new XAConnectionWrapper(_profilerPoint, connection); 53 } 54 55 public XAConnection getXAConnection() 56 throws SQLException 57 { 58 return wrap(_dataSource.getXAConnection()); 59 } 60 61 public XAConnection getXAConnection(String user, String password) 62 throws SQLException 63 { 64 return wrap(_dataSource.getXAConnection(user, password)); 65 } 66 67 public PrintWriter getLogWriter() 68 throws SQLException 69 { 70 return _dataSource.getLogWriter(); 71 } 72 73 public void setLogWriter(PrintWriter out) 74 throws SQLException 75 { 76 _dataSource.setLogWriter(out); 77 } 78 79 public void setLoginTimeout(int seconds) 80 throws SQLException 81 { 82 _dataSource.setLoginTimeout(seconds); 83 } 84 85 public int getLoginTimeout() 86 throws SQLException 87 { 88 return _dataSource.getLoginTimeout(); 89 90 } 91 92 public String toString() 93 { 94 return "XADataSourceWrapper[" + _profilerPoint.getName() + "]"; 95 } 96 } 97 98 | Popular Tags |