Add skipping folder
This commit is contained in:
parent
7cb98bf761
commit
6ee39a8887
3 changed files with 24 additions and 9 deletions
|
@ -69,7 +69,7 @@ public class IndexBatchCreator {
|
||||||
|
|
||||||
|
|
||||||
// process atributtes
|
// process atributtes
|
||||||
boolean skipGeneratedIndexes = false;
|
File skipExistingIndexes;
|
||||||
MapZooms mapZooms = null;
|
MapZooms mapZooms = null;
|
||||||
Integer zoomWaySmoothness = null;
|
Integer zoomWaySmoothness = null;
|
||||||
MapRenderingTypes types = MapRenderingTypes.getDefault();
|
MapRenderingTypes types = MapRenderingTypes.getDefault();
|
||||||
|
@ -114,6 +114,14 @@ public class IndexBatchCreator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean skipExisting = false;
|
||||||
|
for (int i = 0; i < args.length; i++) {
|
||||||
|
if ("--skip-existing".equals(args[i])) {
|
||||||
|
skipExisting = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -123,7 +131,7 @@ public class IndexBatchCreator {
|
||||||
name = args[1];
|
name = args[1];
|
||||||
regions = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(regionsStream);
|
regions = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(regionsStream);
|
||||||
}
|
}
|
||||||
creator.runBatch(doc, regions);
|
creator.runBatch(doc, regions, skipExisting);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
System.out.println("XML configuration file could not be read from " + name);
|
System.out.println("XML configuration file could not be read from " + name);
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -133,14 +141,17 @@ public class IndexBatchCreator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void runBatch(Document doc, Document regions) throws SAXException, IOException, ParserConfigurationException{
|
public void runBatch(Document doc, Document regions, boolean skipExisting) throws SAXException, IOException, ParserConfigurationException{
|
||||||
NodeList list = doc.getElementsByTagName("process");
|
NodeList list = doc.getElementsByTagName("process");
|
||||||
if(list.getLength() != 1){
|
if(list.getLength() != 1){
|
||||||
throw new IllegalArgumentException("You should specify exactly 1 process element!");
|
throw new IllegalArgumentException("You should specify exactly 1 process element!");
|
||||||
}
|
}
|
||||||
Element process = (Element) list.item(0);
|
Element process = (Element) list.item(0);
|
||||||
IndexCreator.REMOVE_POI_DB = true;
|
IndexCreator.REMOVE_POI_DB = true;
|
||||||
skipGeneratedIndexes = Boolean.parseBoolean(process.getAttribute("skipGeneratedIndexes"));
|
String file = process.getAttribute("skipExistingIndexesAt");
|
||||||
|
if(file != null && new File(file).exists() && skipExisting){
|
||||||
|
skipExistingIndexes = new File(file);
|
||||||
|
}
|
||||||
wget = process.getAttribute("wget");
|
wget = process.getAttribute("wget");
|
||||||
|
|
||||||
indexPOI = Boolean.parseBoolean(process.getAttribute("indexPOI"));
|
indexPOI = Boolean.parseBoolean(process.getAttribute("indexPOI"));
|
||||||
|
@ -277,9 +288,13 @@ public class IndexBatchCreator {
|
||||||
|
|
||||||
String regionName = prefix + name;
|
String regionName = prefix + name;
|
||||||
String fileName = Algoritms.capitalizeFirstLetterAndLowercase(prefix + name + suffix);
|
String fileName = Algoritms.capitalizeFirstLetterAndLowercase(prefix + name + suffix);
|
||||||
File bmif = new File(indexDirFiles, fileName + "_" + IndexConstants.BINARY_MAP_VERSION + IndexConstants.BINARY_MAP_INDEX_EXT);
|
if (skipExistingIndexes != null) {
|
||||||
if(skipGeneratedIndexes && bmif.exists()){
|
File bmif = new File(skipExistingIndexes, fileName + "_" + IndexConstants.BINARY_MAP_VERSION
|
||||||
continue;
|
+ IndexConstants.BINARY_MAP_INDEX_EXT);
|
||||||
|
File bmifz = new File(skipExistingIndexes, bmif.getName() + ".zip");
|
||||||
|
if (bmif.exists() || bmifz.exists()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
File toSave = downloadFile(url, fileName, alreadyGeneratedFiles);
|
File toSave = downloadFile(url, fileName, alreadyGeneratedFiles);
|
||||||
if (toSave != null) {
|
if (toSave != null) {
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
-->
|
-->
|
||||||
<!-- zoomWaySmoothness - 1-4, typical mapZooms - 8-10;11-12;13-14;15 -->
|
<!-- zoomWaySmoothness - 1-4, typical mapZooms - 8-10;11-12;13-14;15 -->
|
||||||
<process directory_for_osm_files="/home/..." directory_for_index_files="/home/..." directory_for_generation="/home/..."
|
<process directory_for_osm_files="/home/..." directory_for_index_files="/home/..." directory_for_generation="/home/..."
|
||||||
skipGeneratedIndexes="true" indexPOI="true" indexMap="true" indexTransport="true" indexAddress="true">
|
skipExistingIndexesAt="/home/..." indexPOI="true" indexMap="true" indexTransport="true" indexAddress="true">
|
||||||
<!-- Add wget="C:/Program Files/GNUWin32/bin/wget.exe" to process, to use wget for download.
|
<!-- Add wget="C:/Program Files/GNUWin32/bin/wget.exe" to process, to use wget for download.
|
||||||
On linux systems if wget is in your path it can be wget="wget" or you can make own script with wget command:
|
On linux systems if wget is in your path it can be wget="wget" or you can make own script with wget command:
|
||||||
wget="/path/to/script/wget.sh"
|
wget="/path/to/script/wget.sh"
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
-->
|
-->
|
||||||
<!-- zoomWaySmoothness - 1-4, typical mapZooms - 8-10;11-12;13-14;15 -->
|
<!-- zoomWaySmoothness - 1-4, typical mapZooms - 8-10;11-12;13-14;15 -->
|
||||||
<process directory_for_osm_files=".work/osm" directory_for_index_files="/var/lib/jenkins/indexes" directory_for_generation=".work"
|
<process directory_for_osm_files=".work/osm" directory_for_index_files="/var/lib/jenkins/indexes" directory_for_generation=".work"
|
||||||
skipGeneratedIndexes="true" indexPOI="true" indexMap="true" indexTransport="true" indexAddress="true">
|
skipExistingIndexesAt="/var/lib/jenkins/indexes/uploaded" indexPOI="true" indexMap="true" indexTransport="true" indexAddress="true">
|
||||||
<!-- Add wget="C:/Program Files/GNUWin32/bin/wget.exe" to process, to use wget for download.
|
<!-- Add wget="C:/Program Files/GNUWin32/bin/wget.exe" to process, to use wget for download.
|
||||||
On linux systems if wget is in your path it can be wget="wget" or you can make own script with wget command:
|
On linux systems if wget is in your path it can be wget="wget" or you can make own script with wget command:
|
||||||
wget="/path/to/script/wget.sh"
|
wget="/path/to/script/wget.sh"
|
||||||
|
|
Loading…
Reference in a new issue