1 10 11 package org.mule.providers.jdbc.xa; 12 13 import javax.sql.DataSource ; 14 import javax.sql.XADataSource ; 15 import javax.transaction.TransactionManager ; 16 17 import java.io.PrintWriter ; 18 import java.sql.Connection ; 19 import java.sql.SQLException ; 20 21 24 public class DataSourceWrapper implements DataSource 25 { 26 27 private XADataSource xads; 28 private TransactionManager tm; 29 30 public DataSourceWrapper() 31 { 32 super(); 33 } 34 35 public DataSourceWrapper(XADataSource xads, TransactionManager tm) 36 { 37 this.xads = xads; 38 this.tm = tm; 39 } 40 41 46 public int getLoginTimeout() throws SQLException 47 { 48 return xads.getLoginTimeout(); 49 } 50 51 56 public void setLoginTimeout(int seconds) throws SQLException 57 { 58 xads.setLoginTimeout(seconds); 59 } 60 61 66 public PrintWriter getLogWriter() throws SQLException 67 { 68 return xads.getLogWriter(); 69 } 70 71 76 public void setLogWriter(PrintWriter out) throws SQLException 77 { 78 xads.setLogWriter(out); 79 } 80 81 86 public Connection getConnection() throws SQLException 87 { 88 return new ConnectionWrapper(xads.getXAConnection(), tm); 89 } 90 91 96 public Connection getConnection(String username, String password) throws SQLException 97 { 98 return new ConnectionWrapper(xads.getXAConnection(username, password), tm); 99 } 100 101 104 public TransactionManager getTransactionManager() 105 { 106 return tm; 107 } 108 109 112 public void setTransactionManager(TransactionManager tm) 113 { 114 this.tm = tm; 115 } 116 117 120 public XADataSource getXaDataSource() 121 { 122 return xads; 123 } 124 125 128 public void setXaDataSource(XADataSource xads) 129 { 130 this.xads = xads; 131 } 132 } 133 | Popular Tags |