Search in sources :

Example 1 with TableProvider

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);
    }
}
Also used : TableProvider(org.apache.metron.hbase.TableProvider) HTableProvider(org.apache.metron.hbase.HTableProvider) IOException(java.io.IOException)

Example 2 with TableProvider

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);
}
Also used : HBaseClient(org.apache.metron.hbase.client.HBaseClient) TableProvider(org.apache.metron.hbase.TableProvider) HTableProvider(org.apache.metron.hbase.HTableProvider)

Example 3 with TableProvider

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;
}
Also used : HTableProvider(org.apache.metron.hbase.HTableProvider) TableProvider(org.apache.metron.hbase.TableProvider) HTableProvider(org.apache.metron.hbase.HTableProvider) IOException(java.io.IOException) ParseException(org.apache.metron.stellar.dsl.ParseException)

Aggregations

HTableProvider (org.apache.metron.hbase.HTableProvider)3 TableProvider (org.apache.metron.hbase.TableProvider)3 IOException (java.io.IOException)2 HBaseClient (org.apache.metron.hbase.client.HBaseClient)1 ParseException (org.apache.metron.stellar.dsl.ParseException)1