fr.gouv.culture.sdx.search.lucene.analysis
Class AnalyzerManager

java.lang.Object
  extended by fr.gouv.culture.sdx.utils.AbstractSdxObject
      extended by fr.gouv.culture.sdx.search.lucene.analysis.AnalyzerManager
All Implemented Interfaces:
Describable, Encodable, Identifiable, Localizable, SdxObject, org.apache.avalon.framework.configuration.Configurable, org.apache.avalon.framework.context.Contextualizable, org.apache.avalon.framework.logger.LogEnabled, org.apache.avalon.framework.service.Serviceable, org.apache.excalibur.xml.sax.XMLizable

public class AnalyzerManager
extends AbstractSdxObject

Utility class for managing Lucene analyzers in a multilingual context.

Lucene analyzers are used for indexing and querying a Lucene index. An analyzer is specific to a language, so in a multilingual context we need a way to manage analyzers.

Most SDX applications will share the same analyzers for popular languages and contexts. In order to reuse resources, we will create only one AnalyzerManager and attach it to the framework.

Analyzers used within this manager will each have a unique key. This key will be a combination of the locale and the configuration file used.


Nested Class Summary
 
Nested classes/interfaces inherited from interface fr.gouv.culture.sdx.utils.SdxObject
SdxObject.ConfigurationNode
 
Field Summary
static java.lang.String CLASS_NAME_SUFFIX
           
 
Fields inherited from class fr.gouv.culture.sdx.utils.AbstractSdxObject
_configuration, _context, _description, _encoding, _id, _locale, _logger, _manager, _xmlizable_objects, _xmlLang, isToSaxInitialized
 
Fields inherited from interface fr.gouv.culture.sdx.utils.Encodable
DEFAULT_ENCODING
 
Constructor Summary
AnalyzerManager()
          Builds a manager.
 
Method Summary
 void configure(org.apache.avalon.framework.configuration.Configuration configuration)
          Configures the manager.
 Analyzer getAnalyzer(java.util.Locale locale, java.io.File configurationFile)
          Adds an analyzer given a locale and a configuration file.
 Analyzer getAnalyzer(java.lang.String className, java.io.File configurationFile)
          Adds an analyzer using a specific class name and a configuration file.
protected  java.lang.String getClassNameSuffix()
          Sub classes should element this method to return their class name suffix for SAX output
protected  boolean initToSax()
          Init the LinkedHashMap _xmlizable_objects with the objects in order to describ them in XML
protected  void initVolatileObjectsToSax()
          Init the LinkedHashMap _xmlizable_volatile_objects with the objects in order to describ them in XML Some objects need to be refresh each time a toSAX is called
 
Methods inherited from class fr.gouv.culture.sdx.utils.AbstractSdxObject
configureDescription, contextualize, enableLogging, getBaseAttributes, getConfiguration, getContext, getDescription, getEncoding, getId, getLocale, getLog, getServiceManager, getXmlLang, service, setDescription, setEncoding, setId, setLocale, setUpSdxObject, setUpSdxObject, setXmlLang, toSAX, verifyConfigurationResources
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_NAME_SUFFIX

public static final java.lang.String CLASS_NAME_SUFFIX
See Also:
Constant Field Values
Constructor Detail

AnalyzerManager

public AnalyzerManager()
Builds a manager.

Only one manager is needed for a running SDX installation. It is created and managed by the SDX framework.

Method Detail

configure

public void configure(org.apache.avalon.framework.configuration.Configuration configuration)
               throws org.apache.avalon.framework.configuration.ConfigurationException
Configures the manager.

For now, no specific configuration is needed.

Specified by:
configure in interface org.apache.avalon.framework.configuration.Configurable
Overrides:
configure in class AbstractSdxObject
Throws:
org.apache.avalon.framework.configuration.ConfigurationException

getAnalyzer

public Analyzer getAnalyzer(java.util.Locale locale,
                            java.io.File configurationFile)
                     throws SDXException
Adds an analyzer given a locale and a configuration file.

Parameters:
locale - The givene locale, cannot be null
configurationFile - An XML file for configuring the analyzer (may be null)
Throws:
SDXException

getAnalyzer

public Analyzer getAnalyzer(java.lang.String className,
                            java.io.File configurationFile)
                     throws SDXException
Adds an analyzer using a specific class name and a configuration file.

Parameters:
className - The name of the class to use.
configurationFile - The configuration file for the analyzer (may be null)
Throws:
SDXException

getClassNameSuffix

protected java.lang.String getClassNameSuffix()
Description copied from class: AbstractSdxObject
Sub classes should element this method to return their class name suffix for SAX output

Specified by:
getClassNameSuffix in class AbstractSdxObject

initToSax

protected boolean initToSax()
Description copied from class: AbstractSdxObject
Init the LinkedHashMap _xmlizable_objects with the objects in order to describ them in XML

Specified by:
initToSax in class AbstractSdxObject

initVolatileObjectsToSax

protected void initVolatileObjectsToSax()
Init the LinkedHashMap _xmlizable_volatile_objects with the objects in order to describ them in XML Some objects need to be refresh each time a toSAX is called

Specified by:
initVolatileObjectsToSax in class AbstractSdxObject


Copyright © 2000-2010 Ministere de la culture et de la communication / AJLSM. All Rights Reserved.