package com.lanyuanxiaoyao.service.executor.manager.configuration;

import javax.annotation.PostConstruct;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * yarn 配置
 *
 * @author ZhangJiacheng
 * @date 2022-03-30
 */
@ConfigurationProperties("connector.hadoop")
@Component
public class HadoopConfiguration {
    private static final Logger logger = LoggerFactory.getLogger(HadoopConfiguration.class);

    private String kerberosPrincipal;
    private String kerberosKeytabPath;

    @PostConstruct
    private void init() {
        logger.info("Configuration initial: {}", this);
    }

    public String getKerberosPrincipal() {
        return kerberosPrincipal;
    }

    public void setKerberosPrincipal(String kerberosPrincipal) {
        this.kerberosPrincipal = kerberosPrincipal;
    }

    public String getKerberosKeytabPath() {
        return kerberosKeytabPath;
    }

    public void setKerberosKeytabPath(String kerberosKeytabPath) {
        this.kerberosKeytabPath = kerberosKeytabPath;
    }

    @Override
    public String toString() {
        return "HadoopConfiguration{" +
                "kerberosPrincipal='" + kerberosPrincipal + '\'' +
                ", kerberosKeytabPath='" + kerberosKeytabPath + '\'' +
                '}';
    }
}
