001 /* 002 * Copyright 2002-2005 the original author or authors. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017 package org.jencks.factory; 018 019 import org.apache.geronimo.transaction.context.TransactionContextManager; 020 import org.apache.geronimo.transaction.manager.TransactionManagerImpl; 021 import org.springframework.beans.factory.FactoryBean; 022 import org.springframework.beans.factory.InitializingBean; 023 024 /** 025 * This FactoryBean creates and configures the TransactionManagerContext 026 * of Geronimo. 027 * 028 * @author Thierry Templier 029 * @see org.apache.geronimo.transaction.log.UnrecoverableLog 030 * @see org.apache.geronimo.transaction.log.HOWLLog 031 */ 032 public class TransactionContextManagerFactoryBean implements FactoryBean, InitializingBean { 033 034 private TransactionManagerImpl transactionManagerImpl; 035 private TransactionContextManager transactionContextManager; 036 037 public Object getObject() throws Exception { 038 return transactionContextManager; 039 } 040 041 public Class getObjectType() { 042 return TransactionContextManager.class; 043 } 044 045 public boolean isSingleton() { 046 return true; 047 } 048 049 public TransactionManagerImpl getTransactionManagerImpl() { 050 return transactionManagerImpl; 051 } 052 053 public void setTransactionManagerImpl(TransactionManagerImpl transactionManagerImpl) { 054 this.transactionManagerImpl = transactionManagerImpl; 055 } 056 057 /** 058 * This method initializes the transaction context manager basing on 059 * the Geronimo implementation of the transaction manager and a dedicated 060 * transaction log. 061 * <p/> 062 * It specifies too an unspecified transaction context for the transaction 063 * context manager instanciated. 064 */ 065 public void afterPropertiesSet() throws Exception { 066 //Instanciate the transaction context manager 067 this.transactionContextManager = new TransactionContextManager(this.transactionManagerImpl, 068 this.transactionManagerImpl); 069 070 //TODO to uncomment?! 071 this.transactionContextManager.newUnspecifiedTransactionContext(); 072 } 073 074 }