ITeye博客

spring hadoop 系列(二)

dalan_123 · 2015-11-27 15:26 · Hadoop · 大数据 · Spring · Hbase · 编程语言 · Hadoop · HBase · Markdown

一、源码分析 /** *

  • HbaseAccessor作为HbaseTemplate以及HbaseIntercepter的基类;同时也定义
  • 公共的HBase Configuration 以及 HTableInterfaceFactory

*/ public abstract class HbaseAccessor implements InitializingBean { // 设定编码 private String encoding; private Charset charset = HbaseUtils.getCharset(encoding); // 定义公共属性 HTableInterfaceFactory 及 Configuration private HTableInterfaceFactory tableFactory; private Configuration configuration;

@Override
public void afterPropertiesSet() {
	Assert.notNull(configuration, " a valid configuration is required");
	// detect charset
	charset = HbaseUtils.getCharset(encoding);
}

/**
 * Sets the table factory.
 *
 * @param tableFactory The tableFactory to set.
 */
public void setTableFactory(HTableInterfaceFactory tableFactory) {
	this.tableFactory = tableFactory;
}

/**
 * Sets the encoding.
 *
 * @param encoding The encoding to set.
 */
public void setEncoding(String encoding) {
	this.encoding = encoding;
}

/**
 * Sets the configuration.
 *
 * @param configuration The configuration to set.
 */
public void setConfiguration(Configuration configuration) {
	this.configuration = configuration;
}

public Charset getCharset() {
	return charset;
}

public HTableInterfaceFactory getTableFactory() {
	return tableFactory;
}

public Configuration getConfiguration() {
	return configuration;
}

} 该类是spring-hadoop访问hbase的基类,定义访问hbase的通用部分,用作抽象基类,不能直接使用。

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。