DLESE Tools
v1.2

org.dlese.dpc.index.writer
Class DleseAnnoFileIndexingServiceWriter

java.lang.Object
  extended byorg.dlese.dpc.index.writer.FileIndexingServiceWriter
      extended byorg.dlese.dpc.index.writer.XMLFileIndexingWriter
          extended byorg.dlese.dpc.index.writer.DleseAnnoFileIndexingServiceWriter
All Implemented Interfaces:
DocWriter

public class DleseAnnoFileIndexingServiceWriter
extends XMLFileIndexingWriter

Creates a Lucene Documents for a DLESE annotation record.

The Lucene fields that are created by this class are:

Author:
John Weatherley
See Also:
DleseAnnoDocReader

Field Summary
 
Fields inherited from class org.dlese.dpc.index.writer.XMLFileIndexingWriter
recordDataService, vocab
 
Constructor Summary
DleseAnnoFileIndexingServiceWriter(String collection, RecordDataService recordDataService)
          Create a DleseAnnoFileIndexingServiceWriter that indexes the given collection in field collection.
 
Method Summary
protected  void addFields(Document newDoc, Document existingDoc, File sourceFile)
          Adds additional custom fields that are unique to the dlese anno document format being indexed.
protected  void destroy()
          This method is called at the conclusion of processing and may be used for tear-down.
 String getCollection()
          Returns unique collection keys for the item being indexed, separated by spaces.
 String getDocType()
          Gets the docType attribute of the DleseAnnoFileIndexingServiceWriter object
 String getId()
          Returns unique IDs for the item being indexed, one for each collection that catalog the resource, separted by spaces.
 String getReaderClass()
          Gets the fully qualified name of the concrete DocReader class that is used to read this type of Document, for example "org.dlese.dpc.index.reader.ItemDocReader".
protected  String getValidationReport()
          Gets a report detailing any errors found in the validation of the data, or null if no error was found.
 void init(File source, Document existingDoc)
          This method is called prior to processing and may be used to for any necessary set-up.
 
Methods inherited from class org.dlese.dpc.index.writer.XMLFileIndexingWriter
addCustomFields, getFieldContent, getFieldContent, getFieldName, getOaiModtime
 
Methods inherited from class org.dlese.dpc.index.writer.FileIndexingServiceWriter
abortIndexing, addToAdminDefaultField, addToDefaultField, create, getDeletedDoc, getExistingDoc, getFileIndexingService, getSourceDir, getSourceFile, isValidationEnabled, prtln, prtlnErr, setDebug, setDefaultFieldName, setFileIndexingService, setValidationEnabled
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DleseAnnoFileIndexingServiceWriter

public DleseAnnoFileIndexingServiceWriter(String collection,
                                          RecordDataService recordDataService)
Create a DleseAnnoFileIndexingServiceWriter that indexes the given collection in field collection.

Parameters:
collection - A name for the collection
Method Detail

getCollection

public String getCollection()
Description copied from class: XMLFileIndexingWriter
Returns unique collection keys for the item being indexed, separated by spaces. For example 'dcc,' 'comet' or 'dwel'.

Specified by:
getCollection in class XMLFileIndexingWriter
Returns:
The collection keys

getDocType

public String getDocType()
                  throws Exception
Gets the docType attribute of the DleseAnnoFileIndexingServiceWriter object

Specified by:
getDocType in interface DocWriter
Specified by:
getDocType in class FileIndexingServiceWriter
Returns:
The docType value
Throws:
Exception - if error

getReaderClass

public String getReaderClass()
Gets the fully qualified name of the concrete DocReader class that is used to read this type of Document, for example "org.dlese.dpc.index.reader.ItemDocReader".

Specified by:
getReaderClass in interface DocWriter
Specified by:
getReaderClass in class FileIndexingServiceWriter
Returns:
The name of the DocReader.

init

public void init(File source,
                 Document existingDoc)
          throws Exception
This method is called prior to processing and may be used to for any necessary set-up. This method should throw and exception with appropriate message if an error occurs.

Specified by:
init in class FileIndexingServiceWriter
Parameters:
source - The source file being indexed
existingDoc - An existing Document that currently resides in the index for the given resource, or null if none was previously present
Throws:
Exception - If an error occured during set-up.

getValidationReport

protected String getValidationReport()
                              throws Exception
Gets a report detailing any errors found in the validation of the data, or null if no error was found.

Overrides:
getValidationReport in class FileIndexingServiceWriter
Returns:
Null if no data validation errors were found, otherwise a String that details the nature of the error.
Throws:
Exception - If error in performing the validation.

destroy

protected void destroy()
This method is called at the conclusion of processing and may be used for tear-down.

Specified by:
destroy in class FileIndexingServiceWriter

getId

public String getId()
Description copied from class: XMLFileIndexingWriter
Returns unique IDs for the item being indexed, one for each collection that catalog the resource, separted by spaces. For example "DLESE-000-000-000-001." The String is not tokenized and is stored and indexed under the field key 'id.'

Specified by:
getId in class XMLFileIndexingWriter
Returns:
The id String

addFields

protected void addFields(Document newDoc,
                         Document existingDoc,
                         File sourceFile)
                  throws Exception
Adds additional custom fields that are unique to the dlese anno document format being indexed.

Specified by:
addFields in class XMLFileIndexingWriter
Parameters:
newDoc - The new Document that is being created for this resource
existingDoc - An existing Document that currently resides in the index for the given resource, or null if none was previously present
sourceFile - The sourceFile that is being indexed
Throws:
Exception - This method should throw and Exception with appropriate error message if an error occurs.

DLESE Tools
v1.2