org.apache.hadoop.hive.metastore
Class DummyRawStoreForJdoConnection

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

public class DummyRawStoreForJdoConnection
extends Object
implements RawStore

DummyRawStoreForJdoConnection. An implementation of RawStore that verifies the DummyJdoConnectionUrlHook has already been applied when this class's setConf method is called, by checking that the value of the METASTORECONNECTURLKEY ConfVar has been updated. All non-void methods return default values.


Constructor Summary
DummyRawStoreForJdoConnection()
           
 
Method Summary
 boolean addIndex(Index index)
           
 boolean addPartition(Partition part)
           
 boolean addRole(String rowName, String ownerName)
           
 boolean alterDatabase(String dbname, Database db)
           
 void alterIndex(String dbname, String baseTblName, String name, Index newIndex)
           
 void alterPartition(String db_name, String tbl_name, List<String> part_vals, Partition new_part)
           
 void alterTable(String dbname, String name, Table newTable)
           
 long cleanupEvents()
           
 boolean commitTransaction()
          if this is the commit of the first open call then an actual commit is called.
 void createDatabase(Database db)
           
 void createTable(Table tbl)
           
 boolean createType(Type type)
           
 boolean dropDatabase(String dbname)
           
 boolean dropIndex(String dbName, String origTableName, String indexName)
           
 boolean dropPartition(String dbName, String tableName, List<String> part_vals)
           
 boolean dropTable(String dbName, String tableName)
           
 boolean dropType(String typeName)
           
 List<String> getAllDatabases()
           
 List<String> getAllTables(String dbName)
           
 PrincipalPrivilegeSet getColumnPrivilegeSet(String dbName, String tableName, String partitionName, String columnName, String userName, List<String> groupNames)
           
 org.apache.hadoop.conf.Configuration getConf()
           
 Database getDatabase(String name)
           
 List<String> getDatabases(String pattern)
           
 PrincipalPrivilegeSet getDBPrivilegeSet(String dbName, String userName, List<String> groupNames)
           
 Index getIndex(String dbName, String origTableName, String indexName)
           
 List<Index> getIndexes(String dbName, String origTableName, int max)
           
 Partition getPartition(String dbName, String tableName, List<String> part_vals)
           
 PrincipalPrivilegeSet getPartitionPrivilegeSet(String dbName, String tableName, String partition, String userName, List<String> groupNames)
           
 List<Partition> getPartitions(String dbName, String tableName, int max)
           
 List<Partition> getPartitionsByFilter(String dbName, String tblName, String filter, short maxParts)
           
 List<Partition> getPartitionsByNames(String dbName, String tblName, List<String> partNames)
           
 List<Partition> getPartitionsWithAuth(String dbName, String tblName, short maxParts, String userName, List<String> groupNames)
           
 Partition getPartitionWithAuth(String dbName, String tblName, List<String> partVals, String user_name, List<String> group_names)
           
 Role getRole(String roleName)
           
 Table getTable(String dbName, String tableName)
           
 List<Table> getTableObjectsByName(String dbname, List<String> tableNames)
           
 PrincipalPrivilegeSet getTablePrivilegeSet(String dbName, String tableName, String userName, List<String> groupNames)
           
 List<String> getTables(String dbName, String pattern)
           
 Type getType(String typeName)
           
 PrincipalPrivilegeSet getUserPrivilegeSet(String userName, List<String> groupNames)
           
 boolean grantPrivileges(PrivilegeBag privileges)
           
 boolean grantRole(Role role, String userName, PrincipalType principalType, String grantor, PrincipalType grantorType, boolean grantOption)
           
 boolean isPartitionMarkedForEvent(String dbName, String tblName, Map<String,String> partName, PartitionEventType evtType)
           
 List<MTablePrivilege> listAllTableGrants(String principalName, PrincipalType principalType, String dbName, String tableName)
           
 List<String> listIndexNames(String dbName, String origTableName, short max)
           
 List<String> listPartitionNames(String db_name, String tbl_name, short max_parts)
           
 List<String> listPartitionNamesByFilter(String db_name, String tbl_name, String filter, short max_parts)
           
 List<String> listPartitionNamesPs(String db_name, String tbl_name, List<String> part_vals, short max_parts)
          Lists partition names that match a given partial specification
 List<Partition> listPartitionsPsWithAuth(String db_name, String tbl_name, List<String> part_vals, short max_parts, String userName, List<String> groupNames)
          Lists partitions that match a given partial specification and sets their auth privileges.
 List<MDBPrivilege> listPrincipalDBGrants(String principalName, PrincipalType principalType, String dbName)
           
 List<MGlobalPrivilege> listPrincipalGlobalGrants(String principalName, PrincipalType principalType)
           
 List<MPartitionColumnPrivilege> listPrincipalPartitionColumnGrants(String principalName, PrincipalType principalType, String dbName, String tableName, String partName, String columnName)
           
 List<MPartitionPrivilege> listPrincipalPartitionGrants(String principalName, PrincipalType principalType, String dbName, String tableName, String partName)
           
 List<MTableColumnPrivilege> listPrincipalTableColumnGrants(String principalName, PrincipalType principalType, String dbName, String tableName, String columnName)
           
 List<String> listRoleNames()
           
 List<MRoleMap> listRoles(String principalName, PrincipalType principalType)
           
 List<String> listTableNamesByFilter(String dbName, String filter, short max_tables)
          Gets a list of tables based on a filter string and filter type.
 Table markPartitionForEvent(String dbName, String tblName, Map<String,String> partVals, PartitionEventType evtType)
           
 boolean openTransaction()
          Opens a new one or the one already created Every call of this function must have corresponding commit or rollback function call
 boolean removeRole(String roleName)
           
 boolean revokePrivileges(PrivilegeBag privileges)
           
 boolean revokeRole(Role role, String userName, PrincipalType principalType)
           
 void rollbackTransaction()
          Rolls back the current transaction if it is active
 void setConf(org.apache.hadoop.conf.Configuration arg0)
           
 void shutdown()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DummyRawStoreForJdoConnection

public DummyRawStoreForJdoConnection()
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 arg0)
Specified by:
setConf in interface org.apache.hadoop.conf.Configurable

shutdown

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

openTransaction

public boolean openTransaction()
Description copied from interface: RawStore
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()
Description copied from interface: RawStore
if this is the commit of the first open call then an actual commit is called.

Specified by:
commitTransaction in interface RawStore
Returns:
true or false

rollbackTransaction

public void rollbackTransaction()
Description copied from interface: RawStore
Rolls back the current transaction if it is active

Specified by:
rollbackTransaction in interface RawStore

createDatabase

public void createDatabase(Database db)
                    throws InvalidObjectException,
                           MetaException
Specified by:
createDatabase in interface RawStore
Throws:
InvalidObjectException
MetaException

getDatabase

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

dropDatabase

public boolean dropDatabase(String dbname)
                     throws NoSuchObjectException,
                            MetaException
Specified by:
dropDatabase in interface RawStore
Throws:
NoSuchObjectException
MetaException

alterDatabase

public boolean alterDatabase(String dbname,
                             Database db)
                      throws NoSuchObjectException,
                             MetaException
Specified by:
alterDatabase in interface RawStore
Throws:
NoSuchObjectException
MetaException

getDatabases

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

getAllDatabases

public List<String> getAllDatabases()
                             throws MetaException
Specified by:
getAllDatabases in interface RawStore
Throws:
MetaException

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)
                  throws MetaException
Specified by:
dropTable in interface RawStore
Throws:
MetaException

getTable

public Table getTable(String dbName,
                      String tableName)
               throws MetaException
Specified by:
getTable 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,
                              NoSuchObjectException
Specified by:
getPartition in interface RawStore
Throws:
MetaException
NoSuchObjectException

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

alterTable

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

getTables

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

getTableObjectsByName

public List<Table> getTableObjectsByName(String dbname,
                                         List<String> tableNames)
                                  throws MetaException,
                                         UnknownDBException
Specified by:
getTableObjectsByName in interface RawStore
Parameters:
dbname - The name of the database from which to retrieve the tables
tableNames - The names of the tables to retrieve.
Returns:
A list of the tables retrievable from the database whose names are in the list tableNames. If there are duplicate names, only one instance of the table will be returned
Throws:
MetaException
UnknownDBException

getAllTables

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

listTableNamesByFilter

public List<String> listTableNamesByFilter(String dbName,
                                           String filter,
                                           short max_tables)
                                    throws MetaException,
                                           UnknownDBException
Description copied from interface: RawStore
Gets a list of tables based on a filter string and filter type.

Specified by:
listTableNamesByFilter in interface RawStore
Parameters:
dbName - The name of the database from which you will retrieve the table names
filter - The filter string
max_tables - The maximum number of tables returned
Returns:
A list of table names that match the desired filter
Throws:
MetaException
UnknownDBException

listPartitionNames

public List<String> listPartitionNames(String db_name,
                                       String tbl_name,
                                       short max_parts)
                                throws MetaException
Specified by:
listPartitionNames in interface RawStore
Throws:
MetaException

listPartitionNamesByFilter

public List<String> listPartitionNamesByFilter(String db_name,
                                               String tbl_name,
                                               String filter,
                                               short max_parts)
                                        throws MetaException
Specified by:
listPartitionNamesByFilter in interface RawStore
Throws:
MetaException

alterPartition

public void alterPartition(String db_name,
                           String tbl_name,
                           List<String> part_vals,
                           Partition new_part)
                    throws InvalidObjectException,
                           MetaException
Specified by:
alterPartition in interface RawStore
Throws:
InvalidObjectException
MetaException

addIndex

public boolean addIndex(Index index)
                 throws InvalidObjectException,
                        MetaException
Specified by:
addIndex in interface RawStore
Throws:
InvalidObjectException
MetaException

getIndex

public Index getIndex(String dbName,
                      String origTableName,
                      String indexName)
               throws MetaException
Specified by:
getIndex in interface RawStore
Throws:
MetaException

dropIndex

public boolean dropIndex(String dbName,
                         String origTableName,
                         String indexName)
                  throws MetaException
Specified by:
dropIndex in interface RawStore
Throws:
MetaException

getIndexes

public List<Index> getIndexes(String dbName,
                              String origTableName,
                              int max)
                       throws MetaException
Specified by:
getIndexes in interface RawStore
Throws:
MetaException

listIndexNames

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

alterIndex

public void alterIndex(String dbname,
                       String baseTblName,
                       String name,
                       Index newIndex)
                throws InvalidObjectException,
                       MetaException
Specified by:
alterIndex in interface RawStore
Throws:
InvalidObjectException
MetaException

getPartitionsByFilter

public List<Partition> getPartitionsByFilter(String dbName,
                                             String tblName,
                                             String filter,
                                             short maxParts)
                                      throws MetaException,
                                             NoSuchObjectException
Specified by:
getPartitionsByFilter in interface RawStore
Throws:
MetaException
NoSuchObjectException

getPartitionsByNames

public List<Partition> getPartitionsByNames(String dbName,
                                            String tblName,
                                            List<String> partNames)
                                     throws MetaException,
                                            NoSuchObjectException
Specified by:
getPartitionsByNames in interface RawStore
Throws:
MetaException
NoSuchObjectException

markPartitionForEvent

public Table markPartitionForEvent(String dbName,
                                   String tblName,
                                   Map<String,String> partVals,
                                   PartitionEventType evtType)
                            throws MetaException,
                                   UnknownTableException,
                                   InvalidPartitionException,
                                   UnknownPartitionException
Specified by:
markPartitionForEvent in interface RawStore
Throws:
MetaException
UnknownTableException
InvalidPartitionException
UnknownPartitionException

isPartitionMarkedForEvent

public boolean isPartitionMarkedForEvent(String dbName,
                                         String tblName,
                                         Map<String,String> partName,
                                         PartitionEventType evtType)
                                  throws MetaException,
                                         UnknownTableException,
                                         InvalidPartitionException,
                                         UnknownPartitionException
Specified by:
isPartitionMarkedForEvent in interface RawStore
Throws:
MetaException
UnknownTableException
InvalidPartitionException
UnknownPartitionException

addRole

public boolean addRole(String rowName,
                       String ownerName)
                throws InvalidObjectException,
                       MetaException,
                       NoSuchObjectException
Specified by:
addRole in interface RawStore
Throws:
InvalidObjectException
MetaException
NoSuchObjectException

removeRole

public boolean removeRole(String roleName)
                   throws MetaException,
                          NoSuchObjectException
Specified by:
removeRole in interface RawStore
Throws:
MetaException
NoSuchObjectException

grantRole

public boolean grantRole(Role role,
                         String userName,
                         PrincipalType principalType,
                         String grantor,
                         PrincipalType grantorType,
                         boolean grantOption)
                  throws MetaException,
                         NoSuchObjectException,
                         InvalidObjectException
Specified by:
grantRole in interface RawStore
Throws:
MetaException
NoSuchObjectException
InvalidObjectException

revokeRole

public boolean revokeRole(Role role,
                          String userName,
                          PrincipalType principalType)
                   throws MetaException,
                          NoSuchObjectException
Specified by:
revokeRole in interface RawStore
Throws:
MetaException
NoSuchObjectException

getUserPrivilegeSet

public PrincipalPrivilegeSet getUserPrivilegeSet(String userName,
                                                 List<String> groupNames)
                                          throws InvalidObjectException,
                                                 MetaException
Specified by:
getUserPrivilegeSet in interface RawStore
Throws:
InvalidObjectException
MetaException

getDBPrivilegeSet

public PrincipalPrivilegeSet getDBPrivilegeSet(String dbName,
                                               String userName,
                                               List<String> groupNames)
                                        throws InvalidObjectException,
                                               MetaException
Specified by:
getDBPrivilegeSet in interface RawStore
Throws:
InvalidObjectException
MetaException

getTablePrivilegeSet

public PrincipalPrivilegeSet getTablePrivilegeSet(String dbName,
                                                  String tableName,
                                                  String userName,
                                                  List<String> groupNames)
                                           throws InvalidObjectException,
                                                  MetaException
Specified by:
getTablePrivilegeSet in interface RawStore
Throws:
InvalidObjectException
MetaException

getPartitionPrivilegeSet

public PrincipalPrivilegeSet getPartitionPrivilegeSet(String dbName,
                                                      String tableName,
                                                      String partition,
                                                      String userName,
                                                      List<String> groupNames)
                                               throws InvalidObjectException,
                                                      MetaException
Specified by:
getPartitionPrivilegeSet in interface RawStore
Throws:
InvalidObjectException
MetaException

getColumnPrivilegeSet

public PrincipalPrivilegeSet getColumnPrivilegeSet(String dbName,
                                                   String tableName,
                                                   String partitionName,
                                                   String columnName,
                                                   String userName,
                                                   List<String> groupNames)
                                            throws InvalidObjectException,
                                                   MetaException
Specified by:
getColumnPrivilegeSet in interface RawStore
Throws:
InvalidObjectException
MetaException

listPrincipalGlobalGrants

public List<MGlobalPrivilege> listPrincipalGlobalGrants(String principalName,
                                                        PrincipalType principalType)
Specified by:
listPrincipalGlobalGrants in interface RawStore

listPrincipalDBGrants

public List<MDBPrivilege> listPrincipalDBGrants(String principalName,
                                                PrincipalType principalType,
                                                String dbName)
Specified by:
listPrincipalDBGrants in interface RawStore

listAllTableGrants

public List<MTablePrivilege> listAllTableGrants(String principalName,
                                                PrincipalType principalType,
                                                String dbName,
                                                String tableName)
Specified by:
listAllTableGrants in interface RawStore

listPrincipalPartitionGrants

public List<MPartitionPrivilege> listPrincipalPartitionGrants(String principalName,
                                                              PrincipalType principalType,
                                                              String dbName,
                                                              String tableName,
                                                              String partName)
Specified by:
listPrincipalPartitionGrants in interface RawStore

listPrincipalTableColumnGrants

public List<MTableColumnPrivilege> listPrincipalTableColumnGrants(String principalName,
                                                                  PrincipalType principalType,
                                                                  String dbName,
                                                                  String tableName,
                                                                  String columnName)
Specified by:
listPrincipalTableColumnGrants in interface RawStore

listPrincipalPartitionColumnGrants

public List<MPartitionColumnPrivilege> listPrincipalPartitionColumnGrants(String principalName,
                                                                          PrincipalType principalType,
                                                                          String dbName,
                                                                          String tableName,
                                                                          String partName,
                                                                          String columnName)
Specified by:
listPrincipalPartitionColumnGrants in interface RawStore

grantPrivileges

public boolean grantPrivileges(PrivilegeBag privileges)
                        throws InvalidObjectException,
                               MetaException,
                               NoSuchObjectException
Specified by:
grantPrivileges in interface RawStore
Throws:
InvalidObjectException
MetaException
NoSuchObjectException

revokePrivileges

public boolean revokePrivileges(PrivilegeBag privileges)
                         throws InvalidObjectException,
                                MetaException,
                                NoSuchObjectException
Specified by:
revokePrivileges in interface RawStore
Throws:
InvalidObjectException
MetaException
NoSuchObjectException

getRole

public Role getRole(String roleName)
             throws NoSuchObjectException
Specified by:
getRole in interface RawStore
Throws:
NoSuchObjectException

listRoleNames

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

listRoles

public List<MRoleMap> listRoles(String principalName,
                                PrincipalType principalType)
Specified by:
listRoles in interface RawStore

getPartitionWithAuth

public Partition getPartitionWithAuth(String dbName,
                                      String tblName,
                                      List<String> partVals,
                                      String user_name,
                                      List<String> group_names)
                               throws MetaException,
                                      NoSuchObjectException,
                                      InvalidObjectException
Specified by:
getPartitionWithAuth in interface RawStore
Throws:
MetaException
NoSuchObjectException
InvalidObjectException

getPartitionsWithAuth

public List<Partition> getPartitionsWithAuth(String dbName,
                                             String tblName,
                                             short maxParts,
                                             String userName,
                                             List<String> groupNames)
                                      throws MetaException,
                                             NoSuchObjectException,
                                             InvalidObjectException
Specified by:
getPartitionsWithAuth in interface RawStore
Throws:
MetaException
NoSuchObjectException
InvalidObjectException

listPartitionNamesPs

public List<String> listPartitionNamesPs(String db_name,
                                         String tbl_name,
                                         List<String> part_vals,
                                         short max_parts)
                                  throws MetaException,
                                         NoSuchObjectException
Description copied from interface: RawStore
Lists partition names that match a given partial specification

Specified by:
listPartitionNamesPs in interface RawStore
Parameters:
db_name - The name of the database which has the partitions
tbl_name - The name of the table which has the partitions
part_vals - A partial list of values for partitions in order of the table's partition keys. Entries can be empty if you only want to specify latter partitions.
max_parts - The maximum number of partitions to return
Returns:
A list of partition names that match the partial spec.
Throws:
MetaException
NoSuchObjectException

listPartitionsPsWithAuth

public List<Partition> listPartitionsPsWithAuth(String db_name,
                                                String tbl_name,
                                                List<String> part_vals,
                                                short max_parts,
                                                String userName,
                                                List<String> groupNames)
                                         throws MetaException,
                                                InvalidObjectException,
                                                NoSuchObjectException
Description copied from interface: RawStore
Lists partitions that match a given partial specification and sets their auth privileges. If userName and groupNames null, then no auth privileges are set.

Specified by:
listPartitionsPsWithAuth in interface RawStore
Parameters:
db_name - The name of the database which has the partitions
tbl_name - The name of the table which has the partitions
part_vals - A partial list of values for partitions in order of the table's partition keys Entries can be empty if you need to specify latter partitions.
max_parts - The maximum number of partitions to return
userName - The user name for the partition for authentication privileges
groupNames - The groupNames for the partition for authentication privileges
Returns:
A list of partitions that match the partial spec.
Throws:
MetaException
InvalidObjectException
NoSuchObjectException

cleanupEvents

public long cleanupEvents()
Specified by:
cleanupEvents in interface RawStore


Copyright © 2011 The Apache Software Foundation