Class<?> [] classParm = null;
Object [] objectParm = null;
Class<?> cl = Class.forName(migration);
java.lang.reflect.Constructor<?> co = cl.getConstructor(classParm);
// there will be a cast exception if the object does not implement Migration
Migration mg = (Migration) co.newInstance(objectParm);
// call the 'migrate_up' or down method as appropriate,
// which every class of type Migration must support.
if (direction.equals("down")) {
logger.info("migrating down: " + mg);
res = mg.migrate_down(cursor, range, params);
cursor = res.get("cursor");
}
else {
logger.info("migrating up: " + mg);
res = mg.migrate_up(cursor, range, params);
cursor = res.get("cursor");
}
if (cursor != null) {
Queue queue = QueueFactory.getDefaultQueue();
TaskOptions topt = TaskOptions.Builder.url("/migration");