org.apache.hadoop.hbase.TableName.isLegalTableQualifierName()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(9.6k)|赞(0)|评价(0)|浏览(184)

本文整理了Java中org.apache.hadoop.hbase.TableName.isLegalTableQualifierName()方法的一些代码示例,展示了TableName.isLegalTableQualifierName()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TableName.isLegalTableQualifierName()方法的具体详情如下:
包路径:org.apache.hadoop.hbase.TableName
类名称:TableName
方法名:isLegalTableQualifierName

TableName.isLegalTableQualifierName介绍

[英]Qualifier names can only contain 'word' characters [\p{IsAlphabetic}\p{Digit}] or '_', '.' or '-'. The name may not start with '.' or '-'.
[中]限定符名称只能包含“word”字符[\p{IsAlphabetic}\p{Digit}]或“',”或者“-”。名称不能以“.”开头或者“-”。

代码示例

代码示例来源:origin: apache/hbase

public static byte [] isLegalTableQualifierName(final byte[] qualifierName) {
 isLegalTableQualifierName(qualifierName, 0, qualifierName.length, false);
 return qualifierName;
}

代码示例来源:origin: apache/hbase

public static byte [] isLegalTableQualifierName(final byte[] qualifierName, boolean isSnapshot) {
 isLegalTableQualifierName(qualifierName, 0, qualifierName.length, isSnapshot);
 return qualifierName;
}

代码示例来源:origin: apache/hbase

@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 NAME " + name);
   return false;
  }
  return true;
 }
}

代码示例来源:origin: apache/hbase

(byte) NAMESPACE_DELIM);
if (namespaceDelimIndex < 0){
 isLegalTableQualifierName(tableName);
} else {
 isLegalNamespaceName(tableName, 0, namespaceDelimIndex);
 isLegalTableQualifierName(tableName, namespaceDelimIndex + 1, tableName.length);

代码示例来源:origin: apache/hbase

public static void isLegalTableQualifierName(final byte[] qualifierName,
                       int start,
                       int end,
                       boolean isSnapshot) {
 if(end - start < 1) {
  throw new IllegalArgumentException(isSnapshot ? "Snapshot" : "Table" + " qualifier must not be empty");
 }
 if (qualifierName[start] == '.' || qualifierName[start] == '-') {
  throw new IllegalArgumentException("Illegal first character <" + qualifierName[start] +
                    "> at 0. " + (isSnapshot ? "Snapshot" : "User-space table") +
                    " qualifiers can only start with 'alphanumeric " +
                    "characters' from any language: " +
                    Bytes.toString(qualifierName, start, end));
 }
 // Treat the bytes as UTF-8
 String qualifierString = new String(
   qualifierName, start, (end - start), StandardCharsets.UTF_8);
 if (qualifierString.equals(DISALLOWED_TABLE_NAME)) {
  // Per https://zookeeper.apache.org/doc/r3.4.10/zookeeperProgrammers.html#ch_zkDataModel
  // A znode named "zookeeper" is disallowed by zookeeper.
  throw new IllegalArgumentException("Tables may not be named '" + DISALLOWED_TABLE_NAME + "'");
 }
 for (int i = 0; i < qualifierString.length(); i++) {
  // Treat the string as a char-array as some characters may be multi-byte
  char c = qualifierString.charAt(i);
  // Check for letter, digit, underscore, hyphen, or period, and allowed by ZK.
  // ZooKeeper also has limitations, but Character.isAlphabetic omits those all
  //   See https://zookeeper.apache.org/doc/r3.4.10/zookeeperProgrammers.html#ch_zkDataModel
  if (Character.isAlphabetic(c) || Character.isDigit(c) || c == '_' || c == '-' || c == '.') {
   continue;

代码示例来源:origin: apache/hbase

isLegalTableQualifierName(this.qualifier);

代码示例来源:origin: apache/hbase

/**
 * 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");
  }
 }
}

代码示例来源:origin: org.apache.hbase/hbase-client

/**
 * 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");
  }
 }
}

代码示例来源:origin: org.apache.hbase/hbase-common

public static byte [] isLegalTableQualifierName(final byte[] qualifierName, boolean isSnapshot) {
 isLegalTableQualifierName(qualifierName, 0, qualifierName.length, isSnapshot);
 return qualifierName;
}

代码示例来源:origin: org.apache.hbase/hbase-common

public static byte [] isLegalTableQualifierName(final byte[] qualifierName) {
 isLegalTableQualifierName(qualifierName, 0, qualifierName.length, false);
 return qualifierName;
}

代码示例来源:origin: com.aliyun.hbase/alihbase-common

public static byte [] isLegalTableQualifierName(final byte[] qualifierName) {
 isLegalTableQualifierName(qualifierName, 0, qualifierName.length, false);
 return qualifierName;
}

代码示例来源:origin: com.aliyun.hbase/alihbase-common

public static byte [] isLegalTableQualifierName(final byte[] qualifierName, boolean isSnapshot) {
 isLegalTableQualifierName(qualifierName, 0, qualifierName.length, isSnapshot);
 return qualifierName;
}

代码示例来源:origin: harbby/presto-connectors

public static byte [] isLegalTableQualifierName(final byte[] qualifierName) {
 isLegalTableQualifierName(qualifierName, 0, qualifierName.length, false);
 return qualifierName;
}

代码示例来源:origin: harbby/presto-connectors

public static byte [] isLegalTableQualifierName(final byte[] qualifierName, boolean isSnapshot) {
 isLegalTableQualifierName(qualifierName, 0, qualifierName.length, isSnapshot);
 return qualifierName;
}

代码示例来源:origin: harbby/presto-connectors

protected boolean isValidName(final String name) {
  if (!super.isValidName(name))
   return false;
  try {
   TableName.isLegalTableQualifierName(Bytes.toBytes(name));
  } catch (IllegalArgumentException e) {
   LOG.info("INVALID NAME " + name);
   return false;
  }
  return true;
 }
}

代码示例来源:origin: org.apache.hbase/hbase-common

(byte) NAMESPACE_DELIM);
if (namespaceDelimIndex < 0){
 isLegalTableQualifierName(tableName);
} else {
 isLegalNamespaceName(tableName, 0, namespaceDelimIndex);
 isLegalTableQualifierName(tableName, namespaceDelimIndex + 1, tableName.length);

代码示例来源:origin: org.apache.hbase/hbase-common

public static void isLegalTableQualifierName(final byte[] qualifierName,
                       int start,
                       int end,
                       boolean isSnapshot) {
 if(end - start < 1) {
  throw new IllegalArgumentException(isSnapshot ? "Snapshot" : "Table" + " qualifier must not be empty");
 }
 if (qualifierName[start] == '.' || qualifierName[start] == '-') {
  throw new IllegalArgumentException("Illegal first character <" + qualifierName[start] +
                    "> at 0. " + (isSnapshot ? "Snapshot" : "User-space table") +
                    " qualifiers can only start with 'alphanumeric " +
                    "characters' from any language: " +
                    Bytes.toString(qualifierName, start, end));
 }
 // Treat the bytes as UTF-8
 String qualifierString = new String(
   qualifierName, start, (end - start), StandardCharsets.UTF_8);
 if (qualifierString.equals(DISALLOWED_TABLE_NAME)) {
  // Per https://zookeeper.apache.org/doc/r3.4.10/zookeeperProgrammers.html#ch_zkDataModel
  // A znode named "zookeeper" is disallowed by zookeeper.
  throw new IllegalArgumentException("Tables may not be named '" + DISALLOWED_TABLE_NAME + "'");
 }
 for (int i = 0; i < qualifierString.length(); i++) {
  // Treat the string as a char-array as some characters may be multi-byte
  char c = qualifierString.charAt(i);
  // Check for letter, digit, underscore, hyphen, or period, and allowed by ZK.
  // ZooKeeper also has limitations, but Character.isAlphabetic omits those all
  //   See https://zookeeper.apache.org/doc/r3.4.10/zookeeperProgrammers.html#ch_zkDataModel
  if (Character.isAlphabetic(c) || Character.isDigit(c) || c == '_' || c == '-' || c == '.') {
   continue;

代码示例来源:origin: com.aliyun.hbase/alihbase-common

(byte) NAMESPACE_DELIM);
if (namespaceDelimIndex < 0){
 isLegalTableQualifierName(tableName);
} else {
 isLegalNamespaceName(tableName, 0, namespaceDelimIndex);
 isLegalTableQualifierName(tableName, namespaceDelimIndex + 1, tableName.length);

代码示例来源:origin: com.aliyun.hbase/alihbase-client

/**
 * 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");
  }
 }
}

代码示例来源:origin: harbby/presto-connectors

/**
 * 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(HBaseProtos.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");
  }
 }
}

相关文章