01: /**********************************************************************
02: Copyright (c) 2007 Erik Bengtson and others. All rights reserved.
03: Licensed under the Apache License, Version 2.0 (the "License");
04: you may not use this file except in compliance with the License.
05: You may obtain a copy of the License at
06:
07: http://www.apache.org/licenses/LICENSE-2.0
08:
09: Unless required by applicable law or agreed to in writing, software
10: distributed under the License is distributed on an "AS IS" BASIS,
11: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12: See the License for the specific language governing permissions and
13: limitations under the License.
14:
15: Contributors:
16: 2007 Andy Jefferson - javadocs, lock/unlock/has methods
17: ...
18: **********************************************************************/package org.jpox;
19:
20: import java.util.Map;
21:
22: /**
23: * Manager of connections for an OMF, allowing ManagedConnection pooling, enlistment in transaction.
24: * The pool caches one connection per ObjectManager.
25: * The "allocateConnection" method can create connections and enlist them (like most normal persistence operations need)
26: * or create a connection and return it without enlisting it into a transaction, for example the connections used to
27: * generate object identity, create the database schema or obtaining the schema metadata.
28: *
29: * Connections can be locked per ObjectManager basis. Locking of connections is used to
30: * handle the connection over to the user application. A locked connection denies any further
31: * access to the datastore, until the user application unlock it.
32: *
33: * @version $Revision: 1.13 $
34: */
35: public interface ConnectionManager {
36: /**
37: * Allocate a connection using the specified factory (unless we already have one cached for this ObjectManager).
38: * @param factory The ConnectionFactory to create any new connection with
39: * @param om The ObjectManager
40: * @param options Any options for allocating the connection (e.g isolation)
41: * @return The ManagedConnection
42: */
43: public ManagedConnection allocateConnection(
44: ConnectionFactory factory, final ObjectManager om,
45: Map options);
46: }
|