KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > mlw > vlh > adapter > jdbc > util > ConnectionCreator


1 /**
2  * Copyright (c) 2003 held jointly by the individual authors.
3  *
4  * This library is free software; you can redistribute it and/or modify it
5  * under the terms of the GNU Lesser General Public License as published
6  * by the Free Software Foundation; either version 2.1 of the License, or
7  * (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful, but
10  * WITHOUT ANY WARRANTY; with out even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public License
15  * along with this library; if not, write to the Free Software Foundation,
16  * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
17  *
18  * > http://www.gnu.org/copyleft/lesser.html
19  * > http://www.opensource.org/licenses/lgpl-license.php
20  */

21 package net.mlw.vlh.adapter.jdbc.util;
22
23 import java.sql.Connection JavaDoc;
24 import java.sql.PreparedStatement JavaDoc;
25 import java.sql.ResultSet JavaDoc;
26 import java.sql.SQLException JavaDoc;
27
28 import javax.sql.DataSource JavaDoc;
29
30 /**
31  * This is a helper class to handle different behaviour of connection eg. in transactional/nontransactional environment.
32  *
33  * @author Stepan Marek
34  * @version $Revision: 1.2 $ $Date: 2005/10/20 16:37:49 $
35  */

36 public interface ConnectionCreator
37 {
38
39    /**
40     * Creates a new connection.
41     *
42     * @return
43     * @throws SQLException
44     */

45    Connection JavaDoc createConnection() throws SQLException JavaDoc;
46
47    /**
48     * Close all opened resources.
49     *
50     * @param result
51     * @param statement
52     * @param connection
53     */

54    void close(ResultSet JavaDoc result, PreparedStatement JavaDoc statement, Connection JavaDoc connection);
55
56    /**
57     * @return Returns the dataSource.
58     */

59    DataSource JavaDoc getDataSource();
60
61    /**
62     * @param dataSource The dataSource to set.
63     */

64    void setDataSource(DataSource JavaDoc dataSource);
65 }
Popular Tags