package osm.jp.api; import java.io.File; import java.sql.Connection; import java.util.ArrayList; import jp.co.areaweb.tools.database.DatabaseTool; import osm.jp.postgis.CoverageAll; public abstract class Coverage { public static final String DB_PORP_GISDB = "gisdb"; public static final String DB_PORP_LOCALDB = "database"; public static void output(File dir, String tableName, String comment) throws Exception { output(dir, tableName, tableName.toLowerCase(), comment, null); } public static void output(File dir, String tableName, String name, String comment, String where) throws Exception { File outputFileCsv = new File(dir, "coverage."+ name +".csv"); File outputFileJson = new File(dir, "coverage."+ name +".json"); CoverageAll obj = new CoverageAll(new File(dir, "pbfDate.json")); obj.setTablename(tableName); obj.setData(new ArrayList<>()); Connection conPost = DatabaseTool.openDb(DB_PORP_GISDB); Connection conHsql = DatabaseTool.openDb(DB_PORP_LOCALDB); try { obj.load(conPost, conHsql, tableName, where); obj.outputCSV(outputFileCsv); obj.outputJson(outputFileJson, comment); } finally { DatabaseTool.closeDb(conHsql); DatabaseTool.closeDb(conPost); } } }