Class DbConfigurationManagerConstructorParameters<CommonAccessException extends java.lang.Exception>
- java.lang.Object
-
- com.saperion.common.config.manager.DbConfigurationManagerConstructorParameters<CommonAccessException>
-
- Type Parameters:
CommonAccessException
- the common access exception type of the underlyingDataSource
and so of theDbConfigurationManager
to be created.
public final class DbConfigurationManagerConstructorParameters<CommonAccessException extends java.lang.Exception> extends java.lang.Object
TheDbConfigurationManagerConstructorParameters
accumulates the parameters for construction of aDbConfigurationManager
and their defaults. See the individual setter-methods for the concrete default values.
-
-
Constructor Summary
Constructors Constructor Description DbConfigurationManagerConstructorParameters(DataSource<CommonAccessException,java.lang.IllegalStateException> dataSource)
Creates newDbConfigurationManagerConstructorParameters
with the specifiedDataSource
and all other values set to defaults.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Cipher
getCipher()
Returns theCipher
that should be used to encrypt/decrypt the configuration values.DataSource<CommonAccessException,java.lang.IllegalStateException>
getDataSource()
Returns theDataSource
.NotFoundReactionType
getDefaultNotFoundReactionType()
Returns theNotFoundReactionType
that defines forDbConfigurationManager.get...()-methods
the behavior if the requested configuration value was not found.StorageType
getDefaultStorageType()
Returns the defaultStorageType
that applies for all get...()-methods ofDbConfigurationManager
that have noStorageType
-parameter or for those that have one called withStorageType.DEFAULT
.Pair<java.security.Key,java.security.Key>
getEncryptionKeys()
Returns aPair
ofKey
s that should be used to encrypt/decrypt the configuration values.HierarchicalName
getRootName()
Returns the root name.java.lang.String
getTableName()
Returns the name of the underlying database table to load and store the configuration value to/from.DbConfigurationManagerConstructorParameters<CommonAccessException>
setDefaultNotFoundReactionType(NotFoundReactionType defaultNotFoundReactionType)
Sets the defaultNotFoundReactionType
that defines forDbConfigurationManager.get...()-methods
the behavior if the requested configuration value was not found.DbConfigurationManagerConstructorParameters<CommonAccessException>
setDefaultStorageType(StorageType defaultStorageType)
Sets the defaultStorageType
that applies for all get...()-methods ofDbConfigurationManager
that have noStorageType
-parameter or for those that have one called withStorageType.DEFAULT
.DbConfigurationManagerConstructorParameters<CommonAccessException>
setEncryptionKeys(Cipher cipher, Pair<java.security.Key,java.security.Key> pairEncryptionKeys)
void
setRootName(HierarchicalName rootName)
Sets the root name.DbConfigurationManagerConstructorParameters<CommonAccessException>
setTableName(java.lang.String tableName)
Sets the name of the underlying database table to load and store the configuration value to/from.java.lang.String
toString()
-
-
-
Constructor Detail
-
DbConfigurationManagerConstructorParameters
public DbConfigurationManagerConstructorParameters(DataSource<CommonAccessException,java.lang.IllegalStateException> dataSource)
Creates newDbConfigurationManagerConstructorParameters
with the specifiedDataSource
and all other values set to defaults. See the individual setter-methods for the default values.- Parameters:
dataSource
-DataSource
-
-
Method Detail
-
getDataSource
public DataSource<CommonAccessException,java.lang.IllegalStateException> getDataSource()
Returns theDataSource
.- Returns:
- the
DataSource
-
getTableName
public java.lang.String getTableName()
Returns the name of the underlying database table to load and store the configuration value to/from.- Returns:
- the name of the underlying database table
-
setTableName
public DbConfigurationManagerConstructorParameters<CommonAccessException> setTableName(java.lang.String tableName)
Sets the name of the underlying database table to load and store the configuration value to/from. The name must not benull
or empty and must matchthe regular expression for table names
. Defaults to "configuration".- Parameters:
tableName
- the name of the underlying database table- Returns:
- this
DbConfigurationManagerConstructorParameters
-
getRootName
public HierarchicalName getRootName()
Returns the root name. 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 root name may benull
in which case it has no effects, i.e. all key parameters will be used as provided.- Returns:
- the root name
-
setRootName
public void setRootName(HierarchicalName rootName)
Sets the root name. 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 root name may benull
in which case it has no effects, i.e. all key parameters will be used as provided. Defaults tonull
.- Parameters:
rootName
- root name
-
getDefaultStorageType
public StorageType getDefaultStorageType()
Returns the defaultStorageType
that applies for all get...()-methods ofDbConfigurationManager
that have noStorageType
-parameter or for those that have one called withStorageType.DEFAULT
.- Returns:
- the default
StorageType
-
setDefaultStorageType
public DbConfigurationManagerConstructorParameters<CommonAccessException> setDefaultStorageType(StorageType defaultStorageType)
Sets the defaultStorageType
that applies for all get...()-methods ofDbConfigurationManager
that have noStorageType
-parameter or for those that have one called withStorageType.DEFAULT
. The defaultStorageType
must not benull
and must not beStorageType.DEFAULT
. Defaults toStorageType.DB_IF_NOTHING_IN_MEMORY
.- Parameters:
defaultStorageType
- defaultStorageType
- Returns:
- this
DbConfigurationManagerConstructorParameters
-
getDefaultNotFoundReactionType
public NotFoundReactionType getDefaultNotFoundReactionType()
Returns theNotFoundReactionType
that defines forDbConfigurationManager.get...()-methods
the behavior if the requested configuration value was not found.- Returns:
- the
NotFoundReactionType
-
setDefaultNotFoundReactionType
public DbConfigurationManagerConstructorParameters<CommonAccessException> setDefaultNotFoundReactionType(NotFoundReactionType defaultNotFoundReactionType)
Sets the defaultNotFoundReactionType
that defines forDbConfigurationManager.get...()-methods
the behavior if the requested configuration value was not found. The defaultNotFoundReactionType
must not benull
. Defaults toNotFoundReactionType.EXCEPTION
.- Parameters:
defaultNotFoundReactionType
- defaultNotFoundReactionType
- Returns:
- this
DbConfigurationManagerConstructorParameters
-
getCipher
public Cipher getCipher()
Returns theCipher
that should be used to encrypt/decrypt the configuration values. Returnsnull
if encryption/decryption is not active.- Returns:
- the
Cipher
-
getEncryptionKeys
public Pair<java.security.Key,java.security.Key> getEncryptionKeys()
Returns aPair
ofKey
s that should be used to encrypt/decrypt the configuration values. If the encryption algorithm is asymmetric the first is the public key (used for encryption) and the second is the private key (used for decryption). If the encryption algorithm is symmetric both keys are the same instance. * Returnsnull
if encryption/decryption is not active.- Returns:
Pair
ofKey
s
-
setEncryptionKeys
public DbConfigurationManagerConstructorParameters<CommonAccessException> setEncryptionKeys(Cipher cipher, Pair<java.security.Key,java.security.Key> pairEncryptionKeys)
Sets aCipher
and aPair
ofKey
s that should be used to encrypt/decrypt the configuration values. Either both (Cipher
and aPair
) must be valid and suiting to each other or both must benull
(to deactivate encryption/decryption). If the encryption algorithm is asymmetric the first must be the public key (used for encryption) and the second must be the private key (used for decryption). If the encryption algorithm is symmetric both keys must be the same instance. Defaults tonull
/null
.- Parameters:
cipher
- theCipher
to use ornull
pairEncryptionKeys
- thePair
ofKey
s to use ornull
- Returns:
- this
DbConfigurationManagerConstructorParameters
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-