1
2
3
4
5
6
7 package org.mule.transport.jdbc.xa;
8
9 import java.io.PrintWriter;
10 import java.sql.Connection;
11 import java.sql.SQLException;
12
13 import javax.sql.DataSource;
14 import javax.sql.XADataSource;
15 import javax.transaction.TransactionManager;
16
17
18
19
20 public class DataSourceWrapper implements DataSource
21 {
22
23 private XADataSource xaDataSource;
24
25 public DataSourceWrapper()
26 {
27 super();
28 }
29
30 public DataSourceWrapper(XADataSource xaDataSource)
31 {
32 this.xaDataSource = xaDataSource;
33 }
34
35 public int getLoginTimeout() throws SQLException
36 {
37 return xaDataSource.getLoginTimeout();
38 }
39
40 public void setLoginTimeout(int seconds) throws SQLException
41 {
42 xaDataSource.setLoginTimeout(seconds);
43 }
44
45 public PrintWriter getLogWriter() throws SQLException
46 {
47 return xaDataSource.getLogWriter();
48 }
49
50 public void setLogWriter(PrintWriter out) throws SQLException
51 {
52 xaDataSource.setLogWriter(out);
53 }
54
55 public Connection getConnection() throws SQLException
56 {
57 return new ConnectionWrapper(xaDataSource.getXAConnection());
58 }
59
60 public Connection getConnection(String username, String password) throws SQLException
61 {
62 return new ConnectionWrapper(xaDataSource.getXAConnection(username, password));
63 }
64
65
66
67
68 public XADataSource getXaDataSource()
69 {
70 return xaDataSource;
71 }
72
73
74
75
76 public void setXaDataSource(XADataSource xads)
77 {
78 this.xaDataSource = xads;
79 }
80
81 public boolean isWrapperFor(Class<?> iface) throws SQLException
82 {
83 return false;
84 }
85
86 public <T> T unwrap(Class<T> iface) throws SQLException
87 {
88 return null;
89 }
90
91 }