com.gisgraphy.domain.geoloc.importer
Class GeonamesAdm3Importer

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

public class GeonamesAdm3Importer
extends AbstractImporterProcessor

Import the Adm of level 3 file. It is the first step of the adm3 import process, the import will be complete when all the datastore object will be updated by the GeonamesFeatureImporter

Author:
David Masclet

Field Summary
 
Fields inherited from class com.gisgraphy.domain.geoloc.importer.AbstractImporterProcessor
COMMENT_START, currentFile, importerConfig, in, internationalisationService, logger, readFileLine, status, statusMessage, totalReadLine, transactionManager
 
Constructor Summary
GeonamesAdm3Importer()
          Default constructor
 
Method Summary
protected  void flushAndClear()
          Should flush and clear all the Daos that are used by the processor.
protected  java.io.File[] getFiles()
           
protected  int getMaxInsertsBeforeFlush()
           
protected  int getNumberOfColumns()
           
protected  void processData(java.lang.String line)
          Process a read line of the geonames file, must be implemented by the concrete class
 java.util.List<NameValueDTO<java.lang.Integer>> rollback()
          /!
 void setAdmDao(IAdmDao admDao)
           
protected  void setCommitFlushMode()
          Will flush after every commit
 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.domain.geoloc.importer.AbstractImporterProcessor
checkNumberOfColumn, countLines, dumpFields, getCurrentFileName, getNumberOfLinesToProcess, getReadFileLine, getStatus, getStatusMessage, getTotalReadLine, isEmptyField, isEndOfDocument, process, readLineAndProcessData, resetStatus, setImporterConfig, setInternationalisationService, setTransactionManager, setup, tearDown
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GeonamesAdm3Importer

public GeonamesAdm3Importer()
Default constructor

Method Detail

processData

protected void processData(java.lang.String line)
Description copied from class: AbstractImporterProcessor
Process a read line of the geonames file, must be implemented by the concrete class

Specified by:
processData in class AbstractImporterProcessor
Parameters:
line - the line to process

shouldBeSkipped

public boolean shouldBeSkipped()
Specified by:
shouldBeSkipped in interface IImporterProcessor
Overrides:
shouldBeSkipped in class AbstractImporterProcessor
Returns:
true if the processor should Not be executed

shouldIgnoreFirstLine

protected boolean shouldIgnoreFirstLine()
Description copied from class: AbstractImporterProcessor
Template Method : Whether the processor should ignore the first line of the input

Specified by:
shouldIgnoreFirstLine in class AbstractImporterProcessor
Returns:
true if the processor should ignore first line

shouldIgnoreComments

protected boolean shouldIgnoreComments()
Description copied from class: AbstractImporterProcessor
Whether the filter should ignore the comments (i.e. lines starting with #)

Specified by:
shouldIgnoreComments in class AbstractImporterProcessor
See Also:
AbstractImporterProcessor.COMMENT_START

setCommitFlushMode

protected void setCommitFlushMode()
Description copied from class: AbstractImporterProcessor
Will flush after every commit

Specified by:
setCommitFlushMode in class AbstractImporterProcessor
See Also:
AbstractImporterProcessor.flushAndClear()

flushAndClear

protected void flushAndClear()
Description copied from class: AbstractImporterProcessor
Should flush and clear all the Daos that are used by the processor. This avoid memory leak

Specified by:
flushAndClear in class AbstractImporterProcessor

getNumberOfColumns

protected int getNumberOfColumns()
Specified by:
getNumberOfColumns in class AbstractImporterProcessor
Returns:
the number of fields the processed Geonames file should have

setAdmDao

public void setAdmDao(IAdmDao admDao)
Parameters:
admDao - The admDao to set

getFiles

protected java.io.File[] getFiles()
Specified by:
getFiles in class AbstractImporterProcessor
Returns:
The files to be process
See Also:
ImporterHelper

getMaxInsertsBeforeFlush

protected int getMaxInsertsBeforeFlush()
Overrides:
getMaxInsertsBeforeFlush in class AbstractImporterProcessor
Returns:
The option
See Also:
ImporterConfig.setMaxInsertsBeforeFlush(int)

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

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 © 2010. All Rights Reserved.