Class Setup
java.lang.Object
java.util.AbstractMap<String,String>
org.bgerp.app.cfg.ConfigMap
org.bgerp.app.cfg.Preferences
org.bgerp.app.cfg.Setup
Application setup: the singleton
Preferences loaded from the bundle and the database,
holding the connection pool.-
Nested Class Summary
Nested classes/interfaces inherited from class AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K, V> -
Field Summary
Fields inherited from class Preferences
data -
Constructor Summary
ConstructorsConstructorDescriptionSetup(boolean initConfigAndPool) Constructor loading the configuration bundle and, optionally, the database config and pool. -
Method Summary
Modifier and TypeMethodDescriptionstatic StringConfiguration bundle name, from thesetup.datasystem property.Connection pool.Deprecated.Takes a master DB connection from the pool.Takes a slave DB connection from the pool.static SetupgetSetup()Use this singleton call wisely, because introducing that everywhere makes code hardly testable.Deprecated.static voidresetSetup(ConnectionPool pool) Resets the singleton, used in tests.Methods inherited from class Preferences
entrySet, get, getDataMap, loadBundle, processIncludes, put, putAll, removeSubMethods inherited from class ConfigMap
clearConfigs, get, getBigDecimal, getBoolean, getBoolean, getConfig, getConfig, getDataString, getInt, getInt, getLong, getLong, getSok, getSok, getSokBoolean, getSokBoolean, getSokLong, getSokLong, removeConfig, sub, subIndexed, subKeyed, subSok, subSokIndexed, validateConfigMethods inherited from class AbstractMap
clear, clone, containsKey, containsValue, equals, hashCode, isEmpty, keySet, remove, size, toString, valuesMethods inherited from interface Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Constructor Details
-
Setup
public Setup(boolean initConfigAndPool) Constructor loading the configuration bundle and, optionally, the database config and pool.- Parameters:
initConfigAndPool- whether to init the connection pool and load the DB config
-
-
Method Details
-
getBundleName
Configuration bundle name, from thesetup.datasystem property.- Returns:
- bundle name
-
getSetup
Use this singleton call wisely, because introducing that everywhere makes code hardly testable.- Returns:
- the setup singleton
-
resetSetup
Resets the singleton, used in tests.- Parameters:
pool- connection pool for the next load
-
getConnectionPool
-
getDBConnectionFromPool
Takes a master DB connection from the pool.- Returns:
- DB connection
-
getDBSlaveConnectionFromPool
Takes a slave DB connection from the pool.- Returns:
- slave DB connection
-
getDataSource
Deprecated.- Returns:
- data source
-
getSlaveDataSource
Deprecated.- Returns:
- slave data source
-