package com.primeton.damp.bigdata; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang.StringUtils; import java.util.Properties; import java.util.Set; /** * * 根据参数不同,生成不动的测试连接实例 * *
* * Created by zhaopx. * User: zhaopx * Date: 2020/4/21 * Time: 18:02 * ** * @author zhaopx */ @Slf4j public class HBaseConnectionFactory { /** * 生成不同的测试实例 * @return */ public static HBaseConnectionService getHBaseInstance(Properties hbaseResource) { String authUser = hbaseResource.getProperty("authUser"); String authType = hbaseResource.getProperty("authType"); if("noauth".equalsIgnoreCase(authType) || StringUtils.isBlank(authUser) || "default".equalsIgnoreCase(authUser)) { // 无需认证 return new SimpleHBaseConnectionServiceImpl(hbaseResource); } else if("kerberos".equalsIgnoreCase(authType)){ // kerberos 认证 return new Krb5HBaseConnectionServiceImpl(hbaseResource); } else { //fi 华为 return new FiHBaseConnectionServiceImpl(hbaseResource); } } }