Exemple #1
0
  public JobItem resumeJob(JobItem item) {
    // String rootPathForDownload = getServletContext().getRealPath(File.separator);
    String statusDirectory = suspendConstant;

    String fileName = item.getJobName();
    String projectName = item.getProjectName();
    String userName = item.getUsername();

    String rootPath =
        path
            + userName
            + File.separator
            + projectConstant
            + File.separator
            + projectName
            + File.separator;
    // rootPathForDownload = rootPathForDownload + path1 + File.separator + userName +
    // File.separator + projectConstant + File.separator + projectName + File.separator;
    String pathForDownload =
        path1
            + File.separator
            + userName
            + File.separator
            + projectConstant
            + File.separator
            + projectName
            + File.separator;

    ResumeJobsImpl resume = new ResumeJobsImpl();
    Map<Integer, String[]> outputFiles = new HashMap<Integer, String[]>();
    // if(resume.checkAndMoveFile(statusDirectory, fileName, rootPath, rootPathForDownload))
    if (resume.checkAndMoveFile(statusDirectory, fileName, rootPath)) {
      String filePath = rootPath + queueConstant + File.separator + fileName;
      String newPath = rootPath + constants.getString("Figures") + File.separator;
      String[] fileData = new String[3];
      fileData[0] = fileName;
      fileData[1] = pathForDownload + queueConstant + File.separator + fileName;
      fileData[2] = filePath;
      System.out.println("Path to download: " + fileData[1] + " " + pathForDownload);
      outputFiles.put(1, fileData);

      GetJobDetails jobDetails = new GetJobDetails();
      outputFiles = jobDetails.getOutputFiles(newPath, fileName, outputFiles, pathForDownload);
      item.setStatus("Queued");
      item.setOutputFiles(outputFiles);
    }
    System.out.println(
        "Output files after resume: "
            + item.getOutputFiles().size()
            + " Status: "
            + item.getStatus()
            + " Job: "
            + item);
    return item;
  }
  private void requestData(String uri) {

    RequestPackage p = new RequestPackage();
    p.setMethod("POST");
    p.setUri(uri);

    p.setParam("jobid", jobno);

    GetJobDetails task = new GetJobDetails();
    task.execute(p);
  }