View Javadoc

1   /*
2    * $Id: XaTransactionFactory.java 10465 2008-01-22 20:17:19Z akuzmin $
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.transaction;
12  
13  import org.mule.config.i18n.CoreMessages;
14  import org.mule.umo.TransactionException;
15  import org.mule.umo.UMOTransaction;
16  import org.mule.umo.UMOTransactionFactory;
17  
18  /**
19   * <code>XaTransactionFactory</code> Is used to create/retrieve a Transaction from
20   * a transaction manager configured on the MuleManager.
21   */
22  public class XaTransactionFactory implements UMOTransactionFactory
23  {
24  
25      public XaTransactionFactory()
26      {
27          super();
28      }
29  
30      public UMOTransaction beginTransaction() throws TransactionException
31      {
32          try
33          {
34              XaTransaction xat = new XaTransaction();
35              xat.begin();
36              return xat;
37          }
38          catch (Exception e)
39          {
40              throw new TransactionException(CoreMessages.cannotStartTransaction("XA"), e);
41          }
42      }
43  
44      /**
45       * Determines whether this transaction factory creates transactions that are
46       * really transacted or if they are being used to simulate batch actions, such as
47       * using Jms Client Acknowledge.
48       * 
49       * @return
50       */
51      public boolean isTransacted()
52      {
53          return true;
54      }
55  }