Package org.n52.iceland.ds
Interface Datasource
-
- All Superinterfaces:
Serializable
public interface Datasource extends Serializable
- Since:
- 1.0.0
-
-
Field Summary
Fields Modifier and Type Field Description static SettingDefinitionGroupADVANCED_GROUPstatic SettingDefinitionGroupBASE_GROUP
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleancheckIfSchemaExists(Map<String,Object> settings)Check if the schema exists.booleancheckIfSchemaExists(Properties current, Map<String,Object> newSettings)Check if the schema exists.voidcheckPostCreation(Properties properties)booleancheckSchemaCreation(Map<String,Object> settings)Check if it is possible to create the schema (e.g. test if the privilege are sufficient).voidclear(Properties settings)Clear the contents of the datasource.String[]createSchema(Map<String,Object> settings)Create the schema for the supplied settings.String[]dropSchema(Map<String,Object> settings)Drop the present schema (or parts of it).voidexecute(String[] sql, Map<String,Object> settings)voidexecutePostCreateSchema(Map<String,Object> databaseSettings)DatasourceCallbackgetCallback()Set<SettingDefinition<?>>getChangableSettingDefinitions(Properties current)PropertiesgetDatasourceProperties(Map<String,Object> settings)Create the datasource properties used by theConnectionProviderto connect.PropertiesgetDatasourceProperties(Properties current, Map<String,Object> newSettings)Create the datasource properties used by theConnectionProviderto connect.StringgetDialectName()Set<SettingDefinition<?>>getSettingDefinitions()Set<String>getSpringProfiles()booleanisPostCreateSchema()booleanneedsSchema()Map<String,Object>parseDatasourceProperties(Properties current)Parse datasource properties to mapvoidprepare(Map<String,Object> settings)Called right before a schema is created.booleansupportsClear()String[]updateSchema(Map<String,Object> settings)Creates an update schema for the supplied settings.voidvalidateConnection(Map<String,Object> settings)Check if a connection is possible.voidvalidateConnection(Properties current, Map<String,Object> newSettings)Check if a connection is still possible with the newSettings settings.voidvalidatePrerequisites(Map<String,Object> settings)Validate if all prerequisites (e.g. datasource version) are met.voidvalidatePrerequisites(Properties current, Map<String,Object> newSettings)Used to validate prerequisites after the connections settings newSettings in the admin interface.voidvalidateSchema(Map<String,Object> settings)Validate the existing schema.voidvalidateSchema(Properties current, Map<String,Object> newSettings)Validate the existing schema.
-
-
-
Field Detail
-
BASE_GROUP
static final SettingDefinitionGroup BASE_GROUP
-
ADVANCED_GROUP
static final SettingDefinitionGroup ADVANCED_GROUP
-
-
Method Detail
-
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 settingsnewSettings- the newSettings settings
-
validatePrerequisites
void validatePrerequisites(Map<String,Object> settings)
Validate if all prerequisites (e.g. datasource version) are met. Will only be called ifvalidateConnection()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 settingsnewSettings- 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 ifneedsSchema()andcheckIfSchemaExists()returntrue.- Parameters:
settings- the settings to connect
-
validateSchema
void validateSchema(Properties current, Map<String,Object> newSettings)
Validate the existing schema. Will only be called ifneedsSchema()andcheckIfSchemaExists()returntrue.- Parameters:
current- the current datasource settingsnewSettings- the newSettings settings
-
checkIfSchemaExists
boolean checkIfSchemaExists(Map<String,Object> settings)
Check if the schema exists. Should returntrueeven if parts are missing. Will only be called ifneedsSchema()returnstrue.- 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 returntrueeven if parts are missing. Will only be called ifneedsSchema()returnstrue.- Parameters:
current- the current datasource settingsnewSettings- 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 ifneedsSchema()returnstrue.- 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 ifneedsSchema()andcheckSchemaCreation()returntrue. IfcheckIfSchemaExists()returnedtrue,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 ifneedsSchema()andcheckIfSchemaExists()returntrue.- 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 ifneedsSchema()andcheckSchemaCreation()returntrue. IfcheckIfSchemaExists()returnedtrue,dropSchema()will be called first.- Parameters:
settings- the settings to connect- Returns:
- an array of DDL statements
-
clear
void clear(Properties settings)
Clear the contents of the datasource. Only called ifsupportsClear()returnstrue.- Parameters:
settings- the settings to connect
-
supportsClear
boolean supportsClear()
- Returns:
true
-
getDatasourceProperties
Properties getDatasourceProperties(Map<String,Object> settings)
Create the datasource properties used by theConnectionProviderto 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 theConnectionProviderto connect.- Parameters:
current- the current datasource settingsnewSettings- 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()
-
checkPostCreation
void checkPostCreation(Properties properties)
-
-