Class AbstractLocationConfigSourceLoader

  • Direct Known Subclasses:
    AbstractLocationConfigSourceFactory, DotEnvConfigSourceProvider, PropertiesConfigSourceProvider

    @Experimental("Loads sources by location")
    public abstract class AbstractLocationConfigSourceLoader
    extends Object
    This AbstractLocationConfigSourceLoader loads ConfigSources from a list of specific locations.

    The locations comprise a list of valid URIs which are loaded in order. The following URI schemes are supported:

    1. file or directory
    2. classpath resource
    3. jar resource
    4. http resource

    If a profile is active, the profile resource is only loaded if the unprofiled resource is available in the same location. This is to keep a consistent loading order and match with the unprofiled resource. Profiles are not taken into account if the location is a directory.

    • Constructor Detail

      • AbstractLocationConfigSourceLoader

        public AbstractLocationConfigSourceLoader()
    • Method Detail

      • getFileExtensions

        protected abstract String[] getFileExtensions()
        The file extensions to filter the locations to load. It does not require to include the dot separator.
        Returns:
        an array with the file extensions.
      • loadConfigSource

        protected abstract org.eclipse.microprofile.config.spi.ConfigSource loadConfigSource​(URL url,
                                                                                             int ordinal)
                                                                                      throws IOException
        Loads a ConfigSource from an URL. Implementations must construct the ConfigSource to load.
        Parameters:
        url - the URL to load the ConfigSource.
        ordinal - the ordinal of the ConfigSource.
        Returns:
        the loaded ConfigSource.
        Throws:
        IOException - if an error occurred when reading from the the URL.
      • loadConfigSources

        protected List<org.eclipse.microprofile.config.spi.ConfigSource> loadConfigSources​(String location,
                                                                                           int ordinal)
      • loadConfigSources

        protected List<org.eclipse.microprofile.config.spi.ConfigSource> loadConfigSources​(String location,
                                                                                           int ordinal,
                                                                                           ClassLoader classLoader)
      • loadConfigSources

        protected List<org.eclipse.microprofile.config.spi.ConfigSource> loadConfigSources​(String[] locations,
                                                                                           int ordinal)
      • loadConfigSources

        protected List<org.eclipse.microprofile.config.spi.ConfigSource> loadConfigSources​(String[] locations,
                                                                                           int ordinal,
                                                                                           ClassLoader classLoader)
      • tryFileSystem

        protected List<org.eclipse.microprofile.config.spi.ConfigSource> tryFileSystem​(URI uri,
                                                                                       int ordinal)
      • tryClassPath

        protected List<org.eclipse.microprofile.config.spi.ConfigSource> tryClassPath​(URI uri,
                                                                                      int ordinal,
                                                                                      ClassLoader classLoader)
      • tryJar

        protected List<org.eclipse.microprofile.config.spi.ConfigSource> tryJar​(URI uri,
                                                                                int ordinal)
      • fallbackToUnknownProtocol

        protected List<org.eclipse.microprofile.config.spi.ConfigSource> fallbackToUnknownProtocol​(URI uri,
                                                                                                   int ordinal,
                                                                                                   ClassLoader classLoader)
      • tryHttpResource

        protected List<org.eclipse.microprofile.config.spi.ConfigSource> tryHttpResource​(URI uri,
                                                                                         int ordinal)
      • tryProfiles

        protected List<org.eclipse.microprofile.config.spi.ConfigSource> tryProfiles​(URI uri,
                                                                                     org.eclipse.microprofile.config.spi.ConfigSource mainSource)