KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mule > transaction > XaTransactionFactory


1 /*
2  * $Id: XaTransactionFactory.java 4259 2006-12-14 03:12:07Z 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 MuleSource MPL
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.Message;
14 import org.mule.config.i18n.Messages;
15 import org.mule.umo.TransactionException;
16 import org.mule.umo.UMOTransaction;
17 import org.mule.umo.UMOTransactionFactory;
18
19 /**
20  * <code>XaTransactionFactory</code> Is used to create/retrieve a Transaction from
21  * a transaction manager configured on the MuleManager.
22  */

23 public class XaTransactionFactory implements UMOTransactionFactory
24 {
25
26     public XaTransactionFactory()
27     {
28         super();
29     }
30
31     public UMOTransaction beginTransaction() throws TransactionException
32     {
33         try
34         {
35             XaTransaction xat = new XaTransaction();
36             xat.begin();
37             return xat;
38         }
39         catch (Exception JavaDoc e)
40         {
41             throw new TransactionException(new Message(Messages.TX_CANT_START_X_TRANSACTION, "XA"), e);
42         }
43     }
44
45     /**
46      * Determines whether this transaction factory creates transactions that are
47      * really transacted or if they are being used to simulate batch actions, such as
48      * using Jms Client Acknowledge.
49      *
50      * @return
51      */

52     public boolean isTransacted()
53     {
54         return true;
55     }
56 }
57
Popular Tags