org.apache.hadoop.hbase
Class HTableDescriptor

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

public class HTableDescriptor
extends Object
implements WritableComparable

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


Field Summary
static HTableDescriptor metaTableDesc
          table descriptor for meta table
static HTableDescriptor rootTableDesc
          table descriptor for root table
 
Constructor Summary
HTableDescriptor()
          Constructs an empty object.
HTableDescriptor(String name)
          Constructor.
 
Method Summary
 void addFamily(HColumnDescriptor family)
          Adds a column family.
 int compareTo(Object o)
          
 boolean equals(Object obj)
          
 TreeMap<Text,HColumnDescriptor> families()
          All the column families in this table.
 SortedMap<Text,HColumnDescriptor> getFamilies()
           
 Text getName()
           
static Path getTableDir(Path rootdir, Text tableName)
           
 boolean hasFamily(Text family)
          Checks to see if this table contains the given column family
 int hashCode()
          
 boolean isMetaRegion()
           
 boolean isMetaTable()
           
 boolean isRootRegion()
           
 void readFields(DataInput in)
          Deserialize the fields of this object from in.
 String toString()
          
 void write(DataOutput out)
          Serialize the fields of this object to out.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

rootTableDesc

public static final HTableDescriptor rootTableDesc
table descriptor for root table


metaTableDesc

public static final HTableDescriptor metaTableDesc
table descriptor for meta table

Constructor Detail

HTableDescriptor

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

See Also:
HTableDescriptor(String)

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: i.e. [a-zA-Z_0-9]
Method Detail

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 Text getName()
Returns:
name of table

addFamily

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

Parameters:
family - HColumnDescriptor of familyto add.

hasFamily

public boolean hasFamily(Text family)
Checks to see if this table contains the given column family

Parameters:
family - - family name
Returns:
true if the table contains the specified family name

families

public TreeMap<Text,HColumnDescriptor> families()
All the column families in this table. TODO: What is this used for? Seems Dangerous to let people play with our private members.

Returns:
map of family members

toString

public String toString()

Overrides:
toString in class Object

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
Serialize the fields of this object to out.

Specified by:
write in interface Writable
Parameters:
out - DataOuput to serialize this object into.
Throws:
IOException

readFields

public void readFields(DataInput in)
                throws IOException
Deserialize the fields of this object from in.

For efficiency, implementations should attempt to re-use storage in the existing object where possible.

Specified by:
readFields in interface Writable
Parameters:
in - DataInput to deseriablize this object from.
Throws:
IOException

compareTo

public int compareTo(Object o)

Specified by:
compareTo in interface Comparable

getFamilies

public SortedMap<Text,HColumnDescriptor> getFamilies()
Returns:
Immutable sorted map of families.

getTableDir

public static Path getTableDir(Path rootdir,
                               Text tableName)
Parameters:
rootdir - qualified path of HBase root directory
tableName - name of table
Returns:
path for table


Copyright © 2006 The Apache Software Foundation