@Override public void exportTable(Connection connection, String tableReference, File fileName, ProgressVisitor progress) throws SQLException, IOException{ exportTable(connection,tableReference, fileName,progress, null); }
@Override public void importFile(Connection connection, String tableReference, File fileName, ProgressVisitor progress, String options) throws SQLException, IOException { importFile(connection, tableReference, fileName, progress); }
/** * Read the GeoJSON file. * * @param connection * @param fileName * @param tableReference * @throws IOException * @throws SQLException */ public static void readGeoJson(Connection connection, String fileName, String tableReference) throws IOException, SQLException { GeoJsonDriverFunction gjdf = new GeoJsonDriverFunction(); gjdf.importFile(connection, tableReference, URIUtilities.fileFromString(fileName), new EmptyProgressVisitor()); } }
/** * Write the GeoJSON file. * * @param connection * @param fileName * @param tableReference * @throws IOException * @throws SQLException */ public static void writeGeoJson(Connection connection, String fileName, String tableReference) throws IOException, SQLException { GeoJsonDriverFunction gjdf = new GeoJsonDriverFunction(); gjdf.exportTable(connection, tableReference, URIUtilities.fileFromString(fileName), new EmptyProgressVisitor()); } }
@Override public void start(BundleContext bc) { for(Function function : H2GISFunctions.getBuiltInsFunctions()) { bc.registerService(Function.class, function, null); if(function instanceof DriverFunction) { bc.registerService(DriverFunction.class, (DriverFunction) function, null); } } //Driver registering bc.registerService(DriverFunction.class, new DBFDriverFunction(), null); bc.registerService(DriverFunction.class, new SHPDriverFunction(), null); bc.registerService(DriverFunction.class, new GPXDriverFunction(), null); bc.registerService(DriverFunction.class, new GeoJsonDriverFunction(), null); bc.registerService(DriverFunction.class, new OSMDriverFunction(), null); bc.registerService(DriverFunction.class, new KMLDriverFunction(), null); bc.registerService(DriverFunction.class, new CSVDriverFunction(), null); bc.registerService(DriverFunction.class, new TSVDriverFunction(), null); DataSourceTracker dataSourceTracker = new DataSourceTracker(bc); databaseTracker = new ServiceTracker<>(bc,DataSource.class,dataSourceTracker); databaseTracker.open(); }
/** * Read the GeoJSON file. * * @param connection * @param fileName * @param tableReference * @throws IOException * @throws SQLException */ public static void readGeoJson(Connection connection, String fileName, String tableReference) throws IOException, SQLException { GeoJsonDriverFunction gjdf = new GeoJsonDriverFunction(); gjdf.importFile(connection, tableReference, URIUtilities.fileFromString(fileName), new EmptyProgressVisitor()); } }
/** * Write the GeoJSON file. * * @param connection * @param fileName * @param tableReference * @throws IOException * @throws SQLException */ public static void writeGeoJson(Connection connection, String fileName, String tableReference) throws IOException, SQLException { GeoJsonDriverFunction gjdf = new GeoJsonDriverFunction(); gjdf.exportTable(connection, tableReference, URIUtilities.fileFromString(fileName), new EmptyProgressVisitor()); } }
/** * Read the GeoJSON file. * * @param connection * @param fileName * @param tableReference * @throws IOException * @throws SQLException */ public static void readGeoJson(Connection connection, String fileName, String tableReference) throws IOException, SQLException { GeoJsonDriverFunction gjdf = new GeoJsonDriverFunction(); gjdf.importFile(connection, tableReference, URIUtilities.fileFromString(fileName), new EmptyProgressVisitor()); } }
/** * Write the GeoJSON file. * * @param connection * @param fileName * @param tableReference * @param encoding * @throws IOException * @throws SQLException */ public static void writeGeoJson(Connection connection, String fileName, String tableReference, String encoding) throws IOException, SQLException { GeoJsonDriverFunction geoJsonDriver = new GeoJsonDriverFunction(); geoJsonDriver.exportTable(connection,tableReference, URIUtilities.fileFromString(fileName), new EmptyProgressVisitor(),encoding); }
@Override public void importFile(Connection connection, String tableReference, File fileName, ProgressVisitor progress, boolean deleteTables) throws SQLException, IOException { if(deleteTables) { final boolean isH2 = JDBCUtilities.isH2DataBase(connection.getMetaData()); TableLocation requestedTable = TableLocation.parse(tableReference, isH2); String table = requestedTable.getTable(); Statement stmt = connection.createStatement(); stmt.execute("DROP TABLE IF EXISTS " + table); stmt.close(); } importFile(connection, tableReference, fileName, progress); } }