Search in sources :

Example 1 with SpatiaLiteInstanceReader

use of eu.esdihumboldt.hale.io.jdbc.spatialite.reader.internal.SpatiaLiteInstanceReader in project hale by halestudio.

the class SpatiaLiteTestSuite method readInstances.

/**
 * Reads instances from from a SpatiaLite database file with the provided
 * schema.
 *
 * @param sourceSchema the schema of the source database
 * @param sourceFilePath the path to the source database file
 * @return the read instances
 * @throws Exception any exception thrown by
 *             {@link SpatiaLiteInstanceReader}
 */
public InstanceCollection readInstances(Schema sourceSchema, String sourceFilePath) throws Exception {
    SpatiaLiteInstanceReader instanceReader = new SpatiaLiteInstanceReader();
    instanceReader.setSource(new FileIOSupplier(new File(sourceFilePath)));
    instanceReader.setSourceSchema(sourceSchema);
    // Test instances
    IOReport report = instanceReader.execute(new LogProgressIndicator());
    assertTrue("Data import was not successfull.", report.isSuccess());
    return instanceReader.getInstances();
}
Also used : SpatiaLiteInstanceReader(eu.esdihumboldt.hale.io.jdbc.spatialite.reader.internal.SpatiaLiteInstanceReader) IOReport(eu.esdihumboldt.hale.common.core.io.report.IOReport) FileIOSupplier(eu.esdihumboldt.hale.common.core.io.supplier.FileIOSupplier) LogProgressIndicator(eu.esdihumboldt.hale.common.core.io.impl.LogProgressIndicator) File(java.io.File)

Aggregations

LogProgressIndicator (eu.esdihumboldt.hale.common.core.io.impl.LogProgressIndicator)1 IOReport (eu.esdihumboldt.hale.common.core.io.report.IOReport)1 FileIOSupplier (eu.esdihumboldt.hale.common.core.io.supplier.FileIOSupplier)1 SpatiaLiteInstanceReader (eu.esdihumboldt.hale.io.jdbc.spatialite.reader.internal.SpatiaLiteInstanceReader)1 File (java.io.File)1