|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.objectwave.transactionalSupport.TransactionLog
A key piece of a the TransactionalSupport is the transaction log. All changes made to an object are associated with a transaction log. If no transaction exists, changes are not logged and the transactional object is directly updated.
Nested Class Summary | |
static class |
TransactionLog.Test
Unit tests for the tranasaction log. |
Field Summary | |
protected boolean |
committing
|
protected ObjectEditingView[] |
editedObjects
It is a requirement that the editedObjects collection contain UNIQUE objects!!! No dups allowed. |
protected int |
editedObjectsCount
|
protected ObjectEditingView |
lastObj
A cache of the last object added to the editedObjects |
protected TransactionLog |
parentTransaction
|
protected TransactionLog |
subTransaction
|
protected static TransactionManager |
transactionManager
|
Constructor Summary | |
TransactionLog()
|
Method Summary | |
protected void |
actualCommit()
Actually commit all of my known changes. |
protected void |
addObject(ObjectEditingView obj)
Add the object to the list of modified transactions. |
protected void |
addSubTransaction(TransactionLog log)
Create a nested transaction. |
static void |
addTransactionSupport(java.lang.String name,
java.lang.Class transactionClass)
Register the 'name' with the class. |
void |
chainCommit()
Similar to commit, however, the current transaction is not removed. |
protected void |
clearUpChanges()
Remove the changes from this object. |
void |
commit()
If this is a subtransaction (created via startTransaction) don't actually commit the changes. |
protected void |
commit(Session context)
If using sessions, there is no need to manage a contextList. |
protected void |
commitRootLevelTransaction()
This is a root level transaction, actually do what need to do to commit. |
protected void |
commitSubTransaction()
A sub transaction just migrates changes to the parent transaction. |
protected static boolean |
contains(java.lang.Object obj,
ObjectEditingView[] v,
int count)
An identity contains. |
boolean |
contains(TransactionalObjectIF domainObject)
Can the domainObject be found in the current transaction? |
void |
forceCommit()
Commit the values ignoring any transaction conflicts. |
static TransactionLog |
getCurrentInstance()
Find the most nested transaction. |
java.util.ArrayList |
getEditedObjects()
|
static TransactionLog |
getNewTransaction(java.lang.String name)
Attempt to create a new TransactionLog for the transaction type of 'name'. |
TransactionLog |
getParentTransaction()
If I am a subtransaction, then I have a parent transaction. |
TransactionLog |
getSubTransaction()
As a parent, I may have a subtransaction. |
static boolean |
hasTransactions()
|
void |
limitedRollback()
Return the object back to it's original state, but do not discard the changes made in this transaction. |
void |
migrateChangesTo(TransactionLog parent)
This was refactored from commit subtransaction. |
protected void |
removeObject(ObjectEditingView obj)
Remove the obj as a modified object of this transaction. |
protected void |
reset()
When not using session context we keep a hash collection of contexts, these need to be reset when a root level transaction is commited. |
void |
rollback()
Return the object back to it's original state, and discard the changes made in this transaction. |
protected void |
rollback(Session context)
Return the object back to it's original state, and discard the changes made in this transaction. |
void |
setAllowNesting(boolean b)
Remove the final keyword on the allowNesting variable if this method is to be used. |
static void |
setContext(java.lang.Object obj)
Transactions can have multiple contexts. |
protected static void |
setDefaultInstance(TransactionLog log)
Use this method sparingly. |
static void |
setTransactionManager(TransactionManager mgr)
Allow one to change the TransactionManager. |
static TransactionLog |
startRootTransaction(java.lang.String name,
java.lang.Object context)
Used to provide seperation between a particular transaction instance and the desire to have a transaction. |
static TransactionLog |
startRootTransaction(java.lang.String name,
Session session)
Used to provide seperation between a particular transaction instance and the desire to have a transaction. |
static void |
startRootTransaction(TransactionLog log,
java.lang.Object context)
Only use this method if you KNOW that you want the provided transaction to be a root transaction. |
static TransactionLog |
startTransaction(java.lang.String name,
java.lang.Object context)
Used to provide seperation between a particular transaction instance and the desire to have a transaction. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static TransactionManager transactionManager
protected ObjectEditingView[] editedObjects
protected int editedObjectsCount
protected boolean committing
protected transient ObjectEditingView lastObj
protected TransactionLog subTransaction
protected TransactionLog parentTransaction
Constructor Detail |
public TransactionLog()
Method Detail |
public static void setTransactionManager(TransactionManager mgr)
mgr
- The new TransactionManager valuepublic static void setContext(java.lang.Object obj)
obj
- The new Context valueprotected static void setDefaultInstance(TransactionLog log)
log
- The new DefaultInstance valuepublic static TransactionLog getCurrentInstance()
public static TransactionLog getNewTransaction(java.lang.String name)
name
-
public static void addTransactionSupport(java.lang.String name, java.lang.Class transactionClass)
transactionClass
- must be an instance of TransactionLog. Must also
have a default constructor.name
- The feature to be added to the TransactionSupport attributepublic static boolean hasTransactions()
public static void startRootTransaction(TransactionLog log, java.lang.Object context)
log
- The transaction that is to be the root transaction for the
provided context.context
- The context of the transaction.public static TransactionLog startRootTransaction(java.lang.String name, java.lang.Object context)
context
- The context of the transaction.name
- The name of a registered transaction type.
addTransactionSupport(java.lang.String, java.lang.Class)
public static TransactionLog startRootTransaction(java.lang.String name, Session session)
name
- The name of a registered transaction type.session
-
addTransactionSupport(java.lang.String, java.lang.Class)
public static TransactionLog startTransaction(java.lang.String name, java.lang.Object context)
context
- The context of the transaction.name
- The name of a registered transaction type.
addTransactionSupport(java.lang.String, java.lang.Class)
protected static final boolean contains(java.lang.Object obj, ObjectEditingView[] v, int count)
obj
- java.lang.Objectv
- count
-
public void setAllowNesting(boolean b)
b
- The new AllowNesting valuepublic java.util.ArrayList getEditedObjects()
public TransactionLog getParentTransaction()
public TransactionLog getSubTransaction()
public void chainCommit() throws UpdateException
UpdateException
public void commit() throws UpdateException
UpdateException
public boolean contains(TransactionalObjectIF domainObject)
domainObject
- The object in question.
public void forceCommit()
public void limitedRollback()
#rollit(boolean )
public void rollback()
protected void commitRootLevelTransaction() throws UpdateException
UpdateException
protected void clearUpChanges()
protected void commitSubTransaction()
protected void actualCommit() throws UpdateException
UpdateException
- Any exception that occured during the commit.protected final void addObject(ObjectEditingView obj)
obj
- The feature to be added to the Object attributeprotected void addSubTransaction(TransactionLog log)
log
- The feature to be added to the SubTransaction attributeprotected void commit(Session context) throws UpdateException
context
-
UpdateException
protected void removeObject(ObjectEditingView obj)
obj
- The object to remove from the list of edited objects.protected void reset()
protected void rollback(Session context)
context
- public void migrateChangesTo(TransactionLog parent)
parent
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |