org.apache.ojb.odmg
Class NarrowTransaction

java.lang.Object
  extended byorg.apache.ojb.odmg.NarrowTransaction
All Implemented Interfaces:
HasBroker, Transaction, TransactionExt

public class NarrowTransaction
extends java.lang.Object
implements TransactionExt

Wraps Transaction in managed environments.

Author:
Armin Waibel

Field Summary
 
Fields inherited from interface org.odmg.Transaction
READ, UPGRADE, WRITE
 
Constructor Summary
NarrowTransaction(TransactionExt tx)
           
 
Method Summary
 void abort()
          Abort the underlying odmg-transaction
 void begin()
          Not supported!!
 void checkpoint()
          Not supported!!
 void commit()
          Not supported!!
 void flush()
           Calling flush flushes persistent object modifications made within the ODMG transaction since the last checkpoint to the underlying database transaction, but does commit the database transaction.
 PersistenceBroker getBroker()
          Return associated PB instance, or null if not found.
 java.lang.Object getObjectByIdentity(Identity id)
           
 boolean isOpen()
          Not supported!!
 void join()
          Not supported!!
 void leave()
          Not supported!!
 void lock(java.lang.Object obj, int lockMode)
          lock the given object
 void markDelete(java.lang.Object anObject)
          marks an object for deletion without locking the object.
 void markDirty(java.lang.Object anObject)
          marks an object as dirty without locking the object.
 void setImplicitLocking(boolean value)
          This method can be used to activate or deactivate the implicit locking mechanism for the current transaction.
 boolean tryLock(java.lang.Object obj, int lockMode)
          lock the given object if possible
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NarrowTransaction

public NarrowTransaction(TransactionExt tx)
Method Detail

markDelete

public void markDelete(java.lang.Object anObject)
Description copied from interface: TransactionExt
marks an object for deletion without locking the object.

Specified by:
markDelete in interface TransactionExt
Parameters:
anObject - Object to be marked

markDirty

public void markDirty(java.lang.Object anObject)
Description copied from interface: TransactionExt
marks an object as dirty without locking the object.

Specified by:
markDirty in interface TransactionExt
Parameters:
anObject - Object to be marked

flush

public void flush()
Description copied from interface: TransactionExt

Calling flush flushes persistent object modifications made within the ODMG transaction since the last checkpoint to the underlying database transaction, but does commit the database transaction. The ODMG transaction retains all locks it held on those objects at the time the flush was invoked.

This method is very similair to Transaction.checkpoint().

Specified by:
flush in interface TransactionExt

getBroker

public PersistenceBroker getBroker()
Return associated PB instance, or null if not found.

Specified by:
getBroker in interface HasBroker

join

public void join()
Not supported!!

Specified by:
join in interface Transaction

leave

public void leave()
Not supported!!

Specified by:
leave in interface Transaction

begin

public void begin()
Not supported!!

Specified by:
begin in interface Transaction

isOpen

public boolean isOpen()
Not supported!!

Specified by:
isOpen in interface Transaction
Returns:
True if the transaction is open, otherwise false.

commit

public void commit()
Not supported!!

Specified by:
commit in interface Transaction

abort

public void abort()
Abort the underlying odmg-transaction

Specified by:
abort in interface Transaction

checkpoint

public void checkpoint()
Not supported!!

Specified by:
checkpoint in interface Transaction

lock

public void lock(java.lang.Object obj,
                 int lockMode)
          throws LockNotGrantedException
lock the given object

Specified by:
lock in interface Transaction
Parameters:
obj - The object to acquire a lock on.
lockMode - The lock mode to acquire. The lock modes are READ, UPGRADE, and WRITE.
Throws:
LockNotGrantedException - Is thrown if the given lock mode could not be acquired.
See Also:
Transaction#lock

tryLock

public boolean tryLock(java.lang.Object obj,
                       int lockMode)
lock the given object if possible

Specified by:
tryLock in interface Transaction
Parameters:
obj - The object to acquire a lock on.
lockMode - The lock mode to acquire. The lock modes are READ, UPGRADE, and WRITE.
Returns:
True if the lock has been acquired, otherwise false.
See Also:
Transaction#tryLock

getObjectByIdentity

public java.lang.Object getObjectByIdentity(Identity id)
                                     throws PersistenceBrokerException
Throws:
PersistenceBrokerException

setImplicitLocking

public void setImplicitLocking(boolean value)
Description copied from interface: TransactionExt
This method can be used to activate or deactivate the implicit locking mechanism for the current transaction. turning of implicit locking may improve performance but requires additional care to make sure all changed objects are properly registered to the transaction.

Specified by:
setImplicitLocking in interface TransactionExt
Parameters:
value - if set to true implicit locking is enabled, if false, implicit locking is disabled.
See Also:
TransactionExt.setImplicitLocking(boolean)


Authors: Thomas Mahler and others. (C) 2000 - 2003 Apache Software Foundation
All rights reserved. Published under the Apache License.
http://db.apache.org/ojb
Version: 1.0.rc5, 2003-12-14