magoffin.matt.ma2.lucene
Class AbstractLucenePlugin

java.lang.Object
  extended by magoffin.matt.ma2.lucene.AbstractLucenePlugin
All Implemented Interfaces:
magoffin.matt.lucene.LucenePlugin
Direct Known Subclasses:
MediaItemLucenePlugin, UserLucenePlugin

public abstract class AbstractLucenePlugin
extends java.lang.Object
implements magoffin.matt.lucene.LucenePlugin

Base implementation for LucenePlugin implementations.

Version:
$Revision: 43 $ $Date: 2007-10-21 11:10:01 +1300 (Sun, 21 Oct 2007) $
Author:
matt.magoffin

Nested Class Summary
 
Nested classes/interfaces inherited from interface magoffin.matt.lucene.LucenePlugin
magoffin.matt.lucene.LucenePlugin.LuceneIndexConfig
 
Field Summary
static int DEFAULT_ERROR_PERCENT_MAX_FRACTION_DIGITS
          Default number of error percent fraction digits.
static int DEFAULT_REINDEX_COUNT
          The default value for the infoReindexCount property.
 
Constructor Summary
AbstractLucenePlugin()
           
 
Method Summary
protected  void doAfterInit()
          Method for extending classes to override if needed, called during the init(LuceneService, Set) method.
 magoffin.matt.lucene.SearchResults find(magoffin.matt.lucene.SearchCriteria criteria)
           
 org.apache.lucene.analysis.Analyzer getAnalyzer()
           
 magoffin.matt.lucene.LucenePlugin.LuceneIndexConfig getConfig()
           
 DomainObjectFactory getDomainObjectFactory()
           
protected  java.lang.String getIndexErrorMessage(java.util.List<java.lang.Object> indexErrors)
          Get a single index error message from a list of index errors.
protected  java.util.Set<magoffin.matt.lucene.IndexListener> getIndexEventListeners()
          Get the list of IndexLister objects.
 java.lang.String getIndexType()
           
 int getInfoReindexCount()
           
protected  magoffin.matt.lucene.LuceneService getLucene()
          Get the LuceneService configured for this plugin.
 org.springframework.context.MessageSource getMessages()
           
protected  java.lang.String getSingleIndexErrorMessage(java.lang.Object object)
          Get an individual index error message.
 magoffin.matt.lucene.LucenePlugin.LuceneIndexConfig init(magoffin.matt.lucene.LuceneService luceneService, java.util.Set<magoffin.matt.lucene.IndexListener> indexEventListenersSet)
           
 void setAnalyzer(org.apache.lucene.analysis.Analyzer analyzer)
           
 void setConfig(magoffin.matt.lucene.LucenePlugin.LuceneIndexConfig config)
           
 void setDomainObjectFactory(DomainObjectFactory domainObjectFactory)
           
 void setIndexType(java.lang.String indexType)
           
 void setInfoReindexCount(int infoReindexCount)
           
 void setMessages(org.springframework.context.MessageSource messages)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface magoffin.matt.lucene.LucenePlugin
build, getIdForObject, getNativeQuery, index, index, indexObject, reindex, reindex, search
 

Field Detail

DEFAULT_REINDEX_COUNT

public static final int DEFAULT_REINDEX_COUNT
The default value for the infoReindexCount property.

See Also:
Constant Field Values

DEFAULT_ERROR_PERCENT_MAX_FRACTION_DIGITS

public static final int DEFAULT_ERROR_PERCENT_MAX_FRACTION_DIGITS
Default number of error percent fraction digits.

See Also:
Constant Field Values
Constructor Detail

AbstractLucenePlugin

public AbstractLucenePlugin()
Method Detail

init

public final magoffin.matt.lucene.LucenePlugin.LuceneIndexConfig init(magoffin.matt.lucene.LuceneService luceneService,
                                                                      java.util.Set<magoffin.matt.lucene.IndexListener> indexEventListenersSet)
Specified by:
init in interface magoffin.matt.lucene.LucenePlugin

doAfterInit

protected void doAfterInit()
Method for extending classes to override if needed, called during the init(LuceneService, Set) method.

This method implementation does not do anything.

See Also:
init(LuceneService, Set)

getIndexErrorMessage

protected java.lang.String getIndexErrorMessage(java.util.List<java.lang.Object> indexErrors)
Get a single index error message from a list of index errors.

Parameters:
indexErrors - list of errors
Returns:
single index error message

getSingleIndexErrorMessage

protected java.lang.String getSingleIndexErrorMessage(java.lang.Object object)
Get an individual index error message.

Parameters:
object - the error message or exception
Returns:
error message string

find

public magoffin.matt.lucene.SearchResults find(magoffin.matt.lucene.SearchCriteria criteria)
Specified by:
find in interface magoffin.matt.lucene.LucenePlugin

getLucene

protected magoffin.matt.lucene.LuceneService getLucene()
Get the LuceneService configured for this plugin.

Returns:
the LuceneService instance

getIndexEventListeners

protected java.util.Set<magoffin.matt.lucene.IndexListener> getIndexEventListeners()
Get the list of IndexLister objects.

Returns:
Returns the indexEventListeners.

getInfoReindexCount

public int getInfoReindexCount()
Returns:
the infoReindexCount

setInfoReindexCount

public void setInfoReindexCount(int infoReindexCount)
Parameters:
infoReindexCount - the infoReindexCount to set

getAnalyzer

public org.apache.lucene.analysis.Analyzer getAnalyzer()
Specified by:
getAnalyzer in interface magoffin.matt.lucene.LucenePlugin

getConfig

public magoffin.matt.lucene.LucenePlugin.LuceneIndexConfig getConfig()
Returns:
the config

setConfig

public void setConfig(magoffin.matt.lucene.LucenePlugin.LuceneIndexConfig config)
Parameters:
config - the config to set

setAnalyzer

public void setAnalyzer(org.apache.lucene.analysis.Analyzer analyzer)
Parameters:
analyzer - the analyzer to set

getMessages

public org.springframework.context.MessageSource getMessages()
Returns:
the messages

setMessages

public void setMessages(org.springframework.context.MessageSource messages)
Parameters:
messages - the messages to set

getDomainObjectFactory

public DomainObjectFactory getDomainObjectFactory()
Returns:
Returns the domainObjectFactory.

setDomainObjectFactory

public void setDomainObjectFactory(DomainObjectFactory domainObjectFactory)
Parameters:
domainObjectFactory - The domainObjectFactory to set.

getIndexType

public java.lang.String getIndexType()
Specified by:
getIndexType in interface magoffin.matt.lucene.LucenePlugin

setIndexType

public void setIndexType(java.lang.String indexType)
Parameters:
indexType - the indexType to set