示例#1
0
  /**
   * Construct a {@link SubProcessHeavy SubProcessHeavy} instance which when executed will fulfill
   * the given action agenda.
   *
   * <p>
   *
   * @param agenda The agenda to be accomplished by the action.
   * @param outFile The file to which all STDOUT output is redirected.
   * @param errFile The file to which all STDERR output is redirected.
   * @return The SubProcess which will fulfill the agenda.
   * @throws PipelineException If unable to prepare a SubProcess due to illegal, missing or
   *     imcompatable information in the action agenda or a general failure of the prep method code.
   */
  public SubProcessHeavy prep(ActionAgenda agenda, File outFile, File errFile)
      throws PipelineException {
    /* create the process to run the action */
    try {
      ArrayList<String> args = new ArrayList<String>();

      for (File file : agenda.getPrimaryTarget().getFiles()) args.add(file.toString());

      for (FileSeq fseq : agenda.getSecondaryTargets()) {
        for (File file : fseq.getFiles()) args.add(file.toString());
      }

      return new SubProcessHeavy(
          agenda.getNodeID().getAuthor(),
          getName() + "-" + agenda.getJobID(),
          "touch",
          args,
          agenda.getEnvironment(),
          agenda.getWorkingDir(),
          outFile,
          errFile);
    } catch (Exception ex) {
      throw new PipelineException(
          "Unable to generate the SubProcess to perform this Action!\n" + ex.getMessage());
    }
  }
  /**
   * Launch GIMP with a script which will compare the given two images using layers.
   *
   * <p>
   *
   * @param fileA The absolute path to the first file.
   * @param fileB The absolute path to the second file.
   * @param env The environment under which the comparator is run.
   * @param dir The working directory where the comparator is run.
   * @return The controlling <CODE>SubProcessLight</CODE> instance.
   * @throws PipelineException If unable to launch the comparator.
   * @see SubProcessLight
   */
  public SubProcessLight launch(File fileA, File fileB, Map<String, String> env, File dir)
      throws PipelineException {
    ArrayList<String> args = new ArrayList<String>();
    args.add(fileA.toString());
    args.add("-compare");
    args.add(fileB.toString());

    SubProcessLight proc = new SubProcessLight(getName(), getProgram(), args, env, dir);
    proc.start();

    return proc;
  }