01: //$Id: UserSuppliedConnectionProvider.java 6463 2005-04-19 15:39:07Z steveebersole $
02: package org.hibernate.connection;
03:
04: import java.sql.Connection;
05: import java.util.Properties;
06:
07: import org.apache.commons.logging.LogFactory;
08: import org.hibernate.HibernateException;
09:
10: /**
11: * An implementation of the <literal>ConnectionProvider</literal> interface that
12: * simply throws an exception when a connection is requested. This implementation
13: * indicates that the user is expected to supply a JDBC connection.
14: * @see ConnectionProvider
15: * @author Gavin King
16: */
17: public class UserSuppliedConnectionProvider implements
18: ConnectionProvider {
19:
20: /**
21: * @see org.hibernate.connection.ConnectionProvider#configure(Properties)
22: */
23: public void configure(Properties props) throws HibernateException {
24: LogFactory
25: .getLog(UserSuppliedConnectionProvider.class)
26: .warn(
27: "No connection properties specified - the user must supply JDBC connections");
28: }
29:
30: /**
31: * @see org.hibernate.connection.ConnectionProvider#getConnection()
32: */
33: public Connection getConnection() {
34: throw new UnsupportedOperationException(
35: "The user must supply a JDBC connection");
36: }
37:
38: /**
39: * @see org.hibernate.connection.ConnectionProvider#closeConnection(Connection)
40: */
41: public void closeConnection(Connection conn) {
42: throw new UnsupportedOperationException(
43: "The user must supply a JDBC connection");
44: }
45:
46: public void close() {
47: }
48:
49: /**
50: * @see ConnectionProvider#supportsAggressiveRelease()
51: */
52: public boolean supportsAggressiveRelease() {
53: return false;
54: }
55:
56: }
|