File modelFile;
try {
monitor.subTask("Exporting model to XMI");
modelFile = saveToFile(model, "test.iaml");
} catch (IOException e1) {
throw new VerificationException(e1);
}
monitor.worked(1);
// now generate it
monitor.subTask("Generating SMV template using OAW");
IStatus status = gen.generateCode(modelFile, getWorkflowFile());
if (!status.isOK()) {
throw new VerificationException("Generation was not successful: " + status.getMessage(), status.getException());
}
monitor.worked(2);
// load the file we wrote
monitor.subTask("Loading generated template");
File output = new File(getOutputFile());
if (!output.exists()) {
throw new VerificationException("File '" + output + "' does not exist.");
}
// open it as an input stream
try {
return new BufferedInputStream(new FileInputStream(output));
} catch (FileNotFoundException e) {
throw new VerificationException(e);
}
} finally {
monitor.done();
}