本文整理了Java中co.cask.cdap.data2.util.hbase.HBaseTableUtil.createHTableId()
方法的一些代码示例,展示了HBaseTableUtil.createHTableId()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HBaseTableUtil.createHTableId()
方法的具体详情如下:
包路径:co.cask.cdap.data2.util.hbase.HBaseTableUtil
类名称:HBaseTableUtil
方法名:createHTableId
暂无
代码示例来源:origin: cdapio/cdap
private static TableId getReplicationStateTableId(HBaseTableUtil tableUtil) throws IOException {
String tableName = hConf.get(ReplicationConstants.ReplicationStatusTool.REPLICATION_STATE_TABLE_NAME);
String ns = hConf.get(ReplicationConstants.ReplicationStatusTool.REPLICATION_STATE_TABLE_NAMESPACE);
TableId tableId = tableUtil.createHTableId(
(ns != null)
? new NamespaceId(ns)
: new NamespaceId(ReplicationConstants.ReplicationStatusTool.REPLICATION_STATE_TABLE_DEFAULT_NAMESPACE),
(tableName != null)
? tableName
: ReplicationConstants.ReplicationStatusTool.REPLICATION_STATE_TABLE_DEFAULT_NAME);
return tableId;
}
代码示例来源:origin: co.cask.cdap/cdap-tms
public void disableMessageTable(String tableName) throws IOException {
TableId tableId = tableUtil.createHTableId(NamespaceId.SYSTEM, tableName);
try (HBaseDDLExecutor ddlExecutor = ddlExecutorFactory.get()) {
disableTable(ddlExecutor, tableId);
}
}
代码示例来源:origin: caskdata/cdap
public void disablePayloadTable(String tableName) throws IOException {
TableId tableId = tableUtil.createHTableId(NamespaceId.SYSTEM, tableName);
try (HBaseDDLExecutor ddlExecutor = ddlExecutorFactory.get()) {
disableTable(ddlExecutor, tableId);
}
}
代码示例来源:origin: cdapio/cdap
private DatasetAdminImpl(DatasetContext datasetContext, String tableName, HBaseTableUtil tableUtil,
Configuration hConf, CConfiguration cConf) throws IOException {
this.hCOnf= hConf;
this.cCOnf= cConf;
this.tableUtil = tableUtil;
this.tableId = tableUtil.createHTableId(new NamespaceId(datasetContext.getNamespaceId()), tableName);
this.ddlExecutorFactory = new HBaseDDLExecutorFactory(cConf, hConf);
}
代码示例来源:origin: cdapio/cdap
KVTableImpl(DatasetContext datasetContext, String tableName,
Configuration hConf, HBaseTableUtil tableUtil) throws IOException {
this.tableUtil = tableUtil;
TableId tableId = tableUtil.createHTableId(new NamespaceId(datasetContext.getNamespaceId()), tableName);
this.table = this.tableUtil.createHTable(hConf, tableId);
}
代码示例来源:origin: co.cask.cdap/cdap-data-fabric
private DatasetAdminImpl(DatasetContext datasetContext, String tableName, HBaseTableUtil tableUtil,
Configuration hConf, CConfiguration cConf) throws IOException {
this.hCOnf= hConf;
this.cCOnf= cConf;
this.tableUtil = tableUtil;
this.tableId = tableUtil.createHTableId(new NamespaceId(datasetContext.getNamespaceId()), tableName);
this.ddlExecutorFactory = new HBaseDDLExecutorFactory(cConf, hConf);
}
代码示例来源:origin: co.cask.cdap/cdap-data-fabric
KVTableImpl(DatasetContext datasetContext, String tableName,
Configuration hConf, HBaseTableUtil tableUtil) throws IOException {
this.tableUtil = tableUtil;
TableId tableId = tableUtil.createHTableId(new NamespaceId(datasetContext.getNamespaceId()), tableName);
this.table = this.tableUtil.createHTable(hConf, tableId);
}
代码示例来源:origin: co.cask.cdap/cdap-data-fabric
public HBaseTableAdmin(DatasetContext datasetContext,
DatasetSpecification spec,
Configuration hConf,
HBaseTableUtil tableUtil,
CConfiguration conf,
LocationFactory locationFactory) throws IOException {
super(tableUtil.createHTableId(new NamespaceId(datasetContext.getNamespaceId()), spec.getName()),
hConf, conf, tableUtil, locationFactory);
this.spec = spec;
this.cOnf= conf;
}
代码示例来源:origin: cdapio/cdap
public HBaseTableAdmin(DatasetContext datasetContext,
DatasetSpecification spec,
Configuration hConf,
HBaseTableUtil tableUtil,
CConfiguration conf,
LocationFactory locationFactory) throws IOException {
super(tableUtil.createHTableId(new NamespaceId(datasetContext.getNamespaceId()), spec.getName()),
hConf, conf, tableUtil, locationFactory);
this.spec = spec;
this.cOnf= conf;
}
代码示例来源:origin: co.cask.cdap/cdap-data-fabric
public TableId getDataTableId(FlowId flowId, QueueConstants.QueueType queueType) throws IOException {
String tableName = String.format("%s.%s.%s.%s", NamespaceId.SYSTEM.getNamespace(), queueType,
flowId.getApplication(), flowId.getEntityName());
return tableUtil.createHTableId(new NamespaceId(flowId.getNamespace()), tableName);
}
代码示例来源:origin: caskdata/cdap
private HBaseTableUtil.TableStats getTableStats(String namespace, String tableName) throws IOException {
HBaseTableUtil tableUtil = getTableUtil();
// todo : should support custom table-prefix
TableId tableId = tableUtil.createHTableId(new NamespaceId(namespace), tableName);
Map
return statsMap.get(tableId);
}
}
代码示例来源:origin: co.cask.cdap/cdap-data-fabric
@Override
protected void dropTable(TableId tableId) throws IOException {
try (HBaseDDLExecutor ddlExecutor = ddlExecutorFactory.get(); HBaseAdmin admin = new HBaseAdmin(hConf)) {
TableId hBaseTableId = tableUtil.createHTableId(new NamespaceId(tableId.getNamespace()), tableId.getTableName());
if (tableUtil.tableExists(admin, hBaseTableId)) {
tableUtil.dropTable(ddlExecutor, hBaseTableId);
}
}
}
代码示例来源:origin: caskdata/cdap
private void truncate(String namespace, String tableName) throws IOException {
HBaseTableUtil tableUtil = getTableUtil();
TableId hTableId = tableUtil.createHTableId(new NamespaceId(namespace), tableName);
tableUtil.truncateTable(ddlExecutor, hTableId);
}
代码示例来源:origin: co.cask.cdap/cdap-data-fabric
@Override
public synchronized void dropAllInNamespace(NamespaceId namespace) throws IOException {
try (HBaseDDLExecutor executor = ddlExecutorFactory.get(); HBaseAdmin admin = new HBaseAdmin(hConf)) {
TableId tableId = StreamUtils.getStateStoreTableId(namespace);
TableId hbaseTableId = tableUtil.createHTableId(new NamespaceId(tableId.getNamespace()), tableId.getTableName());
if (tableUtil.tableExists(admin, hbaseTableId)) {
tableUtil.dropTable(executor, hbaseTableId);
}
}
}
}
代码示例来源:origin: caskdata/cdap
private HTableDescriptor getTableDescriptor(String namespace, String name) throws IOException {
HBaseTableUtil tableUtil = getTableUtil();
TableId hTableId = tableUtil.createHTableId(new NamespaceId(namespace), name);
return getTableUtil().getHTableDescriptor(hAdmin, hTableId);
}
代码示例来源:origin: cdapio/cdap
public HBaseMetricsTable(DatasetContext datasetContext, DatasetSpecification spec,
Configuration hConf, HBaseTableUtil tableUtil, CConfiguration cConf) throws IOException {
this.tableUtil = tableUtil;
this.tableId = tableUtil.createHTableId(new NamespaceId(datasetContext.getNamespaceId()), spec.getName());
initializeVars(cConf, spec);
HTable hTable = tableUtil.createHTable(hConf, tableId);
// todo: make configurable
hTable.setWriteBufferSize(HBaseTableUtil.DEFAULT_WRITE_BUFFER_SIZE);
hTable.setAutoFlushTo(false);
this.hTable = hTable;
this.columnFamily = TableProperties.getColumnFamilyBytes(spec.getProperties());
}
代码示例来源:origin: caskdata/cdap
private void writeSome(String namespace, String tableName) throws IOException {
HBaseTableUtil tableUtil = getTableUtil();
TableId hTableId = tableUtil.createHTableId(new NamespaceId(namespace), tableName);
try (HTable table = tableUtil.createHTable(TEST_HBASE.getConfiguration(), hTableId)) {
// writing at least couple megs to reflect in "megabyte"-based metrics
for (int i = 0; i <8; i++) {
Put put = new Put(Bytes.toBytes("row" + i));
put.add(Bytes.toBytes("d"), Bytes.toBytes("col" + i), new byte[1024 * 1024]);
table.put(put);
}
}
}
代码示例来源:origin: caskdata/cdap
private boolean exists(TableId tableId) throws IOException {
HBaseTableUtil tableUtil = getTableUtil();
TableId hTableId = tableUtil.createHTableId(new NamespaceId(tableId.getNamespace()), tableId.getTableName());
return tableUtil.tableExists(hAdmin, hTableId);
}
代码示例来源:origin: caskdata/cdap
private void enable(String namespace, String tableName) throws IOException {
HBaseTableUtil tableUtil = getTableUtil();
TableId hTableId = tableUtil.createHTableId(new NamespaceId(namespace), tableName);
TableName name = HTableNameConverter.toTableName(getPrefix(), hTableId);
ddlExecutor.enableTableIfDisabled(name.getNamespaceAsString(), name.getQualifierAsString());
}
代码示例来源:origin: caskdata/cdap
private void disable(String namespace, String tableName) throws IOException {
HBaseTableUtil tableUtil = getTableUtil();
TableId hTableId = tableUtil.createHTableId(new NamespaceId(namespace), tableName);
TableName name = HTableNameConverter.toTableName(getPrefix(), hTableId);
ddlExecutor.disableTableIfEnabled(name.getNamespaceAsString(), name.getQualifierAsString());
}