org.mmbase.module.core
Class TransactionManager

Package class diagram package TransactionManager
java.lang.Object
  extended by org.mmbase.module.core.TransactionManager

public class TransactionManager
extends Object

The MMBase transaction manager manages a group of changes.

Version:
$Id: TransactionManager.java 46171 2011-12-21 20:33:55Z michiel $
Author:
Rico Jansen
Javadoc:

Nested Class Summary
static class TransactionManager.Exists
          NO: The node does not exists yet, but will be created on commit YES: The node already existed befor the transaction started.
 
Field Summary
static TransactionManager instance
           
protected  Map<String,Collection<MMObjectNode>> transactions
           
 
Method Summary
 String addNode(String transactionName, String owner, String tmpnumber)
           
 String cancel(Object user, String transactionName)
           
 String commit(Object user, String transactionName)
           
 Collection<MMObjectNode> createTransaction(String transactionName)
          Creates transaction with given name.
 String deleteObject(String transactionName, String owner, String tmpnumber)
           
protected  Collection<MMObjectNode> deleteTransaction(String transactionName)
          Removes the transaction with given name
 String findUserName(Object user)
           
static TransactionManager getInstance()
           
 TemporaryNodeManager getTemporaryNodeManager()
           
 Collection<MMObjectNode> getTransaction(String transactionName)
          Returns transaction with given name.
 Map<String,Collection<MMObjectNode>> getTransactions()
          Return a an unmodifable Map with all transactions.
(package private)  boolean performCommits(Object user, Collection<MMObjectNode> nodes)
           
 String removeNode(String transactionName, String owner, String tmpnumber)
           
 boolean resolve(String transactionName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

transactions

protected final Map<String,Collection<MMObjectNode>> transactions

instance

public static TransactionManager instance
Method Detail

getInstance

public static TransactionManager getInstance()
Since:
MMBase-1.9

getTemporaryNodeManager

public TemporaryNodeManager getTemporaryNodeManager()

getTransaction

public Collection<MMObjectNode> getTransaction(String transactionName)
                                        throws TransactionManagerException
Returns transaction with given name. Syncrhonize on the returrned collection if you're going to iterate over it.

Parameters:
transactionName - The name of the transaction to return
Returns:
Collection containing the nodes in this transaction (as MMObjectNodes).
Throws:
TransactionManagerException - if the transaction with given name does not exist

getTransactions

public Map<String,Collection<MMObjectNode>> getTransactions()
Return a an unmodifable Map with all transactions. This map can be used to explore the existing transactions.

Since:
MMBase-1.9

createTransaction

public Collection<MMObjectNode> createTransaction(String transactionName)
                                           throws TransactionManagerException
Creates transaction with given name.

Parameters:
transactionName - The name of the transaction to return
Returns:
Collection containing the nodes in this transaction (so, this is an empty collection)
Throws:
TransactionManagerException - if the transaction with given name existed already

deleteTransaction

protected Collection<MMObjectNode> deleteTransaction(String transactionName)
Removes the transaction with given name

Returns:
the collection with nodes from the removed transaction or null if no transaction with this name existed

addNode

public String addNode(String transactionName,
                      String owner,
                      String tmpnumber)
               throws TransactionManagerException
Throws:
TransactionManagerException

removeNode

public String removeNode(String transactionName,
                         String owner,
                         String tmpnumber)
                  throws TransactionManagerException
Throws:
TransactionManagerException

deleteObject

public String deleteObject(String transactionName,
                           String owner,
                           String tmpnumber)
                    throws TransactionManagerException
Throws:
TransactionManagerException

cancel

public String cancel(Object user,
                     String transactionName)

resolve

public boolean resolve(String transactionName)
                throws TransactionManagerException
Throws:
TransactionManagerException
Since:
MMBase-1.9
To Do:
Review this stuff..

commit

public String commit(Object user,
                     String transactionName)
              throws TransactionManagerException
Throws:
TransactionManagerException

performCommits

boolean performCommits(Object user,
                       Collection<MMObjectNode> nodes)

findUserName

public String findUserName(Object user)


MMBase2 Core 2.0-SNAPSHOT - 2013-05-29T22:08