use of org.openstreetmap.osmosis.apidb.v0_6.impl.EntitySnapshotReader in project osmosis by openstreetmap.
the class ApidbReader method runImpl.
/**
* Runs the task implementation. This is called by the run method within a transaction.
*
* @param dbCtx
* Used to access the database.
*/
protected void runImpl(DatabaseContext2 dbCtx) {
try {
AllEntityDao entityDao;
sink.initialize(Collections.<String, Object>emptyMap());
new SchemaVersionValidator(loginCredentials, preferences).validateVersion(ApidbVersionConstants.SCHEMA_MIGRATIONS);
entityDao = new AllEntityDao(dbCtx.getJdbcTemplate());
sink.process(new BoundContainer(new Bound("Osmosis " + OsmosisConstants.VERSION)));
try (ReleasableIterator<EntityContainer> reader = new EntitySnapshotReader(entityDao.getHistory(), snapshotInstant)) {
while (reader.hasNext()) {
sink.process(reader.next());
}
}
sink.complete();
} finally {
sink.close();
}
}
Aggregations