if (args.length == 1) {
url = args[0];
}
JGDI jgdi = JGDIFactory.newInstance(url);
List<JGDIAnswer> answers = new LinkedList<JGDIAnswer>();
try {
System.out.println("Successfully connected to " + url);
// Create a new checkpoint object which intialized with default values
Checkpoint ckpt = ConfigurationFactory.createCheckpointWithDefaults();
ckpt.setName("sample");
ckpt.setCkptCommand("/usr/bin/ckpt");
ckpt.setCkptDir("/tmp");
jgdi.addCheckpointWithAnswer(ckpt, answers);
for (JGDIAnswer a : answers) {
System.out.println(a.getText());
}
try {
ckpt = jgdi.getCheckpoint(ckpt.getName());
ckpt.setRestCommand("/tmp/blubber");
jgdi.updateCheckpointWithAnswer(ckpt, answers);
for (JGDIAnswer a : answers) {
System.out.println(a.getText());
}
} finally {
jgdi.deleteCheckpointWithAnswer(ckpt.getName(), answers);
for (JGDIAnswer a : answers) {
System.out.println(a.getText());
}
}
} finally {
jgdi.close();
}
} catch (JGDIException e) {
e.printStackTrace();
}