void validateProperties()

in src/main/java/org/apache/sling/feature/extension/apiregions/api/config/validation/ConfigurationValidator.java [182:221]


    void validateProperties(final Configuration configuration,
            final ConfigurableEntity desc,  
            final Map<String, PropertyValidationResult> results,
            final Region region,
            final Mode mode) {
        final Dictionary<String, Object> properties = configuration.getConfigurationProperties();

        // validate the described properties
        for(final Map.Entry<String, PropertyDescription> propEntry : desc.getPropertyDescriptions().entrySet()) {
            final Object value = properties.get(propEntry.getKey());
            final PropertyValidationResult result = propertyValidator.validate(value, propEntry.getValue(), mode);
            results.put(propEntry.getKey(), result);
        }

        // validate additional properties
        final Enumeration<String> keyEnum = properties.keys();
        while ( keyEnum.hasMoreElements() ) {
            final String propName = keyEnum.nextElement();
            if ( !desc.getPropertyDescriptions().containsKey(propName) ) {
                // detect the region
                final Region propRegion = FeatureValidator.getRegionInfo(region, configuration, propName, this.cache);

                final PropertyValidationResult result = new PropertyValidationResult();
                results.put(propName, result);

                if ( desc.getInternalPropertyNames().contains(propName ) ) {
                    if  ( propRegion != Region.INTERNAL ) {
                        PropertyValidator.setResult(result, null, mode, desc, "Property is not allowed");
                    }
                } else if ( Constants.SERVICE_RANKING.equalsIgnoreCase(propName) ) {
                    final Object value = properties.get(propName);
                    if ( !(value instanceof Integer) ) {
                        PropertyValidator.setResult(result, 0, mode, desc, "service.ranking must be of type Integer");
                    }    
                } else if ( !isAllowedProperty(propName) && propRegion != Region.INTERNAL && !desc.isAllowAdditionalProperties() ) {                    
                    PropertyValidator.setResult(result, null, mode, desc, "Property is not allowed");
                }
            }
        }
    }