Ejemplo n.º 1
0
  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();
  }
Ejemplo n.º 2
0
  public static AppConfig get(Class pAppClass, String pAppDir)
      throws DataNotFoundException, InvalidInputException, FileNotFoundException {

    AppConfig appConfig = null;
    if (null == pAppDir) {
      // we don't know where we are installed, so punt and look for
      // the config file as a class resource:
      appConfig = new AppConfig(pAppClass);
    } else {
      File appDirFile = new File(pAppDir);
      if (!appDirFile.exists()) {
        throw new DataNotFoundException("could not find application directory: " + pAppDir);
      }
      String configFileName =
          appDirFile.getAbsolutePath() + "/config/" + AppConfig.CONFIG_FILE_NAME;
      appConfig = new AppConfig(new File(configFileName));
    }
    return appConfig;
  }
Ejemplo n.º 3
0
 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();
 }
Ejemplo n.º 4
0
 protected String getOutputFileName(File f) {
   return f.getAbsolutePath() + Names.PATH_SEPARATOR + "response.xml";
 }
Ejemplo n.º 5
0
 protected String getInstructionFileName(File f) {
   return f.getAbsolutePath() + Names.PATH_SEPARATOR + "instruction.xml";
 }