Package org.dlese.dpc.index.writer
Class ErrorFileIndexingWriter
java.lang.Object
org.dlese.dpc.index.writer.FileIndexingServiceWriter
org.dlese.dpc.index.writer.ErrorFileIndexingWriter
- All Implemented Interfaces:
DocWriter
Writes a Lucene
Document that represents an error that has occured in
in indexing a File. This writer is used by FileIndexingService. The FileIndexingServiceWriter may throw a ErrorDocException, which can be
used to specific specific fields to index with the exception.
The Lucene Document fields that are created by this class are (in
addition the the ones listed for FileIndexingServiceWriter) all fields
specified in the ErrorDocException are stored plus:
error - Set to 'true' for all documents indexed by this writer. Not stored.
errormsg - The description of the error, for display. Stored.
errordoctype - The type of error thrown as specified by ErrorDocException.
Defaults to 'generic'. Stored.
exception - The name of the Java exception that was thrown. Stored.
- Author:
- John Weatherley
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionErrorFileIndexingWriter(Throwable exception) Constructor for the ErrorFileIndexingWriter object -
Method Summary
Modifier and TypeMethodDescriptionprotected final voidaddCustomFields(org.apache.lucene.document.Document newDoc, org.apache.lucene.document.Document existingDoc, File sourceFile) Adds the error message to the Lucene document.protected voiddestroy()Does nothing.Gets the specifier associated with this group of files or null if no group association exists.Gets the docType, which is 'errordoc.'Gets the name of the concreteDocReaderclass that is used to read this type ofDocument, which is "ErrorDocReader".voidDoes nothing.Methods inherited from class org.dlese.dpc.index.writer.FileIndexingServiceWriter
abortIndexing, addDocToRemove, addToAdminDefaultField, addToDefaultField, create, getConfigAttributes, getDeletedDoc, getDocsource, getFileContent, getFileIndexingPlugin, getFileIndexingService, getLuceneDoc, getPreviousRecordDoc, getSessionAttributes, getSourceDir, getSourceFile, getValidationReport, isMakingDeletedDoc, isValidationEnabled, prtln, prtlnErr, setConfigAttributes, setDebug, setFileIndexingPlugin, setFileIndexingService, setIsMakingDeletedDoc, setValidationEnabled
-
Constructor Details
-
ErrorFileIndexingWriter
Constructor for the ErrorFileIndexingWriter object- Parameters:
exception- The exception that was thrown when the error occured.
-
-
Method Details
-
getDocType
Gets the docType, which is 'errordoc.'- Specified by:
getDocTypein interfaceDocWriter- Specified by:
getDocTypein classFileIndexingServiceWriter- Returns:
- Returns 'errordoc.'
- Throws:
Exception- If error.
-
getDocGroup
Gets the specifier associated with this group of files or null if no group association exists.- Specified by:
getDocGroupin classFileIndexingServiceWriter- Returns:
- The docGroup specifier
-
getReaderClass
Gets the name of the concreteDocReaderclass that is used to read this type ofDocument, which is "ErrorDocReader".- Specified by:
getReaderClassin interfaceDocWriter- Specified by:
getReaderClassin classFileIndexingServiceWriter- Returns:
- The STring "ErrorDocReader".
-
addCustomFields
protected final void addCustomFields(org.apache.lucene.document.Document newDoc, org.apache.lucene.document.Document existingDoc, File sourceFile) throws Exception Adds the error message to the Lucene document.- Specified by:
addCustomFieldsin classFileIndexingServiceWriter- Parameters:
newDoc- The new Document that is being created for this resourceexistingDoc- An existing Document that currently resides in the index for the given resource, or null if none was previously presentsourceFile- The sourceFile that is being indexed.- Throws:
Exception- If an error occurs
-
init
Does nothing.- Specified by:
initin classFileIndexingServiceWriter- Parameters:
source- The source file being indexedexistingDoc- 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.
-
destroy
protected void destroy()Does nothing.- Specified by:
destroyin classFileIndexingServiceWriter
-