public void execute() throws Exception { getNewCount(); File executable = new File(getEXEPath()); if (!executable.exists()) throw new FileNotFoundException("executable file does not exist! " + executable); workingDir = getWorkingDirectory(executable); initExecution(); instruction = getInstructionFileName(workingDir); output = getOutputFileName(workingDir); createInstructionFile(instruction); // Profiler pofiler = new Profiler(); // profiler.start("exec-ilink-search " + xmlFileName, "exec-ilink-search " + xmlFileName); ExecShell shell = new ExecShell(); shell.setExecutable(executable.getAbsolutePath()); shell.setWorkingDirectory(workingDir); setArguments(shell); shell.addCommandLineArgument(executable.getParent()); shell.execute(); // profiler.start("exec-ilink-search " + xmlFileName, "shell-wait-for"); exitCode = shell.timeout(timeout); // profiler.stop("exec-ilink-search " + xmlFileName, "shell-wait-for"); // instructionFile.delete(); handleResponse(output); finishExecution(); if (zws.Server.debugMode()) return; // cleanup File[] contents = workingDir.listFiles(); for (int idx = 0; idx < contents.length; contents[idx++].delete()) ; workingDir.delete(); }
private void execExtractor() throws Exception { ExecShell shell = new ExecShell(); File f = new File(Config.getProperty(Config.EXE_ILINK_SEARCH)); if (!f.exists()) throw new Exception( "executable file does not exist! " + Config.getProperty(Config.EXE_ILINK_SEARCH)); shell.setExecutable(f.getAbsolutePath()); shell.setWorkingDirectory(f.getParent()); shell.addCommandLineArgument(criteria); shell.addCommandLineArgument(String.valueOf(maxCount)); shell.addCommandLineArgument(releaseLevel); shell.addCommandLineArgument(metadataSpec); shell.addCommandLineArgument(username); shell.addCommandLineArgument(password); shell.addCommandLineArgument(outputFile); shell.addCommandLineArgument(proiTkEnv); shell.execute(); exitCode = shell.waitFor(); }