congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
Configuration.getDataSource
Code IndexAdd Tabnine to your IDE (free)

How to use
getDataSource
method
in
org.flywaydb.core.api.configuration.Configuration

Best Java code snippets using org.flywaydb.core.api.configuration.Configuration.getDataSource (Showing top 4 results out of 315)

origin: com.blackducksoftware.bdio/bdio-tinkerpop

/**
 * Returns a Sqlg configuration (Apache Commons) based on the supplied Flyway configuration.
 */
protected org.apache.commons.configuration.Configuration sqlgConfiguration(Configuration configuration) {
  Map<String, Object> result = new LinkedHashMap<>();
  // The most important part is getting the JDBC URL since that is required by Sqlg
  result.put(SqlgGraph.JDBC_URL, JdbcUrlDataSource.unwrap(configuration.getDataSource()).getJdbcUrl());
  // Abuse the Flyway place holders as extra configuration parameters for Sqlg
  result.putAll(configuration.getPlaceholders());
  return new MapConfiguration(result);
}
origin: com.blackducksoftware.bdio/bdio-tinkerpop

/**
 * Return a Sqlg dialect based on the supplied Flyway configuration.
 */
protected SqlDialect sqlDialect(Configuration configuration) {
  // Mimic what Sqlg does to load a dialect
  String connectionUri = JdbcUrlDataSource.unwrap(configuration.getDataSource()).getJdbcUrl();
  for (SqlgPlugin p : ServiceLoader.load(SqlgPlugin.class, SqlgGraph.class.getClassLoader())) {
    if (p.getDriverFor(connectionUri) != null) {
      return p.instantiateDialect();
    }
  }
  throw new IllegalStateException("Unable to determine Sqlg dialect to use for JDBC URL: " + connectionUri);
}
origin: theotherp/nzbhydra2

  @Override
  public void migrate(Flyway flyway) {
    try {
      flyway.migrate();
    } catch (FlywayException e) {
      if (e.getMessage().contains("1.15")) {
        logger.info("Found failed database migration. Attempting repair");
        flyway.repair();
        try {
          flyway.getConfiguration().getDataSource().getConnection().createStatement().executeUpdate("delete from PUBLIC.\"schema_version\" where \"version\" = '1.15' or \"version\" = '1.16'");
        } catch (SQLException e1) {
          logger.error("Error while deleting old migration steps", e);
        }
        flyway.migrate();
      } else {
        logger.error("Unable to migrate", e);
        throw e;
      }
    }
  }
};
origin: org.flywaydb/flyway-gradle-plugin

@SuppressWarnings("unused")
@TaskAction
public Object runTask() {
  try {
    Map<String, String> envVars = ConfigUtils.environmentVariablesToPropertyMap();
    Set<URL> extraURLs = new HashSet<>();
    if (isJavaProject()) {
      addClassesAndResourcesDirs(extraURLs);
      addConfigurationArtifacts(determineConfigurations(envVars), extraURLs);
    }
    ClassLoader classLoader = new URLClassLoader(
        extraURLs.toArray(new URL[0]),
        getProject().getBuildscript().getClassLoader());
    Flyway flyway = Flyway.configure(classLoader).configuration(createFlywayConfig(envVars)).load();
    Object result = run(flyway);
    ((DriverDataSource) flyway.getConfiguration().getDataSource()).shutdownDatabase();
    return result;
  } catch (Exception e) {
    throw new FlywayException(collectMessages(e, "Error occurred while executing " + getName()), e);
  }
}
org.flywaydb.core.api.configurationConfigurationgetDataSource

Popular methods of Configuration

  • getLocations
  • getClassLoader
  • getPlaceholders

Popular in Java

  • Making http requests using okhttp
  • getExternalFilesDir (Context)
  • compareTo (BigDecimal)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • Point (java.awt)
    A point representing a location in (x,y) coordinate space, specified in integer precision.
  • RandomAccessFile (java.io)
    Allows reading from and writing to a file in a random-access manner. This is different from the uni-
  • String (java.lang)
  • Time (java.sql)
    Java representation of an SQL TIME value. Provides utilities to format and parse the time's represen
  • Iterator (java.util)
    An iterator over a sequence of objects, such as a collection.If a collection has been changed since
  • BlockingQueue (java.util.concurrent)
    A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
  • 21 Best IntelliJ Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now