01: /*
02:
03: This software is OSI Certified Open Source Software.
04: OSI Certified is a certification mark of the Open Source Initiative.
05:
06: The license (Mozilla version 1.0) can be read at the MMBase site.
07: See http://www.MMBase.org/license
08:
09: */
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.6 2008/02/16 22:13:53 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: * Returns whether the transaction is committed
48: * @return <code>true</code> when committed
49: * @since MMBase-1.8
50: */
51: public boolean isCommitted();
52:
53: /**
54: * Returns whether the transaction is canceled
55: * @return <code>true</code> when canceled
56: * @since MMBase-1.8
57: */
58: public boolean isCanceled();
59:
60: /**
61: * Returns the name of the cloud this transaction uses
62: *
63: * @return the name of the cloud
64: * @since MMBase-1.8
65: */
66: public String getCloudName();
67:
68: }
|