java.lang.Object
io.helidon.config.AbstractSource
io.helidon.config.FileOverrideSource
- All Implemented Interfaces:
OverrideSource,PollableSource<byte[]>,Source,WatchableSource<Path>,Supplier<OverrideSource>
public final class FileOverrideSource
extends AbstractSource
implements OverrideSource, PollableSource<byte[]>, WatchableSource<Path>
OverrideSource implementation that loads override definitions from a file on a filesystem.- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classFile OverrideSource Builder.Nested classes/interfaces inherited from interface io.helidon.config.spi.OverrideSource
OverrideSource.OverrideData -
Method Summary
Modifier and TypeMethodDescriptionstatic FileOverrideSource.Builderbuilder()Create a new builder.A change watcher of this source, if it implementsWatchableSourceand has one configured.static FileOverrideSourceCreate a new file override source from meta configuration.booleanexists()If the underlying data exist at this time.booleanisModified(byte[] stamp) This method is invoked to check if this source has changed.load()Load override data from the underlying source.A polling strategy of this source, if it implementsPollableSourceand has one configured.target()The target of this source.Target type as supported by this source.protected Stringuid()Returns universal id of source to be used to constructAbstractSource.description().Methods inherited from class io.helidon.config.AbstractSource
description, optional, retryPolicyMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.helidon.config.spi.OverrideSource
getMethods inherited from interface io.helidon.config.spi.Source
description, optional, retryPolicy
-
Method Details
-
uid
Description copied from class:AbstractSourceReturns universal id of source to be used to constructAbstractSource.description().- Overrides:
uidin classAbstractSource- Returns:
- universal id of source
-
exists
public boolean exists()Description copied from interface:SourceIf the underlying data exist at this time. This is to prevent us loading such a source if we know it does not exist. -
load
Description copied from interface:OverrideSourceLoad override data from the underlying source.- Specified by:
loadin interfaceOverrideSource- Returns:
- override data if present, empty otherwise
- Throws:
ConfigException- in case the loading of data failed
-
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
-
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
-
target
Description copied from interface:WatchableSourceThe target of this source.- Specified by:
targetin interfaceWatchableSource<Path>- Returns:
- target this source is configured with, never
null
-
changeWatcher
Description copied from class:AbstractSourceA change watcher of this source, if it implementsWatchableSourceand has one configured.- Specified by:
changeWatcherin interfaceWatchableSource<Path>- Overrides:
changeWatcherin classAbstractSource- Returns:
- change watcher if any configured
-
targetType
Description copied from interface:WatchableSourceTarget type as supported by this source.- Specified by:
targetTypein interfaceWatchableSource<Path>- Returns:
- class of the target, by default used for
WatchableSource.target()
-
create
Create a new file override source from meta configuration.- Parameters:
metaConfig- meta configuration containing thepathand other configuration options- Returns:
- a new file override source
-
builder
Create a new builder.- Returns:
- builder to create new instances of file override source
-