KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > hibernate > connection > UserSuppliedConnectionProvider


1 //$Id: UserSuppliedConnectionProvider.java,v 1.3 2005/04/19 15:39:06 steveebersole Exp $
2
package org.hibernate.connection;
3
4 import java.sql.Connection JavaDoc;
5 import java.util.Properties JavaDoc;
6
7 import org.apache.commons.logging.LogFactory;
8 import org.hibernate.HibernateException;
9
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 ConnectionProvider {
18
19     /**
20      * @see org.hibernate.connection.ConnectionProvider#configure(Properties)
21      */

22     public void configure(Properties JavaDoc props) throws HibernateException {
23         LogFactory.getLog(UserSuppliedConnectionProvider.class).warn("No connection properties specified - the user must supply JDBC connections");
24     }
25
26     /**
27      * @see org.hibernate.connection.ConnectionProvider#getConnection()
28      */

29     public Connection JavaDoc getConnection() {
30         throw new UnsupportedOperationException JavaDoc("The user must supply a JDBC connection");
31     }
32
33     /**
34      * @see org.hibernate.connection.ConnectionProvider#closeConnection(Connection)
35      */

36     public void closeConnection(Connection JavaDoc conn) {
37         throw new UnsupportedOperationException JavaDoc("The user must supply a JDBC connection");
38     }
39
40     public void close() {
41     }
42
43     /**
44      * @see ConnectionProvider#supportsAggressiveRelease()
45      */

46     public boolean supportsAggressiveRelease() {
47         return false;
48     }
49
50 }
51
52
53
54
55
56
57
Popular Tags