Package eu.scape_project.planning.utils

Examples of eu.scape_project.planning.utils.CommandExecutor


   
    public String characterise(File input) throws PlanningException{
        if (FITS_HOME == null) {
            throw new PlanningException("FITS is not properly configured (FITS_HOME is not defined).");
        }
        CommandExecutor cmdExecutor = new CommandExecutor();
        cmdExecutor.setWorkingDirectory(FITS_HOME);
        String scriptExt;
        if ("Linux".equalsIgnoreCase(System.getProperty("os.name"))){
            scriptExt = "./fits.sh";
        } else {
            scriptExt = "cmd /c %FITS_HOME%/fits";
        }
        File output = new File(OS.getTmpPath() + "fits"+System.nanoTime()+".out");
        try {
            String commandLine = FITS_COMMAND.replace("%FITS_EXEC%", scriptExt)
                .replace("%INPUT%", input.getAbsolutePath())
                .replace("%OUTPUT%", output.getAbsolutePath());
           
            try {
                int exitcode = cmdExecutor.runCommand(commandLine);
                if (exitcode != 0) {
                    String cmdError = cmdExecutor.getCommandError();
                    throw new PlanningException("FITS characterisation for file: " + input + " failed: " + cmdError);
                }
                if (!output.exists()) {
                    throw new PlanningException("FITS characterisation for file: " + input + " failed: no output was written.");
                }
View Full Code Here

TOP

Related Classes of eu.scape_project.planning.utils.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.