Ejemplo n.º 1
0
  /**
   * Place the last modified date in the format dd MMM yyyy HH:mm:ss" e.g., 17 Jun 2008 09:30:10.
   * This is the same format as the task DEF file form CCP4I
   *
   * @param file
   */
  private void readScriptFileModifiedDate(File file) {

    // 17 Jun 2008  09:30:10
    SimpleDateFormat sdf = new SimpleDateFormat("dd MMM yyyy  HH:mm:ss");

    taskObject.setRunDateTime(sdf.format(file.lastModified()));
  }
Ejemplo n.º 2
0
  public TaskObject readScriptFile() {
    try {
      // File file = new File(scriptFile);
      int count = 0;
      Scanner scanner = new Scanner(scriptFile);
      while (scanner.hasNext()) {
        if (count == 0) {
          // System.out.println("script: " +scanner.next());
          taskObject.setTaskName(scanner.next());
        }
        tmpList.add(scanner.next());
        count++;
      }
      // iterate tmpList
      ListIterator<String> itr = tmpList.listIterator();

      while (itr.hasNext()) {
        String tmp = itr.next();
        if (tmp.equals("xyzin") || tmp.equals("hklin") || tmp.equals("alignin")) {
          // System.out.println(tmp);
          taskObject.setInputFileName(itr.next());
        }
        if (tmp.equals("xyzout") || tmp.equals("hklout") || tmp.equals("alignout")) {
          // System.out.println(tmp);
          taskObject.setOutputFileName(itr.next());
        }
      }
      scanner.close();

      //	String outputFileName = outputFileNames.elementAt(0);
      //	System.out.println(outputFileName);

    } catch (FileNotFoundException e) {
      e.printStackTrace();
    }
    return taskObject;
  }
Ejemplo n.º 3
0
  public static void main(String[] arg) {

    File file = new File("C:\\brilstore\\00EXPT123\\free.com");
    ScriptProcessor p = new ScriptProcessor(file);
    SimpleDateFormat sdf = new SimpleDateFormat("dd MMM yyyy  HH:mm:ss");
    // SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy");
    System.out.println("Original Last Modified Date : " + sdf.format(file.lastModified()));

    TaskObject to = p.readScriptFile();

    System.out.println("Task name: " + to.getTaskName());
    System.out.println("Job id: " + to.getJobID());
    System.out.println("Task date: " + to.getRunDateTime());
    System.out.println("Input filenames: " + to.getInputFileNames());
    System.out.println("Output filenames: " + to.getOutputFileNames());
  }
Ejemplo n.º 4
0
 public ScriptProcessor(File scriptFileLocation) {
   readScriptFileModifiedDate(scriptFileLocation);
   this.scriptFile = scriptFileLocation;
   taskObject.setJobID(scriptFileLocation.getName());
 }