1 /***
2 * License Agreement.
3 *
4 * JSPA (POJO-SP)
5 *
6 * Copyright (C) 2009 HRX Pty Ltd
7 *
8 * This file is part of JSPA.
9 *
10 * JSPA is free software: you can redistribute it and/or modify it under the
11 * terms of the GNU Lesser General Public License version 3 as published by the
12 * Free Software Foundation.
13 *
14 * JSPA is distributed in the hope that it will be useful, but WITHOUT ANY
15 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
16 * A PARTICULAR PURPOSE. See the Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public License
19 * along with JSPA. If not, see <http://www.gnu.org/licenses/>.
20 */
21 package com.hrx.rasp.util.dao.jdbc;
22
23 import java.io.PrintWriter;
24 import java.sql.Connection;
25 import java.sql.SQLException;
26
27 import javax.sql.DataSource;
28
29 /***
30 * <p>
31 * Basic implementation of <code>javax.sql.DataSource</code> that is
32 * used for standalone applications.
33 *
34 *
35 * @author dan.stoica <dan.stoica@acslink.net.au>
36 *
37 */
38 public class DataSourceImpl implements DataSource
39 {
40
41 private Connection conn;
42 private PrintWriter logger = null;
43
44 private int loginTimeout = 0;
45
46 public DataSourceImpl(Connection conn)
47 {
48 this.conn = conn;
49 }
50
51
52
53
54 public Connection getConnection() throws SQLException
55 {
56 return conn;
57 }
58
59
60
61
62 public synchronized Connection getConnection(String username, String password) throws SQLException
63 {
64 throw new SQLException("not implemented");
65 }
66
67
68
69
70 public PrintWriter getLogWriter() throws SQLException
71 {
72 return this.logger;
73 }
74
75
76
77
78 public int getLoginTimeout() throws SQLException
79 {
80 return this.loginTimeout;
81 }
82
83
84
85
86 public void setLogWriter(PrintWriter logger) throws SQLException
87 {
88 this.logger = logger;
89 }
90
91
92
93
94 public void setLoginTimeout(int loginTimeout) throws SQLException
95 {
96 this.loginTimeout = loginTimeout;
97 }
98
99 public boolean isWrapperFor(Class<?> iface) throws SQLException
100 {
101 return false;
102 }
103
104 public <T> T unwrap(Class<T> iface) throws SQLException
105 {
106 return null;
107 }
108 }