public abstract class AbstractFileRetriever extends Object implements IImporterProcessor
| Modifier and Type | Field and Description |
|---|---|
protected String |
currentFileName |
protected int |
fileIndex |
protected ImporterConfig |
importerConfig |
protected static org.slf4j.Logger |
logger
The logger
|
protected int |
numberOfFileToDownload |
protected ImporterStatus |
status |
protected String |
statusMessage |
| Constructor and Description |
|---|
AbstractFileRetriever() |
| Modifier and Type | Method and Description |
|---|---|
abstract void |
decompressFiles()
Method to call if files must be decompress (untar or unzip)
|
protected void |
downloadFile(String file) |
protected void |
downloadFiles() |
String |
getCurrentFileName() |
abstract String |
getDownloadBaseUrl() |
abstract String |
getDownloadDirectory() |
abstract File[] |
getFilesToDecompress()
return an array of file that are to be decompressed
|
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
|
abstract boolean |
isFileNotFoundTolerant() |
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) |
void |
setInternationalisationService(IInternationalisationService internationalisationService) |
boolean |
shouldBeSkipped() |
protected ImporterConfig importerConfig
protected String currentFileName
protected ImporterStatus status
protected int fileIndex
protected int numberOfFileToDownload
protected String statusMessage
protected static final org.slf4j.Logger logger
public void process()
throws ImporterException
IImporterProcessorprocess in interface IImporterProcessorImporterExceptionprotected void downloadFiles()
protected void downloadFile(String file) throws FileNotFoundException
FileNotFoundExceptionpublic abstract boolean isFileNotFoundTolerant()
public boolean shouldBeSkipped()
shouldBeSkipped in interface IImporterProcessorpublic abstract void decompressFiles()
throws IOException
IOExceptionpublic abstract File[] getFilesToDecompress() throws IOException
IOExceptionpublic abstract String getDownloadDirectory()
public abstract String getDownloadBaseUrl()
public long getReadFileLine()
IImporterProcessorgetReadFileLine in interface IImporterProcessorIImporterProcessor.getTotalReadLine()public long getTotalReadLine()
IImporterProcessorgetTotalReadLine in interface IImporterProcessorIImporterProcessor.getReadFileLine()public String getCurrentFileName()
getCurrentFileName in interface IImporterProcessorpublic long getNumberOfLinesToProcess()
getNumberOfLinesToProcess in interface IImporterProcessorpublic ImporterStatus getStatus()
getStatus in interface IImporterProcessorpublic String getStatusMessage()
getStatusMessage in interface IImporterProcessorpublic List<NameValueDTO<Integer>> rollback()
IImporterProcessorrollback in interface IImporterProcessorpublic void resetStatus()
IImporterProcessorresetStatus in interface IImporterProcessorpublic void setImporterConfig(ImporterConfig importerConfig)
importerConfig - The importerConfig to setpublic void setInternationalisationService(IInternationalisationService internationalisationService)
internationalisationService - the internationalisationService to setCopyright © 2015. All rights reserved.