NodeResolver dir = new DbDirectory(hive.getPartitionDimension(), getDataSource(getConnectString(getHiveDatabaseName())));
PartitionKeyMover<String> pMover = new PrimaryMover(origin.getUri());
// This mover just craps out on delete
Mover<Integer> failingMover = new Mover<Integer>() {
public void copy(Integer item, Node node) {
SimpleJdbcDaoSupport dao = new SimpleJdbcDaoSupport();
dao.setDataSource(CachingDataSourceProvider.getInstance().getDataSource(node.getUri()));
dao.getJdbcTemplate().update("insert into secondary_table values (?)", new Object[]{item});
}
public void delete(Integer item, Node node) {
throw new RuntimeException("Ach!");
}
public Integer get(Object id, Node node) {
SimpleJdbcDaoSupport dao = new SimpleJdbcDaoSupport();
dao.setDataSource(CachingDataSourceProvider.getInstance().getDataSource(node.getUri()));
return dao.getJdbcTemplate().queryForInt("select id from secondary_table where id = ?", new Object[]{id});
}
};
Migrator m = new HiveMigrator(hive);
pMover.getDependentMovers().clear();