コード例 #1
0
ファイル: SeadasFileUtils.java プロジェクト: seadas/seadas
  private static String retrieveOFileNameRemote(String[] cmdArray) {
    JsonArrayBuilder jab = Json.createArrayBuilder();
    for (String s : cmdArray) {
      jab.add(s);
    }

    // add jobId for server side database
    // jab.add(OCSSW.getJobId());
    JsonArray remoteCmdArray = jab.build();

    OCSSWClient ocsswClient = new OCSSWClient();
    WebTarget target = ocsswClient.getOcsswWebTarget();
    final Response response =
        target
            .path("ocssw")
            .path("computeNextLevelFileName")
            .path(OCSSW.getJobId())
            .request(MediaType.APPLICATION_JSON_TYPE)
            .post(Entity.entity(remoteCmdArray, MediaType.APPLICATION_JSON_TYPE));

    String ofileName =
        target
            .path("ocssw")
            .path("retrieveNextLevelFileName")
            .path(OCSSW.getJobId())
            .request(MediaType.TEXT_PLAIN)
            .get(String.class);
    if (ofileName != null) {
      return ofileName;
    } else {
      return "output";
    }
  }
コード例 #2
0
ファイル: OCSSWRunner.java プロジェクト: bcdev/seadas
  public static Process executeLocal(String[] cmdArray, File ifileDir) {
    // System.out.println("local execution!" + " "  + Arrays.toString(cmdArray) );
    ProcessBuilder processBuilder = new ProcessBuilder(cmdArray);
    Map<String, String> env = processBuilder.environment();
    if (!env.containsKey(OCSSW_ROOT_VAR) && OCSSW.isOCSSWExist()) {
      env.put(OCSSW_ROOT_VAR, OCSSW.getOcsswEnv());
    }
    if (ifileDir != null) {
      processBuilder.directory(ifileDir);
    } else {
      processBuilder.directory(getDefaultDir());
    }

    Process process = null;
    try {
      process = processBuilder.start();
      int exitValue = process.waitFor();
    } catch (Exception e) {
      VisatApp.getApp()
          .showErrorDialog(
              "OCSSW execution error from SeaDAS application! \n"
                  + cmdArray[0]
                  + "  program is not executed correctly.");
      e.printStackTrace();
    }
    return process;
  }
コード例 #3
0
ファイル: SeadasFileUtils.java プロジェクト: seadas/seadas
  private static String[] getCmdArrayForNextLevelNameFinder(String ifileName, String programName) {
    String[] cmdArray = new String[6];
    cmdArray[0] = OCSSW.getOcsswScriptPath();
    cmdArray[1] = "--ocsswroot";
    cmdArray[2] = OCSSW.getOcsswEnv();
    cmdArray[3] = NEXT_LEVEL_NAME_FINDER_PROGRAM_NAME;
    cmdArray[4] =
        RuntimeContext.getConfig()
                .getContextProperty(OCSSW.OCSSW_LOCATION_PROPERTY)
                .equals(OCSSW.SEADAS_OCSSW_LOCATION_LOCAL)
            ? ifileName
            : getIfileNameforRemoteServer(ifileName);

    cmdArray[5] = programName;
    return cmdArray;
  }
コード例 #4
0
ファイル: SeadasFileUtils.java プロジェクト: seadas/seadas
  public static String findNextLevelFileName(String ifileName, String programName, String suite) {
    if (ifileName == null || programName == null) {
      return null;
    }
    if (programName.equals("l3bindump")) {
      return ifileName + ".xml";
    }
    debug("Program name is " + programName);
    Debug.assertNotNull(ifileName);
    // todo Add suite, also check calling program the make sure ProcessorModel call is right

    String[] cmdArray = new String[6];
    cmdArray[0] = OCSSW.getOcsswScriptPath();
    cmdArray[1] = "--ocsswroot";
    cmdArray[2] = OCSSW.getOcsswEnv();
    cmdArray[3] = NEXT_LEVEL_NAME_FINDER_PROGRAM_NAME;
    cmdArray[4] =
        RuntimeContext.getConfig()
                .getContextProperty(OCSSW.OCSSW_LOCATION_PROPERTY)
                .equals(OCSSW.SEADAS_OCSSW_LOCATION_LOCAL)
            ? ifileName
            : getIfileNameforRemoteServer(ifileName);
    cmdArray[5] = programName;
    // cmdArray[6] = "--suite="+suite;

    String ifileDir =
        ifileName.substring(0, ifileName.lastIndexOf(System.getProperty("file.separator")));

    if (RuntimeContext.getConfig()
        .getContextProperty(OCSSW.OCSSW_LOCATION_PROPERTY)
        .equals(OCSSW.SEADAS_OCSSW_LOCATION_LOCAL)) {
      return retrieveOFileNameLocal(cmdArray, ifileDir);
    } else {
      return retrieveOFileNameRemote(cmdArray);
    }
  }
コード例 #5
0
ファイル: OCSSWRunner.java プロジェクト: bcdev/seadas
  public static Process executeLocal(ProcessorModel processorModel) {
    // System.out.println("local execution!" + " " +
    // Arrays.toString(processorModel.getProgramCmdArray()));
    ProcessBuilder processBuilder = new ProcessBuilder(processorModel.getProgramCmdArray());
    Map<String, String> env = processBuilder.environment();

    if (!env.containsKey(OCSSW_ROOT_VAR) && OCSSW.isOCSSWExist()) {
      // System.out.println("error checkpoint!");
      env.put(OCSSW_ROOT_VAR, OCSSW.getOcsswEnv());
    }

    if (processorModel.getIFileDir() != null) {
      processBuilder.directory(processorModel.getIFileDir());
    } else {
      // processBuilder.directory(getDefaultDir());
    }
    Process process = null;
    try {
      process = processBuilder.start();
    } catch (IOException ioe) {

    }
    return process;
  }
コード例 #6
0
ファイル: SeadasFileUtils.java プロジェクト: seadas/seadas
 private static String getIfileNameforRemoteServer(String ifileName) {
   String newIfileName =
       ifileName.replace(OCSSW.getOCSSWClientSharedDirName(), OCSSW.getServerSharedDirName());
   return newIfileName;
 }
コード例 #7
0
ファイル: OCSSWRunner.java プロジェクト: bcdev/seadas
  public OCSSWRunner() {

    environment.put(OCSSW_ROOT_VAR, OCSSW.getOcsswEnvArray());
  }