Пример #1
0
  @Override
  public synchronized List<String> schemaStatus() {
    if (buildSchema == null) {
      final InfoLines infoLines = new InfoLines();

      infoLines.addLn("Schema build has not been started");

      return infoLines;
    }

    return buildSchema.infoLines;
  }
Пример #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;
      }
    }