Interface ConfigurationRepository
-
- All Known Implementing Classes:
DefaultConfigurationRepository
public interface ConfigurationRepository
A repository for basic storage of the configuration.
-
-
Field Summary
Fields Modifier and Type Field Description static String
CONNECTION_CONFIGURATION_KEY
Key of connection configuration record.static String
CONNECTOR_CONFIGURATION_KEY
Key of connector configuration record.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description void
delete(String key)
Deletes the configuration record stored under the provided key.<T> Optional<T>
fetch(String key, Class<T> clazz)
Retrieves configuration properties from the record stored under the provided key, and maps them to the provided class.ConfigurationMap
fetchAll()
Retrieves all configuration records and maps them to anConfigurationMap
instance.static ConfigurationRepository
getInstance(Session session)
Returns a new instance of the default repository implementation.<T> void
update(String key, T value)
Updates the configuration properties in the record stored under the provided key.
-
-
-
Field Detail
-
CONNECTOR_CONFIGURATION_KEY
static final String CONNECTOR_CONFIGURATION_KEY
Key of connector configuration record.- See Also:
- Constant Field Values
-
CONNECTION_CONFIGURATION_KEY
static final String CONNECTION_CONFIGURATION_KEY
Key of connection configuration record.- See Also:
- Constant Field Values
-
-
Method Detail
-
update
<T> void update(String key, T value)
Updates the configuration properties in the record stored under the provided key. If the configuration is not present, a new record will be created.- Type Parameters:
T
- type of the provided value- Parameters:
key
- key of the configuration recordvalue
- new configuration properties
-
fetch
<T> Optional<T> fetch(String key, Class<T> clazz)
Retrieves configuration properties from the record stored under the provided key, and maps them to the provided class.- Type Parameters:
T
- type of the provided class- Parameters:
key
- key of the configuration recordclazz
- a class to which the retrieved properties will be mapped- Returns:
- an object of a given class, created by mapping the retrieved configuration properties
-
fetchAll
ConfigurationMap fetchAll()
Retrieves all configuration records and maps them to anConfigurationMap
instance.- Returns:
- a configuration map containing all retrieved configuration records
-
delete
void delete(String key)
Deletes the configuration record stored under the provided key. If the record does not exist, then no action is taken.- Parameters:
key
- key of the configuration record
-
getInstance
static ConfigurationRepository getInstance(Session session)
Returns a new instance of the default repository implementation.Default implementation of the repository uses a default implementation of
KeyValueTable
, created for theSTATE.APP_CONFIG
table.- Parameters:
session
- Snowpark session object- Returns:
- a new service instance
-
-