Java Doc for TransactionImpl.java in  » Database-ORM » db-ojb » org » apache » ojb » odmg » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database ORM » db ojb » org.apache.ojb.odmg 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.ojb.odmg.TransactionImpl

All known Subclasses:   org.apache.ojb.odmg.J2EETransactionImpl,
TransactionImpl
public class TransactionImpl implements Transaction,MaterializationListener,Configurable,CollectionProxyListener,TransactionExt(Code)
Implementation of Transaction for org.odmg.Transaction.
author:
   Thomas Mahler & David Dixon-Peugh
author:
   Matthew Baird
author:
   Armin Waibel
author:
   Brian McCallister
version:
   $Id: TransactionImpl.java,v 1.59.2.25 2005/12/21 22:29:21 tomdz Exp $

Inner Class :static class CascadeSettingException extends OJBRuntimeException

Field Summary
protected  PersistenceBrokerInternalbroker
    
protected  ObjectEnvelopeTableobjectEnvelopeTable
    

Constructor Summary
public  TransactionImpl(ImplementationImpl implementation)
    

Method Summary
public  voidabort()
     Abort and close the transaction.
public  voidafterLoading(CollectionProxyDefaultImpl colProxy)
     Remove colProxy from list of pending collections and register its contents with the transaction.
public  voidafterMaterialization(IndirectionHandler handler, Object materializedObject)
     this callback is invoked after an Object is materialized within an IndirectionHandler.
public  voidbeforeLoading(CollectionProxyDefaultImpl colProxy)
    
public  voidbeforeMaterialization(IndirectionHandler handler, Identity oid)
     this callback is invoked before an Object is materialized within an IndirectionHandler.
public synchronized  voidbegin()
     Start a transaction.
protected  booleancascadeDeleteFor(ObjectReferenceDescriptor ord)
     Returns true if cascading delete is enabled for the specified single or collection descriptor.
protected  voidcheckForBegin()
    
protected  voidcheckForCommit()
    
public  voidcheckpoint()
     Commit the transaction, but reopen the transaction, retaining all locks. Calling checkpoint commits persistent object modifications made within the transaction since the last checkpoint to the database.
protected  voidcleanupBroker()
    
public  voidclearRegistrationList()
     Clears the list of processed object Identity.
public  voidcommit()
     Commit and close the transaction.
public  voidconfigure(Configuration config)
    
public  voiddeletePersistent(RuntimeObject rt)
    
protected synchronized  voiddoAbort()
     Do the Aborts, but don't release the locks.
protected synchronized  voiddoClose()
     Close a transaction and do all the cleanup associated with it.
 voiddoSingleLock(ClassDescriptor cld, Object obj, Identity oid, int lockMode)
     Only lock the specified object, represented by the RuntimeObject instance.
Parameters:
  cld - The org.apache.ojb.broker.metadata.ClassDescriptorof the object to acquire a lock on.
Parameters:
  oid - The org.apache.ojb.broker.Identity of the object to lock.
Parameters:
  lockMode - lock mode to acquire.
 voiddoSingleRegister(RuntimeObject rtObject, int lockMode)
     Registers the object (without locking) with this transaction.
protected synchronized  voiddoWriteObjects(boolean isFlush)
     Write objects to data store, but don't release the locks.
public  voidflush()
    
public  DatabaseImplgetAssociatedDatabase()
    
public  PersistenceBrokergetBroker()
    
public  PersistenceBrokerInternalgetBrokerInternal()
     Gets the broker associated with the transaction. MBAIRD: only return the associated broker if the transaction is open, if it's closed, throw a TransactionNotInProgressException.
public  StringgetGUID()
    
public  ImplementationImplgetImplementation()
    
 intgetImpliciteLockType(int parentLockMode)
    
public  NamedRootsMapgetNamedRootsMap()
    
public  ObjectgetObjectByIdentity(Identity id)
     Get object by identity.
public  ArrayListgetRegistrationList()
     Returns an empty List for registration of processed object Identity.
protected  intgetStatus()
    
protected  booleanhasBroker()
     Returns true if an org.apache.ojb.broker.PersistenceBroker was associated with this tx instance.
public  booleanisDeleted(Identity id)
    
public  booleanisImplicitLocking()
    
public  booleanisOpen()
     Determine whether the transaction is open or not.
public  booleanisOrdering()
     Return true if the OJB ordering algorithm is enabled.
protected  booleanisTransient(ClassDescriptor cld, Object obj, Identity oid)
     Detect new objects.
public  voidjoin()
     Attach the caller's thread to this Transaction and detach the thread from any former Transaction the thread may have been associated with.
public  voidleave()
     Detach the caller's thread from this Transaction , but do not attach the thread to another Transaction .
public  voidlock(Object obj, int lockMode)
     Upgrade the lock on the given object to the given lock mode.
public  voidlockAndRegister(RuntimeObject rtObject, int lockMode, List registeredObjects)
     Lock and register the specified object, make sure that when cascading locking and register is enabled to specify a List to register the already processed object Identiy.
public synchronized  voidlockAndRegister(RuntimeObject rtObject, int lockMode, boolean cascade, List registeredObjects)
     Lock and register the specified object, make sure that when cascading locking and register is enabled to specify a List to register the already processed object Identiy.
 voidmakePersistent(RuntimeObject rt)
    
public  voidmarkDelete(Object anObject)
    
public  voidmarkDirty(Object anObject)
    
 voidmarkDirty(RuntimeObject rt)
    
 voidmarkPersistent(RuntimeObject rtObj)
    
protected  voidperformTransactionAwareAfterCommit()
    
protected  voidperformTransactionAwareAfterRollback()
    
protected  voidperformTransactionAwareBeforeCommit()
    
protected  voidperformTransactionAwareBeforeRollback()
    
protected  voidprepareCommit()
     Prepare does the actual work of moving the changes at the object level into storage (the underlying rdbms for instance).
protected  voidrefresh()
    
protected synchronized  voidregisterToIndirectionHandler(IndirectionHandler handler)
    
protected  voidregisterUnmaterializedLocks(Object obj)
    
public  voidsetCascadingDelete(Class target, String referenceField, boolean doCascade)
     Allows to change the cascading delete behavior of the specified reference of the target class while this transaction is in use.
public  voidsetCascadingDelete(Class target, boolean doCascade)
     Allows to change the cascading delete behavior of all references of the specified class while this transaction is in use - if the specified class is an interface, abstract class or class with "extent" classes the cascading flag will be propagated.
public synchronized  voidsetImplicitLocking(boolean value)
    
public  voidsetOrdering(boolean ordering)
     Allows to enable/disable the OJB persistent object ordering algorithm.
protected  voidsetStatus(int status)
    
public  booleantryLock(Object obj, int lockMode)
     Upgrade the lock on the given object to the given lock mode.
protected synchronized  voidunRegisterFromAllCollectionProxies()
    
protected synchronized  voidunRegisterFromAllIndirectionHandlers()
    
protected synchronized  voidunregisterFromCollectionProxy(CollectionProxy handler)
    
protected synchronized  voidunregisterFromIndirectionHandler(IndirectionHandler handler)
    

Field Detail
broker
protected PersistenceBrokerInternal broker(Code)



objectEnvelopeTable
protected ObjectEnvelopeTable objectEnvelopeTable(Code)
the internal table containing all Objects "touched" by this tx and their respective transactional state




Constructor Detail
TransactionImpl
public TransactionImpl(ImplementationImpl implementation)(Code)
Creates new Transaction
Parameters:
  implementation - The odmg Implementation class




Method Detail
abort
public void abort()(Code)
Abort and close the transaction. Calling abort abandons all persistent object modifications and releases the associated locks. Aborting a transaction does not restore the state of modified transient objects



afterLoading
public void afterLoading(CollectionProxyDefaultImpl colProxy)(Code)
Remove colProxy from list of pending collections and register its contents with the transaction.



afterMaterialization
public void afterMaterialization(IndirectionHandler handler, Object materializedObject)(Code)
this callback is invoked after an Object is materialized within an IndirectionHandler. this callback allows to defer registration of objects until it's really neccessary.
Parameters:
  handler - the invoking handler
Parameters:
  materializedObject - the materialized Object



beforeLoading
public void beforeLoading(CollectionProxyDefaultImpl colProxy)(Code)
noop -- here for interface



beforeMaterialization
public void beforeMaterialization(IndirectionHandler handler, Identity oid)(Code)
this callback is invoked before an Object is materialized within an IndirectionHandler.
Parameters:
  handler - the invoking handler
Parameters:
  oid - the identity of the object to be materialized



begin
public synchronized void begin()(Code)
Start a transaction. Calling begin multiple times on the same transaction object, without an intervening call to commit or abort , causes the exception TransactionInProgressException to be thrown on the second and subsequent calls. Operations executed before a transaction has been opened, or before reopening after a transaction is aborted or committed, have undefined results; these may throw a TransactionNotInProgressException exception.



cascadeDeleteFor
protected boolean cascadeDeleteFor(ObjectReferenceDescriptor ord)(Code)
Returns true if cascading delete is enabled for the specified single or collection descriptor.



checkForBegin
protected void checkForBegin()(Code)



checkForCommit
protected void checkForCommit()(Code)



checkpoint
public void checkpoint()(Code)
Commit the transaction, but reopen the transaction, retaining all locks. Calling checkpoint commits persistent object modifications made within the transaction since the last checkpoint to the database. The transaction retains all locks it held on those objects at the time the checkpoint was invoked.



cleanupBroker
protected void cleanupBroker()(Code)



clearRegistrationList
public void clearRegistrationList()(Code)
Clears the list of processed object Identity.



commit
public void commit()(Code)
Commit and close the transaction. Calling commit commits to the database all persistent object modifications within the transaction and releases any locks held by the transaction. A persistent object modification is an update of any field of an existing persistent object, or an update or creation of a new named object in the database. If a persistent object modification results in a reference from an existing persistent object to a transient object, the transient object is moved to the database, and all references to it updated accordingly. Note that the act of moving a transient object to the database may create still more persistent references to transient objects, so its referents must be examined and moved as well. This process continues until the database contains no references to transient objects, a condition that is guaranteed as part of transaction commit. Committing a transaction does not remove from memory transient objects created during the transaction. The updateObjectList contains a list of all objects for which this transaction has write privledge to. We need to update these objects.



configure
public void configure(Configuration config) throws ConfigurationException(Code)



deletePersistent
public void deletePersistent(RuntimeObject rt)(Code)



doAbort
protected synchronized void doAbort()(Code)
Do the Aborts, but don't release the locks. Do the aborts on the NamedRootsMap first, then abort the other stuff.



doClose
protected synchronized void doClose()(Code)
Close a transaction and do all the cleanup associated with it.



doSingleLock
void doSingleLock(ClassDescriptor cld, Object obj, Identity oid, int lockMode) throws LockNotGrantedException(Code)
Only lock the specified object, represented by the RuntimeObject instance.
Parameters:
  cld - The org.apache.ojb.broker.metadata.ClassDescriptorof the object to acquire a lock on.
Parameters:
  oid - The org.apache.ojb.broker.Identity of the object to lock.
Parameters:
  lockMode - lock mode to acquire. The lock modesare READ , UPGRADE , and WRITE.
exception:
  LockNotGrantedException - Description of Exception



doSingleRegister
void doSingleRegister(RuntimeObject rtObject, int lockMode) throws LockNotGrantedException, PersistenceBrokerException(Code)
Registers the object (without locking) with this transaction. This method expects that the object was already locked, no check is done!!!



doWriteObjects
protected synchronized void doWriteObjects(boolean isFlush) throws TransactionAbortedException, LockNotGrantedException(Code)
Write objects to data store, but don't release the locks. I don't know what we should do if we are in a checkpoint and we need to abort.



flush
public void flush()(Code)

See Also:   org.apache.ojb.odmg.TransactionExt.flush



getAssociatedDatabase
public DatabaseImpl getAssociatedDatabase()(Code)
Returns the associated database



getBroker
public PersistenceBroker getBroker()(Code)



getBrokerInternal
public PersistenceBrokerInternal getBrokerInternal()(Code)
Gets the broker associated with the transaction. MBAIRD: only return the associated broker if the transaction is open, if it's closed, throw a TransactionNotInProgressException. If we allow brokers to be reaquired by an already closed transaction, there is a very good chance the broker will be leaked as the doClose() method of transactionImpl will never be called and thus the broker will never be closed and returned to the pool. Returns a PersistenceBroker
throws:
  TransactionNotInProgressException - is the transaction is not open;



getGUID
public String getGUID()(Code)



getImplementation
public ImplementationImpl getImplementation()(Code)



getImpliciteLockType
int getImpliciteLockType(int parentLockMode)(Code)



getNamedRootsMap
public NamedRootsMap getNamedRootsMap()(Code)



getObjectByIdentity
public Object getObjectByIdentity(Identity id) throws PersistenceBrokerException(Code)
Get object by identity. First lookup among objects registered in the transaction, then in persistent storage.
Parameters:
  id - The identity The object
throws:
  PersistenceBrokerException -



getRegistrationList
public ArrayList getRegistrationList()(Code)
Returns an empty List for registration of processed object Identity.



getStatus
protected int getStatus()(Code)



hasBroker
protected boolean hasBroker()(Code)
Returns true if an org.apache.ojb.broker.PersistenceBroker was associated with this tx instance.



isDeleted
public boolean isDeleted(Identity id)(Code)

See Also:   org.apache.ojb.odmg.TransactionExt.isDeleted(org.apache.ojb.broker.Identity)



isImplicitLocking
public boolean isImplicitLocking()(Code)



isOpen
public boolean isOpen()(Code)
Determine whether the transaction is open or not. A transaction is open if a call has been made to begin , but a subsequent call to either commit or abort has not been made. True if the transaction is open, otherwise false.



isOrdering
public boolean isOrdering()(Code)
Return true if the OJB ordering algorithm is enabled.
See Also:   TransactionImpl.setOrdering(boolean)



isTransient
protected boolean isTransient(ClassDescriptor cld, Object obj, Identity oid)(Code)
Detect new objects.



join
public void join()(Code)
Attach the caller's thread to this Transaction and detach the thread from any former Transaction the thread may have been associated with.



leave
public void leave()(Code)
Detach the caller's thread from this Transaction , but do not attach the thread to another Transaction .



lock
public void lock(Object obj, int lockMode) throws LockNotGrantedException(Code)
Upgrade the lock on the given object to the given lock mode. The call has no effect if the object's current lock is already at or above that level of lock mode.
Parameters:
  obj - object to acquire a lock on.
Parameters:
  lockMode - lock mode to acquire. The lock modesare READ , UPGRADE , and WRITE .
exception:
  LockNotGrantedException - Description of Exception



lockAndRegister
public void lockAndRegister(RuntimeObject rtObject, int lockMode, List registeredObjects)(Code)
Lock and register the specified object, make sure that when cascading locking and register is enabled to specify a List to register the already processed object Identiy.



lockAndRegister
public synchronized void lockAndRegister(RuntimeObject rtObject, int lockMode, boolean cascade, List registeredObjects)(Code)
Lock and register the specified object, make sure that when cascading locking and register is enabled to specify a List to register the already processed object Identiy.



makePersistent
void makePersistent(RuntimeObject rt)(Code)



markDelete
public void markDelete(Object anObject)(Code)

See Also:   org.apache.ojb.odmg.TransactionExt.markDelete



markDirty
public void markDirty(Object anObject)(Code)

See Also:   org.apache.ojb.odmg.TransactionExt.markDirty



markDirty
void markDirty(RuntimeObject rt)(Code)



markPersistent
void markPersistent(RuntimeObject rtObj)(Code)



performTransactionAwareAfterCommit
protected void performTransactionAwareAfterCommit()(Code)



performTransactionAwareAfterRollback
protected void performTransactionAwareAfterRollback()(Code)



performTransactionAwareBeforeCommit
protected void performTransactionAwareBeforeCommit()(Code)



performTransactionAwareBeforeRollback
protected void performTransactionAwareBeforeRollback()(Code)



prepareCommit
protected void prepareCommit() throws TransactionAbortedException, LockNotGrantedException(Code)
Prepare does the actual work of moving the changes at the object level into storage (the underlying rdbms for instance). prepare Can be called multiple times, and does not release locks.
throws:
  TransactionAbortedException - if the transaction has been abortedfor any reason.
throws:
  IllegalStateException - Method called if transaction isnot in the proper state to perform this operation
throws:
  TransactionNotInProgressException - if the transaction is closed.



refresh
protected void refresh()(Code)
cleanup tx and prepare for reuse



registerToIndirectionHandler
protected synchronized void registerToIndirectionHandler(IndirectionHandler handler)(Code)



registerUnmaterializedLocks
protected void registerUnmaterializedLocks(Object obj)(Code)
register proxy objects that were locked but haven't been materialized yet so they can be unlocked when closing the transaction



setCascadingDelete
public void setCascadingDelete(Class target, String referenceField, boolean doCascade)(Code)
Allows to change the cascading delete behavior of the specified reference of the target class while this transaction is in use.
Parameters:
  target - The class to change cascading delete behavior of the references.
Parameters:
  referenceField - The field name of the 1:1, 1:n or 1:n reference.
Parameters:
  doCascade - If true cascading delete is enabled, false disabled.



setCascadingDelete
public void setCascadingDelete(Class target, boolean doCascade)(Code)
Allows to change the cascading delete behavior of all references of the specified class while this transaction is in use - if the specified class is an interface, abstract class or class with "extent" classes the cascading flag will be propagated.
Parameters:
  target - The class to change cascading delete behavior of all references.
Parameters:
  doCascade - If true cascading delete is enabled, false disabled.



setImplicitLocking
public synchronized void setImplicitLocking(boolean value)(Code)

See Also:   org.apache.ojb.odmg.TransactionExt.setImplicitLocking(boolean)



setOrdering
public void setOrdering(boolean ordering)(Code)
Allows to enable/disable the OJB persistent object ordering algorithm. If true OJB try to order the modified/new/deleted objects in a correct order (based on a algorithm) before the objects are written to the persistent storage.
If false the order of the objects rely on the order specified by the user and on settings like TransactionImpl.setImplicitLocking(boolean) .
Parameters:
  ordering - Set true to enable object ordering on commit.



setStatus
protected void setStatus(int status)(Code)



tryLock
public boolean tryLock(Object obj, int lockMode)(Code)
Upgrade the lock on the given object to the given lock mode. Method tryLock is the same as lock except it returns a boolean indicating whether the lock was granted instead of generating an exception.
Parameters:
  obj - Description of Parameter
Parameters:
  lockMode - Description of Parameter Description of the Returned Value, UPGRADE , and WRITE . true if the lock has been acquired, otherwise false.



unRegisterFromAllCollectionProxies
protected synchronized void unRegisterFromAllCollectionProxies()(Code)



unRegisterFromAllIndirectionHandlers
protected synchronized void unRegisterFromAllIndirectionHandlers()(Code)



unregisterFromCollectionProxy
protected synchronized void unregisterFromCollectionProxy(CollectionProxy handler)(Code)



unregisterFromIndirectionHandler
protected synchronized void unregisterFromIndirectionHandler(IndirectionHandler handler)(Code)



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.