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.LogUtil;
|
||||
import net.osmand.Version;
|
||||
import net.osmand.binary.BinaryMapIndexReader;
|
||||
import net.osmand.data.IndexConstants;
|
||||
import net.osmand.data.index.ExtractGooglecodeAuthorization.GooglecodeUploadTokens;
|
||||
|
@ -542,7 +543,12 @@ public class IndexBatchCreator {
|
|||
FileHandler fh = null;
|
||||
// configure log path
|
||||
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.setLevel(Level.ALL);
|
||||
Jdk14Logger jdk14Logger = new Jdk14Logger("tempLogger");
|
||||
|
|
|
@ -57,8 +57,9 @@ public class IndexZipper {
|
|||
}
|
||||
|
||||
private File directory;
|
||||
private File targetDirectory;
|
||||
|
||||
public IndexZipper(String path) throws IndexZipperException {
|
||||
public IndexZipper(String path, String targetPath) throws IndexZipperException {
|
||||
directory = new File(path);
|
||||
if (!directory.isDirectory()) {
|
||||
throw new IndexZipperException("Not a directory:" + path);
|
||||
|
@ -106,7 +107,8 @@ public class IndexZipper {
|
|||
String fileName = unzipped.getName();
|
||||
String n = fileName;
|
||||
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";
|
||||
}
|
||||
|
@ -198,21 +200,26 @@ public class IndexZipper {
|
|||
|
||||
public static void main(String[] args) {
|
||||
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();
|
||||
} catch (IndexZipperException e) {
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private static String extractDirectory(String[] args)
|
||||
private static String extractDirectory(String[] args, int ind)
|
||||
throws IndexZipperException {
|
||||
if (args.length > 0) {
|
||||
if (args.length > ind) {
|
||||
if ("-h".equals(args[0])) {
|
||||
throw new IndexZipperException(
|
||||
"Usage: IndexZipper [directory] (if not specified, the current one will be taken)");
|
||||
} else {
|
||||
return args[0];
|
||||
return args[ind];
|
||||
}
|
||||
}
|
||||
return ".";
|
||||
|
|
Loading…
Reference in a new issue