DLESE Tools
v1.6.0

org.dlese.dpc.index.writer
Class DleseAnnoFileIndexingServiceWriter

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.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

Constructor Summary
DleseAnnoFileIndexingServiceWriter()
          Create a DleseAnnoFileIndexingServiceWriter
 
Method Summary
protected  String[] _getIds()
          Gets the id of this annotation
protected  void addFields(org.apache.lucene.document.Document newDoc, org.apache.lucene.document.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.
protected  void finalize()
          Perform finalization...
 String getDescription()
          Return a description for the document being indexed, or null if none applies.
 String getDocType()
          Gets the docType attribute of the DleseAnnoFileIndexingServiceWriter object
static long getNumInstances()
          Gets the numInstances attribute of the DleseAnnoFileIndexingServiceWriter class
 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".
 String getTitle()
          Return a title for the document being indexed, or null if none applies.
 String[] getUrls()
          Return the URL(s) to the resource being indexed, or null if none apply.
protected  String getValidationReport()
          Gets a report detailing any errors found in the validation of the data, or null if no error was found.
protected  Date getWhatsNewDate()
          Returns the the first available of item/statusOf@date, service/date@modified or service/date@created.
protected  String getWhatsNewType()
          Returns 'annocomplete,' 'annoinprogress,' 'drcannocomplete,' or 'drcannoinprogress'.
 boolean indexFullContentInDefaultAndStems()
          Default and stems fields handled here, so do not index full content.
 void init(File source, org.apache.lucene.document.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, 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, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DleseAnnoFileIndexingServiceWriter

public DleseAnnoFileIndexingServiceWriter()
Create a DleseAnnoFileIndexingServiceWriter

Method Detail

finalize

protected void finalize()
                 throws Throwable
Perform finalization... closing resources, etc.

Overrides:
finalize in class Object
Throws:
Throwable - If error

getNumInstances

public static long getNumInstances()
Gets the numInstances attribute of the DleseAnnoFileIndexingServiceWriter class

Returns:
The numInstances value

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 String "org.dlese.dpc.index.reader.DleseAnnoDocReader"

init

public void init(File source,
                 org.apache.lucene.document.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 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.

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

_getIds

protected String[] _getIds()
Gets the id of this annotation

Specified by:
_getIds in class XMLFileIndexingWriter
Returns:
The id value

getUrls

public String[] getUrls()
Description copied from class: XMLFileIndexingWriter
Return the URL(s) to the resource being indexed, or null if none apply. If more than one URL references the resource, the first one is the primary. The URL Strings are tokenized and indexed under the field key 'uri' and is also indexed in the 'default' field. It is also stored in the index untokenized under the field key 'url.'

Specified by:
getUrls in class XMLFileIndexingWriter
Returns:
The url String(s)

getTitle

public String getTitle()
                throws Exception
Description copied from class: XMLFileIndexingWriter
Return a title for the document being indexed, or null if none applies. The String is tokenized, stored and indexed under the field key 'title' and is also indexed in the 'default' field.

Specified by:
getTitle in class XMLFileIndexingWriter
Returns:
The title String
Throws:
Exception - This method should throw and Exception with appropriate error message if an error occurs.

getDescription

public String getDescription()
                      throws Exception
Description copied from class: XMLFileIndexingWriter
Return a description for the document being indexed, or null if none applies. The String is tokenized, stored and indexed under the field key 'description' and is also indexed in the 'default' field.

Specified by:
getDescription in class XMLFileIndexingWriter
Returns:
The description String
Throws:
Exception - This method should throw and Exception with appropriate error message if an error occurs.

getWhatsNewDate

protected Date getWhatsNewDate()
                        throws Exception
Returns the the first available of item/statusOf@date, service/date@modified or service/date@created. Note that the statusOf@date was deprecated as of anno framework v1.0.

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

getWhatsNewType

protected String getWhatsNewType()
                          throws Exception
Returns 'annocomplete,' 'annoinprogress,' 'drcannocomplete,' or 'drcannoinprogress'.

Specified by:
getWhatsNewType in class XMLFileIndexingWriter
Returns:
The string 'annocomplete,' 'annoinprogress,' 'drcannocomplete,' or 'drcannoinprogress'.
Throws:
Exception - If error

indexFullContentInDefaultAndStems

public boolean indexFullContentInDefaultAndStems()
Default and stems fields handled here, so do not index full content.

Specified by:
indexFullContentInDefaultAndStems in class XMLFileIndexingWriter
Returns:
False

addFields

protected void addFields(org.apache.lucene.document.Document newDoc,
                         org.apache.lucene.document.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.6.0