KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jodd > jtx > JtxResource


1 // Copyright (c) 2003-2007, Jodd Team (jodd.sf.net). All Rights Reserved.
2

3 package jodd.jtx;
4
5 /**
6  * Interface for transaction-aware resources.
7  * One transaction may have only <b>one</b> resource instance
8  * of certain type attached to it.
9  * <p>
10  * {@link jodd.jtx.JtxTransaction} starts the transaction on
11  * resource (if transaction is not in {@link JtxTransaction#STATUS_AUTOCOMMIT} mode.
12  */

13 public interface JtxResource {
14
15     /**
16      * Begins new transaction.
17      */

18     public void beginTransaction(JtxTransactionMode mode);
19
20     /**
21      * Commits a transaction.
22      */

23     public void commitTransaction();
24
25     /**
26      * Rolls back a transaction.
27      */

28     public void rollbackTransaction();
29
30     /**
31      * Closes resource.
32      */

33     public void closeResource();
34
35     /**
36      * Returns current transaction mode.
37      */

38     public JtxTransactionMode getTransactionMode();
39
40     /**
41      * Returns <code>true</code> if transaction is active.
42      */

43     public boolean isTransactionActive();
44 }
45
Popular Tags