-
- All Known Implementing Classes:
ClassPathConfigSource,EnvironmentConfigSource,FileConfigSource,KubernetesSecretConfigSource,MapConfigSource,StringConfigSource,SystemPropertiesConfigSource,URLConfigSource
public interface ConfigSourceInterface to define a either stream or map based config source. Configs come in two forms, either a stream such as a file. Or a list of values, such as an Environment Variables or a in memory map provided. A source will have a format that a Config loader expects to load.Each source has a unique ID, so we can track and match it in the system.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default booleanfailOnErrors()If the source should fail on errors.java.lang.Stringformat()The format of the config source, for example this can be envVars, the extension of a file (properties, json, ect).TagsgetTags()A source can have a set of tags that apply to all nodes in the source.booleanhasList()If this config source provides a list of config values.booleanhasStream()If this config source has a stream to load from.java.util.UUIDid()Id that represents this source as unique.java.util.List<Pair<java.lang.String,java.lang.String>>loadList()provides a list of config values.java.io.InputStreamloadStream()If this config source has a stream, this will return the stream of data.java.lang.Stringname()human-readable name for logging.
-
-
-
Method Detail
-
hasStream
boolean hasStream()
If this config source has a stream to load from.- Returns:
- if this config source has a stream to load from
-
loadStream
java.io.InputStream loadStream() throws GestaltExceptionIf this config source has a stream, this will return the stream of data. Or if not supported it will throw an exception.- Returns:
- input stream of data
- Throws:
GestaltException- if there are any IO or if this is an unsupported operation
-
hasList
boolean hasList()
If this config source provides a list of config values.- Returns:
- if this config source provides a list of config values
-
loadList
java.util.List<Pair<java.lang.String,java.lang.String>> loadList() throws GestaltException
provides a list of config values.- Returns:
- provides a list of config values
- Throws:
GestaltException- if there are any IO or if this is an unsupported operation
-
format
java.lang.String format()
The format of the config source, for example this can be envVars, the extension of a file (properties, json, ect).- Returns:
- The format of the config source
-
name
java.lang.String name()
human-readable name for logging.- Returns:
- human-readable name for logging.
-
id
java.util.UUID id()
Id that represents this source as unique.- Returns:
- id
-
getTags
Tags getTags()
A source can have a set of tags that apply to all nodes in the source.- Returns:
- tags assigned to the source
-
failOnErrors
default boolean failOnErrors()
If the source should fail on errors.- Returns:
- If the source should fail on errors
-
-