edu.ucsb.nceas.metacat.harvesterClient

## Class Harvester

- java.lang.Object
- - edu.ucsb.nceas.metacat.harvesterClient.Harvester

-     public class Harvester
      extends java.lang.Object

  Harvester is the main class for the Harvester application. The main method creates a single Harvester object which drives the application.
  Author:
    costa

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.lang.String` | `filler`
    `static java.lang.String` | `marker`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Harvester()` Constructor.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `closeConnection()`
    `java.lang.String` | `dequoteText(java.lang.String text)` Normalizes text prior to insertion into the HARVEST_LOG or HARVEST_DETAIL_LOG tables.
    `java.sql.Connection` | `getConnection()` Returns a connection to the database.
    `int` | `getDetailLogID()` Gets the current value of the detailLogID for storage as a primary key in the DETAIL_LOG_ID field of the HARVEST_DETAIL_LOG table.
    `int` | `getHarvestLogID()` Gets the current value of the harvestLogID for storage as a primary key in the HARVEST_LOG_ID field of the HARVEST_LOG table.
    `void` | `initLogIDs()` Initializes the detailLogID and harvestLogID values to their current maximums + 1.
    `static void` | `loadProperties(java.lang.String metacatContextDir)` Loads Harvester options from a configuration file.
    `static void` | `main(java.lang.String[] args)` Harvester main method.
    `void` | `setHarvestStartTime(java.util.Date date)` Sets the harvest start time for this harvest run.

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

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

- - ### Field Detail

    - #### filler

          public static final java.lang.String filler

      See Also:
        Constant Field Values

    - #### marker

          public static final java.lang.String marker

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### Harvester

          public Harvester()

      Constructor. Creates a new instance of Harvester.

  - ### Method Detail

    - #### loadProperties

          public static void loadProperties(java.lang.String metacatContextDir)

      Loads Harvester options from a configuration file.

    - #### main

          public static void main(java.lang.String[] args)

      Harvester main method.
      Parameters:
        `args` - the command line arguments args[0] if "false", then this is not command-line mode, Command-line mode is true by default. args[1] if present, represents the path to the harvest list schema file. Specifying it overrides the default path to the schema file.
      Throws:
        `SAXException`
        `java.io.IOException`
        `ParserConfigurationException`

    - #### closeConnection

          public void closeConnection()

    - #### dequoteText

          public java.lang.String dequoteText(java.lang.String text)

      Normalizes text prior to insertion into the HARVEST_LOG or HARVEST_DETAIL_LOG tables. In particular, replaces the single quote character with the double quote character. This prevents SQL errors involving words that contain single quotes. Also removes \n and \r characters from the text.
      Parameters:
        `text` - the original string
      Returns:
        a string containing the normalized text

    - #### getConnection

          public java.sql.Connection getConnection()

      Returns a connection to the database. Opens the connection if a connection has not already been made previously.
      Returns:
        conn the database Connection object

    - #### getDetailLogID

          public int getDetailLogID()

      Gets the current value of the detailLogID for storage as a primary key in the DETAIL_LOG_ID field of the HARVEST_DETAIL_LOG table.
      Returns:
        the current value of the detailLogID

    - #### getHarvestLogID

          public int getHarvestLogID()

      Gets the current value of the harvestLogID for storage as a primary key in the HARVEST_LOG_ID field of the HARVEST_LOG table.
      Returns:
        the current value of the detailLogID

    - #### initLogIDs

          public void initLogIDs()

      Initializes the detailLogID and harvestLogID values to their current maximums + 1.

    - #### setHarvestStartTime

          public void setHarvestStartTime(java.util.Date date)

      Sets the harvest start time for this harvest run.
      Parameters:
        `date` -

Copyright © 2023 Regents of the University of California. All Rights Reserved.