org.compass.core.transaction
Class AbstractTransactionFactory

java.lang.Object
  extended by org.compass.core.transaction.AbstractTransactionFactory
All Implemented Interfaces:
TransactionFactory
Direct Known Subclasses:
AbstractJTATransactionFactory, HibernateSyncTransactionFactory, LocalTransactionFactory, SpringSyncTransactionFactory

public abstract class AbstractTransactionFactory
extends Object
implements TransactionFactory

Author:
kimchy

Field Summary
protected  boolean commitBeforeCompletion
           
protected  Compass compass
           
protected  org.apache.commons.logging.Log log
           
 
Constructor Summary
AbstractTransactionFactory()
           
 
Method Summary
 CompassTransaction beginTransaction(InternalCompassSession session, CompassTransaction.TransactionIsolation transactionIsolation)
           
 void configure(Compass compass, CompassSettings settings)
           
protected abstract  InternalCompassTransaction doBeginTransaction(InternalCompassSession session, CompassTransaction.TransactionIsolation transactionIsolation)
           
protected abstract  void doBindSessionToTransaction(CompassTransaction tr, CompassSession session)
           
protected  void doConfigure(CompassSettings settings)
           
protected abstract  InternalCompassTransaction doContinueTransaction(InternalCompassSession session)
           
protected abstract  boolean isWithinExistingTransaction(InternalCompassSession session)
           
 boolean tryJoinExistingTransaction(InternalCompassSession session)
          If there is an outer running existing transaction, try and join it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.compass.core.transaction.TransactionFactory
getTransactionBoundSession
 

Field Detail

log

protected final org.apache.commons.logging.Log log

compass

protected Compass compass

commitBeforeCompletion

protected boolean commitBeforeCompletion
Constructor Detail

AbstractTransactionFactory

public AbstractTransactionFactory()
Method Detail

configure

public void configure(Compass compass,
                      CompassSettings settings)
               throws CompassException
Specified by:
configure in interface TransactionFactory
Throws:
CompassException

doConfigure

protected void doConfigure(CompassSettings settings)

tryJoinExistingTransaction

public boolean tryJoinExistingTransaction(InternalCompassSession session)
                                   throws CompassException
Description copied from interface: TransactionFactory
If there is an outer running existing transaction, try and join it. This method is called when opening a session and will ease the usage of Compass since there won't be a need to begin a transaction explicitly.

Note, this might end up working as if CompassSession.beginTransaction() was called, commit/rollback will not be called afterwards. Actually, beginTransaction might be called again for the same session.

Specified by:
tryJoinExistingTransaction in interface TransactionFactory
Throws:
CompassException

isWithinExistingTransaction

protected abstract boolean isWithinExistingTransaction(InternalCompassSession session)
                                                throws CompassException
Throws:
CompassException

beginTransaction

public CompassTransaction beginTransaction(InternalCompassSession session,
                                           CompassTransaction.TransactionIsolation transactionIsolation)
                                    throws CompassException
Specified by:
beginTransaction in interface TransactionFactory
Throws:
CompassException

doBeginTransaction

protected abstract InternalCompassTransaction doBeginTransaction(InternalCompassSession session,
                                                                 CompassTransaction.TransactionIsolation transactionIsolation)
                                                          throws CompassException
Throws:
CompassException

doContinueTransaction

protected abstract InternalCompassTransaction doContinueTransaction(InternalCompassSession session)
                                                             throws CompassException
Throws:
CompassException

doBindSessionToTransaction

protected abstract void doBindSessionToTransaction(CompassTransaction tr,
                                                   CompassSession session)
                                            throws CompassException
Throws:
CompassException


Copyright (c) 2004-2008 The Compass Project.