net.sf.eos.lucene
Class LuceneDocumentCreator

java.lang.Object
  extended by net.sf.eos.config.Configured
      extended by net.sf.eos.lucene.LuceneDocumentCreator
All Implemented Interfaces:
Configurable
Direct Known Subclasses:
DefaultLuceneDocumentCreator

public abstract class LuceneDocumentCreator
extends Configured

To support different strategies of Lucene document creation this factory decoupled the creation of the document creator from hard coded classnames. Set the classname of a factory different from default implementation. DOCUMENT_CREATOR_IMPL_CONFIG_NAME contains the name of the configuration key.

Implementations must have a default constructor and must implement createLuceneForEosDocument(EosDocument).

Author:
Sascha Kohlmann

Field Summary
static String DOCUMENT_CREATOR_IMPL_CONFIG_NAME
          The configuration key name for the classname of the creator.
 
Constructor Summary
LuceneDocumentCreator()
           
 
Method Summary
abstract  org.apache.lucene.document.Document createLuceneForEosDocument(EosDocument doc)
          Creates a Lucene Document for a given EosDocument.
static LuceneDocumentCreator newInstance(Configuration config)
          Creates a new instance of a of the creator.
 
Methods inherited from class net.sf.eos.config.Configured
configure, getConfiguration
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DOCUMENT_CREATOR_IMPL_CONFIG_NAME

@ConfigurationKey(type=CLASSNAME,
                  description="Configuration key of the Lucene document  creator.")
public static final String DOCUMENT_CREATOR_IMPL_CONFIG_NAME
The configuration key name for the classname of the creator.

See Also:
newInstance(Configuration), Constant Field Values
Constructor Detail

LuceneDocumentCreator

public LuceneDocumentCreator()
Method Detail

newInstance

@FactoryMethod(key="net.sf.eos.lucene.LuceneDocumentCreator.impl",
               implementation=DefaultLuceneDocumentCreator.class)
public static final LuceneDocumentCreator newInstance(Configuration config)
                                               throws EosException
Creates a new instance of a of the creator. If the Configuration contains a key DOCUMENT_CREATOR_IMPL_CONFIG_NAME a new instance of the classname in the value will instantiate. The DefaultLuceneDocumentCreator will instantiate if there is no value setted.

Parameters:
config - the configuration
Returns:
a new instance
Throws:
EosException - if it is not possible to instantiate an instance

createLuceneForEosDocument

public abstract org.apache.lucene.document.Document createLuceneForEosDocument(EosDocument doc)
                                                                        throws EosException
Creates a Lucene Document for a given EosDocument.

Parameters:
doc - the document to transform
Returns:
a Lucene Document for indexing
Throws:
EosException - if transformation fails


Copyright © 2008. All Rights Reserved.