Class ConfigurationLoader

  • All Implemented Interfaces:
    java.lang.Runnable

    
    public final class ConfigurationLoader
    extends HandlerThread
                        

    The main entry point, responsible for configuration retrieval, provider processing, retries, input and error callbacks. It attempts to retrieve configuration data from the queue of providers and returns the configuration data from the first successful provider.

    By default, the initial queue contents are:

    During execution of loadConfiguration, each provider is queried for configuration data. If data is successfully retrieved, it is persisted using the specified persistConfiguration method and the onCompletion handler is called with the provider-id and success. The first provider encountered that requires input will cause the ConfigurationLoader to build a list of all of the providers that expect input and call the onInputRequired handler. Input is returned to the loader by calling processRequestedInputs and will be provided to the associated provider. The provider will then return the successful configuration data retrieved or call the onError handler (allowing new input processing). If an empty or null input is provided, all providers that expect input will be skipped. Therefore, if none of the remaining non-input expected providers successfully retrieve configuration data, the ConfigurationLoader will call the onCompletion handler with a null provider id and unsuccessful.

    Users can override the default queue of providers by creating a ConfigurationLoader and adding the provider(s) of interest. Custom providers provide extensibility