KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > protomatter > jdbc > pool > JdbcConnectionPoolPooledConnection


1 package com.protomatter.jdbc.pool;
2
3 /**
4  * {{{ The Protomatter Software License, Version 1.0
5  * derived from The Apache Software License, Version 1.1
6  *
7  * Copyright (c) 1998-2002 Nate Sammons. All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  *
13  * 1. Redistributions of source code must retain the above copyright
14  * notice, this list of conditions and the following disclaimer.
15  *
16  * 2. Redistributions in binary form must reproduce the above copyright
17  * notice, this list of conditions and the following disclaimer in
18  * the documentation and/or other materials provided with the
19  * distribution.
20  *
21  * 3. The end-user documentation included with the redistribution,
22  * if any, must include the following acknowledgment:
23  * "This product includes software developed for the
24  * Protomatter Software Project
25  * (http://protomatter.sourceforge.net/)."
26  * Alternately, this acknowledgment may appear in the software itself,
27  * if and wherever such third-party acknowledgments normally appear.
28  *
29  * 4. The names "Protomatter" and "Protomatter Software Project" must
30  * not be used to endorse or promote products derived from this
31  * software without prior written permission. For written
32  * permission, please contact support@protomatter.com.
33  *
34  * 5. Products derived from this software may not be called "Protomatter",
35  * nor may "Protomatter" appear in their name, without prior written
36  * permission of the Protomatter Software Project
37  * (support@protomatter.com).
38  *
39  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
40  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
41  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
42  * DISCLAIMED. IN NO EVENT SHALL THE PROTOMATTER SOFTWARE PROJECT OR
43  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
45  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
46  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
47  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
48  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
49  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
50  * SUCH DAMAGE. }}}
51  */

52
53 import java.sql.*;
54 import javax.sql.*;
55 import java.util.*;
56 import com.protomatter.util.*;
57 import com.protomatter.pool.*;
58
59 /**
60  * An implementation of the <tt>javax.sql.PooledConnection</tt> interface.
61  * This is only for use with the <tt>JdbcConnectionPoolDataSource</tt>
62  * class.
63  *
64  * @see JdbcConnectionPoolDataSource
65  * @see JdbcConnectionPoolDriver
66  * @see JdbcConnectionPool
67  * @see javax.sql.PooledConnection
68  */

69 public class JdbcConnectionPoolPooledConnection
70 implements PooledConnection
71 {
72   private JdbcConnectionPoolConnection connection = null;
73
74   /**
75    * Create a new <tt>JdbcConnectionPoolPooledConnection</tt> wrapping
76    * the given <tt>JdbcConnectionPoolConnection</tt>.
77    */

78   JdbcConnectionPoolPooledConnection(JdbcConnectionPoolConnection connection)
79   {
80     this.connection = connection;
81   }
82
83   /**
84    * @see javax.sql.ConnectionPoolDataSource
85    */

86   public Connection getConnection()
87   throws SQLException
88   {
89     if (this.connection.isObjectPoolObjectValid())
90       return (Connection)this.connection;
91     throw new SQLException(PoolResources.getResourceString(MessageConstants.CONNECTION_IS_INVALID_MESSAGE));
92   }
93
94   /**
95    * @see javax.sql.ConnectionPoolDataSource
96    */

97   public void close()
98   throws SQLException
99   {
100     if (this.connection.isObjectPoolObjectValid())
101       this.connection.reallyClose();
102   }
103
104   /**
105    * Not currently implemented.
106    *
107    * @see javax.sql.ConnectionPoolDataSource
108    */

109   public void addConnectionEventListener(ConnectionEventListener listener)
110   {
111     // not implemented
112
}
113
114   /**
115    * Not currently implemented.
116    *
117    * @see javax.sql.ConnectionPoolDataSource
118    */

119   public void removeConnectionEventListener(ConnectionEventListener listener)
120   {
121     // not implemented
122
}
123 }
124
Popular Tags