use of org.apache.metron.hbase.TableProvider in project metron by apache.
the class GetProfile method getTable.
/**
* Create an HBase table used when accessing HBase.
* @param global The global configuration.
* @return
*/
private HTableInterface getTable(Map<String, Object> global) {
String tableName = PROFILER_HBASE_TABLE.get(global, String.class);
TableProvider provider = getTableProvider(global);
try {
return provider.getTable(HBaseConfiguration.create(), tableName);
} catch (IOException e) {
throw new IllegalArgumentException(String.format("Unable to access table: %s", tableName), e);
}
}
use of org.apache.metron.hbase.TableProvider in project metron by apache.
the class HBaseBolt method prepare.
@Override
public void prepare(Map map, TopologyContext topologyContext, OutputCollector collector) {
this.collector = collector;
this.batchHelper = new BatchHelper(batchSize, collector);
TableProvider provider = this.tableProvider == null ? getTableProvider(tableProviderClazzName) : this.tableProvider;
hbaseClient = new HBaseClient(provider, HBaseConfiguration.create(), tableName);
}
use of org.apache.metron.hbase.TableProvider in project metron by apache.
the class GetProfile method getTableProvider.
/**
* Create the TableProvider to use when accessing HBase.
* @param global The global configuration.
*/
private TableProvider getTableProvider(Map<String, Object> global) {
String clazzName = PROFILER_HBASE_TABLE_PROVIDER.get(global, String.class);
TableProvider provider;
try {
@SuppressWarnings("unchecked") Class<? extends TableProvider> clazz = (Class<? extends TableProvider>) Class.forName(clazzName);
provider = clazz.getConstructor().newInstance();
} catch (Exception e) {
provider = new HTableProvider();
}
return provider;
}
Aggregations