com.gisgraphy.domain.geoloc.importer
Class GeonamesDatabaseIndexer

java.lang.Object
  extended by com.gisgraphy.domain.geoloc.importer.GeonamesDatabaseIndexer
All Implemented Interfaces:
IImporterProcessor

public class GeonamesDatabaseIndexer
extends java.lang.Object
implements IImporterProcessor

Create the required index for all the Geonames databases

Author:
David Masclet

Field Summary
static java.lang.String DEFAULT_CURRENT_FILENAME
           
protected static org.slf4j.Logger logger
          The logger
 
Constructor Summary
GeonamesDatabaseIndexer()
           
 
Method Summary
 java.lang.String getCurrentFileName()
           
 long getNumberOfLinesToProcess()
           
 long getReadFileLine()
          The number of read line for the current processed file
 ImporterStatus getStatus()
           
 java.lang.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
 java.util.List<NameValueDTO<java.lang.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 java.lang.String DEFAULT_CURRENT_FILENAME
See Also:
Constant Field Values

logger

protected static final org.slf4j.Logger logger
The logger

Constructor Detail

GeonamesDatabaseIndexer

public GeonamesDatabaseIndexer()
Method Detail

getCurrentFileName

public java.lang.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 java.lang.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 java.util.List<NameValueDTO<java.lang.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 © 2010. All Rights Reserved.