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