Java Code Examples for org.apache.hadoop.hbase.HColumnDescriptor#getNameAsString()

The following examples show how to use org.apache.hadoop.hbase.HColumnDescriptor#getNameAsString() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
private void modifyColumnFamilyDescriptor(HColumnDescriptor hcd, Pair<byte[], Map<String,Object>> family) throws SQLException {
    if (Bytes.equals(hcd.getName(), family.getFirst())) {
        modifyColumnFamilyDescriptor(hcd, family.getSecond());
    } else {
        throw new IllegalArgumentException("Column family names don't match. Column descriptor family name: " + hcd.getNameAsString() + ", Family name: " + Bytes.toString(family.getFirst()));
    }
}
 
Example 2
public void run(Connection connection, List<String> args) throws InvalidArgsException, IOException {
    String pattern = null;
    if (args.size() == 1) {
        pattern = args.get(0);
    } else if (args.size() != 0) {
        throw new InvalidArgsException(args);
    }

    Admin admin = connection.getAdmin();
    HTableDescriptor[] tables;

    // We use the listTables() method on the Admin instance
    // to get a list of HTableDescriptor objects.
    if (pattern != null) {
        tables = admin.listTables(pattern);
    } else {
        tables = admin.listTables();
    }

    // For each of the tables we get the table name and column families
    // registered with the table, and print them out.
    for (HTableDescriptor table : tables) {
        HColumnDescriptor[] columnFamilies = table.getColumnFamilies();
        String columnFamilyNames = "";
        for (HColumnDescriptor columnFamily : columnFamilies) {
            columnFamilyNames += columnFamily.getNameAsString() + ",";
        }
        if (columnFamilyNames.length() > 0) {
            columnFamilyNames = " <" + columnFamilyNames.substring(0, columnFamilyNames.length()) + ">";
        }

        System.out.println(table.getTableName() + columnFamilyNames);
    }
}
 
Example 3
Source Project: geowave   File: GeoWaveColumnFamily.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public GeoWaveColumnFamily fromColumnDescriptor(final HColumnDescriptor column) {

  return new StringColumnFamily(column.getNameAsString());
}