1 package org.apache.ojb.odmg;
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.util.factory.ConfigurableFactory;
19
20 /**
21 * The TxManagerFactory is responsible for creating instances of
22 * TransactionManagers. Set the "OJBTxManagerClass" property in
23 * OJB.properties in order to install a new TxManagerFactory
24 *
25 * @author <a href="mailto:mattbaird@yahoo.com">Matthew Baird</a>
26 * @version $Id: TxManagerFactory.java,v 1.1 2007-08-24 22:17:37 ewestfal Exp $
27 */
28 public class TxManagerFactory extends ConfigurableFactory
29 {
30 private static TxManagerFactory singleton;
31 private OJBTxManager manager;
32
33 static
34 {
35 singleton = new TxManagerFactory();
36 }
37
38 private TxManagerFactory()
39 {
40 manager = (OJBTxManager) this.createNewInstance();
41 }
42
43 private OJBTxManager getManager()
44 {
45 return manager;
46 }
47
48 public synchronized static OJBTxManager instance()
49 {
50 return singleton.getManager();
51 }
52
53 protected String getConfigurationKey()
54 {
55 return "OJBTxManagerClass";
56 }
57 }