コード例 #1
0
  /*
   * This method accesses the functionality of the wrapped executable. In this example, the exectuable takes
   * three params (param1, param2, and param3). You can extend this to take as many parameters as necessary. This
   * examples assume that the executable takes an input file path and an output file path, where the result will be written.
   */
  public String transform() {
    String FileNameRandomString = AbstractOperatorFileUtils.getRandomString();
    String h5FileName = "Mesh" + FileNameRandomString + ".h5";
    String xmfFileName = "Mesh" + FileNameRandomString + ".xmf";

    // The command string that will be passed to the shell
    String cmd = "/share/apps/cmmf/h5WriteMesh " + h5FileName;
    CommandRunner.run(cmd, AbstractOperatorFileUtils.getWorkspace());

    cmd = "/share/apps/cmmf/h5WriteXmfMesh " + h5FileName + " " + xmfFileName;
    CommandRunner.run(cmd, AbstractOperatorFileUtils.getWorkspace());

    return AbstractOperatorFileUtils.getOutputURLPrefix() + xmfFileName;
  }
コード例 #2
0
ファイル: PDFConverter.java プロジェクト: adelfi43/visko
  public String transform() {
    try {

      String commandString =
          "\"" + convertexe + "\" " + inputDatasetURL + " \"" + outputPath + "\"";

      int exitVal = CommandRunner.run(commandString);

      /*
      String array[] = { convertexe, inputDatasetURL, outputPath };
      Runtime rt = Runtime.getRuntime();
      Process pr = rt.exec(array);
      BufferedReader input = new BufferedReader(new InputStreamReader(pr.getInputStream()));
      String line = null;

      while ((line = input.readLine()) != null)
      	System.out.println(line);

      int exitVal = pr.waitFor();*/
      if (exitVal == 0) {
        System.out.println("Done.");
      } else {
        System.out.println("Program terminated with an error " + exitVal);
      }
    } catch (Exception e) {
      System.out.println(e.toString());
      e.printStackTrace();
    }
    return outputURL;
  }