class SslPolicyConfigValidator implements SettingGroup<Object> {

    @Override
    public Map<String,String> validate( Map<String,String> params, Consumer<String> warningConsumer ) throws InvalidSettingException
    {
        Map<String,String> validatedParams = new HashMap<>();

        Set<String> validShortKeys = extractValidShortKeys();
        String groupSettingPrefix = groupPrefix();

        Pattern groupSettingPattern = Pattern.compile(
                Pattern.quote( groupSettingPrefix ) + "\\.([^.]+)\\.?(.+)?" );

        Set<String> policyNames = new HashSet<>();

        for ( Map.Entry<String,String> paramsEntry : params.entrySet() )
        {
            String settingName = paramsEntry.getKey();
            Matcher matcher = groupSettingPattern.matcher( settingName );
            if ( !matcher.matches() )
            {
                continue;
            }

            policyNames.add( matcher.group( 1 ) );
            String shortKey = matcher.group( 2 );

            if ( !validShortKeys.contains( shortKey ) )
            {
                throw new InvalidSettingException( "Invalid setting name: " + settingName );
            }

            validatedParams.put( settingName, paramsEntry.getValue() );
        }

        for ( String policyName : policyNames )
        {
            SslPolicyConfig policy = new SslPolicyConfig( policyName );

            if ( !params.containsKey( policy.base_directory.name() ) )
            {
                throw new InvalidSettingException( "Missing mandatory setting: " + policy.base_directory.name() );
            }
        }

        return validatedParams;
    }

}