1
package org.workcraft.plugins.interop;
4
import java.io.IOException;
6
import org.workcraft.plugins.shared.tasks.ExternalProcessResult;
7
import org.workcraft.plugins.shared.tasks.PunfTask;
8
import org.workcraft.tasks.Result;
9
import org.workcraft.tasks.TaskManager;
10
import org.workcraft.tasks.Result.Outcome;
12
// TODO: Merge with new Punf wrappers and remove this class
13
public class Unfolder {
14
public static void makeUnfolding(TaskManager taskManager, File original, File unfolding) throws IOException
16
PunfTask task = new PunfTask(original.getAbsolutePath(), unfolding.getAbsolutePath());
18
Result<? extends ExternalProcessResult> res = taskManager.execute(task, "Unfolding the Balsa circuit STG");
20
System.out.println("Unfolding output: ");
21
System.out.write(res.getReturnValue().getOutput());System.out.println();System.out.println("----------------------------------------");
23
byte[] errors = res.getReturnValue().getErrors();
27
System.out.println("Unfolding errors stream: ");
28
System.out.write(errors);System.out.println();System.out.println("----------------------------------------");
31
Outcome outcome = res.getOutcome();
35
throw new RuntimeException("Unfolding operation cancelled by user");
39
throw new RuntimeException("Punf failed: " + new String(res.getReturnValue().getErrors()), res.getCause());