Class FileConfigurationSource
java.lang.Object
com.github.cafapi.common.config.source.CafConfigurationSource
com.github.cafapi.common.config.sources.file.FileConfigurationSource
- All Implemented Interfaces:
ConfigurationMetricsReporter
,ConfigurationSource
,HealthReporter
,ManagedConfigurationSource
This is a ConfigurationProvider that reads from a local disk file. If the bootstrap parameter config.path is set, it will read the
config files from the specified directory, otherwise it will use the working dir.
If retrieving the configuration class "TestConfiguration", using the ServicePath /a/b, it will expect the file to be called
"cfg_a_b_TestConfiguration".
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionFileConfigurationSource
(BootstrapConfiguration bootstrap, Cipher cipher, ServicePath servicePath, Decoder decoder) -
Method Summary
Modifier and TypeMethodDescriptionprotected InputStream
getConfigurationStream
(Class configClass, Name relativePath) Acquire and return a stream of the serialised data from the transport source.void
shutdown()
Perform necessary shutdown operations.Methods inherited from class com.github.cafapi.common.config.source.CafConfigurationSource
getCipher, getConfiguration, getConfigurationErrors, getConfigurationRequests, getServicePath, getValidator, incrementErrors, incrementRequests
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.github.cafapi.common.api.HealthReporter
livenessCheck
-
Field Details
-
CONFIG_PATH
- See Also:
-
RESOURCE_PATH
- See Also:
-
OLD_CONFIG_PATH
Deprecated.- See Also:
-
-
Constructor Details
-
FileConfigurationSource
public FileConfigurationSource(BootstrapConfiguration bootstrap, Cipher cipher, ServicePath servicePath, Decoder decoder) throws ConfigurationException - Throws:
ConfigurationException
-
-
Method Details
-
shutdown
public void shutdown()Description copied from interface:ManagedConfigurationSource
Perform necessary shutdown operations. -
healthCheck
- Returns:
- the result of the health (aka readiness) check
-
getConfigurationStream
protected InputStream getConfigurationStream(Class configClass, Name relativePath) throws ConfigurationException Description copied from class:CafConfigurationSource
Acquire and return a stream of the serialised data from the transport source.- Specified by:
getConfigurationStream
in classCafConfigurationSource
- Parameters:
configClass
- the configuration class to be acquiredrelativePath
- the partial service path that defines the scope to try and acquire the configuration in- Returns:
- the stream containing the serailised configuration of the class
- Throws:
ConfigurationException
- if the stream cannot be acquired
-