Remove deprecated scripts
This commit is contained in:
parent
2feef53dad
commit
01e49ed1db
3 changed files with 45 additions and 29 deletions
|
@ -85,6 +85,9 @@ public class IndexBatchCreator {
|
|||
boolean indexRouting = false;
|
||||
|
||||
private String wget;
|
||||
|
||||
private DBDialect osmDbDialect;
|
||||
private DBDialect mapDBDialect;
|
||||
|
||||
public static void main(String[] args) {
|
||||
IndexBatchCreator creator = new IndexBatchCreator();
|
||||
|
@ -241,7 +244,7 @@ public class IndexBatchCreator {
|
|||
String osmDbDialect = process.getAttribute("osmDbDialect");
|
||||
if(osmDbDialect != null && osmDbDialect.length() > 0){
|
||||
try {
|
||||
IndexCreator.dialect = DBDialect.valueOf(osmDbDialect.toUpperCase());
|
||||
this.osmDbDialect = DBDialect.valueOf(osmDbDialect.toUpperCase());
|
||||
} catch (RuntimeException e) {
|
||||
}
|
||||
}
|
||||
|
@ -249,7 +252,7 @@ public class IndexBatchCreator {
|
|||
String mapDbDialect = process.getAttribute("mapDbDialect");
|
||||
if (mapDbDialect != null && mapDbDialect.length() > 0) {
|
||||
try {
|
||||
IndexCreator.mapDBDialect = DBDialect.valueOf(mapDbDialect.toUpperCase());
|
||||
this.mapDBDialect = DBDialect.valueOf(mapDbDialect.toUpperCase());
|
||||
} catch (RuntimeException e) {
|
||||
}
|
||||
}
|
||||
|
@ -439,8 +442,12 @@ public class IndexBatchCreator {
|
|||
} else {
|
||||
rName = Algoritms.capitalizeFirstLetterAndLowercase(rName);
|
||||
}
|
||||
|
||||
DBDialect osmDb = this.osmDbDialect;
|
||||
if(f.length() / 1024 / 1024 > 300 && osmDb == DBDialect.SQLITE_IN_MEMORY) {
|
||||
osmDb = DBDialect.SQLITE;
|
||||
}
|
||||
IndexCreator indexCreator = new IndexCreator(workDir);
|
||||
indexCreator.setDialects(osmDb, this.mapDBDialect);
|
||||
indexCreator.setIndexAddress(indexAddress);
|
||||
indexCreator.setIndexPOI(indexPOI);
|
||||
indexCreator.setIndexTransport(indexTransport);
|
||||
|
|
|
@ -49,8 +49,8 @@ public class IndexCreator {
|
|||
// ONLY derby.jar needed for derby dialect
|
||||
// (NOSQL is the fastest but is supported only on linux 32)
|
||||
// Sqlite better to use only for 32-bit machines
|
||||
public static DBDialect dialect = DBDialect.SQLITE;
|
||||
public static DBDialect mapDBDialect = DBDialect.SQLITE;
|
||||
private DBDialect osmDBdialect = DBDialect.SQLITE;
|
||||
private DBDialect mapIndexDBDialect = DBDialect.SQLITE;
|
||||
public static boolean REMOVE_POI_DB = true;
|
||||
|
||||
public static final int BATCH_SIZE = 5000;
|
||||
|
@ -163,6 +163,15 @@ public class IndexCreator {
|
|||
public String getTempMapDBFileName() {
|
||||
return getMapFileName() + ".tmp"; //$NON-NLS-1$
|
||||
}
|
||||
|
||||
public void setDialects(DBDialect osmDBdialect, DBDialect mapIndexDBDialect) {
|
||||
if(osmDBdialect != null) {
|
||||
this.osmDBdialect = osmDBdialect;
|
||||
}
|
||||
if(mapIndexDBDialect != null) {
|
||||
this.mapIndexDBDialect = mapIndexDBDialect;
|
||||
}
|
||||
}
|
||||
|
||||
public Long getLastModifiedDate() {
|
||||
return lastModifiedDate;
|
||||
|
@ -268,7 +277,7 @@ public class IndexCreator {
|
|||
progress.setGeneralProgress("[15 / 100]"); //$NON-NLS-1$
|
||||
progress.startTask(Messages.getString("IndexCreator.LOADING_FILE") + readFile.getAbsolutePath(), -1); //$NON-NLS-1$
|
||||
// 1 init database to store temporary data
|
||||
dbCreator.initDatabase(dialect, dbConn);
|
||||
dbCreator.initDatabase(osmDBdialect, dbConn);
|
||||
storage.getFilters().add(dbCreator);
|
||||
if (pbfFile) {
|
||||
storage.parseOSMPbf(stream, progress, false);
|
||||
|
@ -276,7 +285,7 @@ public class IndexCreator {
|
|||
storage.parseOSM(stream, progress, streamFile, false);
|
||||
}
|
||||
dbCreator.finishLoading();
|
||||
dialect.commitDatabase(dbConn);
|
||||
osmDBdialect.commitDatabase(dbConn);
|
||||
|
||||
if (log.isInfoEnabled()) {
|
||||
log.info("File parsed : " + (System.currentTimeMillis() - st)); //$NON-NLS-1$
|
||||
|
@ -293,15 +302,15 @@ public class IndexCreator {
|
|||
private boolean createPlainOsmDb(IProgress progress, File readFile, IOsmStorageFilter addFilter, boolean deletePrevious) throws SQLException, FileNotFoundException, IOException, SAXException{
|
||||
// dbFile = new File(workingDir, TEMP_NODES_DB);
|
||||
// initialize db file
|
||||
boolean loadFromExistingFile = dbFile != null && dialect.databaseFileExists(dbFile) && !deletePrevious;
|
||||
boolean loadFromExistingFile = dbFile != null && osmDBdialect.databaseFileExists(dbFile) && !deletePrevious;
|
||||
if (dbFile == null || deletePrevious) {
|
||||
dbFile = new File(workingDir, TEMP_NODES_DB);
|
||||
// to save space
|
||||
if (dialect.databaseFileExists(dbFile)) {
|
||||
dialect.removeDatabase(dbFile);
|
||||
if (osmDBdialect.databaseFileExists(dbFile)) {
|
||||
osmDBdialect.removeDatabase(dbFile);
|
||||
}
|
||||
}
|
||||
dbConn = getDatabaseConnection(dbFile.getAbsolutePath(), dialect);
|
||||
dbConn = getDatabaseConnection(dbFile.getAbsolutePath(), osmDBdialect);
|
||||
int allRelations = 100000;
|
||||
int allWays = 1000000;
|
||||
int allNodes = 10000000;
|
||||
|
@ -313,7 +322,7 @@ public class IndexCreator {
|
|||
allRelations = dbCreator.getAllRelations();
|
||||
}
|
||||
} else {
|
||||
if (DBDialect.NOSQL != dialect) {
|
||||
if (DBDialect.NOSQL != osmDBdialect) {
|
||||
Connection dbc = (Connection) dbConn;
|
||||
final Statement stmt = dbc.createStatement();
|
||||
accessor.computeRealCounts(stmt);
|
||||
|
@ -323,7 +332,7 @@ public class IndexCreator {
|
|||
stmt.close();
|
||||
}
|
||||
}
|
||||
accessor.initDatabase(dbConn, dialect, allNodes, allWays, allRelations);
|
||||
accessor.initDatabase(dbConn, osmDBdialect, allNodes, allWays, allRelations);
|
||||
return loadFromExistingFile;
|
||||
}
|
||||
|
||||
|
@ -333,25 +342,25 @@ public class IndexCreator {
|
|||
// to save space
|
||||
mapFile.getParentFile().mkdirs();
|
||||
File tempDBMapFile = new File(workingDir, getTempMapDBFileName());
|
||||
mapDBDialect.removeDatabase(tempDBMapFile);
|
||||
mapConnection = (Connection) getDatabaseConnection(tempDBMapFile.getAbsolutePath(), mapDBDialect);
|
||||
mapIndexDBDialect.removeDatabase(tempDBMapFile);
|
||||
mapConnection = (Connection) getDatabaseConnection(tempDBMapFile.getAbsolutePath(), mapIndexDBDialect);
|
||||
mapConnection.setAutoCommit(false);
|
||||
|
||||
// 2.2 create rtree map
|
||||
if (indexMap) {
|
||||
indexMapCreator.createDatabaseStructure(mapConnection, mapDBDialect, getRTreeMapIndexNonPackFileName());
|
||||
indexMapCreator.createDatabaseStructure(mapConnection, mapIndexDBDialect, getRTreeMapIndexNonPackFileName());
|
||||
}
|
||||
if (indexRouting) {
|
||||
indexRouteCreator.createDatabaseStructure(mapConnection, mapDBDialect, getRTreeRouteIndexNonPackFileName());
|
||||
indexRouteCreator.createDatabaseStructure(mapConnection, mapIndexDBDialect, getRTreeRouteIndexNonPackFileName());
|
||||
}
|
||||
if (indexAddress) {
|
||||
indexAddressCreator.createDatabaseStructure(mapConnection, mapDBDialect);
|
||||
indexAddressCreator.createDatabaseStructure(mapConnection, mapIndexDBDialect);
|
||||
}
|
||||
if (indexPOI) {
|
||||
indexPoiCreator.createDatabaseStructure(new File(workingDir, getPoiFileName()));
|
||||
}
|
||||
if (indexTransport) {
|
||||
indexTransportCreator.createDatabaseStructure(mapConnection, mapDBDialect, getRTreeTransportStopsFileName());
|
||||
indexTransportCreator.createDatabaseStructure(mapConnection, mapIndexDBDialect, getRTreeTransportStopsFileName());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -481,7 +490,7 @@ public class IndexCreator {
|
|||
if (recreateOnlyBinaryFile) {
|
||||
mapFile = new File(workingDir, getMapFileName());
|
||||
File tempDBMapFile = new File(workingDir, getTempMapDBFileName());
|
||||
mapConnection = (Connection) getDatabaseConnection(tempDBMapFile.getAbsolutePath(), mapDBDialect);
|
||||
mapConnection = (Connection) getDatabaseConnection(tempDBMapFile.getAbsolutePath(), mapIndexDBDialect);
|
||||
mapConnection.setAutoCommit(false);
|
||||
try {
|
||||
if (indexMap) {
|
||||
|
@ -707,27 +716,27 @@ public class IndexCreator {
|
|||
mapConnection.close();
|
||||
mapConnection = null;
|
||||
File tempDBFile = new File(workingDir, getTempMapDBFileName());
|
||||
if (mapDBDialect.databaseFileExists(tempDBFile) && deleteDatabaseIndexes) {
|
||||
if (mapIndexDBDialect.databaseFileExists(tempDBFile) && deleteDatabaseIndexes) {
|
||||
// do not delete it for now
|
||||
mapDBDialect.removeDatabase(tempDBFile);
|
||||
mapIndexDBDialect.removeDatabase(tempDBFile);
|
||||
}
|
||||
}
|
||||
|
||||
// do not delete first db connection
|
||||
if (dbConn != null) {
|
||||
dialect.commitDatabase(dbConn);
|
||||
dialect.closeDatabase(dbConn);
|
||||
osmDBdialect.commitDatabase(dbConn);
|
||||
osmDBdialect.closeDatabase(dbConn);
|
||||
dbConn = null;
|
||||
}
|
||||
if (deleteOsmDB) {
|
||||
if (DBDialect.DERBY == dialect) {
|
||||
if (DBDialect.DERBY == osmDBdialect) {
|
||||
try {
|
||||
DriverManager.getConnection("jdbc:derby:;shutdown=true"); //$NON-NLS-1$
|
||||
} catch (SQLException e) {
|
||||
// ignore exception
|
||||
}
|
||||
}
|
||||
dialect.removeDatabase(dbFile);
|
||||
osmDBdialect.removeDatabase(dbFile);
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<batch_process>
|
||||
<process_attributes mapZooms="" renderingTypesFile="" zoomWaySmoothness="2"
|
||||
osmDbDialect="sqlite" mapDbDialect="sqlite"/>
|
||||
osmDbDialect="SQLITE_IN_MEMORY" mapDbDialect="SQLITE_IN_MEMORY"/>
|
||||
|
||||
<!-- There are 3 subprocess :
|
||||
1. Download fresh osm files from servers to 'directory_for_osm_files' (override existings).
|
||||
|
@ -12,8 +12,8 @@
|
|||
or you can upload any file you have to googlecode (just put into 'directory_for_index_files')
|
||||
-->
|
||||
<!-- zoomWaySmoothness - 1-4, typical mapZooms - 8-10;11-12;13-14;15 -->
|
||||
<process directory_for_osm_files=".work/osm" directory_for_index_files="/var/www-download/road-indexes" directory_for_generation=".work"
|
||||
skipExistingIndexesAt="/var/www-download/road-indexes/" indexPOI="false" indexMap="false" indexRouting="true" indexTransport="false" indexAddress="false">
|
||||
<process directory_for_osm_files=".work/osm" directory_for_index_files="/var/lib/jenkins/indexes" directory_for_generation=".work"
|
||||
skipExistingIndexesAt="/var/lib/jenkins/indexes/road-uploaded" indexPOI="false" indexMap="false" indexRouting="true" indexTransport="false" indexAddress="false">
|
||||
<!-- 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:
|
||||
wget="/path/to/script/wget.sh"
|
||||
|
|
Loading…
Reference in a new issue