public abstract class DatabaseConfiguration extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
NFLOW_DATABASE_INITIALIZER
Name of the nFlow database initializer bean.
|
| Modifier | Constructor and Description |
|---|---|
protected |
DatabaseConfiguration(String dbType)
Creates a new configuration with given database type.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
checkDatabaseConfiguration(Environment env,
DataSource dataSource)
Checks that the database is configured as nFlow expects.
|
DatabaseInitializer |
nflowDatabaseInitializer(DataSource dataSource,
Environment env)
Creates the nFlow database initializer.
|
DataSource |
nflowDatasource(Environment env,
BeanFactory appCtx)
Creates the datasource bean for nFlow.
|
JdbcTemplate |
nflowJdbcTemplate(DataSource nflowDataSource)
Creates a JDBC template using nFlow datasource.
|
NamedParameterJdbcTemplate |
nflowNamedParameterJdbcTemplate(DataSource nflowDataSource)
Creates a named parameter JDBC template using nFlow datasource.
|
TransactionTemplate |
nflowTransactionTemplate(PlatformTransactionManager platformTransactionManager)
Creates a transaction template.
|
protected String |
property(Environment env,
String key)
Get a database configuration string property from the environment, or if the generic property is not defined, the property
based on the database type.
|
protected <T> T |
property(Environment env,
String key,
Class<T> type)
Get the database configuration property of given type from the environment, or if the generic property is not defined, the
property based on the database type.
|
public static final String NFLOW_DATABASE_INITIALIZER
protected DatabaseConfiguration(String dbType)
dbType - Defines the database creation script and configuration properties to be used.@Bean public DataSource nflowDatasource(Environment env, BeanFactory appCtx)
env - The Spring environment for getting the configuration property values.appCtx - The application context for searching Metrics registry bean.@Bean @Scope(value="prototype") @DependsOn(value="nflowDatabaseInitializer") public JdbcTemplate nflowJdbcTemplate(DataSource nflowDataSource)
nflowDataSource - The nFlow datasource.@Bean @Scope(value="prototype") @DependsOn(value="nflowDatabaseInitializer") public NamedParameterJdbcTemplate nflowNamedParameterJdbcTemplate(DataSource nflowDataSource)
nflowDataSource - The nFlow datasource.@Bean public TransactionTemplate nflowTransactionTemplate(PlatformTransactionManager platformTransactionManager)
platformTransactionManager - Transaction manager to be used.protected String property(Environment env, String key)
env - The Spring environment.key - The property key.protected <T> T property(Environment env, String key, Class<T> type)
T - The Property value type.env - The Spring environment.key - The property key.type - The property value type.@Bean(name="nflowDatabaseInitializer") public DatabaseInitializer nflowDatabaseInitializer(DataSource dataSource, Environment env)
dataSource - The nFlow datasource.env - The Spring environment.protected void checkDatabaseConfiguration(Environment env, DataSource dataSource)
env - The Spring environment.dataSource - The nFlow datasource.Copyright © 2014–2020 Nitor Creations. All rights reserved.