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)
          Begins a transaction for the proided session.
 void configure(Compass compass, CompassSettings settings)
          Configures the transaction factory.
protected abstract  InternalCompassTransaction doBeginTransaction(InternalCompassSession session)
           
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)
           
 CompassTransaction 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
Description copied from interface: TransactionFactory
Configures the transaction factory.

Specified by:
configure in interface TransactionFactory
Throws:
CompassException

doConfigure

protected void doConfigure(CompassSettings settings)

tryJoinExistingTransaction

public CompassTransaction 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.

If a transaction is joined, the transcation will be returned. If there is no existing transaction, null will be returned.

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)
                                    throws CompassException
Description copied from interface: TransactionFactory
Begins a transaction for the proided session.

Specified by:
beginTransaction in interface TransactionFactory
Throws:
CompassException

doBeginTransaction

protected abstract InternalCompassTransaction doBeginTransaction(InternalCompassSession session)
                                                          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-2009 The Compass Project.