org.apache.hadoop.hbase.rest.model
Class TableSchemaModel

java.lang.Object
  extended by org.apache.hadoop.hbase.rest.model.TableSchemaModel
All Implemented Interfaces:
Serializable, ProtobufMessageHandler

public class TableSchemaModel
extends Object
implements Serializable, ProtobufMessageHandler

A representation of HBase table descriptors.

 <complexType name="TableSchema">
   <sequence>
     <element name="column" type="tns:ColumnSchema" 
       maxOccurs="unbounded" minOccurs="1"></element>
   </sequence>
   <attribute name="name" type="string"></attribute>
   <anyAttribute></anyAttribute>
 </complexType>
 

See Also:
Serialized Form

Constructor Summary
TableSchemaModel()
          Default constructor.
TableSchemaModel(HTableDescriptor htd)
          Constructor
 
Method Summary
 boolean __getIsMeta()
           
 boolean __getIsRoot()
           
 boolean __getReadOnly()
           
 void __setIsMeta(boolean value)
           
 void __setIsRoot(boolean value)
           
 void __setReadOnly(boolean value)
           
 void addAttribute(String name, Object value)
          Add an attribute to the table descriptor
 void addColumnFamily(ColumnSchemaModel family)
          Add a column family to the table descriptor
 byte[] createProtobufOutput()
           
 Map<QName,Object> getAny()
           
 String getAttribute(String name)
          Return a table descriptor value as a string.
 ColumnSchemaModel getColumnFamily(int index)
          Retrieve the column family at the given index from the table descriptor
 List<ColumnSchemaModel> getColumns()
           
 String getName()
           
 ProtobufMessageHandler getObjectFromMessage(byte[] message)
          Initialize the model from a protobuf representation.
 HTableDescriptor getTableDescriptor()
           
 void setColumns(List<ColumnSchemaModel> columns)
           
 void setName(String name)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TableSchemaModel

public TableSchemaModel()
Default constructor.


TableSchemaModel

public TableSchemaModel(HTableDescriptor htd)
Constructor

Parameters:
htd - the table descriptor
Method Detail

addAttribute

public void addAttribute(String name,
                         Object value)
Add an attribute to the table descriptor

Parameters:
name - attribute name
value - attribute value

getAttribute

public String getAttribute(String name)
Return a table descriptor value as a string. Calls toString() on the object stored in the descriptor value map.

Parameters:
name - the attribute name
Returns:
the attribute value

addColumnFamily

public void addColumnFamily(ColumnSchemaModel family)
Add a column family to the table descriptor

Parameters:
family - the column family model

getColumnFamily

public ColumnSchemaModel getColumnFamily(int index)
Retrieve the column family at the given index from the table descriptor

Parameters:
index - the index
Returns:
the column family model

getName

public String getName()
Returns:
the table name

getAny

public Map<QName,Object> getAny()
Returns:
the map for holding unspecified (user) attributes

getColumns

public List<ColumnSchemaModel> getColumns()
Returns:
the columns

setName

public void setName(String name)
Parameters:
name - the table name

setColumns

public void setColumns(List<ColumnSchemaModel> columns)
Parameters:
columns - the columns to set

toString

public String toString()
Overrides:
toString in class Object

__getIsMeta

public boolean __getIsMeta()
Returns:
true if IS_META attribute exists and is truel

__getIsRoot

public boolean __getIsRoot()
Returns:
true if IS_ROOT attribute exists and is truel

__getReadOnly

public boolean __getReadOnly()
Returns:
true if READONLY attribute exists and is truel

__setIsMeta

public void __setIsMeta(boolean value)
Parameters:
value - desired value of IS_META attribute

__setIsRoot

public void __setIsRoot(boolean value)
Parameters:
value - desired value of IS_ROOT attribute

__setReadOnly

public void __setReadOnly(boolean value)
Parameters:
value - desired value of READONLY attribute

createProtobufOutput

public byte[] createProtobufOutput()
Specified by:
createProtobufOutput in interface ProtobufMessageHandler
Returns:
the protobuf represention of the model

getObjectFromMessage

public ProtobufMessageHandler getObjectFromMessage(byte[] message)
                                            throws IOException
Description copied from interface: ProtobufMessageHandler
Initialize the model from a protobuf representation.

Specified by:
getObjectFromMessage in interface ProtobufMessageHandler
Parameters:
message - the raw bytes of the protobuf message
Returns:
reference to self for convenience
Throws:
IOException

getTableDescriptor

public HTableDescriptor getTableDescriptor()
Returns:
a table descriptor


Copyright © 2011 The Apache Software Foundation. All Rights Reserved.