degu.index.ejb
Class DocumentIndexerLucene

java.lang.Object
  extended by degu.index.ejb.DocumentIndexerLucene

public class DocumentIndexerLucene
extends java.lang.Object

Frontend for the lucene document index implemented as a singleton. Write access to the document index is supposed to take place only through this class, that ensures that only one single lucene IndexWriter is used.


Field Summary
private static java.lang.String DEFAULT_DOC_STORAGE
           
private static java.lang.String DEFAULT_INDEX_DIR_STR
           
private static java.io.File DOC_STORAGE_DIR
           
private static java.io.File INDEX_DIR
           
private static LuceneIndexDescriptor indexDescriptor
           
private static org.apache.lucene.index.IndexWriter indexWriter
           
private static DocumentIndexerLucene instance
           
private static org.apache.log4j.Logger logger
           
 
Constructor Summary
protected DocumentIndexerLucene()
           
 
Method Summary
 LuceneIndexDescriptor getIndexDescriptor()
           
static DocumentIndexerLucene getInstance()
          Returns singleton instance.
 void index(DeguDocument deguDocument)
          Adds a document represented as a string and a decriptor to the document index
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

instance

private static DocumentIndexerLucene instance

DEFAULT_INDEX_DIR_STR

private static final java.lang.String DEFAULT_INDEX_DIR_STR
See Also:
Constant Field Values

DEFAULT_DOC_STORAGE

private static final java.lang.String DEFAULT_DOC_STORAGE
See Also:
Constant Field Values

INDEX_DIR

private static java.io.File INDEX_DIR

DOC_STORAGE_DIR

private static java.io.File DOC_STORAGE_DIR

indexWriter

private static org.apache.lucene.index.IndexWriter indexWriter

indexDescriptor

private static LuceneIndexDescriptor indexDescriptor

logger

private static org.apache.log4j.Logger logger
Constructor Detail

DocumentIndexerLucene

protected DocumentIndexerLucene()
Method Detail

getInstance

public static DocumentIndexerLucene getInstance()
                                         throws java.io.IOException
Returns singleton instance. If there is no index INDEX_DIR a new one is created.

Returns:
Throws:
java.io.IOException

index

public void index(DeguDocument deguDocument)
           throws java.io.IOException,
                  BadDeguDocumentDescriptor,
                  DocumentIsAlreadyIndexedException,
                  DeguDocumentCorrupted
Adds a document represented as a string and a decriptor to the document index

Parameters:
rawText - text to index of a document
descriptor - metainformation about the document
Throws:
java.io.IOException
BadDeguDocumentDescriptor
DocumentIsAlreadyIndexedException
DeguDocumentCorrupted

getIndexDescriptor

public LuceneIndexDescriptor getIndexDescriptor()