org.apache.hadoop.hbase.TableName#isLegalTableQualifierName ( )源码实例Demo

下面列出了org.apache.hadoop.hbase.TableName#isLegalTableQualifierName ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: hbase   文件: FSUtils.java
@Override
protected boolean isValidName(final String name) {
  if (!super.isValidName(name))
    return false;

  try {
    TableName.isLegalTableQualifierName(Bytes.toBytes(name));
  } catch (IllegalArgumentException e) {
    LOG.info("Invalid table name: {}", name);
    return false;
  }
  return true;
}
 
源代码2 项目: hbase   文件: ClientSnapshotDescriptionUtils.java
/**
 * Check to make sure that the description of the snapshot requested is valid
 * @param snapshot description of the snapshot
 * @throws IllegalArgumentException if the name of the snapshot or the name of the table to
 *           snapshot are not valid names
 */
public static void assertSnapshotRequestIsValid(SnapshotProtos.SnapshotDescription snapshot)
    throws IllegalArgumentException {
  // make sure the snapshot name is valid
  TableName.isLegalTableQualifierName(Bytes.toBytes(snapshot.getName()), true);
  if (snapshot.hasTable()) {
    // make sure the table name is valid, this will implicitly check validity
    TableName tableName = TableName.valueOf(snapshot.getTable());

    if (tableName.isSystemTable()) {
      throw new IllegalArgumentException("System table snapshots are not allowed");
    }
  }
}