org.apache.hadoop.hive.metastore
Class ObjectStore

java.lang.Object
  extended by org.apache.hadoop.hive.metastore.ObjectStore
All Implemented Interfaces:
org.apache.hadoop.conf.Configurable, RawStore

public class ObjectStore
extends Object
implements RawStore, org.apache.hadoop.conf.Configurable

This class is the interface between the application logic and the database store that contains the objects. Refrain putting any logic in mode.M* objects or in this file as former could be auto generated and this class would need to be made into a interface that can read both from a database and a filestore.


Constructor Summary
ObjectStore()
           
 
Method Summary
 boolean addPartition(Partition part)
           
 void alterPartition(String dbname, String name, Partition newPart)
           
 void alterTable(String dbname, String name, Table newTable)
           
 boolean commitTransaction()
          if this is the commit of the first open call then an actual commit is called.
 boolean createDatabase(Database db)
           
 boolean createDatabase(String name)
           
 void createTable(Table tbl)
           
 boolean createType(Type type)
           
 boolean dropDatabase(String dbname)
           
 boolean dropPartition(String dbName, String tableName, List<String> part_vals)
           
 boolean dropTable(String dbName, String tableName)
           
 boolean dropType(String typeName)
           
 org.apache.hadoop.conf.Configuration getConf()
           
 Database getDatabase(String name)
           
 List<String> getDatabases()
           
 Partition getPartition(String dbName, String tableName, List<String> part_vals)
           
 List<Partition> getPartitions(String dbName, String tableName, int max)
           
 Table getTable(String dbName, String tableName)
           
 List<String> getTables(String dbName, String pattern)
           
 Type getType(String typeName)
           
 boolean isActiveTransaction()
           
 List<String> listPartitionNames(String dbName, String tableName, short max)
           
 boolean openTransaction()
          Opens a new one or the one already created Every call of this function must have corresponding commit or rollback function call
 void rollbackTransaction()
          Rolls back the current transaction if it is active
 void setConf(org.apache.hadoop.conf.Configuration conf)
           
 void shutdown()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ObjectStore

public ObjectStore()
Method Detail

getConf

public org.apache.hadoop.conf.Configuration getConf()
Specified by:
getConf in interface org.apache.hadoop.conf.Configurable

setConf

public void setConf(org.apache.hadoop.conf.Configuration conf)
Specified by:
setConf in interface org.apache.hadoop.conf.Configurable

shutdown

public void shutdown()
Specified by:
shutdown in interface RawStore

openTransaction

public boolean openTransaction()
Opens a new one or the one already created Every call of this function must have corresponding commit or rollback function call

Specified by:
openTransaction in interface RawStore
Returns:
an active transaction

commitTransaction

public boolean commitTransaction()
if this is the commit of the first open call then an actual commit is called.

Specified by:
commitTransaction in interface RawStore
Returns:
Always returns true

isActiveTransaction

public boolean isActiveTransaction()
Returns:
true if there is an active transaction. If the current transaction is either committed or rolled back it returns false

rollbackTransaction

public void rollbackTransaction()
Rolls back the current transaction if it is active

Specified by:
rollbackTransaction in interface RawStore

createDatabase

public boolean createDatabase(Database db)
Specified by:
createDatabase in interface RawStore

createDatabase

public boolean createDatabase(String name)
Specified by:
createDatabase in interface RawStore

getDatabase

public Database getDatabase(String name)
                     throws NoSuchObjectException
Specified by:
getDatabase in interface RawStore
Throws:
NoSuchObjectException

dropDatabase

public boolean dropDatabase(String dbname)
Specified by:
dropDatabase in interface RawStore

getDatabases

public List<String> getDatabases()
Specified by:
getDatabases in interface RawStore

createType

public boolean createType(Type type)
Specified by:
createType in interface RawStore

getType

public Type getType(String typeName)
Specified by:
getType in interface RawStore

dropType

public boolean dropType(String typeName)
Specified by:
dropType in interface RawStore

createTable

public void createTable(Table tbl)
                 throws InvalidObjectException,
                        MetaException
Specified by:
createTable in interface RawStore
Throws:
InvalidObjectException
MetaException

dropTable

public boolean dropTable(String dbName,
                         String tableName)
Specified by:
dropTable in interface RawStore

getTable

public Table getTable(String dbName,
                      String tableName)
               throws MetaException
Specified by:
getTable in interface RawStore
Throws:
MetaException

getTables

public List<String> getTables(String dbName,
                              String pattern)
                       throws MetaException
Specified by:
getTables in interface RawStore
Throws:
MetaException

addPartition

public boolean addPartition(Partition part)
                     throws InvalidObjectException,
                            MetaException
Specified by:
addPartition in interface RawStore
Throws:
InvalidObjectException
MetaException

getPartition

public Partition getPartition(String dbName,
                              String tableName,
                              List<String> part_vals)
                       throws MetaException
Specified by:
getPartition in interface RawStore
Throws:
MetaException

dropPartition

public boolean dropPartition(String dbName,
                             String tableName,
                             List<String> part_vals)
                      throws MetaException
Specified by:
dropPartition in interface RawStore
Throws:
MetaException

getPartitions

public List<Partition> getPartitions(String dbName,
                                     String tableName,
                                     int max)
                              throws MetaException
Specified by:
getPartitions in interface RawStore
Throws:
MetaException

listPartitionNames

public List<String> listPartitionNames(String dbName,
                                       String tableName,
                                       short max)
                                throws MetaException
Specified by:
listPartitionNames in interface RawStore
Throws:
MetaException

alterTable

public void alterTable(String dbname,
                       String name,
                       Table newTable)
                throws InvalidObjectException,
                       MetaException
Specified by:
alterTable in interface RawStore
Throws:
InvalidObjectException
MetaException

alterPartition

public void alterPartition(String dbname,
                           String name,
                           Partition newPart)
                    throws InvalidObjectException,
                           MetaException
Specified by:
alterPartition in interface RawStore
Throws:
InvalidObjectException
MetaException


Copyright © 2009 The Apache Software Foundation