Java Code Examples for org.apache.hadoop.hbase.TableName#isLegalTableQualifierName()

The following examples show how to use org.apache.hadoop.hbase.TableName#isLegalTableQualifierName() . 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 check out the related API usage on the sidebar.
Example 1
Source File: FSUtils.java    From hbase with Apache License 2.0 5 votes vote down vote up
@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;
}
 
Example 2
Source File: ClientSnapshotDescriptionUtils.java    From hbase with Apache License 2.0 5 votes vote down vote up
/**
 * 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");
    }
  }
}