<commit_before>package org.carlspring.strongbox.providers.header;

import javax.annotation.PostConstruct;
import java.util.LinkedHashMap;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

/**
 * @author carlspring
 */
@Component
public class HeaderMappingRegistry
{

    private static final String USER_AGENT_FORMAT = "%s/*";

    private Map<String, String> userAgentMap = new LinkedHashMap<>();

    private Map<String, String> layoutMap = new LinkedHashMap<>();


    public HeaderMappingRegistry()
    {
    }

    public void register(String layoutProviderAlias,
                         String userAgentPrefix)
    {
        userAgentMap.put(userAgentPrefix, String.format(USER_AGENT_FORMAT, userAgentPrefix));

        layoutMap.put(layoutProviderAlias, String.format(USER_AGENT_FORMAT, userAgentPrefix));
    }
<commit_msg>Issue 714: Make the layout providers expose a header mapping and register it dynamically<commit_after>package org.carlspring.strongbox.providers.header;

import java.util.LinkedHashMap;
import java.util.Map;

import org.springframework.stereotype.Component;

/**
 * @author carlspring
 */
@Component
public class HeaderMappingRegistry
{

    private static final String USER_AGENT_FORMAT = "%s/*";

    private Map<String, String> userAgentMap = new LinkedHashMap<>();

    private Map<String, String> layoutMap = new LinkedHashMap<>();


    public HeaderMappingRegistry()
    {
    }

    public void register(String layoutProviderAlias,
                         String userAgentPrefix)
    {
        userAgentMap.put(userAgentPrefix, String.format(USER_AGENT_FORMAT, userAgentPrefix));

        layoutMap.put(layoutProviderAlias, String.format(USER_AGENT_FORMAT, userAgentPrefix));
    }

{'fraction_non_alphanumeric': 0.09317803660565724, 'fraction_numerical': 0.0027731558513588465, 'mean_word_length': 4.096045197740113, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4370984', 'n_tokens_mistral': 506, 'n_tokens_neox': 491, 'n_words': 111}