Class DefaultConfigurationRepository
- java.lang.Object
-
- com.snowflake.connectors.application.configuration.DefaultConfigurationRepository
-
- All Implemented Interfaces:
ConfigurationRepository
public class DefaultConfigurationRepository extends Object implements ConfigurationRepository
Default implementation ofConfigurationRepository, which uses theKeyValueTablefor data storage.
-
-
Field Summary
-
Fields inherited from interface com.snowflake.connectors.application.configuration.ConfigurationRepository
CONNECTION_CONFIGURATION_KEY, CONNECTOR_CONFIGURATION_KEY
-
-
Constructor Summary
Constructors Constructor Description DefaultConfigurationRepository(KeyValueTable table)Creates a newDefaultConfigurationRepository, using the provided table for data storage.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddelete(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.ConfigurationMapfetchAll()Retrieves all configuration records and maps them to anConfigurationMapinstance.<T> voidupdate(String key, T value)Updates the configuration properties in the record stored under the provided key.
-
-
-
Constructor Detail
-
DefaultConfigurationRepository
public DefaultConfigurationRepository(KeyValueTable table)
Creates a newDefaultConfigurationRepository, using the provided table for data storage.- Parameters:
table- key-value table used for data storage
-
-
Method Detail
-
fetch
public <T> Optional<T> fetch(String key, Class<T> clazz)
Description copied from interface:ConfigurationRepositoryRetrieves configuration properties from the record stored under the provided key, and maps them to the provided class.- Specified by:
fetchin interfaceConfigurationRepository- 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
-
update
public <T> void update(String key, T value)
Description copied from interface:ConfigurationRepositoryUpdates the configuration properties in the record stored under the provided key. If the configuration is not present, a new record will be created.- Specified by:
updatein interfaceConfigurationRepository- Type Parameters:
T- type of the provided value- Parameters:
key- key of the configuration recordvalue- new configuration properties
-
fetchAll
public ConfigurationMap fetchAll()
Description copied from interface:ConfigurationRepositoryRetrieves all configuration records and maps them to anConfigurationMapinstance.- Specified by:
fetchAllin interfaceConfigurationRepository- Returns:
- a configuration map containing all retrieved configuration records
-
delete
public void delete(String key)
Description copied from interface:ConfigurationRepositoryDeletes the configuration record stored under the provided key. If the record does not exist, then no action is taken.- Specified by:
deletein interfaceConfigurationRepository- Parameters:
key- key of the configuration record
-
-