Package africa.absa.inception.config
Interface IConfigService
-
- All Known Implementing Classes:
ConfigService
public interface IConfigServiceThe IConfigService interface defines the functionality provided by a Config Service implementation, which manages the config information for an application or service.- Author:
- Marcus Portmann
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voiddeleteConfig(String key)Delete the config with the specified key.byte[]getBinary(String key)Retrieve the binary config.byte[]getBinary(String key, byte[] defaultValue)Retrieve the binary config.booleangetBoolean(String key)Retrieve the Boolean config.booleangetBoolean(String key, boolean defaultValue)Retrieve the Boolean config.ConfiggetConfig(String key)Retrieve the config.List<Config>getConfigs()Retrieve all the configs.List<ConfigSummary>getConfigSummaries()Retrieve all the config summaries.DoublegetDouble(String key)Retrieve the Double config.doublegetDouble(String key, double defaultValue)Retrieve the Double config.List<Config>getFilteredConfigs(String filter)Retrieve the filtered configs.List<ConfigSummary>getFilteredConfigSummaries(String filter)Retrieve the filtered config summaries.IntegergetInteger(String key)Retrieve the Integer config.intgetInteger(String key, int defaultValue)Retrieve the Integer config.LonggetLong(String key)Retrieve the Long config.longgetLong(String key, long defaultValue)Retrieve the Long config.StringgetString(String key)Retrieve the value for the String config.StringgetString(String key, String defaultValue)Retrieve the value for the String config.booleankeyExists(String key)Check if a config with the specified key exists.voidsetConfig(Config config)Set the config.voidsetConfig(String key, Object value, String description)Set the config key to the specified value.
-
-
-
Method Detail
-
deleteConfig
void deleteConfig(String key) throws InvalidArgumentException, ConfigNotFoundException, ServiceUnavailableException
Delete the config with the specified key.- Parameters:
key- the key for the config- Throws:
InvalidArgumentException- if an argument is invalidConfigNotFoundException- if the config could not be foundServiceUnavailableException- if the config could not be deleted
-
getBinary
byte[] getBinary(String key) throws InvalidArgumentException, ConfigNotFoundException, ServiceUnavailableException
Retrieve the binary config.- Parameters:
key- the key for the config- Returns:
- the binary config
- Throws:
InvalidArgumentException- if an argument is invalidConfigNotFoundException- if the config could not be foundServiceUnavailableException- if the binary config value could not be retrieved
-
getBinary
byte[] getBinary(String key, byte[] defaultValue) throws InvalidArgumentException, ServiceUnavailableException
Retrieve the binary config.- Parameters:
key- the key for the configdefaultValue- the default value to return if the config does not exist- Returns:
- the binary config or the default value if the config does not exist
- Throws:
InvalidArgumentException- if an argument is invalidServiceUnavailableException- if the binary config value could not be retrieved
-
getBoolean
boolean getBoolean(String key) throws InvalidArgumentException, ConfigNotFoundException, ServiceUnavailableException
Retrieve the Boolean config.- Parameters:
key- the key for the config- Returns:
- the Boolean config
- Throws:
InvalidArgumentException- if an argument is invalidConfigNotFoundException- if the config could not be foundServiceUnavailableException- if the boolean config value could not be retrieved
-
getBoolean
boolean getBoolean(String key, boolean defaultValue) throws InvalidArgumentException, ServiceUnavailableException
Retrieve the Boolean config.- Parameters:
key- the key for the configdefaultValue- the default value to return if the config does not exist- Returns:
- the Boolean config or the default value if the config value does not exist
- Throws:
InvalidArgumentException- if an argument is invalidServiceUnavailableException- if the boolean config value could not be retrieved
-
getConfig
Config getConfig(String key) throws InvalidArgumentException, ConfigNotFoundException, ServiceUnavailableException
Retrieve the config.- Parameters:
key- the key for the config- Returns:
- the config
- Throws:
InvalidArgumentException- if an argument is invalidConfigNotFoundException- if the config could not be foundServiceUnavailableException- if the config could not be retrieved
-
getConfigSummaries
List<ConfigSummary> getConfigSummaries() throws ServiceUnavailableException
Retrieve all the config summaries.- Returns:
- the config summaries
- Throws:
ServiceUnavailableException- if the config summaries could not be retrieved
-
getConfigs
List<Config> getConfigs() throws ServiceUnavailableException
Retrieve all the configs.- Returns:
- the configs
- Throws:
ServiceUnavailableException- if the configs could not be retrieved
-
getDouble
Double getDouble(String key) throws InvalidArgumentException, ConfigNotFoundException, ServiceUnavailableException
Retrieve the Double config.- Parameters:
key- the key for the config- Returns:
- the Double config
- Throws:
InvalidArgumentException- if an argument is invalidConfigNotFoundException- if the config could not be foundServiceUnavailableException- if the double config value could not be retrieved
-
getDouble
double getDouble(String key, double defaultValue) throws InvalidArgumentException, ServiceUnavailableException
Retrieve the Double config.- Parameters:
key- the key for the configdefaultValue- the default value to return if the config does not exist- Returns:
- the Double config or the default value if the config entry does not exist
- Throws:
InvalidArgumentException- if an argument is invalidServiceUnavailableException- if the double config value could not be retrieved
-
getFilteredConfigSummaries
List<ConfigSummary> getFilteredConfigSummaries(String filter) throws ServiceUnavailableException
Retrieve the filtered config summaries.- Parameters:
filter- the filter to apply to the keys for the config summaries- Returns:
- the config summaries
- Throws:
ServiceUnavailableException- if the filtered config summaries could not be retrieved
-
getFilteredConfigs
List<Config> getFilteredConfigs(String filter) throws ServiceUnavailableException
Retrieve the filtered configs.- Parameters:
filter- the filter to apply to the keys for the config- Returns:
- the configs
- Throws:
ServiceUnavailableException- if the filtered configs could not be retrieved
-
getInteger
Integer getInteger(String key) throws InvalidArgumentException, ConfigNotFoundException, ServiceUnavailableException
Retrieve the Integer config.- Parameters:
key- the key for the config- Returns:
- the Integer config
- Throws:
InvalidArgumentException- if an argument is invalidConfigNotFoundException- if the config could not be foundServiceUnavailableException- if the integer config value could not be retrieved
-
getInteger
int getInteger(String key, int defaultValue) throws InvalidArgumentException, ServiceUnavailableException
Retrieve the Integer config.- Parameters:
key- the key for the configdefaultValue- the default value to return if the config does not exist- Returns:
- the Integer config or the default value if the config entry does not exist
- Throws:
InvalidArgumentException- if an argument is invalidServiceUnavailableException- if the integer config value could not be retrieved
-
getLong
Long getLong(String key) throws InvalidArgumentException, ConfigNotFoundException, ServiceUnavailableException
Retrieve the Long config.- Parameters:
key- the key for the config- Returns:
- the Long config
- Throws:
InvalidArgumentException- if an argument is invalidConfigNotFoundException- if the config could not be foundServiceUnavailableException- if the long config value could not be retrieved
-
getLong
long getLong(String key, long defaultValue) throws InvalidArgumentException, ServiceUnavailableException
Retrieve the Long config.- Parameters:
key- the key for the configdefaultValue- the default value to return if the config does not exist- Returns:
- the Long config or the default value if the config entry does not exist
- Throws:
InvalidArgumentException- if an argument is invalidServiceUnavailableException- if the long config value could not be retrieved
-
getString
String getString(String key) throws InvalidArgumentException, ConfigNotFoundException, ServiceUnavailableException
Retrieve the value for the String config.- Parameters:
key- the key for the config- Returns:
- the value for the String config
- Throws:
InvalidArgumentException- if an argument is invalidConfigNotFoundException- if the config could not be foundServiceUnavailableException- if the string config value could not be retrieved
-
getString
String getString(String key, String defaultValue) throws InvalidArgumentException, ServiceUnavailableException
Retrieve the value for the String config.- Parameters:
key- the key for the configdefaultValue- the default value to return if the config does not exist- Returns:
- the value for the String config or the default value if the config does not exist
- Throws:
InvalidArgumentException- if an argument is invalidServiceUnavailableException- if the string config value could not be retrieved
-
keyExists
boolean keyExists(String key) throws InvalidArgumentException, ServiceUnavailableException
Check if a config with the specified key exists.- Parameters:
key- the key for the config- Returns:
- true if the config with the specified key exists or false otherwise
- Throws:
InvalidArgumentException- if an argument is invalidServiceUnavailableException- if the check for the existing key failed
-
setConfig
void setConfig(Config config) throws InvalidArgumentException, ServiceUnavailableException
Set the config.- Parameters:
config- the config- Throws:
InvalidArgumentException- if an argument is invalidServiceUnavailableException- if the config could not be set
-
setConfig
void setConfig(String key, Object value, String description) throws InvalidArgumentException, ServiceUnavailableException
Set the config key to the specified value.- Parameters:
key- the key for the configvalue- the value for the configdescription- the description for the config- Throws:
InvalidArgumentException- if an argument is invalidServiceUnavailableException- if the config could not be set
-
-