コード例 #1
0
  public Application(String configurationFile) {
    Runtime.getRuntime().addShutdownHook(new Thread(new ShutDownListener()));
    Properties props = getPropertiesFromFile(configurationFile);

    try {
      init(props);
    } catch (Exception e) {
      e.printStackTrace();
    }

    if (isErrorFileOutput) {
      try {
        err =
            new BufferedOutputStream(
                new FileOutputStream(
                    ApplicationRegistry.getOutputDirectory()
                        + configurationFile
                        + "."
                        + DateUtils.ts()
                        + ".err.txt"));
        System.setErr(new PrintStream(err));
      } catch (FileNotFoundException e1) {
        e1.printStackTrace();
      }
    }

    if (isOutputFileOutput) {
      try {
        oput =
            new BufferedOutputStream(
                new FileOutputStream(
                    ApplicationRegistry.getOutputDirectory()
                        + configurationFile
                        + "."
                        + DateUtils.ts()
                        + ".txt"));
        System.setOut(new PrintStream(oput));
      } catch (FileNotFoundException e1) {
        e1.printStackTrace();
      }
    }

    try {
      runApplication();
    } catch (Exception e) {
      e.printStackTrace();
    }

    try {
      finish();
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
コード例 #2
0
  /**
   * @param e
   * @return The full path and filename where the Exportable was printed
   */
  public String print(Exportable e) {
    if (e == null) return null;

    Collection<Printable> c = e.getPrintables();

    if (c == null) return null;
    String path = null;

    Iterator<Printable> i = c.iterator();

    while (i.hasNext()) {
      Printable p = i.next();
      if (path == null)
        path =
            ApplicationRegistry.getOutputDirectory() + p.getName() + "." + DateUtils.ts() + ".csv";
      print(p, path);
    }

    return path;
  }
コード例 #3
0
 public void print(Printable p) {
   print(p, ApplicationRegistry.getOutputDirectory() + p.getName() + "." + ts + ".csv");
 }