KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mmbase > bridge > Transaction


1 /*
2
3 This software is OSI Certified Open Source Software.
4 OSI Certified is a certification mark of the Open Source Initiative.
5
6 The license (Mozilla version 1.0) can be read at the MMBase site.
7 See http://www.MMBase.org/license
8
9 */

10
11 package org.mmbase.bridge;
12
13 /**
14  * A transaction is an environment that allows for the editing of nodes
15  * within a 'safe' context. Either all edits in a transaction are comitted, or
16  * all fail. A transaction acts as a cloud. All that can be done in a cloud can
17  * be done in a transaction.
18  * For example a node retrieved using the transaction's getNode method resides
19  * in the transaction, if you change or remove the node, you can later roll it
20  * back by calling the transaction's cancel method.
21  *
22  * @author Pierre van Rooden
23  * @version $Id: Transaction.java,v 1.5 2006/06/19 14:16:21 nklasens Exp $
24  */

25 public interface Transaction extends Cloud {
26
27     /**
28      * Commits this transaction. This has no effect if the transaction itself
29      * was 'nested' in another transaction. In that case, nothing happens until
30      * the 'outer' transaction commits. This routine also removes the
31      * transaction as an 'active' transaction (it cannot be opened again).
32      *
33      * @return <code>true</code> if the commit succeeded, <code>false</code>
34      * otherwise
35      */

36     public boolean commit();
37
38     /**
39      * Cancels this transaction. If the transaction itself was 'nested' in
40      * another transaction, that 'outer' transaction is also canceled.
41      * This routine also removes the transaction (and all outer transactions)
42      * as an 'active' transaction (it cannot be opened again).
43      */

44     public void cancel();
45
46     /**
47      * @since MMBase-1.8
48      */

49     public boolean isCommitted();
50
51     /**
52      * @since MMBase-1.8
53      */

54     public boolean isCanceled();
55     
56
57     /**
58      * Returns the name of the cloud this transaction uses
59      *
60      * @return the name of the cloud
61      * @since MMBase-1.8
62      */

63     public String JavaDoc getCloudName();
64
65 }
66
Popular Tags