Class FileMetadataChecksummer
java.lang.Object
com.norconex.collector.core.checksum.AbstractMetadataChecksummer
com.norconex.collector.fs.checksum.impl.FileMetadataChecksummer
- All Implemented Interfaces:
IMetadataChecksummer,IXMLConfigurable
Default implementation of IMetadataChecksummer which by default
returns the combined values of FileMetadata.COLLECTOR_LASTMODIFIED
and FileMetadata.COLLECTOR_SIZE, separated with an underscore
(e.g. "14125443181234_123").
To use different fields (one or several) to constitute a checksum,
you can use the GenericMetadataChecksummer.
Since 2.2.0, this implementation can be disabled in your
configuration by specifying disabled="true". When disabled,
the checksum returned is always null.
XML configuration usage:
<metadataChecksummer
class="com.norconex.collector.fs.checksum.impl.FileMetadataChecksummer"
disabled="[false|true]"
keep="[false|true]"
targetField="(field to store checksum)" />
Usage example:
The following will store the generated metadata checksum in a field called "checksum".
<metadataChecksummer
class="com.norconex.collector.fs.checksum.impl.FileMetadataChecksummer"
keep="true" targetField="checksum" />
- Author:
- Pascal Essiembre
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringdoCreateMetaChecksum(Properties metadata) booleanWhether this checksummer is disabled or not.protected voidprotected voidsaveChecksummerToXML(XML xml) voidsetDisabled(boolean disabled) Sets whether this checksummer is disabled or not.Methods inherited from class com.norconex.collector.core.checksum.AbstractMetadataChecksummer
createMetadataChecksum, equals, getOnSet, getTargetField, getToField, hashCode, isKeep, loadFromXML, saveToXML, setKeep, setOnSet, setTargetField, setToField, toString
-
Constructor Details
-
FileMetadataChecksummer
public FileMetadataChecksummer()
-
-
Method Details
-
doCreateMetaChecksum
- Specified by:
doCreateMetaChecksumin classAbstractMetadataChecksummer
-
isDisabled
public boolean isDisabled()Whether this checksummer is disabled or not. When disabled, not checksum will be created (the checksum will benull).- Returns:
trueif disabled- Since:
- 2.2.0
-
setDisabled
public void setDisabled(boolean disabled) Sets whether this checksummer is disabled or not. When disabled, not checksum will be created (the checksum will benull).- Parameters:
disabled-trueif disabled- Since:
- 2.2.0
-
loadChecksummerFromXML
- Specified by:
loadChecksummerFromXMLin classAbstractMetadataChecksummer
-
saveChecksummerToXML
- Specified by:
saveChecksummerToXMLin classAbstractMetadataChecksummer
-