DLESE Tools
v1.6.0

org.dlese.dpc.index.writer
Class NCSCollectionFileIndexingWriter

java.lang.Object
  extended by org.dlese.dpc.index.writer.FileIndexingServiceWriter
      extended by org.dlese.dpc.index.writer.XMLFileIndexingWriter
          extended by org.dlese.dpc.index.writer.NCSCollectionFileIndexingWriter
All Implemented Interfaces:
DocWriter

public class NCSCollectionFileIndexingWriter
extends XMLFileIndexingWriter

Used to write a Lucene Document for a NCS Collection XML record.

Author:
John Weatherley
See Also:
XMLDocReader, RecordDataService, FileIndexingServiceWriter

Constructor Summary
NCSCollectionFileIndexingWriter()
          Create a NCSCollectionFileIndexingWriter.
 
Method Summary
protected  String[] _getIds()
          Gets the ID of this collection record.
protected  void addFields(org.apache.lucene.document.Document newDoc, org.apache.lucene.document.Document existingDoc, File sourceFile)
          Adds fields to the index that are part of the collection-level Document.
protected  void destroy()
          This method is called at the conclusion of processing and may be used for tear-down.
 String getDescription()
          The description for the collection.
 String getDocType()
          Gets the docType attribute of the NCSCollectionFileIndexingWriter, which is 'ncs_collect.'
 String getReaderClass()
          Gets the name of the concrete DocReader class that is used to read this type of Document, which is "XMLDocReader".
 String getTitle()
          Returns the title for the collection.
 String[] getUrls()
          Gets the URL to the collection.
protected  String getValidationReport()
          Gets a report detailing any errors found in the XML validation of the collection record, or null if no error was found.
protected  Date getWhatsNewDate()
          Returns the date used to determine "What's new" in the library.
protected  String getWhatsNewType()
          Returns 'collection'.
 boolean indexFullContentInDefaultAndStems()
          Place the entire XML content into the default and stems search field.
 void init(File source, org.apache.lucene.document.Document existingDoc)
          Nothing needed
 
Methods inherited from class org.dlese.dpc.index.writer.XMLFileIndexingWriter
addCustomFields, getBoundingBox, getCollections, getDeletedDoc, getDocGroup, getDom4jDoc, getFieldContent, getFieldContent, getFieldName, getIds, getIndex, getMyAnnoResultDocs, getMyCollectionDoc, getOaiModtime, getPrimaryId, getRecordDataService, getRelatedIds, getRelatedIdsMap, getRelatedUrls, getRelatedUrlsMap, getTermStringFromStringArray, getXmlIndexer, getXmlIndexerFieldsConfig
 
Methods inherited from class org.dlese.dpc.index.writer.FileIndexingServiceWriter
abortIndexing, addDocToRemove, addToAdminDefaultField, addToDefaultField, create, getConfigAttributes, getDocsource, getFileContent, getFileIndexingPlugin, getFileIndexingService, getLuceneDoc, getPreviousRecordDoc, getSessionAttributes, getSourceDir, getSourceFile, isMakingDeletedDoc, isValidationEnabled, prtln, prtlnErr, setConfigAttributes, setDebug, setFileIndexingPlugin, setFileIndexingService, setIsMakingDeletedDoc, setValidationEnabled
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NCSCollectionFileIndexingWriter

public NCSCollectionFileIndexingWriter()
Create a NCSCollectionFileIndexingWriter.

Method Detail

getTitle

public String getTitle()
                throws Exception
Returns the title for the collection.

Specified by:
getTitle in class XMLFileIndexingWriter
Returns:
The title value
Throws:
Exception - If error reading XML.

getDescription

public String getDescription()
                      throws Exception
The description for the collection.

Specified by:
getDescription in class XMLFileIndexingWriter
Returns:
The description String
Throws:
Exception - If error reading XML.

getUrls

public String[] getUrls()
                 throws Exception
Gets the URL to the collection.

Specified by:
getUrls in class XMLFileIndexingWriter
Returns:
The collectionUrl value
Throws:
Exception - If error

_getIds

protected String[] _getIds()
                    throws Exception
Gets the ID of this collection record.

Specified by:
_getIds in class XMLFileIndexingWriter
Returns:
The ID
Throws:
Exception - If error

getDocType

public String getDocType()
Gets the docType attribute of the NCSCollectionFileIndexingWriter, which is 'ncs_collect.'

Specified by:
getDocType in interface DocWriter
Specified by:
getDocType in class FileIndexingServiceWriter
Returns:
The docType, which is 'ncs_collect.'

getReaderClass

public String getReaderClass()
Gets the name of the concrete DocReader class that is used to read this type of Document, which is "XMLDocReader".

Specified by:
getReaderClass in interface DocWriter
Specified by:
getReaderClass in class FileIndexingServiceWriter
Returns:
The String "org.dlese.dpc.index.reader.XMLDocReader".

getWhatsNewDate

protected Date getWhatsNewDate()
                        throws Exception
Returns the date used to determine "What's new" in the library. Just returns the file mod date.

Specified by:
getWhatsNewDate in class XMLFileIndexingWriter
Returns:
The what's new date for the item
Throws:
Exception - This method should throw and Exception with appropriate error message if an error occurs.

getWhatsNewType

protected String getWhatsNewType()
Returns 'collection'.

Specified by:
getWhatsNewType in class XMLFileIndexingWriter
Returns:
The string 'collection'.

init

public void init(File source,
                 org.apache.lucene.document.Document existingDoc)
          throws Exception
Nothing needed

Specified by:
init in class XMLFileIndexingWriter
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.

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

getValidationReport

protected String getValidationReport()
                              throws Exception
Gets a report detailing any errors found in the XML validation of the collection record, 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.

indexFullContentInDefaultAndStems

public boolean indexFullContentInDefaultAndStems()
Place the entire XML content into the default and stems search field.

Specified by:
indexFullContentInDefaultAndStems in class XMLFileIndexingWriter
Returns:
True

addFields

protected final void addFields(org.apache.lucene.document.Document newDoc,
                               org.apache.lucene.document.Document existingDoc,
                               File sourceFile)
                        throws Exception
Adds fields to the index that are part of the collection-level Document.

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 - If an error occurs

DLESE Tools
v1.6.0