S - The type of the sent documentspublic abstract class AbstractURLLoader<S extends de.gerdiproject.harvest.IDocument> extends AbstractIteratorLoader<S>
| Modifier and Type | Field and Description |
|---|---|
protected Map<String,de.gerdiproject.harvest.IDocument> |
batchMap |
protected Charset |
charset |
protected HashGenerator |
hashGenerator |
protected org.slf4j.Logger |
logger |
protected IntegerParameter |
maxBatchSizeParam |
protected StringParameter |
urlParam |
dedicatedEtl, hasLoadedDocuments| Constructor and Description |
|---|
AbstractURLLoader()
Constructor that initializes the Logger.
|
| Modifier and Type | Method and Description |
|---|---|
protected String |
checkPreconditionErrors()
Checks if the loader can start
|
void |
clear()
Closes potentially open readers/writers and finishes the Load process
if it is still ongoing.
|
protected String |
getCredentials()
Retrieves the credentials that may be necessary for to authenticate the loader
with the URL.
|
protected abstract int |
getSizeOfDocument(String documentId,
de.gerdiproject.harvest.IDocument document)
Calculates the size of a single document within the batch in bytes.
|
protected String |
getUrl()
Returns the loader target URL as a string.
|
void |
init(AbstractETL<?,?> etl)
Initializes the loader for a new harvest.
|
void |
load(Iterator<S> documents)
Loads the document to a targeted search index.
|
protected abstract void |
loadBatch(Map<String,de.gerdiproject.harvest.IDocument> documents)
The core of the loading function which is to be implemented by
subclasses.
|
void |
loadElement(S document)
Loads a single element of the Iterator.
|
protected void |
tryLoadingBatch()
Sends documents to an external place.
|
void |
unregisterParameters()
If the Loader created parameters in the Configuration,
this method should unregister all of them.
|
loadElementAndIncrementprotected final org.slf4j.Logger logger
protected final IntegerParameter maxBatchSizeParam
protected final StringParameter urlParam
protected final HashGenerator hashGenerator
protected volatile Charset charset
public AbstractURLLoader()
public void unregisterParameters()
ILoaderpublic void init(AbstractETL<?,?> etl)
ILoaderinit in interface ILoader<Iterator<S extends de.gerdiproject.harvest.IDocument>>init in class AbstractIteratorLoader<S extends de.gerdiproject.harvest.IDocument>etl - the AbstractETL to which the loader belongspublic void load(Iterator<S> documents) throws LoaderException
ILoaderload in interface ILoader<Iterator<S extends de.gerdiproject.harvest.IDocument>>load in class AbstractIteratorLoader<S extends de.gerdiproject.harvest.IDocument>documents - the document that is to be loadedLoaderException - when the load did not work properlypublic void loadElement(S document) throws LoaderException
AbstractIteratorLoaderloadElement in class AbstractIteratorLoader<S extends de.gerdiproject.harvest.IDocument>document - a document that is to be loadedLoaderException - when the load failedpublic void clear()
ILoaderprotected abstract int getSizeOfDocument(String documentId, de.gerdiproject.harvest.IDocument document)
documentId - the unique identifier of the documentdocument - the document of which the size is measuredprotected abstract void loadBatch(Map<String,de.gerdiproject.harvest.IDocument> documents)
documents - a map of documentIDs to documents that are to be
loaded, the values may also be null, in which case the
document is to be removed from the indexprotected String checkPreconditionErrors()
protected void tryLoadingBatch()
throws LoaderException
LoaderException - when the batch could not be loadedprotected String getCredentials()
protected String getUrl()
Copyright © 2017–2019. All rights reserved.