HBaseConnectionService.java 872 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. package com.primeton.dsp.datarelease.data.bdata;
  2. import org.apache.hadoop.hbase.client.Admin;
  3. import org.apache.hadoop.hbase.client.Table;
  4. import org.apache.hadoop.hbase.exceptions.HBaseException;
  5. /**
  6. * HBase 测试连接
  7. *
  8. * <pre>
  9. *
  10. * Created by zhaopx.
  11. * User: zhaopx
  12. * Date: 2020/4/21
  13. * Time: 17:59
  14. *
  15. * </pre>
  16. *
  17. * @author zhaopx
  18. */
  19. public interface HBaseConnectionService {
  20. /**
  21. * 安全处理,认证. 认证不通过可能抛出 SecurityException
  22. * @return 返回 true 认证通过
  23. */
  24. default public boolean doAuth() { return true; };
  25. /**
  26. * 获取 HBaseAdmin 连接
  27. * @return
  28. */
  29. public Admin getConnection() throws HBaseException;
  30. /**
  31. * 获取HBase 指定表的链接
  32. * @return
  33. * @throws HBaseException
  34. */
  35. public Table getTable(String tableName) throws HBaseException;
  36. }