private void replaceProperties()

in src/main/java/org/apache/sling/caconfig/impl/def/DefaultConfigurationPersistenceStrategy.java [242:257]


    private void replaceProperties(Resource resource, Map<String,Object> properties) {
        if (log.isTraceEnabled()) {
            log.trace("! Store properties for resource {}: {}", resource.getPath(), MapUtil.traceOutput(properties));
        }
        ModifiableValueMap modValueMap = resource.adaptTo(ModifiableValueMap.class);
        if (modValueMap == null) {
            throw new ConfigurationPersistenceAccessDeniedException("No write access: Unable to store configuration data to " + resource.getPath() + ".");
        }
        // remove all existing properties that are not filterd
        Set<String> propertyNamesToRemove = new HashSet<>(modValueMap.keySet());
        PropertiesFilterUtil.removeIgnoredProperties(propertyNamesToRemove, configurationManagementSettings);
        for (String propertyName : propertyNamesToRemove) {
            modValueMap.remove(propertyName);
        }
        modValueMap.putAll(properties);
    }