org.sakaiproject.search.transaction.impl
Class IndexTransactionImpl

java.lang.Object
  extended by org.sakaiproject.search.transaction.impl.IndexTransactionImpl
All Implemented Interfaces:
IndexTransaction
Direct Known Subclasses:
IndexItemsTransactionImpl, IndexOptimizeTransactionImpl, JournalOptimizationTransactionImpl

public abstract class IndexTransactionImpl
extends Object
implements IndexTransaction

Base for index transactions

Author:
ieb Unit test
See Also:
org.sakaiproject.search.indexer.impl.test.TransactionalIndexWorkerTest

Field Summary
protected  TransactionManagerImpl manager
           
protected  long transactionId
           
protected  int transactionState
           
 
Fields inherited from interface org.sakaiproject.search.transaction.api.IndexTransaction
STATUS_ACTIVE, STATUS_COMMITTED, STATUS_COMMITTING, STATUS_MARKED_ROLLBACK, STATUS_NO_TRANSACTION, STATUS_PREPARED, STATUS_PREPARING, STATUS_ROLLEDBACK, STATUS_ROLLING_BACK, STATUS_UNKNOWN, TRANSACTION_ACTIVE, TRANSACTION_STATUS
 
Constructor Summary
IndexTransactionImpl(TransactionManagerImpl manager, Map<String,Object> m)
           
 
Method Summary
 void clear(String key)
          Clear an object placed in the transaction
 void close()
           
 void commit()
          Commit the transaction and make it available to others in the cluster
protected  void doAfterClose()
           
protected  void doAfterCommit()
           
protected  void doAfterOpen()
           
protected  void doAfterPrepare()
           
protected  void doAfterRollback()
           
protected  void doBeforeClose()
           
protected  void doBeforeCommit()
           
protected  void doBeforeOpen()
           
protected  void doBeforePrepare()
           
protected  void doBeforeRollback()
           
 Object get(String key)
          get an Object from the transaction, that may have been placed in the transaction by earlier phases.
 int getStatus()
          get the transaction status
 long getTransactionId()
          The transaction ID will change as the status cahnges.
 void open()
           
 void prepare()
          Prepare to commit this transaction, all the work is done, but all the listeners need to be ready and able to performa commit without failure
 void put(String key, Object obj)
          Put an object into the transaction for use in later phases
 void rollback()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

transactionId

protected long transactionId

manager

protected TransactionManagerImpl manager

transactionState

protected int transactionState
Constructor Detail

IndexTransactionImpl

public IndexTransactionImpl(TransactionManagerImpl manager,
                            Map<String,Object> m)
Parameters:
m -
impl -
Throws:
IndexTransactionException
Method Detail

open

public void open()
          throws IndexTransactionException
Specified by:
open in interface IndexTransaction
Throws:
IndexTransactionException

doAfterOpen

protected void doAfterOpen()

doBeforeOpen

protected void doBeforeOpen()

close

public final void close()
                 throws IndexTransactionException
Specified by:
close in interface IndexTransaction
Throws:
IndexTransactionException
See Also:
org.sakaiproject.search.component.service.index.transactional.api.IndexUpdateTransaction#close()

doAfterClose

protected void doAfterClose()
                     throws IndexTransactionException
Throws:
IndexTransactionException

doBeforeClose

protected void doBeforeClose()
                      throws IndexTransactionException
Throws:
IndexTransactionException

prepare

public final void prepare()
                   throws IndexTransactionException
Description copied from interface: IndexTransaction
Prepare to commit this transaction, all the work is done, but all the listeners need to be ready and able to performa commit without failure

Specified by:
prepare in interface IndexTransaction
Throws:
IndexTransactionException
See Also:
IndexTransaction.prepare()

doAfterPrepare

protected void doAfterPrepare()
                       throws IndexTransactionException
Throws:
IndexTransactionException

doBeforePrepare

protected void doBeforePrepare()
                        throws IndexTransactionException
Throws:
IndexTransactionException

commit

public final void commit()
                  throws IndexTransactionException
Description copied from interface: IndexTransaction
Commit the transaction and make it available to others in the cluster

Specified by:
commit in interface IndexTransaction
Throws:
IndexTransactionException
See Also:
org.sakaiproject.search.component.service.index.transactional.api.IndexUpdateTransaction#commit()

doAfterCommit

protected void doAfterCommit()
                      throws IndexTransactionException
Throws:
IndexTransactionException

doBeforeCommit

protected void doBeforeCommit()
                       throws IndexTransactionException
Throws:
IndexTransactionException

getTransactionId

public long getTransactionId()
The transaction ID will change as the status cahnges. While the transaction is active it will have a local ID, when the transaction is prepared the cluster wide transaction id will be created. Once prepare has been performed, the transaction should be committed

Specified by:
getTransactionId in interface IndexTransaction
Returns:
See Also:
org.sakaiproject.search.component.service.index.transactional.api.IndexUpdateTransaction#getTransactionId()

rollback

public final void rollback()
                    throws IndexTransactionException
Specified by:
rollback in interface IndexTransaction
Throws:
IndexTransactionException - if the transaction is not open
See Also:
org.sakaiproject.search.component.service.index.transactional.api.IndexUpdateTransaction#rollback()

doAfterRollback

protected void doAfterRollback()
                        throws IndexTransactionException
Throws:
IndexTransactionException

doBeforeRollback

protected void doBeforeRollback()
                         throws IndexTransactionException
Throws:
IndexTransactionException

getStatus

public final int getStatus()
Description copied from interface: IndexTransaction
get the transaction status

Specified by:
getStatus in interface IndexTransaction
Returns:
See Also:
IndexTransaction.getStatus()

clear

public void clear(String key)
Description copied from interface: IndexTransaction
Clear an object placed in the transaction

Specified by:
clear in interface IndexTransaction
See Also:
IndexTransaction.clear(java.lang.String)

get

public Object get(String key)
Description copied from interface: IndexTransaction
get an Object from the transaction, that may have been placed in the transaction by earlier phases.

Specified by:
get in interface IndexTransaction
Returns:
See Also:
IndexTransaction.get(java.lang.String)

put

public void put(String key,
                Object obj)
Description copied from interface: IndexTransaction
Put an object into the transaction for use in later phases

Specified by:
put in interface IndexTransaction
See Also:
IndexTransaction.put(java.lang.String, java.lang.Object)


Copyright © 2003-2012 Sakai Project. All Rights Reserved.