@InterfaceAudience.Public public final class TableName extends Object implements Comparable<TableName>
Internally, in this class, we cache the instances to limit the number of objects and make the "equals" faster. We try to minimize the number of objects created of the number of array copy to check if we already have an instance of this TableName. The code is not optimize for a new instance creation but is optimized to check for existence.
Modifier and Type | Field and Description |
---|---|
static String |
DISALLOWED_TABLE_NAME
One globally disallowed name
|
private int |
hashCode |
static TableName |
META_TABLE_NAME
The hbase:meta table's name.
|
private byte[] |
name |
private String |
nameAsString |
private byte[] |
namespace |
static char |
NAMESPACE_DELIM
Namespace delimiter
|
static TableName |
NAMESPACE_TABLE_NAME
The Namespace table's name.
|
private String |
namespaceAsString |
static String |
OLD_META_STR |
static TableName |
OLD_META_TABLE_NAME
TableName for old .META.
|
static String |
OLD_ROOT_STR |
static TableName |
OLD_ROOT_TABLE_NAME
TableName for old -ROOT- table.
|
private byte[] |
qualifier |
private String |
qualifierAsString |
private boolean |
systemTable |
private static Set<TableName> |
tableCache
|
static String |
VALID_NAMESPACE_REGEX |
static String |
VALID_TABLE_QUALIFIER_REGEX |
static String |
VALID_USER_TABLE_REGEX |
Modifier | Constructor and Description |
---|---|
private |
TableName(ByteBuffer namespace,
ByteBuffer qualifier) |
private |
TableName(String qualifier)
This is only for the old and meta tables.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(TableName tableName)
For performance reasons, the ordering is not lexicographic.
|
private static TableName |
createTableNameIfNecessary(ByteBuffer bns,
ByteBuffer qns)
Check that the object does not exist already.
|
boolean |
equals(Object o) |
private static TableName |
getADummyTableName(String qualifier)
It is used to create table names for old META, and ROOT table.
|
byte[] |
getName() |
String |
getNameAsString() |
byte[] |
getNamespace() |
String |
getNamespaceAsString() |
String |
getNameWithNamespaceInclAsString()
Ideally, getNameAsString should contain namespace within it,
but if the namespace is default, it just returns the name.
|
byte[] |
getQualifier() |
String |
getQualifierAsString() |
int |
hashCode() |
static byte[] |
isLegalFullyQualifiedTableName(byte[] tableName)
Check passed byte array, "tableName", is legal user-space table name.
|
static void |
isLegalNamespaceName(byte[] namespaceName) |
static void |
isLegalNamespaceName(byte[] namespaceName,
int start,
int end)
Valid namespace characters are alphabetic characters, numbers, and underscores.
|
static byte[] |
isLegalTableQualifierName(byte[] qualifierName) |
static byte[] |
isLegalTableQualifierName(byte[] qualifierName,
boolean isSnapshot) |
static void |
isLegalTableQualifierName(byte[] qualifierName,
int start,
int end)
Qualifier names can only contain 'word' characters
[\p{IsAlphabetic}\p{Digit}] or '_', '.' or '-'. |
static void |
isLegalTableQualifierName(byte[] qualifierName,
int start,
int end,
boolean isSnapshot) |
static boolean |
isMetaTableName(TableName tn) |
boolean |
isSystemTable() |
byte[] |
toBytes() |
String |
toString() |
static TableName |
valueOf(byte[] fullName) |
static TableName |
valueOf(byte[] namespace,
byte[] qualifier) |
static TableName |
valueOf(ByteBuffer namespace,
ByteBuffer qualifier) |
static TableName |
valueOf(String name) |
static TableName |
valueOf(String namespaceAsString,
String qualifierAsString) |
private static final Set<TableName> tableCache
public static final char NAMESPACE_DELIM
public static final String VALID_NAMESPACE_REGEX
public static final String VALID_TABLE_QUALIFIER_REGEX
public static final String VALID_USER_TABLE_REGEX
public static final TableName META_TABLE_NAME
public static final TableName NAMESPACE_TABLE_NAME
public static final String OLD_META_STR
public static final String OLD_ROOT_STR
public static final String DISALLOWED_TABLE_NAME
public static final TableName OLD_ROOT_TABLE_NAME
public static final TableName OLD_META_TABLE_NAME
private final byte[] name
private final String nameAsString
private final byte[] namespace
private final String namespaceAsString
private final byte[] qualifier
private final String qualifierAsString
private final boolean systemTable
private final int hashCode
private TableName(ByteBuffer namespace, ByteBuffer qualifier) throws IllegalArgumentException
IllegalArgumentException
- See valueOf(byte[])
public static boolean isMetaTableName(TableName tn)
tn
is the hbase:meta table name.public static byte[] isLegalFullyQualifiedTableName(byte[] tableName)
tableName
paramIllegalArgumentException
- if passed a tableName is null or
is made of other than 'word' characters or underscores: i.e.
[\p{IsAlphabetic}\p{Digit}.-:]
. The ':' is used to delimit the namespace
from the table name and can be used for nothing else.
Namespace names can only contain 'word' characters
[\p{IsAlphabetic}\p{Digit}]
or '_'
Qualifier names can only contain 'word' characters
[\p{IsAlphabetic}\p{Digit}]
or '_', '.' or '-'.
The name may not start with '.' or '-'.
Valid fully qualified table names:
foo:bar, namespace=>foo, table=>bar
org:foo.bar, namespace=org, table=>foo.barpublic static byte[] isLegalTableQualifierName(byte[] qualifierName)
public static byte[] isLegalTableQualifierName(byte[] qualifierName, boolean isSnapshot)
public static void isLegalTableQualifierName(byte[] qualifierName, int start, int end)
[\p{IsAlphabetic}\p{Digit}]
or '_', '.' or '-'.
The name may not start with '.' or '-'.qualifierName
- byte array containing the qualifier namestart
- start indexend
- end index (exclusive)public static void isLegalTableQualifierName(byte[] qualifierName, int start, int end, boolean isSnapshot)
public static void isLegalNamespaceName(byte[] namespaceName)
public static void isLegalNamespaceName(byte[] namespaceName, int start, int end)
public byte[] getName()
public String getNameAsString()
public byte[] getNamespace()
public String getNamespaceAsString()
public String getNameWithNamespaceInclAsString()
public byte[] getQualifier()
public String getQualifierAsString()
public byte[] toBytes()
public boolean isSystemTable()
private static TableName createTableNameIfNecessary(ByteBuffer bns, ByteBuffer qns)
private static TableName getADummyTableName(String qualifier)
public static TableName valueOf(byte[] fullName) throws IllegalArgumentException
IllegalArgumentException
- if fullName equals old root or old meta. Some code
depends on this. The test is buried in the table creation to save on array comparison
when we're creating a standard table object that will be in the cache.public static TableName valueOf(String name)
IllegalArgumentException
- if fullName equals old root or old meta. Some code
depends on this.public static TableName valueOf(ByteBuffer namespace, ByteBuffer qualifier)
public int compareTo(TableName tableName)
compareTo
in interface Comparable<TableName>
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.