package com.intel.GPA; import java.io.File; import java.io.IOException; public class Extraction { public Extraction(File gpa_frame, Settings sett) { this.target = gpa_frame; EXTRACT_TOOL = sett.getBinDir() + "\\" + sett.getPlaybackTool(); OUT_FILE = sett.getWorkDir() + "\\" + target.getName(); } public boolean extract() { String[] query = { EXTRACT_TOOL, "-m", OUT_FILE, target.getName() }; try { Process p = Runtime.getRuntime().exec(query); thread = new Thread(new Daemon(Thread.currentThread()), "Daemon"); thread.setDaemon(true); thread.start(); if (p.waitFor() == 0) { return true; } else { return false; } } catch (InterruptedException e) { p.destroy(); log = e.getMessage(); return false; } catch (IOException e) { log = e.getMessage(); return false; } } public String getLog() { return this.log; } private class Daemon implements Runnable { public Daemon(Thread arg) { t = arg; } public void run() { try { Thread.sleep(60000); t.interrupt(); } catch (InterruptedException e) { e.printStackTrace(); } } private Thread t; } private Thread thread; private Process p; private File target = null; private String EXTRACT_TOOL = ""; private String OUT_FILE = ""; private String log = ""; }