|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.gisgraphy.domain.geoloc.importer.ImporterHelper
public class ImporterHelper
Useful methods for importer
| Field Summary | |
|---|---|
static java.lang.String |
ALLCOUTRY_FILENAME
the all country dump file name |
static java.io.FileFilter |
countryFileFilter
|
static java.lang.String |
EXCLUDED_README_FILENAME
The readme filename (it must not be processed) |
static java.lang.String |
GEONAMES_COUNTRY_FILE_ACCEPT_REGEX_STRING
The regexp that every country file dump matches |
protected static org.slf4j.Logger |
logger
|
static java.lang.String |
OPENSTREETMAP_US_FILE_ACCEPT_REGEX_STRING
|
static java.lang.String |
TAR_BZ2_FILE_ACCEPT_REGEX_STRING
|
static java.lang.String |
ZIP_FILE_ACCEPT_REGEX_STRING
The regexp that every zipped country file dump matches |
| Constructor Summary | |
|---|---|
ImporterHelper()
|
|
| Method Summary | |
|---|---|
static java.util.List<java.util.regex.Pattern> |
compileRegex(java.lang.String regexpSemiColumnSeparated)
|
static java.lang.String[] |
correctLastAdmCodeIfPossible(java.lang.String[] fields)
|
static void |
download(java.lang.String address,
java.lang.String localFileName)
|
static java.lang.String |
formatSeconds(long secsIn)
|
static long |
getHttpFileSize(java.lang.String URL)
|
static java.io.File[] |
listCountryFilesToImport(java.lang.String directoryPath)
|
static java.io.File[] |
listTarFiles(java.lang.String directoryPath)
|
static java.io.File[] |
listZipFiles(java.lang.String directoryPath)
|
static void |
unzipFile(java.io.File file)
unzip a file in the same directory as the zipped file |
static java.lang.String[] |
virtualizeADMD(java.lang.String[] fields)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String EXCLUDED_README_FILENAME
public static final java.lang.String ALLCOUTRY_FILENAME
public static final java.lang.String GEONAMES_COUNTRY_FILE_ACCEPT_REGEX_STRING
public static final java.lang.String OPENSTREETMAP_US_FILE_ACCEPT_REGEX_STRING
public static final java.lang.String ZIP_FILE_ACCEPT_REGEX_STRING
public static final java.lang.String TAR_BZ2_FILE_ACCEPT_REGEX_STRING
protected static final org.slf4j.Logger logger
public static java.io.FileFilter countryFileFilter
| Constructor Detail |
|---|
public ImporterHelper()
| Method Detail |
|---|
public static java.io.File[] listCountryFilesToImport(java.lang.String directoryPath)
directoryPath - The directory where Geonames files are
GEONAMES_COUNTRY_FILE_ACCEPT_REGEX_STRINGpublic static java.io.File[] listZipFiles(java.lang.String directoryPath)
directoryPath - The directory where Geonames files are to be downloaded in
order to be processed
ZIP_FILE_ACCEPT_REGEX_STRINGpublic static java.io.File[] listTarFiles(java.lang.String directoryPath)
directoryPath - The directory where openstreetmap files are to be downloaded
in order to be processed
TAR_BZ2_FILE_ACCEPT_REGEX_STRINGpublic static long getHttpFileSize(java.lang.String URL)
URL - the HTTP URL
public static void download(java.lang.String address,
java.lang.String localFileName)
address - the address of the file to be downloadedlocalFileName - the local file name (with absolute path)public static void unzipFile(java.io.File file)
file - The file to unzippublic static java.lang.String[] virtualizeADMD(java.lang.String[] fields)
fields - the fields corresponding to a split line of the csv geonames file
public static java.lang.String[] correctLastAdmCodeIfPossible(java.lang.String[] fields)
public static java.util.List<java.util.regex.Pattern> compileRegex(java.lang.String regexpSemiColumnSeparated)
regexpSemiColumnSeparated - a string with multiple reqgexp separated by ';'
Pattern or null if a regexp are not correctspublic static java.lang.String formatSeconds(long secsIn)
secsIn - the number of seconds
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||