uk.org.ogsadai.activity.indexedfiles
Class FlatFileIndexWriter

java.lang.Object
  |
  +--uk.org.ogsadai.activity.indexedfiles.FlatFileIndexWriter
Direct Known Subclasses:
OMIMIndexWriter, SwissProtIndexWriter

public abstract class FlatFileIndexWriter
extends java.lang.Object

Implemented by classes that index flat files.

Author:
The OGSA-DAI Project Team.

Field Summary
private static java.lang.String COPYRIGHT_NOTICE
          Copyright statement
static java.lang.String DATA_FILE_NAME
          Internal index field containing the name and location of a data file.
static java.lang.String DATA_LENGTH
          Internal index field for storing the length of a record within a data file.
static java.lang.String DATA_OFFSET
          Internal index field for storing the offset of a record within a data file.
protected  org.apache.lucene.index.IndexWriter mIndexWriter
          Lucene index writer
 
Constructor Summary
FlatFileIndexWriter(org.apache.lucene.index.IndexWriter indexWriter)
          Constructor.
 
Method Summary
abstract  java.lang.String[] getFields()
          Gets the indexed fields.
 org.apache.lucene.index.IndexWriter getIndexWriter()
          Gets the index writer.
abstract  void indexFiles(java.io.File[] files, java.lang.String[] relativeDirectories)
          Indexes an array of flat files.
abstract  void setFields(java.lang.String[] fields)
          Sets the fields for indexing
 void setIndexWriter(org.apache.lucene.index.IndexWriter indexwriter)
          Sets the index writer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COPYRIGHT_NOTICE

private static final java.lang.String COPYRIGHT_NOTICE
Copyright statement

See Also:
Constant Field Values

DATA_FILE_NAME

public static final java.lang.String DATA_FILE_NAME
Internal index field containing the name and location of a data file.

See Also:
Constant Field Values

DATA_OFFSET

public static final java.lang.String DATA_OFFSET
Internal index field for storing the offset of a record within a data file.

See Also:
Constant Field Values

DATA_LENGTH

public static final java.lang.String DATA_LENGTH
Internal index field for storing the length of a record within a data file.

See Also:
Constant Field Values

mIndexWriter

protected org.apache.lucene.index.IndexWriter mIndexWriter
Lucene index writer

Constructor Detail

FlatFileIndexWriter

public FlatFileIndexWriter(org.apache.lucene.index.IndexWriter indexWriter)
Constructor.

Parameters:
indexWriter - org.apache.lucene.index.IndexWriter which is open and ready for writing.
Method Detail

indexFiles

public abstract void indexFiles(java.io.File[] files,
                                java.lang.String[] relativeDirectories)
                         throws java.io.FileNotFoundException,
                                java.io.IOException
Indexes an array of flat files.

Parameters:
files - An array of flat files to be indexed
relativeDirectories - Directories containing the files such that files[i] is located in relativeDirectories[i].
Throws:
java.io.FileNotFoundException - If any file is not found.
java.io.IOException - If there is a problem encountered when indexing a file.

getFields

public abstract java.lang.String[] getFields()
Gets the indexed fields.

Returns:
names of the fields for indexing

setFields

public abstract void setFields(java.lang.String[] fields)
Sets the fields for indexing

Parameters:
fields - The fields that are being indexed.

getIndexWriter

public org.apache.lucene.index.IndexWriter getIndexWriter()
Gets the index writer.

Returns:
the IndexWriter

setIndexWriter

public void setIndexWriter(org.apache.lucene.index.IndexWriter indexwriter)
Sets the index writer.

Parameters:
indexwriter - The IndexWriter to be used for indexing.