public interface DataSourceProvider
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_DATA_SOURCE_PROVIDER_NAME
The default data source provider name.
|
Modifier and Type | Method and Description |
---|---|
void |
close(DataSource dataSource) |
static DataSourceProvider |
create(DataSource dataSource,
JsonObject config)
Init provider with specific
DataSource and config. |
static DataSourceProvider |
create(JsonObject config) |
DataSource |
getDataSource(JsonObject config) |
default JsonObject |
getInitialConfig()
Get the SQL initial configuration
|
default DataSourceProvider |
init(JsonObject sqlConfig)
Init provider with specific configuration
|
static Optional<java.util.function.Supplier<DataSourceProvider>> |
loadDefaultDataSourceProvider()
Load a datasource provider form the JVM system properties with the
DEFAULT_DATA_SOURCE_PROVIDER_NAME key. |
int |
maximumPoolSize(DataSource dataSource,
JsonObject config) |
default JsonObject |
toJson(JDBCConnectOptions connectOptions,
PoolOptions poolOptions)
Transforms the
JDBCConnectOptions and PoolOptions into a config suitable to be passed
as create(JsonObject) argument. |
static final String DEFAULT_DATA_SOURCE_PROVIDER_NAME
static Optional<java.util.function.Supplier<DataSourceProvider>> loadDefaultDataSourceProvider()
DEFAULT_DATA_SOURCE_PROVIDER_NAME
key.
The value can be one of:
C3P0DataSourceProvider
HikariCPDataSourceProvider
AgroalCPDataSourceProvider
AgroalCPDataSourceProvider
is returned.default JsonObject toJson(JDBCConnectOptions connectOptions, PoolOptions poolOptions)
JDBCConnectOptions
and PoolOptions
into a config suitable to be passed
as create(JsonObject)
argument.default DataSourceProvider init(JsonObject sqlConfig)
sqlConfig
- SQL connection configurationdefault JsonObject getInitialConfig()
int maximumPoolSize(DataSource dataSource, JsonObject config) throws SQLException
SQLException
DataSource getDataSource(JsonObject config) throws SQLException
SQLException
void close(DataSource dataSource) throws SQLException
SQLException
static DataSourceProvider create(JsonObject config)
static DataSourceProvider create(DataSource dataSource, JsonObject config)
DataSource
and config. The config expects that several properties are set:
url
- the connection stringuser
- the connection user namedatabase
- the database namemaxPoolSize
- the max allowed number of connections in the pooldataSource
- a pre initialized data sourceconfig
- the configuration for the datasourceCopyright © 2024 Eclipse. All rights reserved.