01: /**
02: * Objective Database Abstraction Layer (ODAL)
03: * Copyright (c) 2004, The ODAL Development Group
04: * All rights reserved.
05: * For definition of the ODAL Development Group please refer to LICENCE.txt file
06: *
07: * Distributable under LGPL license.
08: * See terms of license at gnu.org.
09: */package com.completex.objective.components.persistency.datasource;
10:
11: import javax.sql.DataSource;
12: import java.sql.Connection;
13: import java.sql.SQLException;
14: import java.io.PrintWriter;
15:
16: /**
17: * Extended datasource interface
18: * @see DataSource
19: *
20: * @author Gennady Krizhevsky
21: */
22: public interface DataSourceIntf extends DataSource {
23:
24: public static final DataSourceIntf NULL_DATA_SOURCE = new NullDataSource();
25:
26: /**
27: * Explicitely release bad connection
28: *
29: * @param connection
30: */
31: void releaseBad(Connection connection);
32:
33: /**
34: * Shutdown resources - remove connections from the pool, close them, etc.
35: */
36: void shutdown();
37:
38: /**
39: * Explicitely release connection
40: *
41: * @param connection
42: */
43: void release(Connection connection);
44:
45: /**
46: * Get maximum pool size
47: *
48: * @return maximum pool size
49: */
50: int getMaxSize();
51:
52: public static class NullDataSource implements DataSourceIntf {
53: public void releaseBad(Connection connection) {
54: }
55:
56: public void shutdown() {
57: }
58:
59: public void release(Connection connection) {
60: }
61:
62: public int getMaxSize() {
63: return 0;
64: }
65:
66: public int getLoginTimeout() throws SQLException {
67: return 0;
68: }
69:
70: public void setLoginTimeout(int seconds) throws SQLException {
71: }
72:
73: public PrintWriter getLogWriter() throws SQLException {
74: return null;
75: }
76:
77: public void setLogWriter(PrintWriter out) throws SQLException {
78: }
79:
80: public Connection getConnection() throws SQLException {
81: return null;
82: }
83:
84: public Connection getConnection(String username, String password)
85: throws SQLException {
86: return null;
87: }
88:
89: public Object unwrap(Class iface) throws SQLException {
90: return null;
91: }
92:
93: public boolean isWrapperFor(Class iface) throws SQLException {
94: return false;
95: }
96: }
97: }
|