Package de.pangaea.metadataportal.harvester

## Class ElasticsearchHarvester

- java.lang.Object
- - de.pangaea.metadataportal.harvester.Harvester
  - - de.pangaea.metadataportal.harvester.SingleFileEntitiesHarvester
    - - de.pangaea.metadataportal.harvester.ElasticsearchHarvester

-     public class ElasticsearchHarvester
      extends SingleFileEntitiesHarvester

  TODO

  This harvester supports the following additional harvester properties:

  - `identifierPrefix`: This prefix is added in front of all identifiers from the foreign ES instance (default: "")
  - TODO
  Author:
    Uwe Schindler

- - ### Field Summary

    - ### Fields inherited from class de.pangaea.metadataportal.harvester.Harvester

      `fromDateReference, harvestCount, HARVESTER_METADATA_FIELD_LAST_HARVESTED, harvestMessageStep, iconfig, log, processor`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `ElasticsearchHarvester​(HarvesterConfig iconfig)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `close​(boolean cleanShutdown)` | Closes harvester.
    `protected void` | `enumerateValidHarvesterPropertyNames​(Set<String> props)` | This method is used by subclasses to enumerate all available harvester properties that are implemented by them.
    `void` | `harvest()` | This method is called by the harvester after `Harvester.open(de.pangaea.metadataportal.processor.ElasticsearchConnection, java.lang.String)`'ing it.
    `void` | `open​(ElasticsearchConnection es, String targetIndex)` | Opens harvester for harvesting documents described by the given `HarvesterConfig`.

    - ### Methods inherited from class de.pangaea.metadataportal.harvester.SingleFileEntitiesHarvester

      `addDocument, addDocument, cancelMissingDocumentDelete`

    - ### Methods inherited from class de.pangaea.metadataportal.harvester.Harvester

      `addDocument, createMetadataDocumentInstance, deleteDocument, finishReindex, getValidHarvesterPropertyNames, isAllIndexes, isClosed, isDocumentOutdated, main, prepareReindex, runHarvester, runHarvester, setHarvestingDateReference, setValidIdentifiers`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ElasticsearchHarvester

          public ElasticsearchHarvester​(HarvesterConfig iconfig)

  - ### Method Detail

    - #### open

          public void open​(ElasticsearchConnection es,
                           String targetIndex)
                    throws Exception

      Description copied from class: `Harvester`
      Opens harvester for harvesting documents described by the given `HarvesterConfig`. Opens `Harvester.processor` for usage in `Harvester.harvest()` method.
      Overrides:
        `open` in class `Harvester`
      Throws:
        `Exception` - if an exception occurs during opening (various types of exceptions can be thrown).

    - #### close

          public void close​(boolean cleanShutdown)
                     throws Exception

      Description copied from class: `Harvester`
      Closes harvester. All resources are freed and the `Harvester.processor` is closed.
      Overrides:
        `close` in class `SingleFileEntitiesHarvester`
      Parameters:
        `cleanShutdown` - enables writing of status information to the Elasticsearch instance for the next harvesting. If an error occurred during harvesting this should not be done.
      Throws:
        `Exception` - if an exception occurs during closing (various types of exceptions can be thrown). Exceptions can be thrown asynchronous and may not affect the correct document.

    - #### harvest

          public void harvest()
                       throws Exception

      Description copied from class: `Harvester`
      This method is called by the harvester after `Harvester.open(de.pangaea.metadataportal.processor.ElasticsearchConnection, java.lang.String)`'ing it. Overwrite this method in your harvester class. This method should harvest files from somewhere, generate `MetadataDocument`s and add them with `Harvester.addDocument(de.pangaea.metadataportal.processor.MetadataDocument)`.
      Specified by:
        `harvest` in class `Harvester`
      Throws:
        `Exception` - of any type.

    - #### enumerateValidHarvesterPropertyNames

          protected void enumerateValidHarvesterPropertyNames​(Set<String> props)

      Description copied from class: `Harvester`
      This method is used by subclasses to enumerate all available harvester properties that are implemented by them. Overwrite this method in your own implementation and append all harvester names to the supplied `Set`. The public API for client code requesting property names is `Harvester.getValidHarvesterPropertyNames()`.
      Overrides:
        `enumerateValidHarvesterPropertyNames` in class `SingleFileEntitiesHarvester`
      See Also:
        `Harvester.getValidHarvesterPropertyNames()`