com.gisgraphy.importer

## Class GeonamesDatabaseIndexer

- java.lang.Object
- - com.gisgraphy.importer.GeonamesDatabaseIndexer

- All Implemented Interfaces:
    IImporterProcessor

      public class GeonamesDatabaseIndexer
      extends Object
      implements IImporterProcessor

  Create the required index for all the Geonames databases
  Author:
    David Masclet

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected IGisDao<? extends GisFeature>[]` | `daos`
    `static String` | `DEFAULT_CURRENT_FILENAME`
    `protected ImporterConfig` | `importerConfig`
    `protected IInternationalisationService` | `internationalisationService`
    `protected static org.slf4j.Logger` | `logger` The logger

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `GeonamesDatabaseIndexer()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `getCurrentFileName()`
    `long` | `getNumberOfLinesToProcess()`
    `long` | `getReadFileLine()` The number of read line for the current processed file
    `ImporterStatus` | `getStatus()`
    `String` | `getStatusMessage()`
    `long` | `getTotalReadLine()` The number of read line for all the processed file
    `void` | `process()` Do the stuff...
    `void` | `resetStatus()` Reset status fields, it should be done when the import has been canceled
    `List<NameValueDTO<Integer>>` | `rollback()` /!
    `void` | `setImporterConfig(ImporterConfig importerConfig)`
    `protected void` | `setup()` Template method that can be override.
    `boolean` | `shouldBeSkipped()`
    `protected void` | `tearDown()` Template method that can be override.

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

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

- - ### Field Detail

    - #### DEFAULT_CURRENT_FILENAME

          public static final String DEFAULT_CURRENT_FILENAME

      See Also:
        Constant Field Values

    - #### logger

          protected static final org.slf4j.Logger logger

      The logger

    - #### daos

          @Autowired
          protected IGisDao<? extends GisFeature>[] daos

    - #### importerConfig

          @Autowired
          protected ImporterConfig importerConfig

    - #### internationalisationService

          @Autowired
          protected IInternationalisationService internationalisationService

  - ### Constructor Detail

    - #### GeonamesDatabaseIndexer

          public GeonamesDatabaseIndexer()

  - ### Method Detail

    - #### getCurrentFileName

          public String getCurrentFileName()

      Specified by:
        `getCurrentFileName` in interface `IImporterProcessor`
      Returns:
        The name of the file currently processed or null if no file is processed

    - #### getNumberOfLinesToProcess

          public long getNumberOfLinesToProcess()

      Specified by:
        `getNumberOfLinesToProcess` in interface `IImporterProcessor`
      Returns:
        The number of line the processor will process. (it is not the number of lines left!)

    - #### getReadFileLine

          public long getReadFileLine()

      Description copied from interface: `IImporterProcessor`
      The number of read line for the current processed file
      Specified by:
        `getReadFileLine` in interface `IImporterProcessor`
      See Also:
        `IImporterProcessor.getTotalReadLine()`

    - #### getStatus

          public ImporterStatus getStatus()

      Specified by:
        `getStatus` in interface `IImporterProcessor`
      Returns:
        The current status of the importer

    - #### getStatusMessage

          public String getStatusMessage()

      Specified by:
        `getStatusMessage` in interface `IImporterProcessor`
      Returns:
        A text Message for the importer

    - #### getTotalReadLine

          public long getTotalReadLine()

      Description copied from interface: `IImporterProcessor`
      The number of read line for all the processed file
      Specified by:
        `getTotalReadLine` in interface `IImporterProcessor`
      See Also:
        `IImporterProcessor.getReadFileLine()`

    - #### process

          public void process()

      Description copied from interface: `IImporterProcessor`
      Do the stuff...
      Specified by:
        `process` in interface `IImporterProcessor`

    - #### setup

          protected void setup()

      Template method that can be override. This method is called before the process start. it is not called for each file processed.

    - #### tearDown

          protected void tearDown()

      Template method that can be override. This method is called after the end of the process. it is not called for each file processed. You should always call super.tearDown() when you override this method

    - #### rollback

          public List<NameValueDTO<Integer>> rollback()

      Description copied from interface: `IImporterProcessor`
      /!\ USE THIS METHOD VERY CAREFULLY /!\ : If you call this function, all the imported data for the specified importer will be deleted
      Specified by:
        `rollback` in interface `IImporterProcessor`
      Returns:
        a NameValueDTO with the name of the deleted object and the number of deleted Object. No entry will be return for Object that were 0 object will be deleted except if an error occurred during the deletion.

    - #### shouldBeSkipped

          public boolean shouldBeSkipped()

      Specified by:
        `shouldBeSkipped` in interface `IImporterProcessor`
      Returns:
        true if the processor should Not be executed

    - #### setImporterConfig

          public void setImporterConfig(ImporterConfig importerConfig)

      Parameters:
        `importerConfig` - the importerConfig to set

    - #### resetStatus

          public void resetStatus()

      Description copied from interface: `IImporterProcessor`
      Reset status fields, it should be done when the import has been canceled
      Specified by:
        `resetStatus` in interface `IImporterProcessor`

Copyright © 2015. All rights reserved.