public class MockDatasource extends Object implements Datasource
ADVANCED_GROUP, BASE_GROUP
CONNECTION_PROVIDER_IDENTIFIER
DATASOURCE_DAO_IDENTIFIER, IDEPENDET_IDENTIFIER
Constructor and Description |
---|
MockDatasource() |
Modifier and Type | Method and Description |
---|---|
boolean |
checkIfSchemaExists(Map<String,Object> settings)
Check if the schema exists.
|
boolean |
checkIfSchemaExists(Properties current,
Map<String,Object> newSettings)
Check if the schema exists.
|
void |
checkPostCreation(Properties properties) |
boolean |
checkSchemaCreation(Map<String,Object> settings)
Check if it is possible to create the schema (e.g. test if the privilege
are sufficient).
|
void |
clear(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).
|
void |
execute(String[] sql,
Map<String,Object> settings) |
void |
executePostCreateSchema(Map<String,Object> databaseSettings) |
DatasourceCallback |
getCallback() |
Set<SettingDefinition<?,?>> |
getChangableSettingDefinitions(Properties current) |
String |
getConnectionProviderIdentifier() |
String |
getDatasourceDaoIdentifier() |
Properties |
getDatasourceProperties(Map<String,Object> settings)
Create the datasource properties used by the
ConnectionProvider
to connect. |
Properties |
getDatasourceProperties(Properties current,
Map<String,Object> newSettings)
Create the datasource properties used by the
ConnectionProvider
to connect. |
String |
getDialectName() |
Set<SettingDefinition<?,?>> |
getSettingDefinitions() |
boolean |
isPostCreateSchema() |
boolean |
needsSchema() |
void |
prepare(Map<String,Object> settings)
Called right before a schema is created.
|
boolean |
supportsClear() |
String[] |
updateSchema(Map<String,Object> settings)
Creates an update schema for the supplied settings.
|
void |
validateConnection(Map<String,Object> settings)
Check if a connection is possible.
|
void |
validateConnection(Properties current,
Map<String,Object> newSettings)
Check if a connection is still possible with the newSettings settings.
|
void |
validatePrerequisites(Map<String,Object> settings)
Validate if all prerequisites (e.g. datasource version) are met.
|
void |
validatePrerequisites(Properties current,
Map<String,Object> newSettings)
Used to validate prerequisites after the connections settings newSettings
in the admin interface.
|
void |
validateSchema(Map<String,Object> settings)
Validate the existing schema.
|
void |
validateSchema(Properties current,
Map<String,Object> newSettings)
Validate the existing schema.
|
public String getConnectionProviderIdentifier()
getConnectionProviderIdentifier
in interface ConnectionProviderIdentificator
public String getDatasourceDaoIdentifier()
getDatasourceDaoIdentifier
in interface DatasourceDaoIdentifier
public String getDialectName()
getDialectName
in interface Datasource
public Set<SettingDefinition<?,?>> getSettingDefinitions()
getSettingDefinitions
in interface Datasource
public Set<SettingDefinition<?,?>> getChangableSettingDefinitions(Properties current)
getChangableSettingDefinitions
in interface Datasource
current
- the current settingspublic void validateConnection(Map<String,Object> settings)
Datasource
validateConnection
in interface Datasource
settings
- the settings to connectpublic void validateConnection(Properties current, Map<String,Object> newSettings)
Datasource
validateConnection
in interface Datasource
current
- the current datasource settingsnewSettings
- the newSettings settingspublic void validatePrerequisites(Map<String,Object> settings)
Datasource
validateConnection()
succeeded.validatePrerequisites
in interface Datasource
settings
- the settings to connectpublic void validatePrerequisites(Properties current, Map<String,Object> newSettings)
Datasource
validatePrerequisites
in interface Datasource
current
- the current datasource settingsnewSettings
- the newSettings settingspublic boolean needsSchema()
needsSchema
in interface Datasource
public void validateSchema(Map<String,Object> settings)
Datasource
needsSchema()
and
checkIfSchemaExists()
return
true
.validateSchema
in interface Datasource
settings
- the settings to connectpublic void validateSchema(Properties current, Map<String,Object> newSettings)
Datasource
needsSchema()
and
checkIfSchemaExists()
return true
.validateSchema
in interface Datasource
current
- the current datasource settingsnewSettings
- the newSettings settingspublic boolean checkIfSchemaExists(Map<String,Object> settings)
Datasource
true
even if parts are
missing. Will only be called if needsSchema()
returns true
.checkIfSchemaExists
in interface Datasource
settings
- the settings to connectpublic boolean checkIfSchemaExists(Properties current, Map<String,Object> newSettings)
Datasource
true
even if parts are
missing. Will only be called if needsSchema()
returns true
.checkIfSchemaExists
in interface Datasource
current
- the current datasource settingsnewSettings
- the newSettings settingspublic boolean checkSchemaCreation(Map<String,Object> settings)
Datasource
needsSchema()
returns true
.checkSchemaCreation
in interface Datasource
settings
- the settings to connectpublic String[] createSchema(Map<String,Object> settings)
Datasource
needsSchema()
and
checkSchemaCreation()
return
true
. If checkIfSchemaExists()
returned true
,
dropSchema()
will be called first.createSchema
in interface Datasource
settings
- the settings to connectpublic String[] dropSchema(Map<String,Object> settings)
Datasource
needsSchema()
and
checkIfSchemaExists()
return
true
.dropSchema
in interface Datasource
settings
- the settings to connectpublic String[] updateSchema(Map<String,Object> settings)
Datasource
needsSchema()
and
checkSchemaCreation()
return
true
. If checkIfSchemaExists()
returned true
,
dropSchema()
will be called first.updateSchema
in interface Datasource
settings
- the settings to connectpublic void execute(String[] sql, Map<String,Object> settings)
execute
in interface Datasource
public void clear(Properties settings)
Datasource
supportsClear()
returns true
.clear
in interface Datasource
settings
- the settings to connectpublic boolean supportsClear()
supportsClear
in interface Datasource
true
public Properties getDatasourceProperties(Map<String,Object> settings)
Datasource
ConnectionProvider
to connect.getDatasourceProperties
in interface Datasource
settings
- the settings to connectpublic Properties getDatasourceProperties(Properties current, Map<String,Object> newSettings)
Datasource
ConnectionProvider
to connect.getDatasourceProperties
in interface Datasource
current
- the current datasource settingsnewSettings
- the newSettings settingspublic DatasourceCallback getCallback()
getCallback
in interface Datasource
public void prepare(Map<String,Object> settings)
Datasource
prepare
in interface Datasource
settings
- the settings to connectpublic boolean isPostCreateSchema()
isPostCreateSchema
in interface Datasource
public void executePostCreateSchema(Map<String,Object> databaseSettings)
executePostCreateSchema
in interface Datasource
public void checkPostCreation(Properties properties)
checkPostCreation
in interface Datasource
Copyright © 2012-2015 52north.org. All Rights Reserved.