public static byte [] isLegalTableQualifierName(final byte[] qualifierName) { isLegalTableQualifierName(qualifierName, 0, qualifierName.length, false); return qualifierName; }
public static byte [] isLegalTableQualifierName(final byte[] qualifierName, boolean isSnapshot) { isLegalTableQualifierName(qualifierName, 0, qualifierName.length, isSnapshot); return qualifierName; }
@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; } }
(byte) NAMESPACE_DELIM); if (namespaceDelimIndex < 0){ isLegalTableQualifierName(tableName); } else { isLegalNamespaceName(tableName, 0, namespaceDelimIndex); isLegalTableQualifierName(tableName, namespaceDelimIndex + 1, tableName.length);
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;
isLegalTableQualifierName(this.qualifier);
/** * 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"); } } }
/** * 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"); } } }
public static byte [] isLegalTableQualifierName(final byte[] qualifierName, boolean isSnapshot) { isLegalTableQualifierName(qualifierName, 0, qualifierName.length, isSnapshot); return qualifierName; }
public static byte [] isLegalTableQualifierName(final byte[] qualifierName) { isLegalTableQualifierName(qualifierName, 0, qualifierName.length, false); return qualifierName; }
public static byte [] isLegalTableQualifierName(final byte[] qualifierName) { isLegalTableQualifierName(qualifierName, 0, qualifierName.length, false); return qualifierName; }
public static byte [] isLegalTableQualifierName(final byte[] qualifierName, boolean isSnapshot) { isLegalTableQualifierName(qualifierName, 0, qualifierName.length, isSnapshot); return qualifierName; }
public static byte [] isLegalTableQualifierName(final byte[] qualifierName) { isLegalTableQualifierName(qualifierName, 0, qualifierName.length, false); return qualifierName; }
public static byte [] isLegalTableQualifierName(final byte[] qualifierName, boolean isSnapshot) { isLegalTableQualifierName(qualifierName, 0, qualifierName.length, isSnapshot); return qualifierName; }
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; } }
(byte) NAMESPACE_DELIM); if (namespaceDelimIndex < 0){ isLegalTableQualifierName(tableName); } else { isLegalNamespaceName(tableName, 0, namespaceDelimIndex); isLegalTableQualifierName(tableName, namespaceDelimIndex + 1, tableName.length);
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;
(byte) NAMESPACE_DELIM); if (namespaceDelimIndex < 0){ isLegalTableQualifierName(tableName); } else { isLegalNamespaceName(tableName, 0, namespaceDelimIndex); isLegalTableQualifierName(tableName, namespaceDelimIndex + 1, tableName.length);
/** * 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"); } } }
/** * 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"); } } }