View Javadoc

1   /*
2    * $Id: UMOTransaction.java 10384 2008-01-18 11:35:23Z 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.umo;
12  
13  import javax.transaction.Transaction;
14  
15  public interface UMOTransaction
16  {
17  
18      int STATUS_ACTIVE = 0;
19      int STATUS_MARKED_ROLLBACK = 1;
20      int STATUS_PREPARED = 2;
21      int STATUS_COMMITTED = 3;
22      int STATUS_ROLLEDBACK = 4;
23      int STATUS_UNKNOWN = 5;
24      int STATUS_NO_TRANSACTION = 6;
25      int STATUS_PREPARING = 7;
26      int STATUS_COMMITTING = 8;
27      int STATUS_ROLLING_BACK = 9;
28  
29      /**
30       * Begin the transaction.
31       * 
32       * @throws TransactionException
33       */
34      void begin() throws TransactionException;
35  
36      /**
37       * Commit the transaction
38       * 
39       * @throws TransactionException
40       */
41      void commit() throws TransactionException;
42  
43      /**
44       * Rollback the transaction
45       * 
46       * @throws TransactionException
47       */
48      void rollback() throws TransactionException;
49  
50      int getStatus() throws TransactionException;
51  
52      boolean isBegun() throws TransactionException;
53  
54      boolean isRolledBack() throws TransactionException;
55  
56      boolean isCommitted() throws TransactionException;
57  
58      Object getResource(Object key);
59  
60      boolean hasResource(Object key);
61  
62      void bindResource(Object key, Object resource) throws TransactionException;
63  
64      void setRollbackOnly() throws TransactionException;
65  
66      boolean isRollbackOnly() throws TransactionException;
67  
68      boolean isXA();
69  
70      /**
71       * Resume the XA transaction
72       *
73       * @throws TransactionException if any error
74       */
75      void resume() throws TransactionException;
76  
77      /**
78       * Suspend the XA transaction
79       *
80       * @return
81       * @throws TransactionException if any error
82       */
83      Transaction suspend() throws TransactionException;
84  
85  }