use of org.apache.hadoop.hbase.thrift2.generated.TTableName in project hbase by apache.
the class TestThrift2HttpServer method talkToThriftServer.
@Override
protected void talkToThriftServer(String url, int customHeaderSize) throws Exception {
THttpClient httpClient = new THttpClient(url);
httpClient.open();
if (customHeaderSize > 0) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < customHeaderSize; i++) {
sb.append("a");
}
httpClient.setCustomHeader("User-Agent", sb.toString());
}
try {
TProtocol prot;
prot = new TBinaryProtocol(httpClient);
THBaseService.Client client = new THBaseService.Client(prot);
TTableName tTableName = new TTableName();
tTableName.setNs(Bytes.toBytes(""));
tTableName.setQualifier(Bytes.toBytes(TABLENAME));
if (!tableCreated) {
Assert.assertTrue(!client.tableExists(tTableName));
TTableDescriptor tTableDescriptor = new TTableDescriptor();
tTableDescriptor.setTableName(tTableName);
TColumnFamilyDescriptor columnFamilyDescriptor = new TColumnFamilyDescriptor();
columnFamilyDescriptor.setName(Bytes.toBytes(TABLENAME));
tTableDescriptor.addToColumns(columnFamilyDescriptor);
client.createTable(tTableDescriptor, new ArrayList<>());
tableCreated = true;
}
Assert.assertTrue(client.tableExists(tTableName));
} finally {
httpClient.close();
}
}
use of org.apache.hadoop.hbase.thrift2.generated.TTableName in project hbase by apache.
the class ThriftAdmin method modifyColumnFamily.
@Override
public void modifyColumnFamily(TableName tableName, ColumnFamilyDescriptor columnFamily) throws IOException {
TTableName tTableName = ThriftUtilities.tableNameFromHBase(tableName);
TColumnFamilyDescriptor tColumnFamilyDescriptor = ThriftUtilities.columnFamilyDescriptorFromHBase(columnFamily);
try {
client.modifyColumnFamily(tTableName, tColumnFamilyDescriptor);
} catch (TException e) {
throw new IOException(e);
}
}
use of org.apache.hadoop.hbase.thrift2.generated.TTableName in project hbase by apache.
the class ThriftAdmin method addColumnFamily.
@Override
public void addColumnFamily(TableName tableName, ColumnFamilyDescriptor columnFamily) throws IOException {
TTableName tTableName = ThriftUtilities.tableNameFromHBase(tableName);
TColumnFamilyDescriptor tColumnFamilyDescriptor = ThriftUtilities.columnFamilyDescriptorFromHBase(columnFamily);
try {
client.addColumnFamily(tTableName, tColumnFamilyDescriptor);
} catch (TException e) {
throw new IOException(e);
}
}
use of org.apache.hadoop.hbase.thrift2.generated.TTableName in project hbase by apache.
the class ThriftUtilities method tableNamesArrayFromThrift.
public static TableName[] tableNamesArrayFromThrift(List<TTableName> tableNames) {
TableName[] out = new TableName[tableNames.size()];
int index = 0;
for (TTableName tableName : tableNames) {
out[index++] = tableNameFromThrift(tableName);
}
return out;
}
Aggregations