|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.jdo.impl.pm.TransactionImpl
The Transaction interface allows operations to be performed against the transaction in the target Transaction object. A Transaction object is created corresponding to each PersistentManagerImpl creation. The Transaction object can be used for synchronization registration, transaction completion and status query operations. This implementation is StoreManager independent.
Field Summary | |
protected static int |
BMT_JDO
|
protected static int |
BMT_UT
|
protected static int |
CMT
|
private Connector |
connector
Connector associated with this transaction |
private javax.transaction.Transaction |
jta
javax.transaction.Transaction instance associated with the current thread or null if there is none. |
private static org.apache.commons.logging.Log |
logger
Logger instance |
private static I18NHelper |
msg
I18N message handler |
protected static int |
NON_MGD
Possible values of txType |
private boolean |
nontransactionalRead
Flag that indicates if queries and navigation are allowed without an active transaction |
private boolean |
nontransactionalWrite
Flag that indicates if write access is allowed without an active transaction |
private boolean |
optimistic
Flag that indicates type of the transaction. |
private java.lang.String |
password
|
private PersistenceManagerImpl |
persistenceManager
PersistenceManager associated with this transaction (1-1) |
private PersistenceManagerFactoryImpl |
pmFactory
PersistenceManagerFactory associated with this transaction |
private boolean |
restoreValues
Flag that indicates how to handle objects after rollback. |
private boolean |
retainValues
Flag that indicates how to handle objects after commit. |
private boolean |
startedCommit
The commit process has already begun (even though the status is still STATUS_ACTIVE). |
private int |
status
Transaction status (from javax.transaction.Status). |
private java.lang.Object |
synchronization
Registered Synchronization object. |
private java.lang.Object |
txSync
Synchronisation object associated with this transaction instance |
private int |
txType
Flag to indicate usage mode (non-managed versus managed, and so on). |
private java.lang.String |
username
values for the datasource user and user password to access security connections |
Constructor Summary | |
(package private) |
TransactionImpl(PersistenceManagerImpl pm,
PersistenceManagerFactoryImpl pmf,
java.lang.String username,
java.lang.String password)
Constructors new instance of TransactionImpl for the corresponding PersistenceManagerImpl. |
Method Summary | |
protected void |
afterCompletion(int st)
Called in the managed environment only for transaction completion by TransactionSynchronization#afterCompletion(int st). |
void |
assertReadAllowed()
|
protected void |
beforeCompletion()
Called in the managed environment only for transaction completion by TransactionSynchronization#beforeCompletion(). |
void |
begin()
Begin a transaction. |
protected void |
begin(javax.transaction.Transaction t)
Begin a transaction in a managed environment. |
private void |
beginInternal()
Status change and validation. |
void |
commit()
Commit the transaction represented by this Transaction object |
private void |
commitComplete()
Lower-level commit method - phase 3. |
private void |
commitConnector()
Commit a connector does flush if necessary, commit and close |
private void |
commitPrepare()
Lower-level prepare-commit method - phase 2. |
private boolean |
debugging()
Verifies if debugging is enabled. |
private void |
finish()
Finish this transaction |
private void |
flushConnector()
Close a connector does flush of the changes and close |
private void |
flushInstances(boolean commit)
Flush dirty persistent instances to the datastore. |
private int |
forceRollback()
Force rollback. |
private Connector |
getConnector()
Get a connector |
boolean |
getNontransactionalRead()
|
boolean |
getNontransactionalWrite()
|
boolean |
getOptimistic()
|
javax.jdo.PersistenceManager |
getPersistenceManager()
Returns PersistenceManager associated with this transaction |
boolean |
getRestoreValues()
|
boolean |
getRetainValues()
|
int |
getStatus()
Obtain the status of this transaction object. |
javax.transaction.Synchronization |
getSynchronization()
|
protected int |
getTransactionType()
Returns current transaction type |
private void |
internalAfterCompletion()
Notify Connector, PersistenceManager, and registered Synchronization instances about afterCompletion(). |
protected void |
internalFlush()
Flush changes to the datastore. |
private void |
internalRollback()
Lower-level internal rollback method. |
boolean |
isActive()
|
private boolean |
isTerminated()
Confirm that transaction is terminated. |
private void |
prepareFlush(boolean _commit)
Lower-level before-commit method - phase 1. |
private void |
registerSynchronization(javax.transaction.Synchronization sync)
Register a Synchronization object for this transaction object. |
void |
rollback()
Rollback the transaction represented by this transaction object. |
private void |
rollbackConnector()
Rollback a connector does rollback and close |
void |
setNontransactionalRead(boolean flag)
|
void |
setNontransactionalWrite(boolean flag)
|
void |
setOptimistic(boolean flag)
|
void |
setRestoreValues(boolean flag)
|
void |
setRetainValues(boolean flag)
|
void |
setRollbackOnly()
Modify the transaction object such that the only possible outcome of the transaction is to roll back. |
private void |
setStatus(int status)
Set status under lock (may be a nested lock which is ok) |
void |
setSynchronization(javax.transaction.Synchronization sync)
|
protected boolean |
startedCommit()
Returns true if commit has started |
static java.lang.String |
statusString(int status)
Translates a javax.transaction.Status value into a string. |
java.lang.String |
toString()
Returns a string representation of this transaction object. |
private void |
traceCall(java.lang.String call)
Trace method call. |
private void |
traceCall(java.lang.String call,
int st)
Trace method call with a provided status. |
private java.lang.String |
txTypeString()
Translates a txType value into a string. |
protected boolean |
verify(java.lang.String username,
java.lang.String password)
Verify that username and password are equal to ones stored before |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
private int status
private boolean startedCommit
private java.lang.Object synchronization
private java.lang.Object txSync
private PersistenceManagerFactoryImpl pmFactory
private PersistenceManagerImpl persistenceManager
private Connector connector
private javax.transaction.Transaction jta
private boolean retainValues
private boolean restoreValues
private boolean optimistic
private boolean nontransactionalRead
private boolean nontransactionalWrite
private java.lang.String username
private java.lang.String password
protected static final int NON_MGD
protected static final int CMT
protected static final int BMT_UT
protected static final int BMT_JDO
private int txType
private static final org.apache.commons.logging.Log logger
private static final I18NHelper msg
Constructor Detail |
TransactionImpl(PersistenceManagerImpl pm, PersistenceManagerFactoryImpl pmf, java.lang.String username, java.lang.String password)
pm
- calling instance of PersistenceManagerImplpmf
- PersistenceManagerFactoryImpl associated with the instance of
PersistenceManagerImplusername
- user name for Connector requestpassword
- user password for Connector requestMethod Detail |
public javax.jdo.PersistenceManager getPersistenceManager()
getPersistenceManager
in interface javax.jdo.Transaction
Transaction.getPersistenceManager()
public boolean isActive()
isActive
in interface javax.jdo.Transaction
Transaction.isActive()
public void setRetainValues(boolean flag)
setRetainValues
in interface javax.jdo.Transaction
Transaction.setRetainValues(boolean flag)
public boolean getRetainValues()
getRetainValues
in interface javax.jdo.Transaction
Transaction.getRetainValues()
public void setRestoreValues(boolean flag)
setRestoreValues
in interface javax.jdo.Transaction
Transaction.setRestoreValues(boolean flag)
public boolean getRestoreValues()
getRestoreValues
in interface javax.jdo.Transaction
Transaction.getRestoreValues()
public void setNontransactionalRead(boolean flag)
setNontransactionalRead
in interface javax.jdo.Transaction
Transaction.setNontransactionalRead(boolean flag)
public boolean getNontransactionalRead()
getNontransactionalRead
in interface javax.jdo.Transaction
Transaction.getNontransactionalRead()
public void setNontransactionalWrite(boolean flag)
setNontransactionalWrite
in interface javax.jdo.Transaction
Transaction.setNontransactionalWrite(boolean flag)
public boolean getNontransactionalWrite()
getNontransactionalWrite
in interface javax.jdo.Transaction
Transaction.getNontransactionalWrite()
public void setOptimistic(boolean flag)
setOptimistic
in interface javax.jdo.Transaction
Transaction.setOptimistic(boolean flag)
public boolean getOptimistic()
getOptimistic
in interface javax.jdo.Transaction
Transaction.getOptimistic()
public void setSynchronization(javax.transaction.Synchronization sync)
setSynchronization
in interface javax.jdo.Transaction
Transaction.setSynchronization(Synchronization sync)
public javax.transaction.Synchronization getSynchronization()
getSynchronization
in interface javax.jdo.Transaction
Transaction.getRetainValues()
public void assertReadAllowed()
public void begin()
begin
in interface javax.jdo.Transaction
Transaction.begin()
public void commit()
commit
in interface javax.jdo.Transaction
Transaction.commit()
public void rollback()
rollback
in interface javax.jdo.Transaction
Transaction.rollback()
public void setRollbackOnly()
public int getStatus()
public static java.lang.String statusString(int status)
status
- Status object to translate.
public java.lang.String toString()
protected int getTransactionType()
protected boolean verify(java.lang.String username, java.lang.String password)
username
- as Stringpassword
- as String
protected boolean startedCommit()
protected void internalFlush()
protected void begin(javax.transaction.Transaction t)
t
- JTA Transaction associated with the current threadprotected void beforeCompletion()
protected void afterCompletion(int st)
private void beginInternal()
private void prepareFlush(boolean _commit)
_commit
- true if called during the commit processing
For exceptions see commit() method.private void commitPrepare()
private void commitComplete()
private void internalRollback()
private int forceRollback()
private void registerSynchronization(javax.transaction.Synchronization sync)
sync
- The Synchronization object for the transaction.private boolean isTerminated()
private void flushInstances(boolean commit)
private void internalAfterCompletion()
private void setStatus(int status)
private void finish()
private Connector getConnector()
private void flushConnector()
private void rollbackConnector()
private void commitConnector()
private boolean debugging()
private void traceCall(java.lang.String call)
private void traceCall(java.lang.String call, int st)
private java.lang.String txTypeString()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |