org.alfresco.repo.node.index
Class AbstractReindexComponent

java.lang.Object
  extended by org.alfresco.repo.node.index.AbstractReindexComponent
All Implemented Interfaces:
IndexRecovery
Direct Known Subclasses:
AVMFullIndexRecoveryComponent, AVMRemoteSnapshotTracker, FullIndexRecoveryComponent, IndexRemoteTransactionTracker, IndexTransactionTracker, MissingContentReindexComponent

public abstract class AbstractReindexComponent
extends java.lang.Object
implements IndexRecovery

Abstract helper for reindexing.

See Also:
AbstractReindexComponent.reindexImpl(), AbstractReindexComponent.getIndexerWriteLock(), AbstractReindexComponent.isShuttingDown()

Nested Class Summary
protected static class AbstractReindexComponent.InIndex
           
 
Field Summary
protected  FullTextSearchIndexer ftsIndexer
          the FTS indexer that we will prompt to pick up on any un-indexed text
protected  Indexer indexer
          the component to index the node hierarchy
protected  NodeDaoService nodeDaoService
          the component giving direct access to transaction instances
protected  NodeService nodeService
          the component giving direct access to store instances
protected  SearchService searcher
          the component providing searches of the indexed nodes
protected  TransactionServiceImpl transactionService
          provides transactions to atomically index each missed transaction
 
Constructor Summary
AbstractReindexComponent()
           
 
Method Summary
protected  boolean areTxnsInIndex(java.util.List txns)
           
protected  java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock getIndexerWriteLock()
          Convenience method to get a common write lock.
protected  boolean isShuttingDown()
           
protected  AbstractReindexComponent.InIndex isTxnIdPresentInIndex(long txnId)
          Determines if a given transaction is definitely in the index or not.
 void reindex()
          If this object is currently busy, then it just nothing
protected abstract  void reindexImpl()
          Perform the actual work.
protected  void reindexTransaction(long txnId)
          Perform a full reindexing of the given transaction in the context of a completely new transaction.
 void setAuthenticationComponent(AuthenticationComponent authenticationComponent)
           
 void setFtsIndexer(FullTextSearchIndexer ftsIndexer)
           
 void setIndexer(Indexer indexer)
           
 void setNodeDaoService(NodeDaoService nodeDaoService)
           
 void setNodeService(NodeService nodeService)
           
 void setSearcher(SearchService searcher)
           
 void setShutdown(boolean shutdown)
          Programmatically notify a reindex thread to terminate
 void setTransactionService(TransactionServiceImpl transactionService)
          Set the low-level transaction component to use
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

transactionService

protected TransactionServiceImpl transactionService
provides transactions to atomically index each missed transaction


indexer

protected Indexer indexer
the component to index the node hierarchy


ftsIndexer

protected FullTextSearchIndexer ftsIndexer
the FTS indexer that we will prompt to pick up on any un-indexed text


searcher

protected SearchService searcher
the component providing searches of the indexed nodes


nodeService

protected NodeService nodeService
the component giving direct access to store instances


nodeDaoService

protected NodeDaoService nodeDaoService
the component giving direct access to transaction instances

Constructor Detail

AbstractReindexComponent

public AbstractReindexComponent()
Method Detail

getIndexerWriteLock

protected java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock getIndexerWriteLock()
Convenience method to get a common write lock. This can be used to avoid concurrent access to the work methods.


setShutdown

public void setShutdown(boolean shutdown)
Programmatically notify a reindex thread to terminate

Parameters:
shutdown - true to shutdown, false to reset

isShuttingDown

protected boolean isShuttingDown()
Returns:
Returns true if the VM shutdown hook has been triggered, or the instance was programmatically shut down

setAuthenticationComponent

public void setAuthenticationComponent(AuthenticationComponent authenticationComponent)
Parameters:
authenticationComponent - ensures that reindexing operates as system user

setTransactionService

public void setTransactionService(TransactionServiceImpl transactionService)
Set the low-level transaction component to use

Parameters:
transactionComponent - provide transactions to index each missed transaction

setIndexer

public void setIndexer(Indexer indexer)
Parameters:
indexer - the indexer that will be index

setFtsIndexer

public void setFtsIndexer(FullTextSearchIndexer ftsIndexer)
Parameters:
ftsIndexer - the FTS background indexer

setSearcher

public void setSearcher(SearchService searcher)
Parameters:
searcher - component providing index searches

setNodeService

public void setNodeService(NodeService nodeService)
Parameters:
nodeService - provides information about nodes for indexing

setNodeDaoService

public void setNodeDaoService(NodeDaoService nodeDaoService)
Parameters:
nodeDaoService - provides access to transaction-related queries

reindexImpl

protected abstract void reindexImpl()
Perform the actual work. This method will be called as the system user and within an existing transaction. This thread will only ever be accessed by a single thread per instance.


reindex

public final void reindex()
If this object is currently busy, then it just nothing

Specified by:
reindex in interface IndexRecovery

isTxnIdPresentInIndex

protected AbstractReindexComponent.InIndex isTxnIdPresentInIndex(long txnId)
Determines if a given transaction is definitely in the index or not.

Parameters:
txnId - a specific transaction
Returns:
Returns true if the transaction is definitely in the index

areTxnsInIndex

protected boolean areTxnsInIndex(java.util.List txns)
Returns:
Returns false if any one of the transactions aren't in the index.

reindexTransaction

protected void reindexTransaction(long txnId)
Perform a full reindexing of the given transaction in the context of a completely new transaction.

Parameters:
txnId - the transaction identifier


Copyright © 2005 - 2008 Alfresco Software, Inc. All Rights Reserved.