Search in sources :

Example 6 with HBaseMetricsTableDefinition

use of io.cdap.cdap.data2.dataset2.lib.table.hbase.HBaseMetricsTableDefinition in project cdap by caskdata.

the class SystemDatasetRuntimeModule method getDistributedModules.

@Override
public Module getDistributedModules() {
    return new AbstractModule() {

        @Override
        protected void configure() {
            MapBinder<String, DatasetModule> mapBinder = MapBinder.newMapBinder(binder(), String.class, DatasetModule.class, Constants.Dataset.Manager.DefaultDatasetModules.class);
            // NOTE: order is important due to dependencies between modules
            mapBinder.addBinding("orderedTable-hbase").toProvider(OrderedTableModuleProvider.class).in(Singleton.class);
            mapBinder.addBinding("metricsTable-hbase").toInstance(new HBaseMetricsTableModule());
            bindDefaultModules(mapBinder);
            bind(String.class).annotatedWith(Names.named(Constants.Dataset.TABLE_TYPE)).toInstance("table");
            bind(DatasetDefinition.class).annotatedWith(Names.named(Constants.Dataset.TABLE_TYPE)).to(HBaseTableDefinition.class);
            bind(String.class).annotatedWith(Names.named(Constants.Dataset.TABLE_TYPE_NO_TX)).toInstance("table-no-tx");
            bind(DatasetDefinition.class).annotatedWith(Names.named(Constants.Dataset.TABLE_TYPE_NO_TX)).to(HBaseMetricsTableDefinition.class);
            // Direct binding for the Metrics table definition such that metrics system doesn't need to go through
            // dataset service to get metrics table.
            bind(new TypeLiteral<DatasetDefinition<MetricsTable, DatasetAdmin>>() {
            }).toInstance(new HBaseMetricsTableDefinition(MetricsTable.class.getName()));
        }
    };
}
Also used : MetricsTable(io.cdap.cdap.data2.dataset2.lib.table.MetricsTable) TypeLiteral(com.google.inject.TypeLiteral) HBaseMetricsTableDefinition(io.cdap.cdap.data2.dataset2.lib.table.hbase.HBaseMetricsTableDefinition) HBaseMetricsTableModule(io.cdap.cdap.data2.dataset2.module.lib.hbase.HBaseMetricsTableModule) Constants(io.cdap.cdap.common.conf.Constants) DatasetAdmin(io.cdap.cdap.api.dataset.DatasetAdmin) ExternalDatasetModule(io.cdap.cdap.data2.dataset2.lib.external.ExternalDatasetModule) DatasetModule(io.cdap.cdap.api.dataset.module.DatasetModule) AbstractModule(com.google.inject.AbstractModule)

Example 7 with HBaseMetricsTableDefinition

use of io.cdap.cdap.data2.dataset2.lib.table.hbase.HBaseMetricsTableDefinition in project cdap by caskdata.

the class HBaseMetricsTableModule method register.

@Override
public void register(DatasetDefinitionRegistry registry) {
    registry.add(new HBaseMetricsTableDefinition(HBaseMetricsTable.class.getName()));
    registry.add(new HBaseMetricsTableDefinition(MetricsTable.class.getName()));
}
Also used : HBaseMetricsTableDefinition(io.cdap.cdap.data2.dataset2.lib.table.hbase.HBaseMetricsTableDefinition)

Aggregations

DatasetAdmin (io.cdap.cdap.api.dataset.DatasetAdmin)4 HBaseMetricsTableDefinition (io.cdap.cdap.data2.dataset2.lib.table.hbase.HBaseMetricsTableDefinition)4 AbstractModule (com.google.inject.AbstractModule)2 TypeLiteral (com.google.inject.TypeLiteral)2 DatasetSpecification (io.cdap.cdap.api.dataset.DatasetSpecification)2 DatasetModule (io.cdap.cdap.api.dataset.module.DatasetModule)2 Constants (io.cdap.cdap.common.conf.Constants)2 ExternalDatasetModule (io.cdap.cdap.data2.dataset2.lib.external.ExternalDatasetModule)2 MetricsTable (io.cdap.cdap.data2.dataset2.lib.table.MetricsTable)2 HBaseMetricsTableModule (io.cdap.cdap.data2.dataset2.module.lib.hbase.HBaseMetricsTableModule)2 TableId (io.cdap.cdap.data2.util.TableId)2 HColumnDescriptor (org.apache.hadoop.hbase.HColumnDescriptor)2 HTableDescriptor (org.apache.hadoop.hbase.HTableDescriptor)2 TableName (org.apache.hadoop.hbase.TableName)2 HBaseAdmin (org.apache.hadoop.hbase.client.HBaseAdmin)2 FileContextLocationFactory (org.apache.twill.filesystem.FileContextLocationFactory)2 Test (org.junit.Test)2 HBaseMetricsTableDefinition (co.cask.cdap.data2.dataset2.lib.table.hbase.HBaseMetricsTableDefinition)1