Package at.tuwien.minimee.util

Examples of at.tuwien.minimee.util.CommandExecutor


    public RunInfo run()  {
        RunInfo r = new RunInfo();
   
        log.debug("running tool: "+command);
        CommandExecutor cmdExecutor = new CommandExecutor();    
        if (workingDir != null) {
            cmdExecutor.setWorkingDirectory(workingDir);
        }
        long startTime = System.nanoTime();
        try {
            int exitStatus = cmdExecutor.runCommand(command);
            r.setSuccess(exitStatus == 0);
            r.setReport(cmdExecutor.getCommandError());
           
            if (r.isSuccess() && "".equals(r.getReport())) {
                String report = cmdExecutor.getCommandOutput();
                if ("".equals(report)) {
                    r.setReport("Successfully executed command.");
                } else {
                    r.setReport(report);
                }
View Full Code Here


    }

    public Double evaluate(String tempDir, String file1, String file2, String metric) {
        String commandTemplate = compareCommand.replace("%FILE1%", file1).replace("%FILE2%", file2);

        CommandExecutor cmdEx = new CommandExecutor();
        cmdEx.setWorkingDirectory(OS.getTmpPath());
        String command = commandTemplate.replace("%METRIC%", metric);
        try {
            cmdEx.runCommand(command);
            String out = cmdEx.getCommandError();
            log.debug(command + " == " + out);
            Double value = Scale.MAX_VALUE;

            try {
                if (out.contains(" ")) {
                    out = out.substring(0, out.indexOf(" "));
                }
                value = Double.valueOf(out.trim());
            } catch (NumberFormatException e) {
                log.error("unknown numberformat: " + out + " " + e.getMessage());
            }
            return value;
        } catch (Exception e) {
            log.error("error during image comparison " + command + " : " + cmdEx.getCommandError(), e);
            return null;
        }
    }
View Full Code Here

TOP

Related Classes of at.tuwien.minimee.util.CommandExecutor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.