use of org.openstreetmap.osmosis.apidb.v0_6.impl.SchemaVersionValidator in project osmosis by openstreetmap.
the class ApidbFileReplicator 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) {
Replicator replicator;
ReplicationSource source;
TransactionManager txnSnapshotLoader;
SystemTimeLoader systemTimeLoader;
new SchemaVersionValidator(loginCredentials, preferences).validateVersion(ApidbVersionConstants.SCHEMA_MIGRATIONS);
source = new AllEntityDao(dbCtx.getJdbcTemplate());
txnSnapshotLoader = new TransactionDao(dbCtx);
systemTimeLoader = new TimeDao(dbCtx.getJdbcTemplate());
replicator = new Replicator(source, changeSink, txnSnapshotLoader, systemTimeLoader, iterations, minInterval, maxInterval);
replicator.replicate();
}
use of org.openstreetmap.osmosis.apidb.v0_6.impl.SchemaVersionValidator in project osmosis by openstreetmap.
the class ApidbChangeReader 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;
changeSink.initialize(Collections.<String, Object>emptyMap());
new SchemaVersionValidator(loginCredentials, preferences).validateVersion(ApidbVersionConstants.SCHEMA_MIGRATIONS);
entityDao = new AllEntityDao(dbCtx.getJdbcTemplate());
try (ReleasableIterator<ChangeContainer> reader = entityDao.getHistory(intervalBegin, intervalEnd)) {
ReleasableIterator<ChangeContainer> i;
if (fullHistory) {
i = reader;
} else {
i = new DeltaToDiffReader(reader);
}
while (i.hasNext()) {
changeSink.process(i.next());
}
}
changeSink.complete();
} finally {
changeSink.close();
}
}
use of org.openstreetmap.osmosis.apidb.v0_6.impl.SchemaVersionValidator in project osmosis by openstreetmap.
the class ApidbCurrentReader 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 = entityDao.getCurrent()) {
while (reader.hasNext()) {
sink.process(reader.next());
}
}
sink.complete();
} finally {
sink.close();
}
}
use of org.openstreetmap.osmosis.apidb.v0_6.impl.SchemaVersionValidator 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