Map deserializeOsgiConfiguration()

in src/main/java/org/apache/sling/repoinit/filevault/validator/RepoInitValidator.java [151:167]


    Map<String, Object> deserializeOsgiConfiguration(
            @NotNull OsgiConfigurationSerialization serializationType, @NotNull InputStream input) throws IOException {
        switch (serializationType) {
            case CONFIG:
                return convertToMap(org.apache.felix.cm.file.ConfigurationHandler.read(input));
            case CFG:
                Properties properties = new Properties();
                properties.load(input);
                return convertToMap(properties);
            case CFG_JSON:
                Reader reader = new InputStreamReader(input, StandardCharsets.UTF_8);
                ConfigurationReader configReader =
                        org.apache.felix.cm.json.Configurations.buildReader().build(reader);
                return convertToMap(configReader.readConfiguration());
        }
        return null;
    }