|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.mmbase.bridge.implementation.BasicCloud
org.mmbase.bridge.implementation.BasicTransaction
public class BasicTransaction
The basic implementation for a Transaction cLoud. A Transaction cloud is a cloud which buffers all changes made to nodes - which means that changes are committed only if you commit the transaction itself. This mechanism allows you to rollback changes if something goes wrong.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class org.mmbase.bridge.implementation.BasicCloud |
|---|
BasicCloud.BasicCloudStarter |
| Field Summary | |
|---|---|
protected BasicCloud |
parentCloud
|
protected String |
transactionName
The id of the transaction for use with the transaction manager. |
| Fields inherited from class org.mmbase.bridge.implementation.BasicCloud |
|---|
account, count, description, locale, name, nodeManagerCache, properties, transactions, userContext |
| Fields inherited from interface org.mmbase.bridge.Cloud |
|---|
PROP_IGNOREVALIDATION, PROP_REQUEST, PROP_RESPONSE, PROP_SESSIONNAME, PROP_XMLMODE |
| Constructor Summary | |
|---|---|
BasicTransaction(String name,
BasicCloud cloud)
|
|
| Method Summary | |
|---|---|
(package private) int |
add(BasicNode node)
Marks the given node as 'being edited'. |
(package private) void |
add(String currentObjectContext)
Ignored by basic cloud. |
protected void |
afterCommit(BasicNode n)
This method is called after a of a certain node. |
void |
cancel()
Cancels this transaction. |
boolean |
commit()
Commits this transaction. |
(package private) boolean |
contains(MMObjectNode node)
Checks wether the current transaction contains the given node. |
(package private) void |
createAlias(BasicNode node,
String aliasName)
|
BasicTransaction |
createTransaction(String name,
boolean overwrite)
Creates a transaction on this cloud with a specified name. |
(package private) void |
deleteNewNode(int temporaryNodeId,
MMObjectNode node)
|
(package private) void |
deleteNode(int temporaryNodeId,
MMObjectNode node)
Ignored by basic cloud. |
protected void |
finalize()
If this Transaction is scheduled to be garbage collected, the transaction is canceled and cleaned up. |
(package private) String |
getAccount()
The owner to use for the temporary node manager. |
String |
getCloudName()
Returns the name of the cloud this transaction uses |
protected Collection<MMObjectNode> |
getCoreNodes()
|
String |
getId()
Returns the unique ID used for this transaction. |
Node |
getNode(String nodeNumber)
Returns the node with the specified number from this cloud. |
NodeList |
getNodes()
|
Cloud |
getNonTransactionalCloud()
Returns a cloud which is not a Transaction. |
Map<Object,Object> |
getProperties()
Retrieves all properties previously set for this cloud. |
Object |
getProperty(Object key)
Retrieves a property previously set for this cloud. |
boolean |
hasNode(String nodeNumber)
Determines whether a node with the specified number is available from this cloud. |
boolean |
isCanceled()
Returns whether the transaction is canceled |
boolean |
isCommitted()
Returns whether the transaction is committed |
(package private) BasicNode |
makeNode(MMObjectNode node,
String nodeNumber)
|
protected void |
processCommitProcessors(Node n)
Calls the commit processor for every field. |
protected void |
processDeleteProcessors(Node n)
Calls the delete processor for every field. |
protected void |
setValue(BasicNode node,
String fieldName,
Object value)
|
String |
toString()
|
(package private) boolean |
verify()
|
| Methods inherited from class java.lang.Object |
|---|
clone, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected String transactionName
protected BasicCloud parentCloud
| Constructor Detail |
|---|
BasicTransaction(String name,
BasicCloud cloud)
| Method Detail |
|---|
protected final Collection<MMObjectNode> getCoreNodes()
String getAccount()
BasicCloud
getAccount in class BasicCloudpublic String getId()
transaction name may not be unique, because different users,
may have transactions with the same name.
public NodeList getNodes()
getNodes in interface Transaction
public BasicTransaction createTransaction(String name,
boolean overwrite)
throws AlreadyExistsException
Cloud
createTransaction in interface CloudcreateTransaction in class BasicCloudname - an unique name to use for the transactionoverwrite - if true, cancels and replaces
any existing transaction of this name for the current user
Transaction on this cloud
AlreadyExistsException - if a transaction with the specified name allready
exists and overwrite is falseboolean verify()
public boolean commit()
Transaction
commit in interface Transactiontrue if the commit succeeded, false
otherwisepublic void cancel()
Transaction
cancel in interface Transactionint add(BasicNode node)
BasicCloud
add in class BasicCloudvoid add(String currentObjectContext)
BasicCloudadd(String).
add in class BasicCloud
void createAlias(BasicNode node,
String aliasName)
createAlias in class BasicCloud
void deleteNewNode(int temporaryNodeId,
MMObjectNode node)
deleteNewNode in class BasicCloud
void deleteNode(int temporaryNodeId,
MMObjectNode node)
BasicClouddelete(String).
deleteNode in class BasicCloudboolean contains(MMObjectNode node)
BasicCloud
contains in class BasicCloud
BasicNode makeNode(MMObjectNode node,
String nodeNumber)
makeNode in class BasicCloudprotected void finalize()
finalize in class Objectpublic boolean isCanceled()
Transaction
isCanceled in interface Transactiontrue when canceledpublic boolean isCommitted()
Transaction
isCommitted in interface Transactiontrue when committedpublic Object getProperty(Object key)
CloudTransaction), then this will also mirror properties in this
parent cloud.
getProperty in interface CloudgetProperty in class BasicCloudkey - the key of the property
Cloud.setProperty(Object, Object)public Map<Object,Object> getProperties()
Cloud
getProperties in interface CloudgetProperties in class BasicCloudpublic String getCloudName()
Transaction
getCloudName in interface TransactionTransaction.getCloudName()public String toString()
toString in class BasicCloudpublic Cloud getNonTransactionalCloud()
Cloud
getNonTransactionalCloud in interface CloudgetNonTransactionalCloud in class BasicCloudTransactionprotected void processDeleteProcessors(Node n)
BasicCloud
processDeleteProcessors in class BasicCloudprotected void processCommitProcessors(Node n)
BasicCloud
processCommitProcessors in class BasicCloud
protected void setValue(BasicNode node,
String fieldName,
Object value)
setValue in class BasicCloudpublic boolean hasNode(String nodeNumber)
CloudCloud.mayRead(int) to determine this.
hasNode in interface CloudhasNode in class BasicCloudnodeNumber - a string containing the number or alias of the requested node
public Node getNode(String nodeNumber)
throws NotFoundException
CloudNode with a reference to this
instance of Cloud.
getNode in interface CloudgetNode in class BasicCloudnodeNumber - a string containing the number or alias of the requested node
NotFoundException - if the specified node could not be foundprotected void afterCommit(BasicNode n)
BasicCloudObject.notifyAll().
This last thing makes it easy to wait for a node to really exist (finished committing)
synchronized(ntCloud) {
while (! ntCloud.hasNode(node)) {
ntCloud.wait();
}
}
Committing in a transaction goes a bit different, because the
actual committing only happens in the
, this method will be mostly empty
for BasicTransaction.
afterCommit in class BasicCloud
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||