001    package org.apache.ojb.odmg;
002    
003    /* Copyright 2002-2005 The Apache Software Foundation
004     *
005     * Licensed under the Apache License, Version 2.0 (the "License");
006     * you may not use this file except in compliance with the License.
007     * You may obtain a copy of the License at
008     *
009     *     http://www.apache.org/licenses/LICENSE-2.0
010     *
011     * Unless required by applicable law or agreed to in writing, software
012     * distributed under the License is distributed on an "AS IS" BASIS,
013     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014     * See the License for the specific language governing permissions and
015     * limitations under the License.
016     */
017    
018    import org.apache.ojb.broker.util.factory.ConfigurableFactory;
019    
020    /**
021     * The TxManagerFactory is responsible for creating instances of
022     * TransactionManagers. Set the "OJBTxManagerClass" property in
023     * OJB.properties in order to install a new TxManagerFactory
024     * 
025     * @author <a href="mailto:mattbaird@yahoo.com">Matthew Baird</a>
026     * @version $Id: TxManagerFactory.java,v 1.1 2007-08-24 22:17:37 ewestfal Exp $
027     */
028    public class TxManagerFactory extends ConfigurableFactory
029    {
030        private static TxManagerFactory singleton;
031        private OJBTxManager manager;
032    
033        static
034        {
035            singleton = new TxManagerFactory();
036        }
037    
038        private TxManagerFactory()
039        {
040            manager = (OJBTxManager) this.createNewInstance();
041        }
042    
043        private OJBTxManager getManager()
044        {
045            return manager;
046        }
047    
048        public synchronized static OJBTxManager instance()
049        {
050            return singleton.getManager();
051        }
052    
053        protected String getConfigurationKey()
054        {
055            return "OJBTxManagerClass";
056        }
057    }