01: package org.apache.ojb.broker.accesslayer;
02:
03: /* Copyright 2002-2005 The Apache Software Foundation
04: *
05: * Licensed under the Apache License, Version 2.0 (the "License");
06: * you may not use this file except in compliance with the License.
07: * You may obtain a copy of the License at
08: *
09: * 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.11.2.1 2005/04/26 03:41:35 mkalen 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: * Lookup a connection from the connection factory implementation.
38: */
39: Connection lookupConnection(JdbcConnectionDescriptor jcd)
40: 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: }
|