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

The following are Jave code examples for showing how to use getScope() of the org.apache.hadoop.hbase.HColumnDescriptor class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: ditb   File:   Source Code and License Vote up 5 votes
 * Find all column families that are replicated from this cluster
 * @return the full list of the replicated column families of this cluster as:
 *        tableName, family name, replicationType
 * Currently replicationType is Global. In the future, more replication
 * types may be extended here. For example
 *  1) the replication may only apply to selected peers instead of all peers
 *  2) the replicationType may indicate the host Cluster servers as Slave
 *     for the table:columnFam.
public List<HashMap<String, String>> listReplicated() throws IOException {
  List<HashMap<String, String>> replicationColFams = new ArrayList<HashMap<String, String>>();

  Admin admin = connection.getAdmin();
  HTableDescriptor[] tables;
  try {
    tables = admin.listTables();
  } finally {
    if (admin!= null) admin.close();

  for (HTableDescriptor table : tables) {
    HColumnDescriptor[] columns = table.getColumnFamilies();
    String tableName = table.getNameAsString();
    for (HColumnDescriptor column : columns) {
      if (column.getScope() != HConstants.REPLICATION_SCOPE_LOCAL) {
        // At this moment, the columfam is replicated to all peers
        HashMap<String, String> replicationEntry = new HashMap<String, String>();
        replicationEntry.put(TNAME, tableName);
        replicationEntry.put(CFNAME, column.getNameAsString());

  return replicationColFams;
Example 2
Project: ditb   File:   Source Code and License Vote up 5 votes
 * @param htd table descriptor details for the table to check
 * @return true if table's replication switch is enabled
private boolean isTableRepEnabled(HTableDescriptor htd) {
  for (HColumnDescriptor hcd : htd.getFamilies()) {
    if (hcd.getScope() != HConstants.REPLICATION_SCOPE_GLOBAL) {
      return false;
  return true;