com.gisgraphy.importer

## Class GeonamesLanguageImporter

- java.lang.Object
- - com.gisgraphy.importer.AbstractSimpleImporterProcessor
  - - com.gisgraphy.importer.GeonamesLanguageImporter

- All Implemented Interfaces:
    IImporterProcessor

      public class GeonamesLanguageImporter
      extends AbstractSimpleImporterProcessor

  Import the languages.
  Author:
    David Masclet

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected static org.slf4j.Logger` | `logger`

    - ### Fields inherited from class com.gisgraphy.importer.AbstractSimpleImporterProcessor

      `COMMENT_START, currentFile, importerConfig, in, internationalisationService, readFileLine, status, statusMessage, totalReadLine, transactionManager, txDefinition, txStatus`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `GeonamesLanguageImporter()` Default constructor

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `flushAndClear()` Should flush and clear all the Daos that are used by the processor.
    `protected File[]` | `getFiles()`
    `protected int` | `getNumberOfColumns()`
    `protected void` | `onFileProcessed(File file)` hook to do when the file has been processed without error
    `protected void` | `processData(String line)` Process a read line of the geonames file, must be implemented by the concrete class
    `List<NameValueDTO<Integer>>` | `rollback()` /!
    `protected void` | `setCommitFlushMode()` Will flush after every commit
    `void` | `setLanguageDao(ILanguageDao languageDao)`
    `boolean` | `shouldBeSkipped()`
    `protected boolean` | `shouldIgnoreComments()` Whether the filter should ignore the comments (i.e. lines starting with #)
    `protected boolean` | `shouldIgnoreFirstLine()` Template Method : Whether the processor should ignore the first line of the input

    - ### Methods inherited from class com.gisgraphy.importer.AbstractSimpleImporterProcessor

      `checkNumberOfColumn, commit, countLines, decrementReadedFileLine, dumpFields, getCurrentFileName, getMaxInsertsBeforeFlush, getNumberOfLinesToProcess, getReadFileLine, getStatus, getStatusMessage, getTotalReadLine, incrementReadedFileLine, isEmptyField, isEndOfDocument, needCommit, process, processError, readLineAndProcessData, resetStatus, rollbackTransaction, setImporterConfig, setInternationalisationService, setTransactionManager, setup, startTransaction, tearDown`

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

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

- - ### Field Detail

    - #### logger

          protected static final org.slf4j.Logger logger

  - ### Constructor Detail

    - #### GeonamesLanguageImporter

          public GeonamesLanguageImporter()

      Default constructor

  - ### Method Detail

    - #### processData

          protected void processData(String line)

      Description copied from class: `AbstractSimpleImporterProcessor`
      Process a read line of the geonames file, must be implemented by the concrete class
      Specified by:
        `processData` in class `AbstractSimpleImporterProcessor`
      Parameters:
        `line` - the line to process

    - #### shouldBeSkipped

          public boolean shouldBeSkipped()

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

    - #### onFileProcessed

          protected void onFileProcessed(File file)

      Description copied from class: `AbstractSimpleImporterProcessor`
      hook to do when the file has been processed without error
      Overrides:
        `onFileProcessed` in class `AbstractSimpleImporterProcessor`

    - #### shouldIgnoreFirstLine

          protected boolean shouldIgnoreFirstLine()

      Description copied from class: `AbstractSimpleImporterProcessor`
      Template Method : Whether the processor should ignore the first line of the input
      Specified by:
        `shouldIgnoreFirstLine` in class `AbstractSimpleImporterProcessor`
      Returns:
        true if the processor should ignore first line

    - #### shouldIgnoreComments

          protected boolean shouldIgnoreComments()

      Description copied from class: `AbstractSimpleImporterProcessor`
      Whether the filter should ignore the comments (i.e. lines starting with #)
      Specified by:
        `shouldIgnoreComments` in class `AbstractSimpleImporterProcessor`
      See Also:
        `AbstractSimpleImporterProcessor.COMMENT_START`

    - #### setCommitFlushMode

          protected void setCommitFlushMode()

      Description copied from class: `AbstractSimpleImporterProcessor`
      Will flush after every commit
      Specified by:
        `setCommitFlushMode` in class `AbstractSimpleImporterProcessor`
      See Also:
        `AbstractSimpleImporterProcessor.flushAndClear()`

    - #### flushAndClear

          protected void flushAndClear()

      Description copied from class: `AbstractSimpleImporterProcessor`
      Should flush and clear all the Daos that are used by the processor. This avoid memory leak
      Specified by:
        `flushAndClear` in class `AbstractSimpleImporterProcessor`

    - #### getNumberOfColumns

          protected int getNumberOfColumns()

      Specified by:
        `getNumberOfColumns` in class `AbstractSimpleImporterProcessor`
      Returns:
        the number of fields the processed Geonames file should have

    - #### setLanguageDao

          public void setLanguageDao(ILanguageDao languageDao)

      Parameters:
        `languageDao` - the languageDao to set

    - #### getFiles

          protected File[] getFiles()

      Specified by:
        `getFiles` in class `AbstractSimpleImporterProcessor`
      Returns:
        The files to be process
      See Also:
        `ImporterHelper`

    - #### 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
      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.

Copyright © 2015. All rights reserved.