void run(ImportTask task) throws IOException { if (task.getState() == ImportTask.State.COMPLETE) { return; } task.setState(ImportTask.State.RUNNING); if (task.isDirect()) { // direct import, simply add configured store and layers to catalog doDirectImport(task); } else { // indirect import, read data from the source and into the target store doIndirectImport(task); } }
void run(ImportTask task) throws IOException { if (task.getState() == ImportTask.State.COMPLETE) { return; } task.setState(ImportTask.State.RUNNING); if (task.isDirect()) { //direct import, simply add configured store and layers to catalog doDirectImport(task); } else { //indirect import, read data from the source and into the target datastore doIndirectImport(task); } }
@Test public void testImportNoCrsLatLonBoundingBox() throws Exception { File dir = unpack("shape/archsites_no_crs.zip"); ImportContext context = importer.createContext(new Directory(dir)); assertEquals(1, context.getTasks().size()); ImportTask task = context.getTasks().get(0); assertEquals(ImportTask.State.NO_CRS, task.getState()); task.getLayer().getResource().setSRS("EPSG:26713"); importer.changed(task); assertEquals(ImportTask.State.READY, task.getState()); ResourceInfo r = task.getLayer().getResource(); assertNotNull(r.getLatLonBoundingBox()); assertNotNull(r.boundingBox()); assertNotNull(r.boundingBox().getCoordinateReferenceSystem()); assertEquals("EPSG:26713", CRS.toSRS(r.boundingBox().getCoordinateReferenceSystem())); // Do the import, verify the changed CRS is preserved when the bounds are calculated importer.doDirectImport(task); assertEquals(ImportTask.State.COMPLETE, task.getState()); r = task.getLayer().getResource(); assertNotNull(r.getLatLonBoundingBox()); assertNotEquals(VectorFormat.EMPTY_BOUNDS, r.getLatLonBoundingBox()); assertNotNull(r.boundingBox()); assertNotEquals(VectorFormat.EMPTY_BOUNDS, r.boundingBox()); assertNotNull(r.boundingBox().getCoordinateReferenceSystem()); assertEquals("EPSG:26713", CRS.toSRS(r.boundingBox().getCoordinateReferenceSystem())); }