- java.lang.Object
-
- io.helidon.config.AbstractSource
-
- io.helidon.config.AbstractConfigSource
-
- io.helidon.config.git.GitConfigSource
-
- All Implemented Interfaces:
ConfigSource,ParsableSource,PollableSource<byte[]>,Source,AutoCloseable,Supplier<ConfigSource>
public class GitConfigSource extends AbstractConfigSource implements ParsableSource, PollableSource<byte[]>, AutoCloseable
A config source which loads a configuration document from Git repository.Config source is initialized by
GitConfigSourceBuilder.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface io.helidon.config.spi.ParsableSource
ParsableSource.Builder<B extends ParsableSource.Builder<B>>
-
Nested classes/interfaces inherited from interface io.helidon.config.spi.PollableSource
PollableSource.Builder<T extends PollableSource.Builder<T>>
-
Nested classes/interfaces inherited from interface io.helidon.config.spi.Source
Source.Builder<B extends Source.Builder<B>>
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static GitConfigSourceBuilderbuilder()Create a fluent API builder for GIT config source.voidclose()static GitConfigSourcecreate(Config metaConfig)Create an instance from meta configuration.voidinit(ConfigContext context)Initialize the config source with aConfigContext.booleanisModified(byte[] stamp)This method is invoked to check if this source has changed.Optional<ConfigParser.Content>load()Loads the underlying source data.Optional<String>mediaType()Media type if on eis configured for parsing content ofParsableSource.Optional<ConfigParser>parser()Config parser if one is configured to use for parsing content ofParsableSource.Optional<PollingStrategy>pollingStrategy()A polling strategy of this source, if it implementsPollableSourceand has one configured.Function<String,Optional<InputStream>>relativeResolver()Resolve relative resource to the current resource.protected Stringuid()Returns universal id of source to be used to constructAbstractSource.description().-
Methods inherited from class io.helidon.config.AbstractConfigSource
toString
-
Methods inherited from class io.helidon.config.AbstractSource
changeWatcher, description, optional, retryPolicy
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface io.helidon.config.spi.ConfigSource
get
-
Methods inherited from interface io.helidon.config.spi.Source
description, exists, optional, retryPolicy
-
-
-
-
Method Detail
-
init
public void init(ConfigContext context)
Description copied from interface:ConfigSourceInitialize the config source with aConfigContext.The method is executed during
Configbootstrapping byConfig.Builder.- Specified by:
initin interfaceConfigSource- Parameters:
context- a config context
-
create
public static GitConfigSource create(Config metaConfig)
Create an instance from meta configuration.- Parameters:
metaConfig- meta configuration of this source- Returns:
- config source configured from the meta configuration
-
builder
public static GitConfigSourceBuilder builder()
Create a fluent API builder for GIT config source.- Returns:
- a new builder instance
-
uid
protected String uid()
Description copied from class:AbstractSourceReturns universal id of source to be used to constructAbstractSource.description().- Overrides:
uidin classAbstractSource- Returns:
- universal id of source
-
parser
public Optional<ConfigParser> parser()
Description copied from class:AbstractConfigSourceConfig parser if one is configured to use for parsing content ofParsableSource. If one is not configured on a source (default), a parser is chosen based onAbstractConfigSource.mediaType().- Specified by:
parserin interfaceParsableSource- Overrides:
parserin classAbstractConfigSource- Returns:
- a configured parser, or empty if one should be chosen from media type (or if this is not a parsable source)
-
pollingStrategy
public Optional<PollingStrategy> pollingStrategy()
Description copied from class:AbstractSourceA polling strategy of this source, if it implementsPollableSourceand has one configured.- Specified by:
pollingStrategyin interfacePollableSource<byte[]>- Overrides:
pollingStrategyin classAbstractSource- Returns:
- polling strategy if any configured
-
isModified
public boolean isModified(byte[] stamp)
Description copied from interface:PollableSourceThis method is invoked to check if this source has changed.- Specified by:
isModifiedin interfacePollableSource<byte[]>- Parameters:
stamp- the stamp of the last loaded content- Returns:
trueif the current data of this config source differ from the loaded data, including cases when the source has disappeared
-
load
public Optional<ConfigParser.Content> load() throws ConfigException
Description copied from interface:ParsableSourceLoads the underlying source data. This method is only called when the sourceSource.exists().The method can be invoked repeatedly, for example during retries. In case the underlying data is gone or does not exist, return an empty optional.
- Specified by:
loadin interfaceParsableSource- Returns:
- An instance of
Tas read from the underlying origin of the data (if it exists) - Throws:
ConfigException- in case of errors loading from the underlying origin
-
relativeResolver
public Function<String,Optional<InputStream>> relativeResolver()
Description copied from interface:ParsableSourceResolve relative resource to the current resource.- Specified by:
relativeResolverin interfaceParsableSource- Returns:
- a function to resolve resource name into an input stream
-
mediaType
public Optional<String> mediaType()
Description copied from class:AbstractConfigSourceMedia type if on eis configured for parsing content ofParsableSource. If there is none configured (default), a parser is chosen based onConfigParser.Content.mediaType()- media type detected during load of data.- Specified by:
mediaTypein interfaceParsableSource- Overrides:
mediaTypein classAbstractConfigSource- Returns:
- configured media type or empty if none configured
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Throws:
IOException
-
-