Class ManagedDBConfig
- java.lang.Object
-
- hu.icellmobilsoft.roaster.oracle.config.ManagedDBConfig
-
- All Implemented Interfaces:
DBConfig
@Dependent public class ManagedDBConfig extends Object implements DBConfig
Helper class for obtaining DB connection settings using microprofile config.
General pattern is "roaster.datasource.${dbType}.${schema}.${setting}ie.:
roaster: datasource: oracle: employee: url: jdbc:oracle:thin:@ldap://ldap.sample.hu:389/SAMPLEDB,cn=OracleContext,dc=sample,dc=hu user: user password: *****The upper configuration is injectable with:
@Inject @DBConnection(dbType = "oracle", schema = "employee") ManagedDBConfig dbConfig;
or:
ManagedDBConfig dbConfig = CDI.current().select(ManagedDBConfig.class, new DBConnection.Literal("oracle", "employee")).get();- Author:
- balazs.joo
-
-
Field Summary
Fields Modifier and Type Field Description static StringDB_PREFIXConstantDB_PREFIX="roaster.datasource"static StringKEY_DELIMITERConstantKEY_DELIMITER="."static StringMAXIMUM_POOL_SIZEConstant "maximumPoolSize"static StringPASSWORDConstantPASSWORD="password"static StringURLConstantURL="url"static StringUSERConstantUSER="user"
-
Constructor Summary
Constructors Constructor Description ManagedDBConfig()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetConfigKey()intgetMaximumPoolSize()Returns the maximus size of the connection poolStringgetPassword()getPassword.StringgetUrl()getUrl.StringgetUser()getUser.voidsetConfigKey(String configKey)
-
-
-
Field Detail
-
DB_PREFIX
public static final String DB_PREFIX
ConstantDB_PREFIX="roaster.datasource"- See Also:
- Constant Field Values
-
URL
public static final String URL
ConstantURL="url"- See Also:
- Constant Field Values
-
USER
public static final String USER
ConstantUSER="user"- See Also:
- Constant Field Values
-
PASSWORD
public static final String PASSWORD
ConstantPASSWORD="password"- See Also:
- Constant Field Values
-
MAXIMUM_POOL_SIZE
public static final String MAXIMUM_POOL_SIZE
Constant "maximumPoolSize"- See Also:
- Constant Field Values
-
KEY_DELIMITER
public static final String KEY_DELIMITER
ConstantKEY_DELIMITER="."- See Also:
- Constant Field Values
-
-
Method Detail
-
getUrl
public String getUrl()
getUrl.
The url where the selected DB is available.
-
getUser
public String getUser()
getUser.
The user of the selected DB to connect with.
-
getPassword
public String getPassword()
getPassword.
The password of the selected DB to connect with.
- Specified by:
getPasswordin interfaceDBConfig- Returns:
- password value
-
getMaximumPoolSize
public int getMaximumPoolSize()
Description copied from interface:DBConfigReturns the maximus size of the connection pool- Specified by:
getMaximumPoolSizein interfaceDBConfig- Returns:
- the maximus size of the connection pool
-
getConfigKey
public String getConfigKey()
-
setConfigKey
public void setConfigKey(String configKey)
-
-