All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.nocrala.tools.database.db.source.Scenario Maven / Gradle / Ivy

Go to download

This Maven plugin automates the build, rebuild, and clean operations on a project database based on the SQL source code available in a strict, versioned structure in the the SCM.

There is a newer version: 1.0.3
Show newest version
package org.nocrala.tools.database.db.source;

import java.io.File;

import org.nocrala.tools.database.db.executor.SQLExecutor;
import org.nocrala.tools.database.db.executor.SQLExecutor.CouldNotReadSQLScriptException;
import org.nocrala.tools.database.db.executor.SQLExecutor.SQLScriptAbortedException;

public class Scenario {

  private final static String BUILD_DATA_FILE = "build-data.sql";

  private File buildData;

  public Scenario(final File dir) {
    this.buildData = new File(dir, BUILD_DATA_FILE);
  }

  // Build

  public void build(final SQLExecutor sqlExecutor, final boolean onErrorContinue)
      throws CouldNotReadSQLScriptException, SQLScriptAbortedException {
    if (this.buildData.exists() && this.buildData.isFile()) {
      sqlExecutor.run(this.buildData, onErrorContinue);
    } else {
      System.out.println("-- " + this.buildData + " does not exist -- skipped");
    }
  }

  // Getters

  public File getBuildData() {
    return buildData;
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy