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

java.lang.Object
  extended byfr.gouv.culture.sdx.search.lucene.analysis.AnalyzerManager
All Implemented Interfaces:
org.apache.avalon.framework.component.Composable, org.apache.avalon.framework.configuration.Configurable, org.apache.avalon.framework.logger.LogEnabled

public class AnalyzerManager
extends java.lang.Object
implements org.apache.avalon.framework.component.Composable, org.apache.avalon.framework.logger.LogEnabled, org.apache.avalon.framework.configuration.Configurable

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.


Constructor Summary
AnalyzerManager()
          Builds a manager.
 
Method Summary
 void compose(org.apache.avalon.framework.component.ComponentManager manager)
          Sets the pipeline's ComponentManager.
 void configure(org.apache.avalon.framework.configuration.Configuration configuration)
          Configures the manager.
 void enableLogging(org.apache.avalon.framework.logger.Logger logger)
          Sets the logger.
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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

enableLogging

public void enableLogging(org.apache.avalon.framework.logger.Logger logger)
Sets the logger.

Specified by:
enableLogging in interface org.apache.avalon.framework.logger.LogEnabled
Parameters:
logger - The logger to use.

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
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

compose

public void compose(org.apache.avalon.framework.component.ComponentManager manager)
             throws org.apache.avalon.framework.component.ComponentException
Sets the pipeline's ComponentManager.

Specified by:
compose in interface org.apache.avalon.framework.component.Composable
Parameters:
manager - The ComponentManager to use.
Throws:
org.apache.avalon.framework.component.ComponentException


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