org.sakaiproject.search.indexer.impl
Class IndexUpdateTransactionImpl

java.lang.Object
  extended by org.sakaiproject.search.transaction.impl.IndexTransactionImpl
      extended by org.sakaiproject.search.transaction.impl.IndexItemsTransactionImpl
          extended by org.sakaiproject.search.indexer.impl.IndexUpdateTransactionImpl
All Implemented Interfaces:
IndexUpdateTransaction, IndexItemsTransaction, IndexTransaction

public class IndexUpdateTransactionImpl
extends IndexItemsTransactionImpl
implements IndexUpdateTransaction

A transaction to manage the 2PC of a journaled indexing operation, this is created by a Transaction Manager

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

Field Summary
 
Fields inherited from class org.sakaiproject.search.transaction.impl.IndexTransactionImpl
manager, transactionId, 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
IndexUpdateTransactionImpl(TransactionManagerImpl manager, JournalSettings journalSettings, Map<String,Object> m)
           
 
Method Summary
protected  void doAfterCommit()
           
protected  void doAfterRollback()
           
protected  void doBeforePrepare()
           
protected  void doBeforeRollback()
           
 org.apache.lucene.index.IndexReader getIndexReader()
           
 org.apache.lucene.index.IndexWriter getIndexWriter()
          Get the index writer associated with this transaction
 String getTempIndex()
          The name of the temp index should be used to locate the index, and NOT the transaction ID.
 long getTransactionId()
          The transaction ID will change as the status cahnges.
 Iterator<SearchBuilderItem> lockedItemIterator()
          Get a list of add items associated with this transaction
 void setItems(List<SearchBuilderItem> items)
          Sets the items for the tansaction if the transaction is not open
 
Methods inherited from class org.sakaiproject.search.transaction.impl.IndexItemsTransactionImpl
getItems
 
Methods inherited from class org.sakaiproject.search.transaction.impl.IndexTransactionImpl
clear, close, commit, doAfterClose, doAfterOpen, doAfterPrepare, doBeforeClose, doBeforeCommit, doBeforeOpen, get, getStatus, open, prepare, put, rollback
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.sakaiproject.search.indexer.api.IndexUpdateTransaction
getItems
 
Methods inherited from interface org.sakaiproject.search.transaction.api.IndexTransaction
clear, close, commit, get, getStatus, open, prepare, put, rollback
 

Constructor Detail

IndexUpdateTransactionImpl

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

lockedItemIterator

public Iterator<SearchBuilderItem> lockedItemIterator()
                                               throws IndexTransactionException
Description copied from interface: IndexUpdateTransaction
Get a list of add items associated with this transaction

Specified by:
lockedItemIterator in interface IndexUpdateTransaction
Returns:
Throws:
IndexTransactionException - if the transaction is not open
See Also:
org.sakaiproject.search.component.service.index.transactional.api.IndexUpdateTransaction#addItemIterator()

doBeforePrepare

protected void doBeforePrepare()
                        throws IndexTransactionException
Overrides:
doBeforePrepare in class IndexTransactionImpl
Throws:
IndexTransactionException

doAfterCommit

protected void doAfterCommit()
                      throws IndexTransactionException
Overrides:
doAfterCommit in class IndexTransactionImpl
Throws:
IndexTransactionException

getIndexWriter

public org.apache.lucene.index.IndexWriter getIndexWriter()
                                                   throws IndexTransactionException
Description copied from interface: IndexUpdateTransaction
Get the index writer associated with this transaction

Specified by:
getIndexWriter in interface IndexUpdateTransaction
Returns:
Throws:
IndexTransactionException - if the transaction is not open
See Also:
org.sakaiproject.search.component.service.index.transactional.api.IndexUpdateTransaction#getIndexWriter()

getTempIndex

public String getTempIndex()
The name of the temp index should be used to locate the index, and NOT the transaction ID.

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

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
Overrides:
getTransactionId in class IndexTransactionImpl
Returns:
See Also:
org.sakaiproject.search.component.service.index.transactional.api.IndexUpdateTransaction#getTransactionId()

doBeforeRollback

protected void doBeforeRollback()
                         throws IndexTransactionException
Overrides:
doBeforeRollback in class IndexTransactionImpl
Throws:
IndexTransactionException

doAfterRollback

protected void doAfterRollback()
                        throws IndexTransactionException
Overrides:
doAfterRollback in class IndexTransactionImpl
Throws:
IndexTransactionException

setItems

public void setItems(List<SearchBuilderItem> items)
              throws IndexTransactionException
Description copied from interface: IndexUpdateTransaction
Sets the items for the tansaction if the transaction is not open

Specified by:
setItems in interface IndexUpdateTransaction
Specified by:
setItems in interface IndexItemsTransaction
Overrides:
setItems in class IndexItemsTransactionImpl
Throws:
IndexTransactionException - if the items has already been set, or the transaction is not open
See Also:
org.sakaiproject.search.component.service.index.transactional.api.IndexUpdateTransaction#setItems(java.util.List)

getIndexReader

public org.apache.lucene.index.IndexReader getIndexReader()
                                                   throws IndexTransactionException
Specified by:
getIndexReader in interface IndexUpdateTransaction
Returns:
Throws:
IndexTransactionException


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