Class LastModifiedMetadataChecksummer
- java.lang.Object
-
- com.norconex.collector.core.checksum.AbstractMetadataChecksummer
-
- com.norconex.collector.http.checksum.impl.LastModifiedMetadataChecksummer
-
- All Implemented Interfaces:
IMetadataChecksummer
,IXMLConfigurable
public class LastModifiedMetadataChecksummer extends AbstractMetadataChecksummer
Default implementation of
IMetadataChecksummer
for the Norconex HTTP Collector which simply returns the exact value of the "Last-Modified" HTTP header field, ornull
if not present.You have the option to keep the checksum as a document metadata field. When
AbstractMetadataChecksummer.setKeep(boolean)
istrue
, the checksum will be stored in the target field name specified. If you do not specify any, it stores it under the metadata field nameCrawlDocMetadata.CHECKSUM_METADATA
.To use different fields (one or several) to constitute a checksum, you can instead use the
GenericMetadataChecksummer
.XML configuration usage:
<metadataChecksummer class="com.norconex.collector.http.checksum.impl.LastModifiedMetadataChecksummer" keep="[false|true]" toField="(field to store checksum)"/>
XML usage example:
<metadataChecksummer keep="true" toField="metaChecksum"/>
The above example will store the last modified date used for checksum purposes in a field called "metaChecksum".
Since 2.0.0, a self-closing
<metadataChecksummer/>
tag without any attributes is used to disable checksum generation.- Since:
- 2.2.0
- Author:
- Pascal Essiembre
- See Also:
GenericMetadataChecksummer
-
-
Constructor Summary
Constructors Constructor Description LastModifiedMetadataChecksummer()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected String
doCreateMetaChecksum(Properties metadata)
boolean
equals(Object other)
int
hashCode()
boolean
isDisabled()
Deprecated.Since 2.0.0, not having a checksummer defined or setting one explicitly tonull
effectively disables it.protected void
loadChecksummerFromXML(XML xml)
protected void
saveChecksummerToXML(XML xml)
void
setDisabled(boolean disabled)
Deprecated.Since 2.0.0, not having a checksummer defined or setting one explicitly tonull
effectively disable it.String
toString()
-
Methods inherited from class com.norconex.collector.core.checksum.AbstractMetadataChecksummer
createMetadataChecksum, getOnSet, getTargetField, getToField, isKeep, loadFromXML, saveToXML, setKeep, setOnSet, setTargetField, setToField
-
-
-
-
Method Detail
-
doCreateMetaChecksum
protected String doCreateMetaChecksum(Properties metadata)
- Specified by:
doCreateMetaChecksum
in classAbstractMetadataChecksummer
-
isDisabled
@Deprecated public boolean isDisabled()
Deprecated.Since 2.0.0, not having a checksummer defined or setting one explicitly tonull
effectively disables it.Deprecated.- Returns:
- always
false
-
setDisabled
@Deprecated public void setDisabled(boolean disabled)
Deprecated.Since 2.0.0, not having a checksummer defined or setting one explicitly tonull
effectively disable it.Deprecated. Invoking this method has no effect- Parameters:
disabled
- argument is ignored
-
loadChecksummerFromXML
protected void loadChecksummerFromXML(XML xml)
- Specified by:
loadChecksummerFromXML
in classAbstractMetadataChecksummer
-
saveChecksummerToXML
protected void saveChecksummerToXML(XML xml)
- Specified by:
saveChecksummerToXML
in classAbstractMetadataChecksummer
-
equals
public boolean equals(Object other)
- Overrides:
equals
in classAbstractMetadataChecksummer
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classAbstractMetadataChecksummer
-
toString
public String toString()
- Overrides:
toString
in classAbstractMetadataChecksummer
-
-