Interface ConfigurationLoader

All Known Implementing Classes:
DefaultConfigurationLoader

public interface ConfigurationLoader
Contract for loading and validating Agenor configuration. Implementations live in agenor-runtime or agenor-adapters.
  • Method Details

    • loadFromFile

      AgenorConfiguration loadFromFile(String path)
      Loads configuration from a file on the filesystem. Supports YAML (.yml, .yaml) and JSON (.json) formats. Environment variable substitution (${VAR} and ${VAR:default}) is applied.
      Parameters:
      path - absolute or relative path to the configuration file, not null or empty
      Returns:
      the loaded configuration
      Throws:
      ConfigurationException - if the file is not found, not readable, or cannot be parsed
    • loadFromClasspath

      AgenorConfiguration loadFromClasspath(String resourcePath)
      Loads configuration from a classpath resource. Supports YAML (.yml, .yaml) and JSON (.json) formats. Environment variable substitution (${VAR} and ${VAR:default}) is applied.
      Parameters:
      resourcePath - classpath-relative path to the resource, not null or empty
      Returns:
      the loaded configuration
      Throws:
      ConfigurationException - if the resource is not found or cannot be parsed
    • loadFromStream

      AgenorConfiguration loadFromStream(InputStream inputStream, String format)
      Loads configuration from an InputStream. Environment variable substitution (${VAR} and ${VAR:default}) is applied.
      Parameters:
      inputStream - the stream to read from, not null
      format - the format hint: "json" for JSON, anything else defaults to YAML
      Returns:
      the loaded configuration
      Throws:
      ConfigurationException - if the stream is null or its content cannot be parsed
    • loadDefault

      AgenorConfiguration loadDefault()
      Loads configuration using the default lookup strategy:
      1. agenor.yml in the working directory
      2. agenor.yml on the classpath
      3. Built-in defaults via AgenorConfiguration.defaults()
      Returns:
      the loaded configuration, never null
    • validate

      void validate(AgenorConfiguration configuration)
      Validates the given configuration, checking for required fields and well-formed values. Logs warnings for non-critical issues (e.g. unknown environment name, missing scan packages).
      Parameters:
      configuration - the configuration to validate, not null
      Throws:
      ConfigurationException - if configuration is null, runtime.name is empty, or any scan-package name is invalid