org.compass.core.lucene.engine.transaction
Class AbstractTransaction

java.lang.Object
  extended by org.compass.core.lucene.engine.transaction.AbstractTransaction
All Implemented Interfaces:
LuceneSearchEngineTransaction
Direct Known Subclasses:
LuceneTransaction, ReadCommittedTransaction

public abstract class AbstractTransaction
extends Object
implements LuceneSearchEngineTransaction

A base class for all Lucene based transactions. Provides helper methods for Lucene index transaction management, and default state management for the transcational operations.

Author:
kimchy

Field Summary
protected  LuceneAnalyzerManager analyzerManager
           
protected  boolean dirty
           
protected  LuceneSearchEngineIndexManager indexManager
           
protected  CompassMapping mapping
           
protected  LuceneSearchEngine searchEngine
           
 
Constructor Summary
AbstractTransaction()
           
 
Method Summary
 void begin()
           
protected  void closeDelegateClosed()
           
 void commit(boolean onePhase)
           
 void configure(LuceneSearchEngine searchEngine)
           
 void create(InternalResource resource, Analyzer analyzer)
           
 void delete(ResourceKey resourceKey)
           
protected abstract  void doBegin()
           
protected abstract  void doCommit(boolean onePhase)
           
protected abstract  void doCreate(InternalResource resource, Analyzer analyzer)
           
protected abstract  void doDelete(ResourceKey resourceKey)
           
protected abstract  LuceneSearchEngineHits doFind(LuceneSearchEngineQuery query)
           
protected  LuceneSearchEngineInternalSearch doInternalSearch(String[] subIndexes, String[] aliases)
           
protected abstract  void doPrepare()
           
protected abstract  void doRollback()
           
protected  void doUpdate(InternalResource resource, Analyzer analyzer)
           
 SearchEngineHits find(SearchEngineQuery query)
           
protected  Hits findByQuery(LuceneSearchEngineInternalSearch internalSearch, LuceneSearchEngineQuery searchEngineQuery, Filter filter)
           
protected  ResourceMapping getResourceMapping(String alias)
           
 SearchEngineInternalSearch internalSearch(String[] subIndexes, String[] aliases)
           
 boolean isDirty()
           
 void prepare()
           
 void removeDelegatedClose(LuceneDelegatedClose closable)
           
 void rollback()
           
 void update(InternalResource resource, Analyzer analyzer)
           
 
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.lucene.engine.transaction.LuceneSearchEngineTransaction
flush, get
 

Field Detail

searchEngine

protected LuceneSearchEngine searchEngine

indexManager

protected LuceneSearchEngineIndexManager indexManager

mapping

protected CompassMapping mapping

analyzerManager

protected LuceneAnalyzerManager analyzerManager

dirty

protected boolean dirty
Constructor Detail

AbstractTransaction

public AbstractTransaction()
Method Detail

configure

public void configure(LuceneSearchEngine searchEngine)
Specified by:
configure in interface LuceneSearchEngineTransaction

begin

public void begin()
           throws SearchEngineException
Specified by:
begin in interface LuceneSearchEngineTransaction
Throws:
SearchEngineException

doBegin

protected abstract void doBegin()
                         throws SearchEngineException
Throws:
SearchEngineException

rollback

public void rollback()
              throws SearchEngineException
Specified by:
rollback in interface LuceneSearchEngineTransaction
Throws:
SearchEngineException

doRollback

protected abstract void doRollback()
                            throws SearchEngineException
Throws:
SearchEngineException

prepare

public void prepare()
             throws SearchEngineException
Specified by:
prepare in interface LuceneSearchEngineTransaction
Throws:
SearchEngineException

doPrepare

protected abstract void doPrepare()
                           throws SearchEngineException
Throws:
SearchEngineException

commit

public void commit(boolean onePhase)
            throws SearchEngineException
Specified by:
commit in interface LuceneSearchEngineTransaction
Throws:
SearchEngineException

doCommit

protected abstract void doCommit(boolean onePhase)
                          throws SearchEngineException
Throws:
SearchEngineException

find

public SearchEngineHits find(SearchEngineQuery query)
                      throws SearchEngineException
Specified by:
find in interface LuceneSearchEngineTransaction
Throws:
SearchEngineException

doFind

protected abstract LuceneSearchEngineHits doFind(LuceneSearchEngineQuery query)
                                          throws SearchEngineException
Throws:
SearchEngineException

internalSearch

public SearchEngineInternalSearch internalSearch(String[] subIndexes,
                                                 String[] aliases)
                                          throws SearchEngineException
Specified by:
internalSearch in interface LuceneSearchEngineTransaction
Throws:
SearchEngineException

doInternalSearch

protected LuceneSearchEngineInternalSearch doInternalSearch(String[] subIndexes,
                                                            String[] aliases)
                                                     throws SearchEngineException
Throws:
SearchEngineException

create

public void create(InternalResource resource,
                   Analyzer analyzer)
            throws SearchEngineException
Specified by:
create in interface LuceneSearchEngineTransaction
Throws:
SearchEngineException

doCreate

protected abstract void doCreate(InternalResource resource,
                                 Analyzer analyzer)
                          throws SearchEngineException
Throws:
SearchEngineException

delete

public void delete(ResourceKey resourceKey)
            throws SearchEngineException
Specified by:
delete in interface LuceneSearchEngineTransaction
Throws:
SearchEngineException

doDelete

protected abstract void doDelete(ResourceKey resourceKey)
                          throws SearchEngineException
Throws:
SearchEngineException

update

public void update(InternalResource resource,
                   Analyzer analyzer)
            throws SearchEngineException
Specified by:
update in interface LuceneSearchEngineTransaction
Throws:
SearchEngineException

doUpdate

protected void doUpdate(InternalResource resource,
                        Analyzer analyzer)
                 throws SearchEngineException
Throws:
SearchEngineException

isDirty

public boolean isDirty()
Specified by:
isDirty in interface LuceneSearchEngineTransaction

removeDelegatedClose

public void removeDelegatedClose(LuceneDelegatedClose closable)
Specified by:
removeDelegatedClose in interface LuceneSearchEngineTransaction

closeDelegateClosed

protected void closeDelegateClosed()
                            throws SearchEngineException
Throws:
SearchEngineException

getResourceMapping

protected ResourceMapping getResourceMapping(String alias)

findByQuery

protected Hits findByQuery(LuceneSearchEngineInternalSearch internalSearch,
                           LuceneSearchEngineQuery searchEngineQuery,
                           Filter filter)
                    throws SearchEngineException
Throws:
SearchEngineException


Copyright (c) 2004-2008 The Compass Project.