1 package org.apache.ojb.broker.accesslayer;
2
3 /* Copyright 2002-2005 The Apache Software Foundation
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18 import org.apache.ojb.broker.metadata.JdbcConnectionDescriptor;
19
20 import java.sql.Connection;
21
22 /**
23 * ConnectionFactory is responsible to lookup and release the
24 * connections used by the
25 * {@link org.apache.ojb.broker.accesslayer.ConnectionManagerIF}
26 * implementation.
27 *
28 * @version $Id: ConnectionFactory.java,v 1.1 2007-08-24 22:17:30 ewestfal Exp $
29 * @see org.apache.ojb.broker.accesslayer.ConnectionFactoryPooledImpl
30 * @see org.apache.ojb.broker.accesslayer.ConnectionFactoryNotPooledImpl
31 * @see org.apache.ojb.broker.accesslayer.ConnectionFactoryDBCPImpl
32 * @see org.apache.ojb.broker.accesslayer.ConnectionFactoryManagedImpl
33 */
34 public interface ConnectionFactory
35 {
36
37 /**
38 * Lookup a connection from the connection factory implementation.
39 */
40 Connection lookupConnection(JdbcConnectionDescriptor jcd) throws LookupException;
41
42 /**
43 * Release connection - CAUTION: Release every connection after use to avoid abandoned connections.
44 * Depending on the used implementation connection will be closed, returned to pool, ...
45 */
46 void releaseConnection(JdbcConnectionDescriptor jcd, Connection con);
47
48 /**
49 * Release all resources
50 * used by the implementing class (e.g. connection pool, ...)
51 * for the given connection descriptor.
52 */
53 void releaseAllResources();
54
55 }