Class CalculatedSettings

java.lang.Object
io.micronaut.jdbc.CalculatedSettings

public class CalculatedSettings extends Object
A class used to fill in the missing gaps of information needed to successfully configure a data source.
Since:
1.0
Author:
James Kleeh
  • Constructor Details

    • CalculatedSettings

      public CalculatedSettings(BasicJdbcConfiguration basicJdbcConfiguration)
      Parameters:
      basicJdbcConfiguration - The basic jdbc configuration
    • CalculatedSettings

      public CalculatedSettings(BasicJdbcConfiguration basicJdbcConfiguration, ClassLoader classLoader)
      Parameters:
      basicJdbcConfiguration - The basic jdbc configuration
      classLoader - The classloader to get the embedded database connection from
  • Method Details

    • getDriverClassName

      public String getDriverClassName()
      Determines the driver class name based on the configured value. If not configured, determine the driver class name based on the URL. If the URL is not configured, look for an embedded database driver on the classpath.
      Returns:
      The calculated driver class name
    • getUrl

      public String getUrl()
      Determines the URL based on the configured value. If the URL is not configured, search for an embedded database driver on the classpath and retrieve a default URL for it.
      Returns:
      The calculated URL
    • getUsername

      public String getUsername()
      Determines the username based on the configured value. If the username is not configured and an embedded database driver is on the classpath, return 'sa'.
      Returns:
      The calculated username
    • getPassword

      public String getPassword()
      Determines the password based on the configured value. If the password is not configured and an embedded database driver is on the classpath, return an empty string.
      Returns:
      The calculated password
    • getValidationQuery

      public String getValidationQuery()
      Determines the validation query based on the configured value. If the validation query is not configured, search pre-defined databases for a match based on the URL. If a match is found, return the defined validation query for that database.
      Returns:
      The calculated validation query