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