01: /*
02: * Distributed as part of c3p0 v.0.9.1.2
03: *
04: * Copyright (C) 2005 Machinery For Change, Inc.
05: *
06: * Author: Steve Waldman <swaldman@mchange.com>
07: *
08: * This library is free software; you can redistribute it and/or modify
09: * it under the terms of the GNU Lesser General Public License version 2.1, as
10: * published by the Free Software Foundation.
11: *
12: * This software is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15: * GNU Lesser General Public License for more details.
16: *
17: * You should have received a copy of the GNU Lesser General Public License
18: * along with this software; see the file LICENSE. If not, write to the
19: * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
20: * Boston, MA 02111-1307, USA.
21: */
22:
23: package com.mchange.v2.c3p0;
24:
25: import java.sql.Connection;
26: import java.sql.SQLException;
27:
28: /**
29: * <p>Implementations of this interface should
30: * be immutable, and should offer public,
31: * no argument constructors.</p>
32: *
33: * <p>The methods are handed raw, physical
34: * database Connections, not c3p0-generated
35: * proxies.</p>
36: *
37: * <p>Although c3p0 will ensure this with
38: * respect to state controlled by
39: * standard JDBC methods, any modifications
40: * of vendor-specific state shold be made
41: * consistently so that all Connections
42: * in the pool are interchangable.</p>
43: */
44: public interface ConnectionCustomizer {
45: /**
46: * <p>Called immediately after a
47: * Connection is acquired from the
48: * underlying database for
49: * incorporation into the pool.</p>
50: *
51: * <p>This method is only called once
52: * per Connection. If standard JDBC
53: * Connection properties are modified
54: * [holdability, transactionIsolation,
55: * readOnly], those modifications
56: * will override defaults throughout
57: * the Connection's tenure in the
58: * pool.</p>
59: */
60: public void onAcquire(Connection c,
61: String parentDataSourceIdentityToken) throws Exception;
62:
63: /**
64: * Called immediately before a
65: * Connection is destroyed after
66: * being removed from the pool.
67: */
68: public void onDestroy(Connection c,
69: String parentDataSourceIdentityToken) throws Exception;
70:
71: /**
72: * Called immediately before a
73: * Connection is made available to
74: * a client upon checkout.
75: */
76: public void onCheckOut(Connection c,
77: String parentDataSourceIdentityToken) throws Exception;
78:
79: /**
80: * Called immediately after a
81: * Connection is checked in,
82: * prior to reincorporation
83: * into the pool.
84: */
85: public void onCheckIn(Connection c,
86: String parentDataSourceIdentityToken) throws Exception;
87: }
|