public abstract class AbstractDocumentChecksummer extends Object implements IDocumentChecksummer, IXMLConfigurable
IDocumentChecksummer
giving the option
to keep the generated checksum in a metadata field.
The checksum can be stored
in a target field name specified. If no target field name is specified,
it stores it under the
metadata field name CollectorMetadata.COLLECTOR_CHECKSUM_DOC
.
<documentChecksummer class="(subclass)" keep="[false|true]" targetField="(optional metadata field to store the checksum)" />
targetField
is ignored unless the keep
attribute is set to true
.Constructor and Description |
---|
AbstractDocumentChecksummer() |
Modifier and Type | Method and Description |
---|---|
String |
createDocumentChecksum(ImporterDocument document)
Creates a document checksum.
|
protected abstract String |
doCreateDocumentChecksum(ImporterDocument document) |
boolean |
equals(Object other) |
String |
getTargetField()
Gets the metadata field to use to store the checksum value.
|
int |
hashCode() |
boolean |
isKeep()
Whether to keep the document checksum value as a new field in the
document metadata.
|
protected abstract void |
loadChecksummerFromXML(XMLConfiguration xml) |
void |
loadFromXML(Reader in) |
protected abstract void |
saveChecksummerToXML(EnhancedXMLStreamWriter writer) |
void |
saveToXML(Writer out) |
void |
setKeep(boolean keep)
Sets whether to keep the document checksum value as a new field in the
document metadata.
|
void |
setTargetField(String targetField)
Sets the metadata field name to use to store the checksum value.
|
String |
toString() |
public final String createDocumentChecksum(ImporterDocument document)
IDocumentChecksummer
createDocumentChecksum
in interface IDocumentChecksummer
document
- an HTTP documentprotected abstract String doCreateDocumentChecksum(ImporterDocument document)
public boolean isKeep()
true
to keep the checksumpublic void setKeep(boolean keep)
keep
- true
to keep the checksumpublic String getTargetField()
CollectorMetadata.COLLECTOR_CHECKSUM_DOC
.
Only applicable if isKeep()
returns true
public void setTargetField(String targetField)
targetField
- the metadata field namepublic final void loadFromXML(Reader in)
loadFromXML
in interface IXMLConfigurable
protected abstract void loadChecksummerFromXML(XMLConfiguration xml)
public final void saveToXML(Writer out) throws IOException
saveToXML
in interface IXMLConfigurable
IOException
protected abstract void saveChecksummerToXML(EnhancedXMLStreamWriter writer) throws XMLStreamException
XMLStreamException
Copyright © 2014–2021 Norconex Inc.. All rights reserved.