Coverage Report - org.mule.module.jboss.transaction.JBossArjunaTransactionManagerFactory
 
Classes in this File Line Coverage Branch Coverage Complexity
JBossArjunaTransactionManagerFactory
94%
15/16
83%
5/6
1.75
 
 1  
 /*
 2  
  * $Id:JBossArjunaTransactionManagerFactory.java 8215 2007-09-05 16:56:51Z aperepel $
 3  
  * --------------------------------------------------------------------------------------
 4  
  * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
 5  
  *
 6  
  * The software in this package is published under the terms of the CPAL v1.0
 7  
  * license, a copy of which has been included with this distribution in the
 8  
  * LICENSE.txt file.
 9  
  */
 10  
 
 11  
 package org.mule.module.jboss.transaction;
 12  
 
 13  
 import org.mule.RegistryContext;
 14  
 import org.mule.api.transaction.TransactionManagerFactory;
 15  
 
 16  
 import com.arjuna.ats.arjuna.common.Environment;
 17  
 import com.arjuna.ats.arjuna.common.arjPropertyManager;
 18  
 
 19  
 import java.util.HashMap;
 20  
 import java.util.Iterator;
 21  
 import java.util.Map;
 22  
 
 23  
 import javax.transaction.TransactionManager;
 24  
 
 25  
 public class JBossArjunaTransactionManagerFactory implements TransactionManagerFactory
 26  
 {
 27  16
     private Map properties = new HashMap();
 28  
 
 29  
     //static
 30  
     //{
 31  
     //arjPropertyManager.propertyManager.setProperty(LogFactory.LOGGER_PROPERTY, "log4j_releveler");
 32  
     //arjPropertyManager.propertyManager.setProperty(LogFactory.LOGGER_PROPERTY, "jakarta");
 33  
     //arjPropertyManager.propertyManager.setProperty(LogFactory.DEBUG_LEVEL, String.valueOf(DebugLevel.FULL_DEBUGGING));
 34  
     //commonPropertyManager.propertyManager.setProperty(LogFactory.LOGGER_PROPERTY, "jakarta");
 35  
     //commonPropertyManager.propertyManager.setProperty(LogFactory.DEBUG_LEVEL, String.valueOf(DebugLevel.FULL_DEBUGGING));
 36  
     //}
 37  
 
 38  
     private TransactionManager tm;
 39  
 
 40  
     public JBossArjunaTransactionManagerFactory()
 41  16
     {
 42  
         //arjPropertyManager.propertyManager.setProperty("com.arjuna.ats.arjuna.objectstore.objectStoreType", "ShadowNoFileLockStore");
 43  
         //arjPropertyManager.propertyManager.setProperty(Environment.OBJECTSTORE_TYPE, ArjunaNames.Implementation_ObjectStore_JDBCStore().stringForm());
 44  
 
 45  
 
 46  16
     }
 47  
 
 48  
     public synchronized TransactionManager create() throws Exception
 49  
     {
 50  18
         if (tm == null)
 51  
         {
 52  16
             if (!properties.containsKey(Environment.OBJECTSTORE_DIR))
 53  
             {
 54  16
                 final String muleInternalDir = RegistryContext.getConfiguration().getWorkingDirectory();
 55  16
                 arjPropertyManager.propertyManager.setProperty(Environment.OBJECTSTORE_DIR, muleInternalDir + "/transaction-log");
 56  
             }
 57  
 
 58  16
             for (Iterator i = properties.entrySet().iterator(); i.hasNext();)
 59  
             {
 60  2
                 Map.Entry entry = (Map.Entry) i.next();
 61  2
                 arjPropertyManager.propertyManager.setProperty((String) entry.getKey(), (String) entry.getValue());
 62  2
             }
 63  16
             tm = com.arjuna.ats.jta.TransactionManager.transactionManager();
 64  
 
 65  
         }
 66  18
         return tm;
 67  
     }
 68  
 
 69  
     public Map getProperties()
 70  
     {
 71  0
         return properties;
 72  
     }
 73  
 
 74  
     public void setProperties(Map properties)
 75  
     {
 76  2
         this.properties = properties;
 77  2
     }
 78  
 }