Interface Datasource

All Superinterfaces:
Serializable

public interface Datasource extends Serializable
Since:
1.0.0
  • Field Details

  • Method Details

    • getDialectName

      String getDialectName()
      Returns:
      the representive name of this dialect
    • getSettingDefinitions

      Set<SettingDefinition<?>> getSettingDefinitions()
      Returns:
      the settings needed to connect
    • getChangableSettingDefinitions

      Set<SettingDefinition<?>> getChangableSettingDefinitions(Properties current)
      Parameters:
      current - the current settings
      Returns:
      the settings that can be newSettings without schema without reinstallation
    • parseDatasourceProperties

      Map<String,Object> parseDatasourceProperties(Properties current)
      Parse datasource properties to map
      Parameters:
      current - Current datasource properties
      Returns:
      Map with String key and Object value
    • validateConnection

      void validateConnection(Map<String,Object> settings)
      Check if a connection is possible.
      Parameters:
      settings - the settings to connect
    • validateConnection

      void validateConnection(Properties current, Map<String,Object> newSettings)
      Check if a connection is still possible with the newSettings settings.
      Parameters:
      current - the current datasource settings
      newSettings - the newSettings settings
    • validatePrerequisites

      void validatePrerequisites(Map<String,Object> settings)
      Validate if all prerequisites (e.g. datasource version) are met. Will only be called if validateConnection() succeeded.
      Parameters:
      settings - the settings to connect
    • validatePrerequisites

      void validatePrerequisites(Properties current, Map<String,Object> newSettings)
      Used to validate prerequisites after the connections settings newSettings in the admin interface.
      Parameters:
      current - the current datasource settings
      newSettings - the newSettings settings
    • needsSchema

      boolean needsSchema()
      Returns:
      if this datasource needs some kind of schema
    • validateSchema

      void validateSchema(Map<String,Object> settings)
      Validate the existing schema. Will only be called if needsSchema() and checkIfSchemaExists() return true.
      Parameters:
      settings - the settings to connect
    • validateSchema

      void validateSchema(Properties current, Map<String,Object> newSettings)
      Validate the existing schema. Will only be called if needsSchema() and checkIfSchemaExists() return true.
      Parameters:
      current - the current datasource settings
      newSettings - the newSettings settings
    • checkIfSchemaExists

      boolean checkIfSchemaExists(Map<String,Object> settings)
      Check if the schema exists. Should return true even if parts are missing. Will only be called if needsSchema() returns true.
      Parameters:
      settings - the settings to connect
      Returns:
      if the schema (or parts of it) exists
    • checkIfSchemaExists

      boolean checkIfSchemaExists(Properties current, Map<String,Object> newSettings)
      Check if the schema exists. Should return true even if parts are missing. Will only be called if needsSchema() returns true.
      Parameters:
      current - the current datasource settings
      newSettings - the newSettings settings
      Returns:
      if the schema (or parts of it) exists
    • checkSchemaCreation

      boolean checkSchemaCreation(Map<String,Object> settings)
      Check if it is possible to create the schema (e.g. test if the privilege are sufficient). Will only be called if needsSchema() returns true.
      Parameters:
      settings - the settings to connect
      Returns:
      if the creation if the schema is possible
    • createSchema

      String[] createSchema(Map<String,Object> settings)
      Create the schema for the supplied settings. Will only be called if needsSchema() and checkSchemaCreation() return true. If checkIfSchemaExists() returned true, dropSchema() will be called first.
      Parameters:
      settings - the settings to connect
      Returns:
      an array of DDL statements
    • dropSchema

      String[] dropSchema(Map<String,Object> settings)
      Drop the present schema (or parts of it). Will only be called if needsSchema() and checkIfSchemaExists() return true.
      Parameters:
      settings - the settings to connect
      Returns:
      an array of DDL statements
    • updateSchema

      String[] updateSchema(Map<String,Object> settings)
      Creates an update schema for the supplied settings. Will only be called if needsSchema() and checkSchemaCreation() return true. If checkIfSchemaExists() returned true, dropSchema() will be called first.
      Parameters:
      settings - the settings to connect
      Returns:
      an array of DDL statements
    • execute

      void execute(String[] sql, Map<String,Object> settings)
    • clear

      void clear(Properties settings)
      Clear the contents of the datasource. Only called if supportsClear() returns true.
      Parameters:
      settings - the settings to connect
    • supportsClear

      boolean supportsClear()
      Returns:
      true
    • getDatasourceProperties

      Properties getDatasourceProperties(Map<String,Object> settings)
      Create the datasource properties used by the ConnectionProvider to connect.
      Parameters:
      settings - the settings to connect
      Returns:
      the datasource properties
    • getDatasourceProperties

      Properties getDatasourceProperties(Properties current, Map<String,Object> newSettings)
      Create the datasource properties used by the ConnectionProvider to connect.
      Parameters:
      current - the current datasource settings
      newSettings - the newSettings settings
      Returns:
      the new datasource properties
    • getCallback

      DatasourceCallback getCallback()
      Returns:
      the callback used at instantiation time of the connection provider
    • prepare

      void prepare(Map<String,Object> settings)
      Called right before a schema is created.
      Parameters:
      settings - the settings to connect
    • isPostCreateSchema

      boolean isPostCreateSchema()
    • executePostCreateSchema

      void executePostCreateSchema(Map<String,Object> databaseSettings)
    • checkPostCreation

      void checkPostCreation(Properties properties)
    • getSpringProfiles

      Set<String> getSpringProfiles()