org.apache.hadoop.hbase.util.migration.v5
Class HTableDescriptor

java.lang.Object
  extended by org.apache.hadoop.hbase.util.migration.v5.HTableDescriptor
All Implemented Interfaces:
Comparable, org.apache.hadoop.io.Writable, org.apache.hadoop.io.WritableComparable

public class HTableDescriptor
extends Object
implements org.apache.hadoop.io.WritableComparable

HTableDescriptor contains the name of an HTable, and its column families.


Field Summary
static String FAMILIES
           
static HTableDescriptor META_TABLEDESC
          Table descriptor for .META. catalog table
static HTableDescriptor ROOT_TABLEDESC
          Table descriptor for -ROOT- catalog table
 
Constructor Summary
HTableDescriptor()
          Constructs an empty object.
HTableDescriptor(byte[] name)
          Constructor.
HTableDescriptor(String name)
          Constructor.
 
Method Summary
 void addFamily(HColumnDescriptor family)
          Adds a column family.
 int compareTo(Object o)
          
 boolean equals(Object obj)
          
 Collection<HColumnDescriptor> getFamilies()
           
 HColumnDescriptor getFamily(byte[] column)
           
 byte[] getName()
           
 String getNameAsString()
           
static org.apache.hadoop.fs.Path getTableDir(org.apache.hadoop.fs.Path rootdir, byte[] tableName)
           
 boolean hasFamily(byte[] c)
          Checks to see if this table contains the given column family
 boolean hasFamily(byte[] c, int index)
          Checks to see if this table contains the given column family
 int hashCode()
          
static byte[] isLegalTableName(byte[] b)
          Check passed buffer is legal user-space table name.
 boolean isMetaRegion()
           
 boolean isMetaTable()
           
 boolean isRootRegion()
           
 void readFields(DataInput in)
          
 HColumnDescriptor removeFamily(byte[] column)
           
 String toString()
           
 void write(DataOutput out)
          
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ROOT_TABLEDESC

public static final HTableDescriptor ROOT_TABLEDESC
Table descriptor for -ROOT- catalog table


META_TABLEDESC

public static final HTableDescriptor META_TABLEDESC
Table descriptor for .META. catalog table


FAMILIES

public static final String FAMILIES
See Also:
Constant Field Values
Constructor Detail

HTableDescriptor

public HTableDescriptor()
Constructs an empty object. For deserializing an HTableDescriptor instance only.

See Also:
HTableDescriptor(byte[])

HTableDescriptor

public HTableDescriptor(String name)
Constructor.

Parameters:
name - Table name.
Throws:
IllegalArgumentException - if passed a table name that is made of other than 'word' characters, underscore or period: i.e. [a-zA-Z_0-9.].
See Also:
HADOOP-1581 HBASE: Un-openable tablename bug

HTableDescriptor

public HTableDescriptor(byte[] name)
Constructor.

Parameters:
name - Table name.
Throws:
IllegalArgumentException - if passed a table name that is made of other than 'word' characters, underscore or period: i.e. [a-zA-Z_0-9.].
See Also:
HADOOP-1581 HBASE: Un-openable tablename bug
Method Detail

isLegalTableName

public static byte[] isLegalTableName(byte[] b)
Check passed buffer is legal user-space table name.

Parameters:
b - Table name.
Returns:
Returns passed b param
Throws:
NullPointerException - If passed b is null
IllegalArgumentException - if passed a table name that is made of other than 'word' characters or underscores: i.e. [a-zA-Z_0-9].

isRootRegion

public boolean isRootRegion()
Returns:
true if this is the root region

isMetaTable

public boolean isMetaTable()
Returns:
true if table is the meta table

isMetaRegion

public boolean isMetaRegion()
Returns:
true if this is a meta region (part of the root or meta tables)

getName

public byte[] getName()
Returns:
name of table

getNameAsString

public String getNameAsString()
Returns:
name of table

addFamily

public void addFamily(HColumnDescriptor family)
Adds a column family.

Parameters:
family - HColumnDescriptor of familyto add.

hasFamily

public boolean hasFamily(byte[] c)
Checks to see if this table contains the given column family

Parameters:
c - Family name or column name.
Returns:
true if the table contains the specified family name

hasFamily

public boolean hasFamily(byte[] c,
                         int index)
Checks to see if this table contains the given column family

Parameters:
c - Family name or column name.
index - Index to column family delimiter
Returns:
true if the table contains the specified family name

toString

public String toString()
Overrides:
toString in class Object
Returns:
Name of this table and then a map of all of the column family descriptors.
See Also:
getNameAsString()

equals

public boolean equals(Object obj)

Overrides:
equals in class Object

hashCode

public int hashCode()

Overrides:
hashCode in class Object

write

public void write(DataOutput out)
           throws IOException

Specified by:
write in interface org.apache.hadoop.io.Writable
Throws:
IOException

readFields

public void readFields(DataInput in)
                throws IOException

Specified by:
readFields in interface org.apache.hadoop.io.Writable
Throws:
IOException

compareTo

public int compareTo(Object o)

Specified by:
compareTo in interface Comparable

getFamilies

public Collection<HColumnDescriptor> getFamilies()
Returns:
Immutable sorted map of families.

getFamily

public HColumnDescriptor getFamily(byte[] column)
Parameters:
column -
Returns:
Column descriptor for the passed family name or the family on passed in column.

removeFamily

public HColumnDescriptor removeFamily(byte[] column)
Parameters:
column -
Returns:
Column descriptor for the passed family name or the family on passed in column.

getTableDir

public static org.apache.hadoop.fs.Path getTableDir(org.apache.hadoop.fs.Path rootdir,
                                                    byte[] tableName)
Parameters:
rootdir - qualified path of HBase root directory
tableName - name of table
Returns:
path for table


Copyright © 2008 The Apache Software Foundation