Search in sources :

Example 6 with HTableProvider

use of org.apache.metron.hbase.HTableProvider 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)

Example 7 with HTableProvider

use of org.apache.metron.hbase.HTableProvider in project metron by apache.

the class SimpleHBaseConfigTest method test.

@Test
public void test() {
    SimpleHBaseConfig shc = new SimpleHBaseConfig();
    shc.withHBaseCF(cf);
    shc.withHBaseTable(table);
    provider = new HTableProvider();
    Assert.assertEquals(cf, shc.getHBaseCF());
    Assert.assertEquals(table, shc.getHBaseTable());
}
Also used : HTableProvider(org.apache.metron.hbase.HTableProvider) Test(org.junit.Test)

Aggregations

HTableProvider (org.apache.metron.hbase.HTableProvider)7 Configuration (org.apache.hadoop.conf.Configuration)3 HBaseConfiguration (org.apache.hadoop.hbase.HBaseConfiguration)3 IOException (java.io.IOException)2 RestException (org.apache.metron.rest.RestException)2 Test (org.junit.Test)2 Bean (org.springframework.context.annotation.Bean)2 Random (java.util.Random)1 HTableInterface (org.apache.hadoop.hbase.client.HTableInterface)1 WriterConfiguration (org.apache.metron.common.configuration.writer.WriterConfiguration)1 TableProvider (org.apache.metron.hbase.TableProvider)1 UserSettingsClient (org.apache.metron.hbase.client.UserSettingsClient)1 AccessConfig (org.apache.metron.indexing.dao.AccessConfig)1 IndexDao (org.apache.metron.indexing.dao.IndexDao)1 MetaAlertDao (org.apache.metron.indexing.dao.MetaAlertDao)1 ProfileMeasurement (org.apache.metron.profiler.ProfileMeasurement)1 ColumnBuilder (org.apache.metron.profiler.hbase.ColumnBuilder)1 RowKeyBuilder (org.apache.metron.profiler.hbase.RowKeyBuilder)1 SaltyRowKeyBuilder (org.apache.metron.profiler.hbase.SaltyRowKeyBuilder)1 ValueOnlyColumnBuilder (org.apache.metron.profiler.hbase.ValueOnlyColumnBuilder)1