01: // Copyright (c) 2003-2007, Jodd Team (jodd.sf.net). All Rights Reserved.
02:
03: package jodd.db.connection;
04:
05: import java.sql.Connection;
06:
07: /**
08: * A generic strategy for obtaining JDBC connections.
09: * <p>
10: * Implementors might also implement connection pooling.
11: * <p>
12: * Implementions should provide a public default constructor.
13: */
14: public interface ConnectionProvider {
15:
16: /**
17: * Initialize the connection provider. Properties are provided either
18: * with constructor either with bean setters.
19: */
20: void init();
21:
22: /**
23: * Get a connection.
24: */
25: Connection getConnection();
26:
27: /**
28: * Dispose of a used connection.
29: */
30: void closeConnection(Connection conn);
31:
32: /**
33: * Closes a provider and realises all its resources.
34: */
35: void close();
36:
37: }
|