public abstract class AbstractMetadataChecksummer extends Object implements IMetadataChecksummer, IXMLConfigurable
Abstract implementation of IMetadataChecksummer
giving the option
to keep the generated checksum. 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 CrawlDocMetadata.CHECKSUM_METADATA
.
Implementors do not need to store the checksum themselves, this abstract class does it.
Implementors should offer this XML configuration usage:
<metadataChecksummer
class="(subclass)">
keep="[false|true]"
toField="(optional metadata field to store the checksum)"
onSet="[append|prepend|replace|optional]" />
toField
is ignored unless the keep
attribute is set to true
.
Constructor and Description |
---|
AbstractMetadataChecksummer() |
Modifier and Type | Method and Description |
---|---|
String |
createMetadataChecksum(Properties metadata)
Creates a metadata checksum.
|
protected abstract String |
doCreateMetaChecksum(Properties metadata) |
boolean |
equals(Object other) |
PropertySetter |
getOnSet()
Gets the property setter to use when a value is set.
|
String |
getTargetField()
Deprecated.
Since 2.0.0, use
getToField() . |
String |
getToField()
Gets the metadata field to use to store the checksum value.
|
int |
hashCode() |
boolean |
isKeep()
Whether to keep the metadata checksum value as a new metadata field.
|
protected abstract void |
loadChecksummerFromXML(XML xml) |
void |
loadFromXML(XML xml) |
protected abstract void |
saveChecksummerToXML(XML xml) |
void |
saveToXML(XML xml) |
void |
setKeep(boolean keep)
Sets whether to keep the metadata checksum value as a new metadata field.
|
void |
setOnSet(PropertySetter onSet)
Sets the property setter to use when a value is set.
|
void |
setTargetField(String targetField)
Deprecated.
Since 2.0.0, use
setToField(String) . |
void |
setToField(String toField)
Sets the metadata field name to use to store the checksum value.
|
String |
toString() |
public final String createMetadataChecksum(Properties metadata)
IMetadataChecksummer
createMetadataChecksum
in interface IMetadataChecksummer
metadata
- all metadata valuesprotected abstract String doCreateMetaChecksum(Properties metadata)
public boolean isKeep()
true
to keep the checksumpublic void setKeep(boolean keep)
keep
- true
to keep the checksum@Deprecated public String getTargetField()
getToField()
.CrawlDocMetadata.CHECKSUM_METADATA
.
Only applicable if isKeep()
returns true
@Deprecated public void setTargetField(String targetField)
setToField(String)
.targetField
- the metadata field namepublic String getToField()
CrawlDocMetadata.CHECKSUM_METADATA
.
Only applicable if isKeep()
returns true
public void setToField(String toField)
toField
- the metadata field namepublic PropertySetter getOnSet()
public void setOnSet(PropertySetter onSet)
onSet
- property setterpublic final void loadFromXML(XML xml)
loadFromXML
in interface IXMLConfigurable
protected abstract void loadChecksummerFromXML(XML xml)
public final void saveToXML(XML xml)
saveToXML
in interface IXMLConfigurable
protected abstract void saveChecksummerToXML(XML xml)
Copyright © 2014–2023 Norconex Inc.. All rights reserved.