use of eu.esdihumboldt.hale.io.jdbc.spatialite.writer.internal.SpatiaLiteInstanceWriter in project hale by halestudio.
the class SpatiaLiteTestSuite method writeInstances.
/**
* Writes the provided instances to a SpatiaLite database.
*
* @param schema the target schema
* @param targetFilePath the path to the target database file
* @param instances the instances to write
* @throws Exception any exception thrown by
* {@link SpatiaLiteInstanceWriter}
*/
public void writeInstances(Schema schema, String targetFilePath, InstanceCollection instances) throws Exception {
SpatiaLiteInstanceWriter instanceWriter = new SpatiaLiteInstanceWriter();
instanceWriter.setInstances(instances);
DefaultSchemaSpace ss = new DefaultSchemaSpace();
ss.addSchema(schema);
instanceWriter.setTargetSchema(ss);
instanceWriter.setTarget(new FileIOSupplier(new File(targetFilePath)));
// Test instances
IOReport report = instanceWriter.execute(new LogProgressIndicator());
assertTrue("Data export was not successfull.", report.isSuccess());
}
Aggregations