Coverage Report - org.mule.util.xa.AbstractXAResourceManager
 
Classes in this File Line Coverage Branch Coverage Complexity
AbstractXAResourceManager
21%
4/19
0%
0/2
1.222
 
 1  
 /*
 2  
  * $Id: AbstractXAResourceManager.java 7963 2007-08-21 08:53:15Z dirk.olmes $
 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.util.xa;
 12  
 
 13  
 import java.util.HashMap;
 14  
 import java.util.Map;
 15  
 
 16  
 import javax.transaction.xa.Xid;
 17  
 
 18  
 public abstract class AbstractXAResourceManager extends AbstractResourceManager
 19  
 {
 20  
 
 21  94
     protected Map suspendedContexts = new HashMap();
 22  94
     protected Map activeContexts = new HashMap();
 23  
 
 24  
     public AbstractXAResourceManager()
 25  
     {
 26  94
         super();
 27  94
     }
 28  
 
 29  
     protected boolean includeBranchInXid()
 30  
     {
 31  0
         return true;
 32  
     }
 33  
 
 34  
     AbstractTransactionContext getTransactionalResource(Xid xid)
 35  
     {
 36  0
         AbstractTransactionContext context = getActiveTransactionalResource(xid);
 37  0
         if (context != null)
 38  
         {
 39  0
             return context;
 40  
         }
 41  
         else
 42  
         {
 43  0
             return getSuspendedTransactionalResource(xid);
 44  
         }
 45  
     }
 46  
 
 47  
     AbstractTransactionContext getActiveTransactionalResource(Xid xid)
 48  
     {
 49  0
         return (AbstractTransactionContext) activeContexts.get(xid);
 50  
     }
 51  
 
 52  
     AbstractTransactionContext getSuspendedTransactionalResource(Xid xid)
 53  
     {
 54  0
         return (AbstractTransactionContext) suspendedContexts.get(xid);
 55  
     }
 56  
 
 57  
     void addActiveTransactionalResource(Xid xid, AbstractTransactionContext context)
 58  
     {
 59  0
         activeContexts.put(xid, context);
 60  0
     }
 61  
 
 62  
     void addSuspendedTransactionalResource(Xid xid, AbstractTransactionContext context)
 63  
     {
 64  0
         suspendedContexts.put(xid, context);
 65  0
     }
 66  
 
 67  
     void removeActiveTransactionalResource(Xid xid)
 68  
     {
 69  0
         activeContexts.remove(xid);
 70  0
     }
 71  
 
 72  
     void removeSuspendedTransactionalResource(Xid xid)
 73  
     {
 74  0
         suspendedContexts.remove(xid);
 75  0
     }
 76  
 
 77  
 }