Update batch creation mechanism
This commit is contained in:
parent
9bc1131a3e
commit
50eaa9b337
3 changed files with 20 additions and 7 deletions
BIN
DataExtractionOSM/lib/jsch-20120101.jar
Normal file
BIN
DataExtractionOSM/lib/jsch-20120101.jar
Normal file
Binary file not shown.
|
@ -38,6 +38,7 @@ import javax.xml.parsers.ParserConfigurationException;
|
||||||
|
|
||||||
import net.osmand.Algoritms;
|
import net.osmand.Algoritms;
|
||||||
import net.osmand.LogUtil;
|
import net.osmand.LogUtil;
|
||||||
|
import net.osmand.Version;
|
||||||
import net.osmand.binary.BinaryMapIndexReader;
|
import net.osmand.binary.BinaryMapIndexReader;
|
||||||
import net.osmand.data.IndexConstants;
|
import net.osmand.data.IndexConstants;
|
||||||
import net.osmand.data.index.ExtractGooglecodeAuthorization.GooglecodeUploadTokens;
|
import net.osmand.data.index.ExtractGooglecodeAuthorization.GooglecodeUploadTokens;
|
||||||
|
@ -542,7 +543,12 @@ public class IndexBatchCreator {
|
||||||
FileHandler fh = null;
|
FileHandler fh = null;
|
||||||
// configure log path
|
// configure log path
|
||||||
try {
|
try {
|
||||||
fh = new FileHandler(new File(workDir, mapFileName+".gen.log").getAbsolutePath(), 5000000, 1, true);
|
File fs = new File(workDir, mapFileName+".gen.log");
|
||||||
|
FileOutputStream fout = new FileOutputStream(fs);
|
||||||
|
fout.write((new Date() + "\n").getBytes());
|
||||||
|
fout.write((Version.APP_MAP_CREATOR_FULL_NAME+"\n").getBytes());
|
||||||
|
fout.close();
|
||||||
|
fh = new FileHandler(fs.getAbsolutePath(), 5000000, 1, false);
|
||||||
fh.setFormatter(new SimpleFormatter());
|
fh.setFormatter(new SimpleFormatter());
|
||||||
fh.setLevel(Level.ALL);
|
fh.setLevel(Level.ALL);
|
||||||
Jdk14Logger jdk14Logger = new Jdk14Logger("tempLogger");
|
Jdk14Logger jdk14Logger = new Jdk14Logger("tempLogger");
|
||||||
|
|
|
@ -57,8 +57,9 @@ public class IndexZipper {
|
||||||
}
|
}
|
||||||
|
|
||||||
private File directory;
|
private File directory;
|
||||||
|
private File targetDirectory;
|
||||||
|
|
||||||
public IndexZipper(String path) throws IndexZipperException {
|
public IndexZipper(String path, String targetPath) throws IndexZipperException {
|
||||||
directory = new File(path);
|
directory = new File(path);
|
||||||
if (!directory.isDirectory()) {
|
if (!directory.isDirectory()) {
|
||||||
throw new IndexZipperException("Not a directory:" + path);
|
throw new IndexZipperException("Not a directory:" + path);
|
||||||
|
@ -106,7 +107,8 @@ public class IndexZipper {
|
||||||
String fileName = unzipped.getName();
|
String fileName = unzipped.getName();
|
||||||
String n = fileName;
|
String n = fileName;
|
||||||
if (fileName.endsWith(".odb")) {
|
if (fileName.endsWith(".odb")) {
|
||||||
n = fileName.substring(0, fileName.length() - 4);
|
throw new UnsupportedOperationException("Odb is not supported any more");
|
||||||
|
// n = fileName.substring(0, fileName.length() - 4);
|
||||||
}
|
}
|
||||||
return n + ".zip";
|
return n + ".zip";
|
||||||
}
|
}
|
||||||
|
@ -198,21 +200,26 @@ public class IndexZipper {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
try {
|
try {
|
||||||
IndexZipper indexZipper = new IndexZipper(extractDirectory(args));
|
String srcPath = extractDirectory(args, 0);
|
||||||
|
String targetPath = srcPath;
|
||||||
|
if(args.length > 1) {
|
||||||
|
targetPath = extractDirectory(args, 1);
|
||||||
|
}
|
||||||
|
IndexZipper indexZipper = new IndexZipper(srcPath, targetPath);
|
||||||
indexZipper.run();
|
indexZipper.run();
|
||||||
} catch (IndexZipperException e) {
|
} catch (IndexZipperException e) {
|
||||||
log.error(e.getMessage());
|
log.error(e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String extractDirectory(String[] args)
|
private static String extractDirectory(String[] args, int ind)
|
||||||
throws IndexZipperException {
|
throws IndexZipperException {
|
||||||
if (args.length > 0) {
|
if (args.length > ind) {
|
||||||
if ("-h".equals(args[0])) {
|
if ("-h".equals(args[0])) {
|
||||||
throw new IndexZipperException(
|
throw new IndexZipperException(
|
||||||
"Usage: IndexZipper [directory] (if not specified, the current one will be taken)");
|
"Usage: IndexZipper [directory] (if not specified, the current one will be taken)");
|
||||||
} else {
|
} else {
|
||||||
return args[0];
|
return args[ind];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ".";
|
return ".";
|
||||||
|
|
Loading…
Reference in a new issue