Search in sources :

Example 1 with ConfigurationResourceWrapper

use of org.apache.sling.caconfig.impl.ConfigurationResourceWrapper in project sling by apache.

the class DefaultConfigurationInheritanceStrategy method getResource.

@Override
public Resource getResource(Iterator<Resource> configResources) {
    if (!config.enabled()) {
        return null;
    }
    if (!configResources.hasNext()) {
        return null;
    }
    Resource primary = configResources.next();
    if (!isPropertyInheritance(primary) || !configResources.hasNext()) {
        return primary;
    }
    Map<String, Object> mergedProps = getInheritedProperties(primary.getValueMap(), configResources);
    return new ConfigurationResourceWrapper(primary, new ValueMapDecorator(mergedProps));
}
Also used : Resource(org.apache.sling.api.resource.Resource) ValueMapDecorator(org.apache.sling.api.wrappers.ValueMapDecorator) ConfigurationResourceWrapper(org.apache.sling.caconfig.impl.ConfigurationResourceWrapper)

Aggregations

Resource (org.apache.sling.api.resource.Resource)1 ValueMapDecorator (org.apache.sling.api.wrappers.ValueMapDecorator)1 ConfigurationResourceWrapper (org.apache.sling.caconfig.impl.ConfigurationResourceWrapper)1