// Path: common/src/main/java/com/kumuluz/ee/configuration/utils/ConfigurationDispatcher.java
// public class ConfigurationDispatcher {
// 
//     private List<ConfigurationListener> subscriptions = new ArrayList<>();
// 
//     public void notifyChange(String key, String value) {
// 
//         for (ConfigurationListener subscription : subscriptions) {
//             subscription.onChange(key, value);
//         }
//     }
// 
//     public void subscribe(ConfigurationListener listener) {
//         subscriptions.add(listener);
//     }
// 
//     public void unsubscribe(ConfigurationListener listener) {
//         subscriptions.remove(listener);
//     }
// }


import java.util.*;
import java.util.logging.Logger;
import java.util.stream.Collectors;
import com.kumuluz.ee.configuration.ConfigurationSource;
import com.kumuluz.ee.configuration.utils.ConfigurationDispatcher;
import com.kumuluz.ee.configuration.utils.ConfigurationSourceUtils;
import com.kumuluz.ee.logs.LogDeferrer;
import org.yaml.snakeyaml.Yaml;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Paths;
    public FileConfigurationSource() {

        this.ymlFileName = "config.yml";
        this.yamlFileName = "config.yaml";
        this.propertiesFileName = "config.properties";
        this.microProfilePropertiesFileName = "META-INF/microprofile-config.properties";

        String configurationFileName = System.getProperty("com.kumuluz.ee.configuration.file");

        if (configurationFileName != null && !configurationFileName.isEmpty()) {
            this.ymlFileName = configurationFileName;
            this.yamlFileName = configurationFileName;
            this.propertiesFileName = configurationFileName;
        }

        this.logDeferrer = new LogDeferrer<>();

        this.logDeferrer.init(() -> Logger.getLogger(FileConfigurationSource.class.getName()));
    }

    public void postInit() {

        logDeferrer.execute();
        logDeferrer = null;

        log = Logger.getLogger(FileConfigurationSource.class.getName());
    }

    @Override
    @SuppressWarnings("unchecked")
// Path: common/src/main/java/com/kumuluz/ee/configuration/utils/ConfigurationDispatcher.java
// public class ConfigurationDispatcher {
// 
//     private List<ConfigurationListener> subscriptions = new ArrayList<>();
// 
//     public void notifyChange(String key, String value) {
// 
//         for (ConfigurationListener subscription : subscriptions) {
//             subscription.onChange(key, value);
//         }
//     }
// 
//     public void subscribe(ConfigurationListener listener) {
//         subscriptions.add(listener);
//     }
// 
//     public void unsubscribe(ConfigurationListener listener) {
//         subscriptions.remove(listener);
//     }
// }


// Path: common/src/main/java/com/kumuluz/ee/configuration/sources/FileConfigurationSource.java
import java.util.*;
import java.util.logging.Logger;
import java.util.stream.Collectors;
import com.kumuluz.ee.configuration.ConfigurationSource;
import com.kumuluz.ee.configuration.utils.ConfigurationDispatcher;
import com.kumuluz.ee.configuration.utils.ConfigurationSourceUtils;
import com.kumuluz.ee.logs.LogDeferrer;
import org.yaml.snakeyaml.Yaml;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Paths;

    public FileConfigurationSource() {

        this.ymlFileName = "config.yml";
        this.yamlFileName = "config.yaml";
        this.propertiesFileName = "config.properties";
        this.microProfilePropertiesFileName = "META-INF/microprofile-config.properties";

        String configurationFileName = System.getProperty("com.kumuluz.ee.configuration.file");

        if (configurationFileName != null && !configurationFileName.isEmpty()) {
            this.ymlFileName = configurationFileName;
            this.yamlFileName = configurationFileName;
            this.propertiesFileName = configurationFileName;
        }

        this.logDeferrer = new LogDeferrer<>();

        this.logDeferrer.init(() -> Logger.getLogger(FileConfigurationSource.class.getName()));
    }

    public void postInit() {

        logDeferrer.execute();
        logDeferrer = null;

        log = Logger.getLogger(FileConfigurationSource.class.getName());
    }

    @Override
    @SuppressWarnings("unchecked")
    public void init(ConfigurationDispatcher configurationDispatcher) {