Пример #1
0
  private JobListWrapper parseJobsFromFile(File jobFile) {
    JobListWrapper jlw = new JobListWrapper();
    try {
      BufferedReader reader = new BufferedReader(new FileReader(jobFile));
      String line = "";
      String jsonString = "";
      while ((line = reader.readLine()) != null) {
        jsonString += line + "\n";
        if (line.substring(0, 1).equals("#")) { // comments
          continue;
        }
        if (line.equals("}")) { // end of metric event json block

          jlw.addJob(Job.getFromJSON(jsonString));
        }
      }
    } catch (FileNotFoundException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    return jlw;
  }
Пример #2
0
 /**
  * Add a job to the list of scheduled jobs
  *
  * @param j
  */
 public void addJob(Job j) {
   jobs.addJob(j);
 }