KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > logicalcobwebs > dbscript > ConnectionAdapterIF


1 /*
2  * This software is released under a licence similar to the Apache Software Licence.
3  * See org.logicalcobwebs.proxool.package.html for details.
4  * The latest version is available at http://proxool.sourceforge.net
5  */

6 package org.logicalcobwebs.dbscript;
7
8 import org.logicalcobwebs.proxool.ProxoolException;
9
10 import java.util.Properties JavaDoc;
11 import java.sql.SQLException JavaDoc;
12 import java.sql.Connection JavaDoc;
13
14 /**
15  * An interface that will provide connections. It differs from a real
16  * {@link java.sql.Driver Driver} because it has {@link #setup} and
17  * {@link #tearDown} methods.
18  *
19  * @version $Revision: 1.8 $, $Date: 2003/03/03 11:12:03 $
20  * @author Bill Horsman (bill@logicalcobwebs.co.uk)
21  * @author $Author: billhorsman $ (current maintainer)
22  * @since Proxool 0.5
23  */

24 public interface ConnectionAdapterIF {
25
26     /**
27      * Setup the adapter. Define the connection. Prototype any connections
28      * as necessary.
29      *
30      * @param driver the name of the class
31      * @param url the url to pass to the driver
32      * @param info the properties to pass to the driver
33      * @throws SQLException if anything goes wrong
34      */

35     void setup(String JavaDoc driver, String JavaDoc url, Properties JavaDoc info) throws SQLException JavaDoc, ProxoolException;
36
37     /**
38      * Simply get a connection (using the definitions defined in {@link #setup}
39      * @return the connection
40      * @throws SQLException if anything goes wrong
41      */

42     Connection JavaDoc getConnection()
43             throws SQLException JavaDoc;
44
45     /**
46      * This gives the adapter the flexibilty of closing the connection for real
47      * or just putting it back in a pool.
48      * @param connection the connection to "close"
49      * @throws SQLException if anything goes wrong
50      */

51     void closeConnection(Connection JavaDoc connection) throws SQLException JavaDoc;
52
53     /**
54      * Reclaim resources used by the adapter (for instance, close any
55      * open connections)
56      */

57     void tearDown() throws ProxoolException;
58
59     /**
60      * Convenient name so we can identify this adapter in logs.
61      * @return name
62      */

63     String JavaDoc getName();
64
65 }
66
67 /*
68  Revision history:
69  $Log: ConnectionAdapterIF.java,v $
70  Revision 1.8 2003/03/03 11:12:03 billhorsman
71  fixed licence
72
73  Revision 1.7 2003/02/19 15:14:21 billhorsman
74  fixed copyright (copy and paste error,
75  not copyright change)
76
77  Revision 1.6 2003/01/17 00:38:12 billhorsman
78  wide ranging changes to clarify use of alias and url -
79  this has led to some signature changes (new exceptions
80  thrown) on the ProxoolFacade API.
81
82  Revision 1.5 2002/11/13 20:23:34 billhorsman
83  change method name, throw exceptions differently, trivial changes
84
85  Revision 1.4 2002/11/09 15:59:34 billhorsman
86  fix doc
87
88  Revision 1.3 2002/11/02 14:22:16 billhorsman
89  Documentation
90
91  Revision 1.2 2002/11/02 12:46:42 billhorsman
92  improved debug
93
94  Revision 1.1 2002/11/02 11:29:53 billhorsman
95  new script runner for testing
96
97 */

98
Popular Tags