<commit_before>package com.sequenceiq.cloudbreak.cmtemplate.configproviders.kafka;

import static com.sequenceiq.cloudbreak.cmtemplate.configproviders.ConfigUtils.config;

import java.util.List;

import com.cloudera.api.swagger.model.ApiClusterTemplateConfig;
import com.sequenceiq.cloudbreak.cmtemplate.CmTemplateComponentConfigProvider;
import com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor;
import com.sequenceiq.cloudbreak.dto.LdapView;
import com.sequenceiq.cloudbreak.template.TemplatePreparationObject;

public class KafkaLdapConfigProvider implements CmTemplateComponentConfigProvider {

    private static final String LDAP_AUTH_URL = "ldap.auth.url";

    private static final String LDAP_AUTH_USER_DN_TEMPLATE = "ldap.auth.user.dn.template";

    private static final String LDAP_AUTH_ENABLE = "ldap.auth.enable";

    @Override
    public List<ApiClusterTemplateConfig> getServiceConfigs(CmTemplateProcessor templateProcessor, TemplatePreparationObject source) {
        LdapView ldapView = source.getLdapConfig().get();
        return List.of(
                config(LDAP_AUTH_ENABLE, "true"),
                config(LDAP_AUTH_URL, ldapView.getConnectionURL()),
                config(LDAP_AUTH_USER_DN_TEMPLATE, ldapView.getUserDnPattern()));
    }

    @Override
    public boolean isConfigurationNeeded(CmTemplateProcessor cmTemplateProcessor, TemplatePreparationObject source) {
        return source.getLdapConfig().isPresent() && cmTemplateProcessor.isRoleTypePresentInService(getServiceType(), getRoleTypes());
    }

    @Override
    public List<String> getRoleTypes() {
        return List.of(KafkaRoles.KAFKA_BROKER);
    }

    @Override
    public String getServiceType() {
        return KafkaRoles.KAFKA_SERVICE;
    }
}
<commit_msg>CB-3981 Missing @Component<commit_after>package com.sequenceiq.cloudbreak.cmtemplate.configproviders.kafka;

import static com.sequenceiq.cloudbreak.cmtemplate.configproviders.ConfigUtils.config;

import java.util.List;

import org.springframework.stereotype.Component;

import com.cloudera.api.swagger.model.ApiClusterTemplateConfig;
import com.sequenceiq.cloudbreak.cmtemplate.CmTemplateComponentConfigProvider;
import com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor;
import com.sequenceiq.cloudbreak.dto.LdapView;
import com.sequenceiq.cloudbreak.template.TemplatePreparationObject;

@Component
public class KafkaLdapConfigProvider implements CmTemplateComponentConfigProvider {

    private static final String LDAP_AUTH_URL = "ldap.auth.url";

    private static final String LDAP_AUTH_USER_DN_TEMPLATE = "ldap.auth.user.dn.template";

    private static final String LDAP_AUTH_ENABLE = "ldap.auth.enable";

    @Override
    public List<ApiClusterTemplateConfig> getServiceConfigs(CmTemplateProcessor templateProcessor, TemplatePreparationObject source) {
        LdapView ldapView = source.getLdapConfig().get();
        return List.of(
                config(LDAP_AUTH_ENABLE, "true"),
                config(LDAP_AUTH_URL, ldapView.getConnectionURL()),
                config(LDAP_AUTH_USER_DN_TEMPLATE, ldapView.getUserDnPattern()));
    }

    @Override
    public boolean isConfigurationNeeded(CmTemplateProcessor cmTemplateProcessor, TemplatePreparationObject source) {
        return source.getLdapConfig().isPresent() && cmTemplateProcessor.isRoleTypePresentInService(getServiceType(), getRoleTypes());
    }

    @Override
    public List<String> getRoleTypes() {
        return List.of(KafkaRoles.KAFKA_BROKER);
    }

    @Override
    public String getServiceType() {
        return KafkaRoles.KAFKA_SERVICE;
    }
}

{'fraction_non_alphanumeric': 0.08379424778761062, 'fraction_numerical': 0.0011061946902654867, 'mean_word_length': 4.768740031897926, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '2660346', 'n_tokens_mistral': 1070, 'n_tokens_neox': 1038, 'n_words': 167}