public class BasicTransaction extends BasicCloud implements Transaction
BasicCloud.BasicCloudStarter| Modifier and Type | Field and Description |
|---|---|
protected BasicCloud |
parentCloud |
protected String |
transactionName
The id of the transaction for use with the transaction manager.
|
account, count, description, locale, name, nodeManagerCache, properties, transactions, userContextPROP_IGNOREVALIDATION, PROP_REQUEST, PROP_RESPONSE, PROP_SESSIONNAME, PROP_XMLMODE| Constructor and Description |
|---|
BasicTransaction(String name,
BasicCloud cloud) |
| Modifier and Type | Method and Description |
|---|---|
(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() |
_readObject, _writeObject, check, check, checkAlias, checkNodes, compareTo, createAggregatedQuery, createNodeList, createNodeManagerList, createNodeQuery, createQuery, createRelationList, createRelationManagerList, createTransaction, createTransaction, equals, getBasicNodeManager, getBasicNodeManager, getByteSize, getByteSize, getCloudContext, getClusterNodes, getDescription, getFunction, getFunctions, getLastStepList, getList, getList, getLocale, getName, getNode, getNodeByAlias, getNodeManager, getNodeManager, getNodeManagers, getPossibleContexts, getRelation, getRelation, getRelationManager, getRelationManager, getRelationManager, getRelationManager, getRelationManager, getRelationManagers, getRelationManagers, getRelationManagers, getResultNodeList, getSecureList, getTransaction, getUser, hasNode, hasNodeManager, hasRelation, hasRelation, hasRelationManager, hasRelationManager, hasRelationManager, hasRole, isTemporaryId, may, mayRead, mayRead, remove, setLocale, setProperty, setSecurityConstraint, setSecurityConstraint, shutdown, toBasicQuery, uniqueId, verify, verifyclone, getClass, hashCode, notify, notifyAll, wait, wait, waitcreateAggregatedQuery, createNodeList, createNodeManagerList, createNodeQuery, createQuery, createRelationList, createRelationManagerList, createTransaction, createTransaction, getCloudContext, getDescription, getFunction, getFunctions, getList, getList, getLocale, getName, getNode, getNodeByAlias, getNodeManager, getNodeManager, getNodeManagers, getPossibleContexts, getRelation, getRelation, getRelationManager, getRelationManager, getRelationManager, getRelationManager, getRelationManagers, getRelationManagers, getRelationManagers, getTransaction, getUser, hasNode, hasNodeManager, hasRelation, hasRelation, hasRelationManager, hasRelationManager, hasRelationManager, hasRole, may, mayRead, mayRead, setLocale, setProperty, shutdownprotected String transactionName
protected BasicCloud parentCloud
BasicTransaction(String name, BasicCloud cloud)
protected final Collection<MMObjectNode> getCoreNodes()
String getAccount()
BasicCloudgetAccount 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 Transactionpublic BasicTransaction createTransaction(String name, boolean overwrite) throws AlreadyExistsException
CloudcreateTransaction 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 userTransaction on this cloudAlreadyExistsException - if a transaction with the specified name allready
exists and overwrite is falseboolean verify()
public boolean commit()
Transactioncommit in interface Transactiontrue if the commit succeeded, false
otherwisepublic void cancel()
Transactioncancel in interface Transactionint add(BasicNode node)
BasicCloudadd in class BasicCloudvoid add(String currentObjectContext)
BasicCloudadd(String).add in class BasicCloudvoid createAlias(BasicNode node, String aliasName)
createAlias in class BasicCloudvoid deleteNewNode(int temporaryNodeId,
MMObjectNode node)
deleteNewNode in class BasicCloudvoid deleteNode(int temporaryNodeId,
MMObjectNode node)
BasicClouddelete(String).deleteNode in class BasicCloudboolean contains(MMObjectNode node)
BasicCloudcontains in class BasicCloudBasicNode makeNode(MMObjectNode node, String nodeNumber)
makeNode in class BasicCloudprotected void finalize()
public boolean isCanceled()
TransactionisCanceled in interface Transactiontrue when canceledpublic boolean isCommitted()
TransactionisCommitted 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 propertyCloud.setProperty(Object, Object)public Map<Object,Object> getProperties()
CloudgetProperties in interface CloudgetProperties in class BasicCloudpublic String getCloudName()
TransactiongetCloudName in interface TransactionTransaction.getCloudName()public String toString()
toString in class BasicCloudpublic Cloud getNonTransactionalCloud()
CloudgetNonTransactionalCloud in interface CloudgetNonTransactionalCloud in class BasicCloudTransactionprotected void processDeleteProcessors(Node n)
BasicCloudprocessDeleteProcessors in class BasicCloudprotected void processCommitProcessors(Node n)
BasicCloudprocessCommitProcessors in class BasicCloudprotected 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 nodepublic 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 nodeNotFoundException - 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 BasicCloudMMBase 1.9-SNAPSHOT - ${javadoctimestamp}