Class DbConfigurationManager<CommonAccessException extends java.lang.Exception>
- java.lang.Object
-
- com.saperion.common.config.manager.DbConfigurationManager<CommonAccessException>
-
- Type Parameters:
CommonAccessException
- the common access exception type of the underlyingDataSource
and so of theDbConfigurationManager
to be created.
public class DbConfigurationManager<CommonAccessException extends java.lang.Exception> extends java.lang.Object
The
DbConfigurationManager
manages configuration values in a database table and an in-memory cache.One must specify a
DataSource
. One canset a different table name
. One cancreate the table if it does not exist
.A configuration value is basically a
String
. There are several methods for conversion of other values to string during get() and set() and it is highly recommended to rely on these specialized get()-methods and according objects it set() and not to convert them in the business code by yourself. These classes are supported:A configuration value can be
null
. This is treated as a valid value and it is a difference, whether a configuration value not exists or exists and is set tonull
. ForString
snull
and an emptyString
both are stored asnull
. All get()-methods will returnnull
in this case. So there is (intentionally) no way to store an emptyString
.A configuration value is identified by a key that is a
HierarchicalName
. It is highly recommended to group your configuration values according to their sense and common usage the same way as you group java-classes into packages. All configuration values that belong to the same sub-tree can beloaded
together.The get()-methods have an optional
StorageType
-parameter, that controls whether a configuration valueshould be loaded from the database
,from the in-memory cache
orfrom the database only if it is not found in the in-memory cache
. The methods without theStorageType
-parameter behave likeStorageType.DEFAULT
, i.e. they use theStorageType
that was specified to use as the default during construction of theDbConfigurationManager
(@seeDbConfigurationManagerConstructorParameters.setDefaultStorageType(StorageType)
).Usual approaches are:
- Simply use the get()-methods with
StorageType.DB_IF_NOTHING_IN_MEMORY
if there are only a few configuration values at all. Load
a whole hierarchy of configuration values at some initialization point and use them later withStorageType.MEMORY
orStorageType.DB_IF_NOTHING_IN_MEMORY
.
A
root name can be provided
in which case all entry-keys will start with this root name. If the key specified as a method parameter alreadystarts with
the root name it will be used unchanged, else the parameter will beadded
to the root name before use.The configuration values can be encrypted/decrypted automatically. Simply
specify a Cipher and Pair of Keys
.One can
fine-tune what should happen if a requested configuration value is not found
.This
DbConfigurationManager
does no transaction handling. It simple executes its SQL-statements and relies on a suitable surrounding transaction management. If used in a JEE-container this is usually exactly the desired behavior. If used in a stand-alone application, one should care about the transaction around the invocations of methods of this class.Apart from transactional aspects the methods are synchronized, so an instance of this
DbConfigurationManager
can be used in several threads concurrently.- Author:
- agz
- See Also:
DbConfigurationManagerConstructorParameters
,StorageType
,NotFoundReactionType
,DataSource
,Cipher
-
-
Field Summary
Fields Modifier and Type Field Description static int
NAME_MAX_LENGTH
The maximum string length (toString()
-result) of aHierarchicalName
to be used as a key by thisDbConfigurationManager
.static java.lang.String
TABLE_NAME_REGEX
The regular expression, a table name must match.static int
VALUE_MAX_LENGTH
The maximum string length of the serialized (and if encryption is active encrypted) representation of a configuration value to be used by thisDbConfigurationManager
.
-
Constructor Summary
Constructors Constructor Description DbConfigurationManager(DbConfigurationManagerConstructorParameters<CommonAccessException> parameters)
Creates a newDbConfigurationManager
with the specifiedDbConfigurationManagerConstructorParameters
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
createTableIfNotExistent()
Tries to find out whether the underlying database table exists and if not so to create it by executing an SQL-CREATE-TABLE-statement.int
delete(HierarchicalName hierarchicalName, boolean includingSubvalues)
Deletes the configuration value for the specifiedHierarchicalName
from the database and internal cache.boolean
exists(HierarchicalName hierarchicalName)
Tests whether a configuration value with the specifiedHierarchicalName
exists.boolean
exists(HierarchicalName hierarchicalName, StorageType storageType)
Tests whether a configuration value with the specifiedHierarchicalName
exists.Binary
getBinary(HierarchicalName hierarchicalName)
Gets the configuration value with the specifiedHierarchicalName
and converts it to aBinary
.Binary
getBinary(HierarchicalName hierarchicalName, StorageType storageType)
Gets the configuration value with the specifiedHierarchicalName
and converts it to aBinary
.java.lang.Boolean
getBoolean(HierarchicalName hierarchicalName)
Gets the configuration value with the specifiedHierarchicalName
and converts it to aBoolean
.java.lang.Boolean
getBoolean(HierarchicalName hierarchicalName, StorageType storageType)
Gets the configuration value with the specifiedHierarchicalName
and converts it to aBoolean
.java.util.Date
getDateTime(HierarchicalName hierarchicalName)
Gets the configuration value with the specifiedHierarchicalName
and converts it to aDate
.java.util.Date
getDateTime(HierarchicalName hierarchicalName, StorageType storageType)
Gets the configuration value with the specifiedHierarchicalName
and converts it to aDate
.Decimal
getDecimal(HierarchicalName hierarchicalName)
Gets the configuration value with the specifiedHierarchicalName
and converts it to aDecimal
.Decimal
getDecimal(HierarchicalName hierarchicalName, StorageType storageType)
Gets the configuration value with the specifiedHierarchicalName
and converts it to aDecimal
.java.lang.Double
getDouble(HierarchicalName hierarchicalName)
Gets the configuration value with the specifiedHierarchicalName
and converts it to aDouble
.java.lang.Double
getDouble(HierarchicalName hierarchicalName, StorageType storageType)
Gets the configuration value with the specifiedHierarchicalName
and converts it to aDouble
.java.lang.Float
getFloat(HierarchicalName hierarchicalName)
Gets the configuration value with the specifiedHierarchicalName
and converts it to aFloat
.java.lang.Float
getFloat(HierarchicalName hierarchicalName, StorageType storageType)
Gets the configuration value with the specifiedHierarchicalName
and converts it to aFloat
.java.util.Collection<HierarchicalName>
getHierarchicalNames(HierarchicalName hierarchicalName)
java.util.Collection<HierarchicalName>
getHierarchicalNames(HierarchicalName hierarchicalName, StorageType storageType)
Guid
getId(HierarchicalName hierarchicalName)
Gets the configuration value with the specifiedHierarchicalName
and converts it to aGuid
.Guid
getId(HierarchicalName hierarchicalName, StorageType storageType)
Gets the configuration value with the specifiedHierarchicalName
and converts it to aGuid
.java.lang.Integer
getInteger(HierarchicalName hierarchicalName)
Gets the configuration value with the specifiedHierarchicalName
and converts it to anInteger
.java.lang.Integer
getInteger(HierarchicalName hierarchicalName, StorageType storageType)
Gets the configuration value with the specifiedHierarchicalName
and converts it to anInteger
.java.lang.Long
getLong(HierarchicalName hierarchicalName)
Gets the configuration value with the specifiedHierarchicalName
and converts it to aLong
.java.lang.Long
getLong(HierarchicalName hierarchicalName, StorageType storageType)
Gets the configuration value with the specifiedHierarchicalName
and converts it to aLong
.java.lang.String
getString(HierarchicalName hierarchicalName)
Gets the configuration value with the specifiedHierarchicalName
.java.lang.String
getString(HierarchicalName hierarchicalName, StorageType storageType)
Gets the configuration value with the specifiedHierarchicalName
.void
load(HierarchicalName hierarchicalName)
Loads the configuration value for the specifiedHierarchicalName
from the database and stores it into the internal cache.void
load(HierarchicalName hierarchicalName, boolean includingSubvalues)
Loads the configuration value for the specifiedHierarchicalName
from the database and stores it into the internal cache.void
set(HierarchicalName hierarchicalName, java.lang.Object value)
Sets the configuration value with the specifiedHierarchicalName
.void
set(java.util.Map<HierarchicalName,java.lang.Object> mapHierarchicalName2Value)
Sets all the specified configuration values (values of the specified map) according to their specifiedHierarchicalName
s (keys of the specified map.
-
-
-
Field Detail
-
TABLE_NAME_REGEX
public static final java.lang.String TABLE_NAME_REGEX
The regular expression, a table name must match.- See Also:
- Constant Field Values
-
NAME_MAX_LENGTH
public static final int NAME_MAX_LENGTH
The maximum string length (toString()
-result) of aHierarchicalName
to be used as a key by thisDbConfigurationManager
.- See Also:
- Constant Field Values
-
VALUE_MAX_LENGTH
public static final int VALUE_MAX_LENGTH
The maximum string length of the serialized (and if encryption is active encrypted) representation of a configuration value to be used by thisDbConfigurationManager
.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DbConfigurationManager
public DbConfigurationManager(DbConfigurationManagerConstructorParameters<CommonAccessException> parameters)
Creates a newDbConfigurationManager
with the specifiedDbConfigurationManagerConstructorParameters
. The specifiedDbConfigurationManagerConstructorParameters
must not benull
.- Parameters:
parameters
-DbConfigurationManagerConstructorParameters
-
-
Method Detail
-
createTableIfNotExistent
public void createTableIfNotExistent() throws CommonAccessException extends java.lang.Exception
Tries to find out whether the underlying database table exists and if not so to create it by executing an SQL-CREATE-TABLE-statement. This method does not analyze whether an existing database table is correct.- Throws:
java.lang.IllegalStateException
- on errors during the existence checkCommonAccessException
- on errors during creation of the tableCommonAccessException extends java.lang.Exception
-
delete
public int delete(HierarchicalName hierarchicalName, boolean includingSubvalues) throws CommonAccessException extends java.lang.Exception
Deletes the configuration value for the specifiedHierarchicalName
from the database and internal cache. If specified to include sub-values all configuration values that namesstart with
the specifiedHierarchicalName
are deleted. The specifiedHierarchicalName
must not benull
.- Parameters:
hierarchicalName
-HierarchicalName
includingSubvalues
- whether to include sub-values- Returns:
- count of manipulated rows
- Throws:
CommonAccessException
- on errors during db-operationsCommonAccessException extends java.lang.Exception
-
load
public void load(HierarchicalName hierarchicalName, boolean includingSubvalues) throws CommonAccessException extends java.lang.Exception
Loads the configuration value for the specifiedHierarchicalName
from the database and stores it into the internal cache. If specified to include sub-values all configuration values that namesstart with
the specifiedHierarchicalName
are loaded. The specifiedHierarchicalName
must not benull
.- Parameters:
hierarchicalName
-HierarchicalName
includingSubvalues
- whether to include sub-values- Throws:
CommonAccessException
- on errors during db-operationsCommonAccessException extends java.lang.Exception
-
load
public void load(HierarchicalName hierarchicalName) throws CommonAccessException extends java.lang.Exception
Loads the configuration value for the specifiedHierarchicalName
from the database and stores it into the internal cache. The specifiedHierarchicalName
must not benull
.- Parameters:
hierarchicalName
-HierarchicalName
- Throws:
CommonAccessException
- on errors during db-operationsCommonAccessException extends java.lang.Exception
-
exists
public boolean exists(HierarchicalName hierarchicalName, StorageType storageType) throws CommonAccessException extends java.lang.Exception
Tests whether a configuration value with the specifiedHierarchicalName
exists. The operation is executed according to the specifiedStorageType
. The specifiedHierarchicalName
must not benull
. The specifiedStorageType
must not benull
.- Parameters:
hierarchicalName
-HierarchicalName
storageType
-StorageType
- Returns:
- whether such a configuration value exists
- Throws:
CommonAccessException
- on errors during db-operationsCommonAccessException extends java.lang.Exception
-
exists
public boolean exists(HierarchicalName hierarchicalName) throws CommonAccessException extends java.lang.Exception
Tests whether a configuration value with the specifiedHierarchicalName
exists. The operation is executed according to the defaultStorageType
configured during construction of thisDbConfigurationManager
. The specifiedHierarchicalName
must not benull
.- Parameters:
hierarchicalName
-HierarchicalName
- Returns:
- whether such a configuration value exists
- Throws:
CommonAccessException
- on errors during db-operationsCommonAccessException extends java.lang.Exception
-
getHierarchicalNames
public java.util.Collection<HierarchicalName> getHierarchicalNames(HierarchicalName hierarchicalName, StorageType storageType) throws CommonAccessException extends java.lang.Exception
Gets aCollection
of allHierarchicalName
s thatstarts with
the specifiedHierarchicalName
. The operation is executed according to the specifiedStorageType
.StorageType.DB_IF_NOTHING_IN_MEMORY
is treated equally toStorageType.DB
in this method to avoid incomplete results. If no such value is found an emptyCollection
will be returned. The specifiedHierarchicalName
must not benull
. The specifiedStorageType
must not benull
.- Parameters:
hierarchicalName
-HierarchicalName
all results will start withstorageType
-StorageType
- Returns:
Collection
ofHierarchicalName
s- Throws:
CommonAccessException
- on errors during db-operationsCommonAccessException extends java.lang.Exception
-
getHierarchicalNames
public java.util.Collection<HierarchicalName> getHierarchicalNames(HierarchicalName hierarchicalName) throws CommonAccessException extends java.lang.Exception
Gets aCollection
of allHierarchicalName
s thatstarts with
the specifiedHierarchicalName
. The operation is executed according to the defaultStorageType
configured during construction of thisDbConfigurationManager
. If no such value is found an emptyCollection
will be returned. The specifiedHierarchicalName
must not benull
.- Parameters:
hierarchicalName
-HierarchicalName
all results will start with- Returns:
Collection
ofHierarchicalName
s- Throws:
CommonAccessException
- on errors during db-operationsCommonAccessException extends java.lang.Exception
-
getString
public java.lang.String getString(HierarchicalName hierarchicalName, StorageType storageType) throws CommonAccessException extends java.lang.Exception
Gets the configuration value with the specifiedHierarchicalName
. The operation is executed according to the specifiedStorageType
. If no such value is found, the behavior is defined by theNotFoundReactionType
specified during construction of thisDbConfigurationManager
. The specifiedHierarchicalName
must not benull
. The specifiedStorageType
must not benull
.- Parameters:
hierarchicalName
-HierarchicalName
storageType
-StorageType
- Returns:
- the configuration value
- Throws:
CommonAccessException
- on errors during db-operationsCommonAccessException extends java.lang.Exception
-
getString
public java.lang.String getString(HierarchicalName hierarchicalName) throws CommonAccessException extends java.lang.Exception
Gets the configuration value with the specifiedHierarchicalName
. The operation is executed according to the defaultStorageType
configured during construction of thisDbConfigurationManager
. If no such value is found, the behavior is defined by theNotFoundReactionType
specified during construction of thisDbConfigurationManager
. The specifiedHierarchicalName
must not benull
.- Parameters:
hierarchicalName
-HierarchicalName
- Returns:
- the configuration value
- Throws:
CommonAccessException
- on errors during db-operationsCommonAccessException extends java.lang.Exception
-
getId
public final Guid getId(HierarchicalName hierarchicalName, StorageType storageType) throws CommonAccessException extends java.lang.Exception
Gets the configuration value with the specifiedHierarchicalName
and converts it to aGuid
. The operation is executed according to the specifiedStorageType
. If no such value is found, the behavior is defined by theNotFoundReactionType
specified during construction of thisDbConfigurationManager
. The specifiedHierarchicalName
must not benull
. The specifiedStorageType
must not benull
.- Parameters:
hierarchicalName
-HierarchicalName
storageType
-StorageType
- Returns:
- the configuration value
- Throws:
CommonAccessException
- on errors during db-operationsCommonAccessException extends java.lang.Exception
-
getId
public final Guid getId(HierarchicalName hierarchicalName) throws CommonAccessException extends java.lang.Exception
Gets the configuration value with the specifiedHierarchicalName
and converts it to aGuid
. The operation is executed according to the defaultStorageType
configured during construction of thisDbConfigurationManager
. If no such value is found, the behavior is defined by theNotFoundReactionType
specified during construction of thisDbConfigurationManager
. The specifiedHierarchicalName
must not benull
.- Parameters:
hierarchicalName
-HierarchicalName
- Returns:
- the configuration value
- Throws:
CommonAccessException
- on errors during db-operationsCommonAccessException extends java.lang.Exception
-
getInteger
public final java.lang.Integer getInteger(HierarchicalName hierarchicalName, StorageType storageType) throws CommonAccessException extends java.lang.Exception
Gets the configuration value with the specifiedHierarchicalName
and converts it to anInteger
. The operation is executed according to the specifiedStorageType
. If no such value is found, the behavior is defined by theNotFoundReactionType
specified during construction of thisDbConfigurationManager
. The specifiedHierarchicalName
must not benull
. The specifiedStorageType
must not benull
.- Parameters:
hierarchicalName
-HierarchicalName
storageType
-StorageType
- Returns:
- the configuration value
- Throws:
CommonAccessException
- on errors during db-operationsCommonAccessException extends java.lang.Exception
-
getInteger
public final java.lang.Integer getInteger(HierarchicalName hierarchicalName) throws CommonAccessException extends java.lang.Exception
Gets the configuration value with the specifiedHierarchicalName
and converts it to anInteger
. The operation is executed according to the defaultStorageType
configured during construction of thisDbConfigurationManager
. If no such value is found, the behavior is defined by theNotFoundReactionType
specified during construction of thisDbConfigurationManager
. The specifiedHierarchicalName
must not benull
.- Parameters:
hierarchicalName
-HierarchicalName
- Returns:
- the configuration value
- Throws:
CommonAccessException
- on errors during db-operationsCommonAccessException extends java.lang.Exception
-
getLong
public final java.lang.Long getLong(HierarchicalName hierarchicalName, StorageType storageType) throws CommonAccessException extends java.lang.Exception
Gets the configuration value with the specifiedHierarchicalName
and converts it to aLong
. The operation is executed according to the specifiedStorageType
. If no such value is found, the behavior is defined by theNotFoundReactionType
specified during construction of thisDbConfigurationManager
. The specifiedHierarchicalName
must not benull
. The specifiedStorageType
must not benull
.- Parameters:
hierarchicalName
-HierarchicalName
storageType
-StorageType
- Returns:
- the configuration value
- Throws:
CommonAccessException
- on errors during db-operationsCommonAccessException extends java.lang.Exception
-
getLong
public final java.lang.Long getLong(HierarchicalName hierarchicalName) throws CommonAccessException extends java.lang.Exception
Gets the configuration value with the specifiedHierarchicalName
and converts it to aLong
. The operation is executed according to the defaultStorageType
configured during construction of thisDbConfigurationManager
. If no such value is found, the behavior is defined by theNotFoundReactionType
specified during construction of thisDbConfigurationManager
. The specifiedHierarchicalName
must not benull
.- Parameters:
hierarchicalName
-HierarchicalName
- Returns:
- the configuration value
- Throws:
CommonAccessException
- on errors during db-operationsCommonAccessException extends java.lang.Exception
-
getDecimal
public final Decimal getDecimal(HierarchicalName hierarchicalName, StorageType storageType) throws CommonAccessException extends java.lang.Exception
Gets the configuration value with the specifiedHierarchicalName
and converts it to aDecimal
. The operation is executed according to the specifiedStorageType
. If no such value is found, the behavior is defined by theNotFoundReactionType
specified during construction of thisDbConfigurationManager
. The specifiedHierarchicalName
must not benull
. The specifiedStorageType
must not benull
.- Parameters:
hierarchicalName
-HierarchicalName
storageType
-StorageType
- Returns:
- the configuration value
- Throws:
CommonAccessException
- on errors during db-operationsCommonAccessException extends java.lang.Exception
-
getDecimal
public final Decimal getDecimal(HierarchicalName hierarchicalName) throws CommonAccessException extends java.lang.Exception
Gets the configuration value with the specifiedHierarchicalName
and converts it to aDecimal
. The operation is executed according to the defaultStorageType
configured during construction of thisDbConfigurationManager
. If no such value is found, the behavior is defined by theNotFoundReactionType
specified during construction of thisDbConfigurationManager
. The specifiedHierarchicalName
must not benull
.- Parameters:
hierarchicalName
-HierarchicalName
- Returns:
- the configuration value
- Throws:
CommonAccessException
- on errors during db-operationsCommonAccessException extends java.lang.Exception
-
getFloat
public final java.lang.Float getFloat(HierarchicalName hierarchicalName, StorageType storageType) throws CommonAccessException extends java.lang.Exception
Gets the configuration value with the specifiedHierarchicalName
and converts it to aFloat
. The operation is executed according to the specifiedStorageType
. If no such value is found, the behavior is defined by theNotFoundReactionType
specified during construction of thisDbConfigurationManager
. The specifiedHierarchicalName
must not benull
. The specifiedStorageType
must not benull
.- Parameters:
hierarchicalName
-HierarchicalName
storageType
-StorageType
- Returns:
- the configuration value
- Throws:
CommonAccessException
- on errors during db-operationsCommonAccessException extends java.lang.Exception
-
getFloat
public final java.lang.Float getFloat(HierarchicalName hierarchicalName) throws CommonAccessException extends java.lang.Exception
Gets the configuration value with the specifiedHierarchicalName
and converts it to aFloat
. The operation is executed according to the defaultStorageType
configured during construction of thisDbConfigurationManager
. If no such value is found, the behavior is defined by theNotFoundReactionType
specified during construction of thisDbConfigurationManager
. The specifiedHierarchicalName
must not benull
.- Parameters:
hierarchicalName
-HierarchicalName
- Returns:
- the configuration value
- Throws:
CommonAccessException
- on errors during db-operationsCommonAccessException extends java.lang.Exception
-
getDouble
public final java.lang.Double getDouble(HierarchicalName hierarchicalName, StorageType storageType) throws CommonAccessException extends java.lang.Exception
Gets the configuration value with the specifiedHierarchicalName
and converts it to aDouble
. The operation is executed according to the specifiedStorageType
. If no such value is found, the behavior is defined by theNotFoundReactionType
specified during construction of thisDbConfigurationManager
. The specifiedHierarchicalName
must not benull
. The specifiedStorageType
must not benull
.- Parameters:
hierarchicalName
-HierarchicalName
storageType
-StorageType
- Returns:
- the configuration value
- Throws:
CommonAccessException
- on errors during db-operationsCommonAccessException extends java.lang.Exception
-
getDouble
public final java.lang.Double getDouble(HierarchicalName hierarchicalName) throws CommonAccessException extends java.lang.Exception
Gets the configuration value with the specifiedHierarchicalName
and converts it to aDouble
. The operation is executed according to the defaultStorageType
configured during construction of thisDbConfigurationManager
. If no such value is found, the behavior is defined by theNotFoundReactionType
specified during construction of thisDbConfigurationManager
. The specifiedHierarchicalName
must not benull
.- Parameters:
hierarchicalName
-HierarchicalName
- Returns:
- the configuration value
- Throws:
CommonAccessException
- on errors during db-operationsCommonAccessException extends java.lang.Exception
-
getBoolean
public final java.lang.Boolean getBoolean(HierarchicalName hierarchicalName, StorageType storageType) throws CommonAccessException extends java.lang.Exception
Gets the configuration value with the specifiedHierarchicalName
and converts it to aBoolean
. The operation is executed according to the specifiedStorageType
. If no such value is found, the behavior is defined by theNotFoundReactionType
specified during construction of thisDbConfigurationManager
. The specifiedHierarchicalName
must not benull
. The specifiedStorageType
must not benull
.- Parameters:
hierarchicalName
-HierarchicalName
storageType
-StorageType
- Returns:
- the configuration value
- Throws:
CommonAccessException
- on errors during db-operationsCommonAccessException extends java.lang.Exception
-
getBoolean
public final java.lang.Boolean getBoolean(HierarchicalName hierarchicalName) throws CommonAccessException extends java.lang.Exception
Gets the configuration value with the specifiedHierarchicalName
and converts it to aBoolean
. The operation is executed according to the defaultStorageType
configured during construction of thisDbConfigurationManager
. If no such value is found, the behavior is defined by theNotFoundReactionType
specified during construction of thisDbConfigurationManager
. The specifiedHierarchicalName
must not benull
.- Parameters:
hierarchicalName
-HierarchicalName
- Returns:
- the configuration value
- Throws:
CommonAccessException
- on errors during db-operationsCommonAccessException extends java.lang.Exception
-
getDateTime
public final java.util.Date getDateTime(HierarchicalName hierarchicalName, StorageType storageType) throws CommonAccessException extends java.lang.Exception
Gets the configuration value with the specifiedHierarchicalName
and converts it to aDate
. The operation is executed according to the specifiedStorageType
. If no such value is found, the behavior is defined by theNotFoundReactionType
specified during construction of thisDbConfigurationManager
. The specifiedHierarchicalName
must not benull
. The specifiedStorageType
must not benull
.- Parameters:
hierarchicalName
-HierarchicalName
storageType
-StorageType
- Returns:
- the configuration value
- Throws:
CommonAccessException
- on errors during db-operationsCommonAccessException extends java.lang.Exception
-
getDateTime
public final java.util.Date getDateTime(HierarchicalName hierarchicalName) throws CommonAccessException extends java.lang.Exception
Gets the configuration value with the specifiedHierarchicalName
and converts it to aDate
. The operation is executed according to the defaultStorageType
configured during construction of thisDbConfigurationManager
. If no such value is found, the behavior is defined by theNotFoundReactionType
specified during construction of thisDbConfigurationManager
. The specifiedHierarchicalName
must not benull
.- Parameters:
hierarchicalName
-HierarchicalName
- Returns:
- the configuration value
- Throws:
CommonAccessException
- on errors during db-operationsCommonAccessException extends java.lang.Exception
-
getBinary
public final Binary getBinary(HierarchicalName hierarchicalName, StorageType storageType) throws CommonAccessException extends java.lang.Exception
Gets the configuration value with the specifiedHierarchicalName
and converts it to aBinary
. The operation is executed according to the specifiedStorageType
. If no such value is found, the behavior is defined by theNotFoundReactionType
specified during construction of thisDbConfigurationManager
. The specifiedHierarchicalName
must not benull
. The specifiedStorageType
must not benull
.- Parameters:
hierarchicalName
-HierarchicalName
storageType
-StorageType
- Returns:
- the configuration value
- Throws:
CommonAccessException
- on errors during db-operationsCommonAccessException extends java.lang.Exception
-
getBinary
public final Binary getBinary(HierarchicalName hierarchicalName) throws CommonAccessException extends java.lang.Exception
Gets the configuration value with the specifiedHierarchicalName
and converts it to aBinary
. The operation is executed according to the defaultStorageType
configured during construction of thisDbConfigurationManager
. If no such value is found, the behavior is defined by theNotFoundReactionType
specified during construction of thisDbConfigurationManager
. The specifiedHierarchicalName
must not benull
.- Parameters:
hierarchicalName
-HierarchicalName
- Returns:
- the configuration value
- Throws:
CommonAccessException
- on errors during db-operationsCommonAccessException extends java.lang.Exception
-
set
public void set(HierarchicalName hierarchicalName, java.lang.Object value) throws CommonAccessException extends java.lang.Exception
Sets the configuration value with the specifiedHierarchicalName
. Saves it both in the database and in the in-memory cache. The object must be one of the following: The specifiedHierarchicalName
must not benull
.- Parameters:
hierarchicalName
-HierarchicalName
value
- the configuration value- Throws:
CommonAccessException
- on errors during db-operationsCommonAccessException extends java.lang.Exception
-
set
public void set(java.util.Map<HierarchicalName,java.lang.Object> mapHierarchicalName2Value) throws CommonAccessException extends java.lang.Exception
Sets all the specified configuration values (values of the specified map) according to their specifiedHierarchicalName
s (keys of the specified map. Saves them both in the database and in the in-memory cache. Every value-object must be one of the following: All the specifiedHierarchicalName
s must not benull
. The specifiedMap
must not benull
.- Parameters:
mapHierarchicalName2Value
-Map
of configuration values (key =HierarchicalName
, value = configuration value (Object
))- Throws:
CommonAccessException
- on errors during db-operationsCommonAccessException extends java.lang.Exception
-
-