01: package org.geotools.data.jdbc.datasource;
02:
03: import java.io.PrintWriter;
04: import java.sql.Connection;
05: import java.sql.SQLException;
06:
07: import javax.sql.DataSource;
08:
09: /**
10: * An abstract wrapper created to ease the setup of a
11: * {@link ManageableDataSource}, you just have to subclass and create a close
12: * method
13: *
14: * @author Andrea Aime - TOPP
15: *
16: */
17: public abstract class AbstractManageableDataSource implements
18: ManageableDataSource {
19:
20: protected DataSource wrapped;
21:
22: public AbstractManageableDataSource(DataSource wrapped) {
23: this .wrapped = wrapped;
24: }
25:
26: public Connection getConnection() throws SQLException {
27: return wrapped.getConnection();
28: }
29:
30: public Connection getConnection(String username, String password)
31: throws SQLException {
32: return wrapped.getConnection(username, password);
33: }
34:
35: public int getLoginTimeout() throws SQLException {
36: return wrapped.getLoginTimeout();
37: }
38:
39: public PrintWriter getLogWriter() throws SQLException {
40: return wrapped.getLogWriter();
41: }
42:
43: public void setLoginTimeout(int seconds) throws SQLException {
44: wrapped.setLoginTimeout(seconds);
45: }
46:
47: public void setLogWriter(PrintWriter out) throws SQLException {
48: wrapped.setLogWriter(out);
49: }
50:
51: public boolean isWrapperFor(Class c) throws SQLException {
52: return false;
53: }
54:
55: public Object unwrap(Class arg0) throws SQLException {
56: throw new SQLException(
57: "This implementation cannot unwrap anything");
58: }
59: }
|