コード例 #1
0
  @Override
  public String doConvert() {
    final InfoLines msgs = new InfoLines();

    try {
      final Processor proc = getProc();

      proc.parse();

      if (getGenerate()) {
        proc.generateZoneinfoFiles(
            Util.buildPath(true, getRootdir(), "/", "zoneinfo"), true); // doLinks
      }

      if (getCompare()) {
        proc.compare(msgs);
      }

      for (final String msg : msgs) {
        System.out.print(msg);
      }
    } catch (final Throwable t) {
      t.printStackTrace();
      msgs.exceptionMsg(t);
    }

    return msgs.toString();
  }
コード例 #2
0
    @Override
    public void run() {
      try {
        infoLines.addLn("Started export of schema");

        final long startTime = System.currentTimeMillis();

        final SchemaExport se = new SchemaExport(getHibConfiguration());

        se.setFormat(true); // getFormat());
        se.setHaltOnError(false); // getHaltOnError());
        se.setOutputFile(getSchemaOutFile());
        /* There appears to be a bug in the hibernate code. Everybody initialises
        this to /import.sql. Set to null causes an NPE
        Make sure it refers to a non-existant file */
        // se.setImportFile("not-a-file.sql");

        setStatus(statusRunning);
        se.execute(
            false, // script - causes write to System.out if true
            getExport(),
            false, // drop
            true); //   getCreate());

        final long millis = System.currentTimeMillis() - startTime;
        final long seconds = millis / 1000;
        final long minutes = seconds / 60;

        infoLines.addLn("Elapsed time: " + minutes + ":" + twoDigits(seconds - (minutes * 60)));
        setStatus(statusDone);
      } catch (final Throwable t) {
        error(t);
        infoLines.exceptionMsg(t);
        setStatus(statusFailed);
      } finally {
        infoLines.addLn("Schema build completed");
        export = false;
      }
    }