You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by na...@apache.org on 2011/01/12 07:58:10 UTC

svn commit: r1057999 [12/22] - in /hive/trunk: ./ common/src/java/org/apache/hadoop/hive/conf/ conf/ metastore/if/ metastore/src/gen/thrift/gen-cpp/ metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/ metastore/src/gen/thrift/ge...

Modified: hive/trunk/metastore/src/gen/thrift/gen-rb/thrift_hive_metastore.rb
URL: http://svn.apache.org/viewvc/hive/trunk/metastore/src/gen/thrift/gen-rb/thrift_hive_metastore.rb?rev=1057999&r1=1057998&r2=1057999&view=diff
==============================================================================
--- hive/trunk/metastore/src/gen/thrift/gen-rb/thrift_hive_metastore.rb (original)
+++ hive/trunk/metastore/src/gen/thrift/gen-rb/thrift_hive_metastore.rb Wed Jan 12 06:58:04 2011
@@ -419,6 +419,23 @@ module ThriftHiveMetastore
       raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'get_partition failed: unknown result')
     end
 
+    def get_partition_with_auth(db_name, tbl_name, part_vals, user_name, group_names)
+      send_get_partition_with_auth(db_name, tbl_name, part_vals, user_name, group_names)
+      return recv_get_partition_with_auth()
+    end
+
+    def send_get_partition_with_auth(db_name, tbl_name, part_vals, user_name, group_names)
+      send_message('get_partition_with_auth', Get_partition_with_auth_args, :db_name => db_name, :tbl_name => tbl_name, :part_vals => part_vals, :user_name => user_name, :group_names => group_names)
+    end
+
+    def recv_get_partition_with_auth()
+      result = receive_message(Get_partition_with_auth_result)
+      return result.success unless result.success.nil?
+      raise result.o1 unless result.o1.nil?
+      raise result.o2 unless result.o2.nil?
+      raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'get_partition_with_auth failed: unknown result')
+    end
+
     def get_partition_by_name(db_name, tbl_name, part_name)
       send_get_partition_by_name(db_name, tbl_name, part_name)
       return recv_get_partition_by_name()
@@ -453,6 +470,23 @@ module ThriftHiveMetastore
       raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'get_partitions failed: unknown result')
     end
 
+    def get_partitions_with_auth(db_name, tbl_name, max_parts, user_name, group_names)
+      send_get_partitions_with_auth(db_name, tbl_name, max_parts, user_name, group_names)
+      return recv_get_partitions_with_auth()
+    end
+
+    def send_get_partitions_with_auth(db_name, tbl_name, max_parts, user_name, group_names)
+      send_message('get_partitions_with_auth', Get_partitions_with_auth_args, :db_name => db_name, :tbl_name => tbl_name, :max_parts => max_parts, :user_name => user_name, :group_names => group_names)
+    end
+
+    def recv_get_partitions_with_auth()
+      result = receive_message(Get_partitions_with_auth_result)
+      return result.success unless result.success.nil?
+      raise result.o1 unless result.o1.nil?
+      raise result.o2 unless result.o2.nil?
+      raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'get_partitions_with_auth failed: unknown result')
+    end
+
     def get_partition_names(db_name, tbl_name, max_parts)
       send_get_partition_names(db_name, tbl_name, max_parts)
       return recv_get_partition_names()
@@ -485,6 +519,23 @@ module ThriftHiveMetastore
       raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'get_partitions_ps failed: unknown result')
     end
 
+    def get_partitions_ps_with_auth(db_name, tbl_name, part_vals, max_parts, user_name, group_names)
+      send_get_partitions_ps_with_auth(db_name, tbl_name, part_vals, max_parts, user_name, group_names)
+      return recv_get_partitions_ps_with_auth()
+    end
+
+    def send_get_partitions_ps_with_auth(db_name, tbl_name, part_vals, max_parts, user_name, group_names)
+      send_message('get_partitions_ps_with_auth', Get_partitions_ps_with_auth_args, :db_name => db_name, :tbl_name => tbl_name, :part_vals => part_vals, :max_parts => max_parts, :user_name => user_name, :group_names => group_names)
+    end
+
+    def recv_get_partitions_ps_with_auth()
+      result = receive_message(Get_partitions_ps_with_auth_result)
+      return result.success unless result.success.nil?
+      raise result.o1 unless result.o1.nil?
+      raise result.o2 unless result.o2.nil?
+      raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'get_partitions_ps_with_auth failed: unknown result')
+    end
+
     def get_partition_names_ps(db_name, tbl_name, part_vals, max_parts)
       send_get_partition_names_ps(db_name, tbl_name, part_vals, max_parts)
       return recv_get_partition_names_ps()
@@ -683,6 +734,150 @@ module ThriftHiveMetastore
       raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'get_index_names failed: unknown result')
     end
 
+    def create_role(role)
+      send_create_role(role)
+      return recv_create_role()
+    end
+
+    def send_create_role(role)
+      send_message('create_role', Create_role_args, :role => role)
+    end
+
+    def recv_create_role()
+      result = receive_message(Create_role_result)
+      return result.success unless result.success.nil?
+      raise result.o1 unless result.o1.nil?
+      raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'create_role failed: unknown result')
+    end
+
+    def drop_role(role_name)
+      send_drop_role(role_name)
+      return recv_drop_role()
+    end
+
+    def send_drop_role(role_name)
+      send_message('drop_role', Drop_role_args, :role_name => role_name)
+    end
+
+    def recv_drop_role()
+      result = receive_message(Drop_role_result)
+      return result.success unless result.success.nil?
+      raise result.o1 unless result.o1.nil?
+      raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'drop_role failed: unknown result')
+    end
+
+    def grant_role(role_name, principal_name, principal_type, grantor, grantorType, grant_option)
+      send_grant_role(role_name, principal_name, principal_type, grantor, grantorType, grant_option)
+      return recv_grant_role()
+    end
+
+    def send_grant_role(role_name, principal_name, principal_type, grantor, grantorType, grant_option)
+      send_message('grant_role', Grant_role_args, :role_name => role_name, :principal_name => principal_name, :principal_type => principal_type, :grantor => grantor, :grantorType => grantorType, :grant_option => grant_option)
+    end
+
+    def recv_grant_role()
+      result = receive_message(Grant_role_result)
+      return result.success unless result.success.nil?
+      raise result.o1 unless result.o1.nil?
+      raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'grant_role failed: unknown result')
+    end
+
+    def revoke_role(role_name, principal_name, principal_type)
+      send_revoke_role(role_name, principal_name, principal_type)
+      return recv_revoke_role()
+    end
+
+    def send_revoke_role(role_name, principal_name, principal_type)
+      send_message('revoke_role', Revoke_role_args, :role_name => role_name, :principal_name => principal_name, :principal_type => principal_type)
+    end
+
+    def recv_revoke_role()
+      result = receive_message(Revoke_role_result)
+      return result.success unless result.success.nil?
+      raise result.o1 unless result.o1.nil?
+      raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'revoke_role failed: unknown result')
+    end
+
+    def list_roles(principal_name, principal_type)
+      send_list_roles(principal_name, principal_type)
+      return recv_list_roles()
+    end
+
+    def send_list_roles(principal_name, principal_type)
+      send_message('list_roles', List_roles_args, :principal_name => principal_name, :principal_type => principal_type)
+    end
+
+    def recv_list_roles()
+      result = receive_message(List_roles_result)
+      return result.success unless result.success.nil?
+      raise result.o1 unless result.o1.nil?
+      raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'list_roles failed: unknown result')
+    end
+
+    def get_privilege_set(hiveObject, user_name, group_names)
+      send_get_privilege_set(hiveObject, user_name, group_names)
+      return recv_get_privilege_set()
+    end
+
+    def send_get_privilege_set(hiveObject, user_name, group_names)
+      send_message('get_privilege_set', Get_privilege_set_args, :hiveObject => hiveObject, :user_name => user_name, :group_names => group_names)
+    end
+
+    def recv_get_privilege_set()
+      result = receive_message(Get_privilege_set_result)
+      return result.success unless result.success.nil?
+      raise result.o1 unless result.o1.nil?
+      raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'get_privilege_set failed: unknown result')
+    end
+
+    def list_privileges(principal_name, principal_type, hiveObject)
+      send_list_privileges(principal_name, principal_type, hiveObject)
+      return recv_list_privileges()
+    end
+
+    def send_list_privileges(principal_name, principal_type, hiveObject)
+      send_message('list_privileges', List_privileges_args, :principal_name => principal_name, :principal_type => principal_type, :hiveObject => hiveObject)
+    end
+
+    def recv_list_privileges()
+      result = receive_message(List_privileges_result)
+      return result.success unless result.success.nil?
+      raise result.o1 unless result.o1.nil?
+      raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'list_privileges failed: unknown result')
+    end
+
+    def grant_privileges(privileges)
+      send_grant_privileges(privileges)
+      return recv_grant_privileges()
+    end
+
+    def send_grant_privileges(privileges)
+      send_message('grant_privileges', Grant_privileges_args, :privileges => privileges)
+    end
+
+    def recv_grant_privileges()
+      result = receive_message(Grant_privileges_result)
+      return result.success unless result.success.nil?
+      raise result.o1 unless result.o1.nil?
+      raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'grant_privileges failed: unknown result')
+    end
+
+    def revoke_privileges(privileges)
+      send_revoke_privileges(privileges)
+      return recv_revoke_privileges()
+    end
+
+    def send_revoke_privileges(privileges)
+      send_message('revoke_privileges', Revoke_privileges_args, :privileges => privileges)
+    end
+
+    def recv_revoke_privileges()
+      result = receive_message(Revoke_privileges_result)
+      return result.success unless result.success.nil?
+      raise result.o1 unless result.o1.nil?
+      raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'revoke_privileges failed: unknown result')
+    end
+
   end
 
   class Processor < FacebookService::Processor 
@@ -1010,6 +1205,19 @@ module ThriftHiveMetastore
       write_result(result, oprot, 'get_partition', seqid)
     end
 
+    def process_get_partition_with_auth(seqid, iprot, oprot)
+      args = read_args(iprot, Get_partition_with_auth_args)
+      result = Get_partition_with_auth_result.new()
+      begin
+        result.success = @handler.get_partition_with_auth(args.db_name, args.tbl_name, args.part_vals, args.user_name, args.group_names)
+      rescue MetaException => o1
+        result.o1 = o1
+      rescue NoSuchObjectException => o2
+        result.o2 = o2
+      end
+      write_result(result, oprot, 'get_partition_with_auth', seqid)
+    end
+
     def process_get_partition_by_name(seqid, iprot, oprot)
       args = read_args(iprot, Get_partition_by_name_args)
       result = Get_partition_by_name_result.new()
@@ -1036,6 +1244,19 @@ module ThriftHiveMetastore
       write_result(result, oprot, 'get_partitions', seqid)
     end
 
+    def process_get_partitions_with_auth(seqid, iprot, oprot)
+      args = read_args(iprot, Get_partitions_with_auth_args)
+      result = Get_partitions_with_auth_result.new()
+      begin
+        result.success = @handler.get_partitions_with_auth(args.db_name, args.tbl_name, args.max_parts, args.user_name, args.group_names)
+      rescue NoSuchObjectException => o1
+        result.o1 = o1
+      rescue MetaException => o2
+        result.o2 = o2
+      end
+      write_result(result, oprot, 'get_partitions_with_auth', seqid)
+    end
+
     def process_get_partition_names(seqid, iprot, oprot)
       args = read_args(iprot, Get_partition_names_args)
       result = Get_partition_names_result.new()
@@ -1058,6 +1279,19 @@ module ThriftHiveMetastore
       write_result(result, oprot, 'get_partitions_ps', seqid)
     end
 
+    def process_get_partitions_ps_with_auth(seqid, iprot, oprot)
+      args = read_args(iprot, Get_partitions_ps_with_auth_args)
+      result = Get_partitions_ps_with_auth_result.new()
+      begin
+        result.success = @handler.get_partitions_ps_with_auth(args.db_name, args.tbl_name, args.part_vals, args.max_parts, args.user_name, args.group_names)
+      rescue NoSuchObjectException => o1
+        result.o1 = o1
+      rescue MetaException => o2
+        result.o2 = o2
+      end
+      write_result(result, oprot, 'get_partitions_ps_with_auth', seqid)
+    end
+
     def process_get_partition_names_ps(seqid, iprot, oprot)
       args = read_args(iprot, Get_partition_names_ps_args)
       result = Get_partition_names_ps_result.new()
@@ -1206,6 +1440,105 @@ module ThriftHiveMetastore
       write_result(result, oprot, 'get_index_names', seqid)
     end
 
+    def process_create_role(seqid, iprot, oprot)
+      args = read_args(iprot, Create_role_args)
+      result = Create_role_result.new()
+      begin
+        result.success = @handler.create_role(args.role)
+      rescue MetaException => o1
+        result.o1 = o1
+      end
+      write_result(result, oprot, 'create_role', seqid)
+    end
+
+    def process_drop_role(seqid, iprot, oprot)
+      args = read_args(iprot, Drop_role_args)
+      result = Drop_role_result.new()
+      begin
+        result.success = @handler.drop_role(args.role_name)
+      rescue MetaException => o1
+        result.o1 = o1
+      end
+      write_result(result, oprot, 'drop_role', seqid)
+    end
+
+    def process_grant_role(seqid, iprot, oprot)
+      args = read_args(iprot, Grant_role_args)
+      result = Grant_role_result.new()
+      begin
+        result.success = @handler.grant_role(args.role_name, args.principal_name, args.principal_type, args.grantor, args.grantorType, args.grant_option)
+      rescue MetaException => o1
+        result.o1 = o1
+      end
+      write_result(result, oprot, 'grant_role', seqid)
+    end
+
+    def process_revoke_role(seqid, iprot, oprot)
+      args = read_args(iprot, Revoke_role_args)
+      result = Revoke_role_result.new()
+      begin
+        result.success = @handler.revoke_role(args.role_name, args.principal_name, args.principal_type)
+      rescue MetaException => o1
+        result.o1 = o1
+      end
+      write_result(result, oprot, 'revoke_role', seqid)
+    end
+
+    def process_list_roles(seqid, iprot, oprot)
+      args = read_args(iprot, List_roles_args)
+      result = List_roles_result.new()
+      begin
+        result.success = @handler.list_roles(args.principal_name, args.principal_type)
+      rescue MetaException => o1
+        result.o1 = o1
+      end
+      write_result(result, oprot, 'list_roles', seqid)
+    end
+
+    def process_get_privilege_set(seqid, iprot, oprot)
+      args = read_args(iprot, Get_privilege_set_args)
+      result = Get_privilege_set_result.new()
+      begin
+        result.success = @handler.get_privilege_set(args.hiveObject, args.user_name, args.group_names)
+      rescue MetaException => o1
+        result.o1 = o1
+      end
+      write_result(result, oprot, 'get_privilege_set', seqid)
+    end
+
+    def process_list_privileges(seqid, iprot, oprot)
+      args = read_args(iprot, List_privileges_args)
+      result = List_privileges_result.new()
+      begin
+        result.success = @handler.list_privileges(args.principal_name, args.principal_type, args.hiveObject)
+      rescue MetaException => o1
+        result.o1 = o1
+      end
+      write_result(result, oprot, 'list_privileges', seqid)
+    end
+
+    def process_grant_privileges(seqid, iprot, oprot)
+      args = read_args(iprot, Grant_privileges_args)
+      result = Grant_privileges_result.new()
+      begin
+        result.success = @handler.grant_privileges(args.privileges)
+      rescue MetaException => o1
+        result.o1 = o1
+      end
+      write_result(result, oprot, 'grant_privileges', seqid)
+    end
+
+    def process_revoke_privileges(seqid, iprot, oprot)
+      args = read_args(iprot, Revoke_privileges_args)
+      result = Revoke_privileges_result.new()
+      begin
+        result.success = @handler.revoke_privileges(args.privileges)
+      rescue MetaException => o1
+        result.o1 = o1
+      end
+      write_result(result, oprot, 'revoke_privileges', seqid)
+    end
+
   end
 
   # HELPER FUNCTIONS AND STRUCTURES
@@ -2115,16 +2448,20 @@ module ThriftHiveMetastore
     ::Thrift::Struct.generate_accessors self
   end
 
-  class Get_partition_by_name_args
+  class Get_partition_with_auth_args
     include ::Thrift::Struct, ::Thrift::Struct_Union
     DB_NAME = 1
     TBL_NAME = 2
-    PART_NAME = 3
+    PART_VALS = 3
+    USER_NAME = 4
+    GROUP_NAMES = 5
 
     FIELDS = {
       DB_NAME => {:type => ::Thrift::Types::STRING, :name => 'db_name'},
       TBL_NAME => {:type => ::Thrift::Types::STRING, :name => 'tbl_name'},
-      PART_NAME => {:type => ::Thrift::Types::STRING, :name => 'part_name'}
+      PART_VALS => {:type => ::Thrift::Types::LIST, :name => 'part_vals', :element => {:type => ::Thrift::Types::STRING}},
+      USER_NAME => {:type => ::Thrift::Types::STRING, :name => 'user_name'},
+      GROUP_NAMES => {:type => ::Thrift::Types::LIST, :name => 'group_names', :element => {:type => ::Thrift::Types::STRING}}
     }
 
     def struct_fields; FIELDS; end
@@ -2135,7 +2472,7 @@ module ThriftHiveMetastore
     ::Thrift::Struct.generate_accessors self
   end
 
-  class Get_partition_by_name_result
+  class Get_partition_with_auth_result
     include ::Thrift::Struct, ::Thrift::Struct_Union
     SUCCESS = 0
     O1 = 1
@@ -2155,16 +2492,16 @@ module ThriftHiveMetastore
     ::Thrift::Struct.generate_accessors self
   end
 
-  class Get_partitions_args
+  class Get_partition_by_name_args
     include ::Thrift::Struct, ::Thrift::Struct_Union
     DB_NAME = 1
     TBL_NAME = 2
-    MAX_PARTS = 3
+    PART_NAME = 3
 
     FIELDS = {
       DB_NAME => {:type => ::Thrift::Types::STRING, :name => 'db_name'},
       TBL_NAME => {:type => ::Thrift::Types::STRING, :name => 'tbl_name'},
-      MAX_PARTS => {:type => ::Thrift::Types::I16, :name => 'max_parts', :default => -1}
+      PART_NAME => {:type => ::Thrift::Types::STRING, :name => 'part_name'}
     }
 
     def struct_fields; FIELDS; end
@@ -2175,16 +2512,16 @@ module ThriftHiveMetastore
     ::Thrift::Struct.generate_accessors self
   end
 
-  class Get_partitions_result
+  class Get_partition_by_name_result
     include ::Thrift::Struct, ::Thrift::Struct_Union
     SUCCESS = 0
     O1 = 1
     O2 = 2
 
     FIELDS = {
-      SUCCESS => {:type => ::Thrift::Types::LIST, :name => 'success', :element => {:type => ::Thrift::Types::STRUCT, :class => Partition}},
-      O1 => {:type => ::Thrift::Types::STRUCT, :name => 'o1', :class => NoSuchObjectException},
-      O2 => {:type => ::Thrift::Types::STRUCT, :name => 'o2', :class => MetaException}
+      SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => Partition},
+      O1 => {:type => ::Thrift::Types::STRUCT, :name => 'o1', :class => MetaException},
+      O2 => {:type => ::Thrift::Types::STRUCT, :name => 'o2', :class => NoSuchObjectException}
     }
 
     def struct_fields; FIELDS; end
@@ -2195,7 +2532,7 @@ module ThriftHiveMetastore
     ::Thrift::Struct.generate_accessors self
   end
 
-  class Get_partition_names_args
+  class Get_partitions_args
     include ::Thrift::Struct, ::Thrift::Struct_Union
     DB_NAME = 1
     TBL_NAME = 2
@@ -2215,13 +2552,15 @@ module ThriftHiveMetastore
     ::Thrift::Struct.generate_accessors self
   end
 
-  class Get_partition_names_result
+  class Get_partitions_result
     include ::Thrift::Struct, ::Thrift::Struct_Union
     SUCCESS = 0
-    O2 = 1
+    O1 = 1
+    O2 = 2
 
     FIELDS = {
-      SUCCESS => {:type => ::Thrift::Types::LIST, :name => 'success', :element => {:type => ::Thrift::Types::STRING}},
+      SUCCESS => {:type => ::Thrift::Types::LIST, :name => 'success', :element => {:type => ::Thrift::Types::STRUCT, :class => Partition}},
+      O1 => {:type => ::Thrift::Types::STRUCT, :name => 'o1', :class => NoSuchObjectException},
       O2 => {:type => ::Thrift::Types::STRUCT, :name => 'o2', :class => MetaException}
     }
 
@@ -2233,18 +2572,20 @@ module ThriftHiveMetastore
     ::Thrift::Struct.generate_accessors self
   end
 
-  class Get_partitions_ps_args
+  class Get_partitions_with_auth_args
     include ::Thrift::Struct, ::Thrift::Struct_Union
     DB_NAME = 1
     TBL_NAME = 2
-    PART_VALS = 3
-    MAX_PARTS = 4
+    MAX_PARTS = 3
+    USER_NAME = 4
+    GROUP_NAMES = 5
 
     FIELDS = {
       DB_NAME => {:type => ::Thrift::Types::STRING, :name => 'db_name'},
       TBL_NAME => {:type => ::Thrift::Types::STRING, :name => 'tbl_name'},
-      PART_VALS => {:type => ::Thrift::Types::LIST, :name => 'part_vals', :element => {:type => ::Thrift::Types::STRING}},
-      MAX_PARTS => {:type => ::Thrift::Types::I16, :name => 'max_parts', :default => -1}
+      MAX_PARTS => {:type => ::Thrift::Types::I16, :name => 'max_parts', :default => -1},
+      USER_NAME => {:type => ::Thrift::Types::STRING, :name => 'user_name'},
+      GROUP_NAMES => {:type => ::Thrift::Types::LIST, :name => 'group_names', :element => {:type => ::Thrift::Types::STRING}}
     }
 
     def struct_fields; FIELDS; end
@@ -2255,14 +2596,16 @@ module ThriftHiveMetastore
     ::Thrift::Struct.generate_accessors self
   end
 
-  class Get_partitions_ps_result
+  class Get_partitions_with_auth_result
     include ::Thrift::Struct, ::Thrift::Struct_Union
     SUCCESS = 0
     O1 = 1
+    O2 = 2
 
     FIELDS = {
       SUCCESS => {:type => ::Thrift::Types::LIST, :name => 'success', :element => {:type => ::Thrift::Types::STRUCT, :class => Partition}},
-      O1 => {:type => ::Thrift::Types::STRUCT, :name => 'o1', :class => MetaException}
+      O1 => {:type => ::Thrift::Types::STRUCT, :name => 'o1', :class => NoSuchObjectException},
+      O2 => {:type => ::Thrift::Types::STRUCT, :name => 'o2', :class => MetaException}
     }
 
     def struct_fields; FIELDS; end
@@ -2273,17 +2616,15 @@ module ThriftHiveMetastore
     ::Thrift::Struct.generate_accessors self
   end
 
-  class Get_partition_names_ps_args
+  class Get_partition_names_args
     include ::Thrift::Struct, ::Thrift::Struct_Union
     DB_NAME = 1
     TBL_NAME = 2
-    PART_VALS = 3
-    MAX_PARTS = 4
+    MAX_PARTS = 3
 
     FIELDS = {
       DB_NAME => {:type => ::Thrift::Types::STRING, :name => 'db_name'},
       TBL_NAME => {:type => ::Thrift::Types::STRING, :name => 'tbl_name'},
-      PART_VALS => {:type => ::Thrift::Types::LIST, :name => 'part_vals', :element => {:type => ::Thrift::Types::STRING}},
       MAX_PARTS => {:type => ::Thrift::Types::I16, :name => 'max_parts', :default => -1}
     }
 
@@ -2295,14 +2636,14 @@ module ThriftHiveMetastore
     ::Thrift::Struct.generate_accessors self
   end
 
-  class Get_partition_names_ps_result
+  class Get_partition_names_result
     include ::Thrift::Struct, ::Thrift::Struct_Union
     SUCCESS = 0
-    O1 = 1
+    O2 = 1
 
     FIELDS = {
       SUCCESS => {:type => ::Thrift::Types::LIST, :name => 'success', :element => {:type => ::Thrift::Types::STRING}},
-      O1 => {:type => ::Thrift::Types::STRUCT, :name => 'o1', :class => MetaException}
+      O2 => {:type => ::Thrift::Types::STRUCT, :name => 'o2', :class => MetaException}
     }
 
     def struct_fields; FIELDS; end
@@ -2313,17 +2654,17 @@ module ThriftHiveMetastore
     ::Thrift::Struct.generate_accessors self
   end
 
-  class Get_partitions_by_filter_args
+  class Get_partitions_ps_args
     include ::Thrift::Struct, ::Thrift::Struct_Union
     DB_NAME = 1
     TBL_NAME = 2
-    FILTER = 3
+    PART_VALS = 3
     MAX_PARTS = 4
 
     FIELDS = {
       DB_NAME => {:type => ::Thrift::Types::STRING, :name => 'db_name'},
       TBL_NAME => {:type => ::Thrift::Types::STRING, :name => 'tbl_name'},
-      FILTER => {:type => ::Thrift::Types::STRING, :name => 'filter'},
+      PART_VALS => {:type => ::Thrift::Types::LIST, :name => 'part_vals', :element => {:type => ::Thrift::Types::STRING}},
       MAX_PARTS => {:type => ::Thrift::Types::I16, :name => 'max_parts', :default => -1}
     }
 
@@ -2335,16 +2676,14 @@ module ThriftHiveMetastore
     ::Thrift::Struct.generate_accessors self
   end
 
-  class Get_partitions_by_filter_result
+  class Get_partitions_ps_result
     include ::Thrift::Struct, ::Thrift::Struct_Union
     SUCCESS = 0
     O1 = 1
-    O2 = 2
 
     FIELDS = {
       SUCCESS => {:type => ::Thrift::Types::LIST, :name => 'success', :element => {:type => ::Thrift::Types::STRUCT, :class => Partition}},
-      O1 => {:type => ::Thrift::Types::STRUCT, :name => 'o1', :class => MetaException},
-      O2 => {:type => ::Thrift::Types::STRUCT, :name => 'o2', :class => NoSuchObjectException}
+      O1 => {:type => ::Thrift::Types::STRUCT, :name => 'o1', :class => MetaException}
     }
 
     def struct_fields; FIELDS; end
@@ -2355,16 +2694,22 @@ module ThriftHiveMetastore
     ::Thrift::Struct.generate_accessors self
   end
 
-  class Alter_partition_args
+  class Get_partitions_ps_with_auth_args
     include ::Thrift::Struct, ::Thrift::Struct_Union
     DB_NAME = 1
     TBL_NAME = 2
-    NEW_PART = 3
+    PART_VALS = 3
+    MAX_PARTS = 4
+    USER_NAME = 5
+    GROUP_NAMES = 6
 
     FIELDS = {
       DB_NAME => {:type => ::Thrift::Types::STRING, :name => 'db_name'},
       TBL_NAME => {:type => ::Thrift::Types::STRING, :name => 'tbl_name'},
-      NEW_PART => {:type => ::Thrift::Types::STRUCT, :name => 'new_part', :class => Partition}
+      PART_VALS => {:type => ::Thrift::Types::LIST, :name => 'part_vals', :element => {:type => ::Thrift::Types::STRING}},
+      MAX_PARTS => {:type => ::Thrift::Types::I16, :name => 'max_parts', :default => -1},
+      USER_NAME => {:type => ::Thrift::Types::STRING, :name => 'user_name'},
+      GROUP_NAMES => {:type => ::Thrift::Types::LIST, :name => 'group_names', :element => {:type => ::Thrift::Types::STRING}}
     }
 
     def struct_fields; FIELDS; end
@@ -2375,13 +2720,15 @@ module ThriftHiveMetastore
     ::Thrift::Struct.generate_accessors self
   end
 
-  class Alter_partition_result
+  class Get_partitions_ps_with_auth_result
     include ::Thrift::Struct, ::Thrift::Struct_Union
+    SUCCESS = 0
     O1 = 1
     O2 = 2
 
     FIELDS = {
-      O1 => {:type => ::Thrift::Types::STRUCT, :name => 'o1', :class => InvalidOperationException},
+      SUCCESS => {:type => ::Thrift::Types::LIST, :name => 'success', :element => {:type => ::Thrift::Types::STRUCT, :class => Partition}},
+      O1 => {:type => ::Thrift::Types::STRUCT, :name => 'o1', :class => NoSuchObjectException},
       O2 => {:type => ::Thrift::Types::STRUCT, :name => 'o2', :class => MetaException}
     }
 
@@ -2393,9 +2740,129 @@ module ThriftHiveMetastore
     ::Thrift::Struct.generate_accessors self
   end
 
-  class Get_config_value_args
+  class Get_partition_names_ps_args
     include ::Thrift::Struct, ::Thrift::Struct_Union
-    NAME = 1
+    DB_NAME = 1
+    TBL_NAME = 2
+    PART_VALS = 3
+    MAX_PARTS = 4
+
+    FIELDS = {
+      DB_NAME => {:type => ::Thrift::Types::STRING, :name => 'db_name'},
+      TBL_NAME => {:type => ::Thrift::Types::STRING, :name => 'tbl_name'},
+      PART_VALS => {:type => ::Thrift::Types::LIST, :name => 'part_vals', :element => {:type => ::Thrift::Types::STRING}},
+      MAX_PARTS => {:type => ::Thrift::Types::I16, :name => 'max_parts', :default => -1}
+    }
+
+    def struct_fields; FIELDS; end
+
+    def validate
+    end
+
+    ::Thrift::Struct.generate_accessors self
+  end
+
+  class Get_partition_names_ps_result
+    include ::Thrift::Struct, ::Thrift::Struct_Union
+    SUCCESS = 0
+    O1 = 1
+
+    FIELDS = {
+      SUCCESS => {:type => ::Thrift::Types::LIST, :name => 'success', :element => {:type => ::Thrift::Types::STRING}},
+      O1 => {:type => ::Thrift::Types::STRUCT, :name => 'o1', :class => MetaException}
+    }
+
+    def struct_fields; FIELDS; end
+
+    def validate
+    end
+
+    ::Thrift::Struct.generate_accessors self
+  end
+
+  class Get_partitions_by_filter_args
+    include ::Thrift::Struct, ::Thrift::Struct_Union
+    DB_NAME = 1
+    TBL_NAME = 2
+    FILTER = 3
+    MAX_PARTS = 4
+
+    FIELDS = {
+      DB_NAME => {:type => ::Thrift::Types::STRING, :name => 'db_name'},
+      TBL_NAME => {:type => ::Thrift::Types::STRING, :name => 'tbl_name'},
+      FILTER => {:type => ::Thrift::Types::STRING, :name => 'filter'},
+      MAX_PARTS => {:type => ::Thrift::Types::I16, :name => 'max_parts', :default => -1}
+    }
+
+    def struct_fields; FIELDS; end
+
+    def validate
+    end
+
+    ::Thrift::Struct.generate_accessors self
+  end
+
+  class Get_partitions_by_filter_result
+    include ::Thrift::Struct, ::Thrift::Struct_Union
+    SUCCESS = 0
+    O1 = 1
+    O2 = 2
+
+    FIELDS = {
+      SUCCESS => {:type => ::Thrift::Types::LIST, :name => 'success', :element => {:type => ::Thrift::Types::STRUCT, :class => Partition}},
+      O1 => {:type => ::Thrift::Types::STRUCT, :name => 'o1', :class => MetaException},
+      O2 => {:type => ::Thrift::Types::STRUCT, :name => 'o2', :class => NoSuchObjectException}
+    }
+
+    def struct_fields; FIELDS; end
+
+    def validate
+    end
+
+    ::Thrift::Struct.generate_accessors self
+  end
+
+  class Alter_partition_args
+    include ::Thrift::Struct, ::Thrift::Struct_Union
+    DB_NAME = 1
+    TBL_NAME = 2
+    NEW_PART = 3
+
+    FIELDS = {
+      DB_NAME => {:type => ::Thrift::Types::STRING, :name => 'db_name'},
+      TBL_NAME => {:type => ::Thrift::Types::STRING, :name => 'tbl_name'},
+      NEW_PART => {:type => ::Thrift::Types::STRUCT, :name => 'new_part', :class => Partition}
+    }
+
+    def struct_fields; FIELDS; end
+
+    def validate
+    end
+
+    ::Thrift::Struct.generate_accessors self
+  end
+
+  class Alter_partition_result
+    include ::Thrift::Struct, ::Thrift::Struct_Union
+    O1 = 1
+    O2 = 2
+
+    FIELDS = {
+      O1 => {:type => ::Thrift::Types::STRUCT, :name => 'o1', :class => InvalidOperationException},
+      O2 => {:type => ::Thrift::Types::STRUCT, :name => 'o2', :class => MetaException}
+    }
+
+    def struct_fields; FIELDS; end
+
+    def validate
+    end
+
+    ::Thrift::Struct.generate_accessors self
+  end
+
+  class Get_config_value_args
+    include ::Thrift::Struct, ::Thrift::Struct_Union
+    NAME = 1
     DEFAULTVALUE = 2
 
     FIELDS = {
@@ -2737,5 +3204,350 @@ module ThriftHiveMetastore
     ::Thrift::Struct.generate_accessors self
   end
 
+  class Create_role_args
+    include ::Thrift::Struct, ::Thrift::Struct_Union
+    ROLE = 1
+
+    FIELDS = {
+      ROLE => {:type => ::Thrift::Types::STRUCT, :name => 'role', :class => Role}
+    }
+
+    def struct_fields; FIELDS; end
+
+    def validate
+    end
+
+    ::Thrift::Struct.generate_accessors self
+  end
+
+  class Create_role_result
+    include ::Thrift::Struct, ::Thrift::Struct_Union
+    SUCCESS = 0
+    O1 = 1
+
+    FIELDS = {
+      SUCCESS => {:type => ::Thrift::Types::BOOL, :name => 'success'},
+      O1 => {:type => ::Thrift::Types::STRUCT, :name => 'o1', :class => MetaException}
+    }
+
+    def struct_fields; FIELDS; end
+
+    def validate
+    end
+
+    ::Thrift::Struct.generate_accessors self
+  end
+
+  class Drop_role_args
+    include ::Thrift::Struct, ::Thrift::Struct_Union
+    ROLE_NAME = 1
+
+    FIELDS = {
+      ROLE_NAME => {:type => ::Thrift::Types::STRING, :name => 'role_name'}
+    }
+
+    def struct_fields; FIELDS; end
+
+    def validate
+    end
+
+    ::Thrift::Struct.generate_accessors self
+  end
+
+  class Drop_role_result
+    include ::Thrift::Struct, ::Thrift::Struct_Union
+    SUCCESS = 0
+    O1 = 1
+
+    FIELDS = {
+      SUCCESS => {:type => ::Thrift::Types::BOOL, :name => 'success'},
+      O1 => {:type => ::Thrift::Types::STRUCT, :name => 'o1', :class => MetaException}
+    }
+
+    def struct_fields; FIELDS; end
+
+    def validate
+    end
+
+    ::Thrift::Struct.generate_accessors self
+  end
+
+  class Grant_role_args
+    include ::Thrift::Struct, ::Thrift::Struct_Union
+    ROLE_NAME = 1
+    PRINCIPAL_NAME = 2
+    PRINCIPAL_TYPE = 3
+    GRANTOR = 4
+    GRANTORTYPE = 5
+    GRANT_OPTION = 6
+
+    FIELDS = {
+      ROLE_NAME => {:type => ::Thrift::Types::STRING, :name => 'role_name'},
+      PRINCIPAL_NAME => {:type => ::Thrift::Types::STRING, :name => 'principal_name'},
+      PRINCIPAL_TYPE => {:type => ::Thrift::Types::I32, :name => 'principal_type', :enum_class => PrincipalType},
+      GRANTOR => {:type => ::Thrift::Types::STRING, :name => 'grantor'},
+      GRANTORTYPE => {:type => ::Thrift::Types::I32, :name => 'grantorType', :enum_class => PrincipalType},
+      GRANT_OPTION => {:type => ::Thrift::Types::BOOL, :name => 'grant_option'}
+    }
+
+    def struct_fields; FIELDS; end
+
+    def validate
+      unless @principal_type.nil? || PrincipalType::VALID_VALUES.include?(@principal_type)
+        raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field principal_type!')
+      end
+      unless @grantorType.nil? || PrincipalType::VALID_VALUES.include?(@grantorType)
+        raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field grantorType!')
+      end
+    end
+
+    ::Thrift::Struct.generate_accessors self
+  end
+
+  class Grant_role_result
+    include ::Thrift::Struct, ::Thrift::Struct_Union
+    SUCCESS = 0
+    O1 = 1
+
+    FIELDS = {
+      SUCCESS => {:type => ::Thrift::Types::BOOL, :name => 'success'},
+      O1 => {:type => ::Thrift::Types::STRUCT, :name => 'o1', :class => MetaException}
+    }
+
+    def struct_fields; FIELDS; end
+
+    def validate
+    end
+
+    ::Thrift::Struct.generate_accessors self
+  end
+
+  class Revoke_role_args
+    include ::Thrift::Struct, ::Thrift::Struct_Union
+    ROLE_NAME = 1
+    PRINCIPAL_NAME = 2
+    PRINCIPAL_TYPE = 3
+
+    FIELDS = {
+      ROLE_NAME => {:type => ::Thrift::Types::STRING, :name => 'role_name'},
+      PRINCIPAL_NAME => {:type => ::Thrift::Types::STRING, :name => 'principal_name'},
+      PRINCIPAL_TYPE => {:type => ::Thrift::Types::I32, :name => 'principal_type', :enum_class => PrincipalType}
+    }
+
+    def struct_fields; FIELDS; end
+
+    def validate
+      unless @principal_type.nil? || PrincipalType::VALID_VALUES.include?(@principal_type)
+        raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field principal_type!')
+      end
+    end
+
+    ::Thrift::Struct.generate_accessors self
+  end
+
+  class Revoke_role_result
+    include ::Thrift::Struct, ::Thrift::Struct_Union
+    SUCCESS = 0
+    O1 = 1
+
+    FIELDS = {
+      SUCCESS => {:type => ::Thrift::Types::BOOL, :name => 'success'},
+      O1 => {:type => ::Thrift::Types::STRUCT, :name => 'o1', :class => MetaException}
+    }
+
+    def struct_fields; FIELDS; end
+
+    def validate
+    end
+
+    ::Thrift::Struct.generate_accessors self
+  end
+
+  class List_roles_args
+    include ::Thrift::Struct, ::Thrift::Struct_Union
+    PRINCIPAL_NAME = 1
+    PRINCIPAL_TYPE = 2
+
+    FIELDS = {
+      PRINCIPAL_NAME => {:type => ::Thrift::Types::STRING, :name => 'principal_name'},
+      PRINCIPAL_TYPE => {:type => ::Thrift::Types::I32, :name => 'principal_type', :enum_class => PrincipalType}
+    }
+
+    def struct_fields; FIELDS; end
+
+    def validate
+      unless @principal_type.nil? || PrincipalType::VALID_VALUES.include?(@principal_type)
+        raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field principal_type!')
+      end
+    end
+
+    ::Thrift::Struct.generate_accessors self
+  end
+
+  class List_roles_result
+    include ::Thrift::Struct, ::Thrift::Struct_Union
+    SUCCESS = 0
+    O1 = 1
+
+    FIELDS = {
+      SUCCESS => {:type => ::Thrift::Types::LIST, :name => 'success', :element => {:type => ::Thrift::Types::STRUCT, :class => Role}},
+      O1 => {:type => ::Thrift::Types::STRUCT, :name => 'o1', :class => MetaException}
+    }
+
+    def struct_fields; FIELDS; end
+
+    def validate
+    end
+
+    ::Thrift::Struct.generate_accessors self
+  end
+
+  class Get_privilege_set_args
+    include ::Thrift::Struct, ::Thrift::Struct_Union
+    HIVEOBJECT = 1
+    USER_NAME = 2
+    GROUP_NAMES = 3
+
+    FIELDS = {
+      HIVEOBJECT => {:type => ::Thrift::Types::STRUCT, :name => 'hiveObject', :class => HiveObjectRef},
+      USER_NAME => {:type => ::Thrift::Types::STRING, :name => 'user_name'},
+      GROUP_NAMES => {:type => ::Thrift::Types::LIST, :name => 'group_names', :element => {:type => ::Thrift::Types::STRING}}
+    }
+
+    def struct_fields; FIELDS; end
+
+    def validate
+    end
+
+    ::Thrift::Struct.generate_accessors self
+  end
+
+  class Get_privilege_set_result
+    include ::Thrift::Struct, ::Thrift::Struct_Union
+    SUCCESS = 0
+    O1 = 1
+
+    FIELDS = {
+      SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => PrincipalPrivilegeSet},
+      O1 => {:type => ::Thrift::Types::STRUCT, :name => 'o1', :class => MetaException}
+    }
+
+    def struct_fields; FIELDS; end
+
+    def validate
+    end
+
+    ::Thrift::Struct.generate_accessors self
+  end
+
+  class List_privileges_args
+    include ::Thrift::Struct, ::Thrift::Struct_Union
+    PRINCIPAL_NAME = 1
+    PRINCIPAL_TYPE = 2
+    HIVEOBJECT = 3
+
+    FIELDS = {
+      PRINCIPAL_NAME => {:type => ::Thrift::Types::STRING, :name => 'principal_name'},
+      PRINCIPAL_TYPE => {:type => ::Thrift::Types::I32, :name => 'principal_type', :enum_class => PrincipalType},
+      HIVEOBJECT => {:type => ::Thrift::Types::STRUCT, :name => 'hiveObject', :class => HiveObjectRef}
+    }
+
+    def struct_fields; FIELDS; end
+
+    def validate
+      unless @principal_type.nil? || PrincipalType::VALID_VALUES.include?(@principal_type)
+        raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field principal_type!')
+      end
+    end
+
+    ::Thrift::Struct.generate_accessors self
+  end
+
+  class List_privileges_result
+    include ::Thrift::Struct, ::Thrift::Struct_Union
+    SUCCESS = 0
+    O1 = 1
+
+    FIELDS = {
+      SUCCESS => {:type => ::Thrift::Types::LIST, :name => 'success', :element => {:type => ::Thrift::Types::STRUCT, :class => HiveObjectPrivilege}},
+      O1 => {:type => ::Thrift::Types::STRUCT, :name => 'o1', :class => MetaException}
+    }
+
+    def struct_fields; FIELDS; end
+
+    def validate
+    end
+
+    ::Thrift::Struct.generate_accessors self
+  end
+
+  class Grant_privileges_args
+    include ::Thrift::Struct, ::Thrift::Struct_Union
+    PRIVILEGES = 1
+
+    FIELDS = {
+      PRIVILEGES => {:type => ::Thrift::Types::STRUCT, :name => 'privileges', :class => PrivilegeBag}
+    }
+
+    def struct_fields; FIELDS; end
+
+    def validate
+    end
+
+    ::Thrift::Struct.generate_accessors self
+  end
+
+  class Grant_privileges_result
+    include ::Thrift::Struct, ::Thrift::Struct_Union
+    SUCCESS = 0
+    O1 = 1
+
+    FIELDS = {
+      SUCCESS => {:type => ::Thrift::Types::BOOL, :name => 'success'},
+      O1 => {:type => ::Thrift::Types::STRUCT, :name => 'o1', :class => MetaException}
+    }
+
+    def struct_fields; FIELDS; end
+
+    def validate
+    end
+
+    ::Thrift::Struct.generate_accessors self
+  end
+
+  class Revoke_privileges_args
+    include ::Thrift::Struct, ::Thrift::Struct_Union
+    PRIVILEGES = 1
+
+    FIELDS = {
+      PRIVILEGES => {:type => ::Thrift::Types::STRUCT, :name => 'privileges', :class => PrivilegeBag}
+    }
+
+    def struct_fields; FIELDS; end
+
+    def validate
+    end
+
+    ::Thrift::Struct.generate_accessors self
+  end
+
+  class Revoke_privileges_result
+    include ::Thrift::Struct, ::Thrift::Struct_Union
+    SUCCESS = 0
+    O1 = 1
+
+    FIELDS = {
+      SUCCESS => {:type => ::Thrift::Types::BOOL, :name => 'success'},
+      O1 => {:type => ::Thrift::Types::STRUCT, :name => 'o1', :class => MetaException}
+    }
+
+    def struct_fields; FIELDS; end
+
+    def validate
+    end
+
+    ::Thrift::Struct.generate_accessors self
+  end
+
 end
 

Modified: hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
URL: http://svn.apache.org/viewvc/hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java?rev=1057999&r1=1057998&r2=1057999&view=diff
==============================================================================
--- hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java (original)
+++ hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java Wed Jan 12 06:58:04 2011
@@ -41,6 +41,9 @@ import org.apache.hadoop.hive.metastore.
 import org.apache.hadoop.hive.metastore.api.Constants;
 import org.apache.hadoop.hive.metastore.api.Database;
 import org.apache.hadoop.hive.metastore.api.FieldSchema;
+import org.apache.hadoop.hive.metastore.api.HiveObjectPrivilege;
+import org.apache.hadoop.hive.metastore.api.HiveObjectRef;
+import org.apache.hadoop.hive.metastore.api.HiveObjectType;
 import org.apache.hadoop.hive.metastore.api.Index;
 import org.apache.hadoop.hive.metastore.api.IndexAlreadyExistsException;
 import org.apache.hadoop.hive.metastore.api.InvalidObjectException;
@@ -48,12 +51,25 @@ import org.apache.hadoop.hive.metastore.
 import org.apache.hadoop.hive.metastore.api.MetaException;
 import org.apache.hadoop.hive.metastore.api.NoSuchObjectException;
 import org.apache.hadoop.hive.metastore.api.Partition;
+import org.apache.hadoop.hive.metastore.api.PrincipalPrivilegeSet;
+import org.apache.hadoop.hive.metastore.api.PrincipalType;
+import org.apache.hadoop.hive.metastore.api.PrivilegeBag;
+import org.apache.hadoop.hive.metastore.api.PrivilegeGrantInfo;
+import org.apache.hadoop.hive.metastore.api.Role;
 import org.apache.hadoop.hive.metastore.api.Table;
 import org.apache.hadoop.hive.metastore.api.ThriftHiveMetastore;
 import org.apache.hadoop.hive.metastore.api.Type;
 import org.apache.hadoop.hive.metastore.api.UnknownDBException;
 import org.apache.hadoop.hive.metastore.api.UnknownTableException;
 import org.apache.hadoop.hive.metastore.hooks.JDOConnectionURLHook;
+import org.apache.hadoop.hive.metastore.model.MDBPrivilege;
+import org.apache.hadoop.hive.metastore.model.MPartitionColumnPrivilege;
+import org.apache.hadoop.hive.metastore.model.MPartitionPrivilege;
+import org.apache.hadoop.hive.metastore.model.MRole;
+import org.apache.hadoop.hive.metastore.model.MGlobalPrivilege;
+import org.apache.hadoop.hive.metastore.model.MRoleMap;
+import org.apache.hadoop.hive.metastore.model.MTableColumnPrivilege;
+import org.apache.hadoop.hive.metastore.model.MTablePrivilege;
 import org.apache.hadoop.hive.serde2.Deserializer;
 import org.apache.hadoop.hive.serde2.SerDeException;
 import org.apache.hadoop.hive.serde2.SerDeUtils;
@@ -1338,6 +1354,35 @@ public class HiveMetaStore extends Thrif
       }
       return ret;
     }
+    
+    @Override
+    public Partition get_partition_with_auth(final String db_name,
+        final String tbl_name, final List<String> part_vals,
+        final String user_name, final List<String> group_names)
+        throws MetaException, NoSuchObjectException, TException {
+      incrementCounter("get_partition_with_auth");
+      logStartPartitionFunction("get_partition_with_auth", db_name, tbl_name,
+          part_vals);
+
+      Partition ret = null;
+      try {
+        ret = executeWithRetry(new Command<Partition>() {
+          @Override
+          Partition run(RawStore ms) throws Exception {
+            return ms.getPartitionWithAuth(db_name, tbl_name, part_vals,
+                user_name, group_names);
+          }
+        });
+      } catch (MetaException e) {
+        throw e;
+      } catch (NoSuchObjectException e) {
+        throw e;
+      } catch (Exception e) {
+        assert (e instanceof RuntimeException);
+        throw (RuntimeException) e;
+      }
+      return ret;
+    }
 
     public List<Partition> get_partitions(final String db_name, final String tbl_name,
         final short max_parts) throws NoSuchObjectException, MetaException {
@@ -1363,6 +1408,35 @@ public class HiveMetaStore extends Thrif
       return ret;
 
     }
+    
+    @Override
+    public List<Partition> get_partitions_with_auth(final String dbName,
+        final String tblName, final short maxParts, final String userName,
+        final List<String> groupNames) throws NoSuchObjectException,
+        MetaException, TException {
+      incrementCounter("get_partitions_with_auth");
+      logStartTableFunction("get_partitions_with_auth", dbName, tblName);
+
+      List<Partition> ret = null;
+      try {
+        ret = executeWithRetry(new Command<List<Partition>>() {
+          @Override
+          List<Partition> run(RawStore ms) throws Exception {
+            return ms.getPartitionsWithAuth(dbName, tblName, maxParts,
+                userName, groupNames);
+          }
+        });
+      } catch (MetaException e) {
+        throw e;
+      } catch (NoSuchObjectException e) {
+        throw e;
+      } catch (Exception e) {
+        assert (e instanceof RuntimeException);
+        throw (RuntimeException) e;
+      }
+      return ret;
+
+    }
 
     public List<String> get_partition_names(final String db_name, final String tbl_name,
         final short max_parts) throws MetaException {
@@ -1800,10 +1874,24 @@ public class HiveMetaStore extends Thrif
 
     @Override
     public List<Partition> get_partitions_ps(final String db_name,
-        final String tbl_name, final List<String> part_vals, final short max_parts)
-        throws MetaException, TException {
+        final String tbl_name, final List<String> part_vals,
+        final short max_parts) throws MetaException, TException {
+      incrementCounter("get_partitions_ps");
+      logStartPartitionFunction("get_partitions_ps", db_name, tbl_name,
+          part_vals);
+
+      return this.get_partitions_ps_with_auth(db_name, tbl_name, part_vals,
+          max_parts, null, null);
+    }
+    
+    @Override
+    public List<Partition> get_partitions_ps_with_auth(final String db_name,
+        final String tbl_name, final List<String> part_vals,
+        final short max_parts, final String userName,
+        final List<String> groupNames) throws MetaException, TException {
       incrementCounter("get_partitions_ps");
-      logStartPartitionFunction("get_partitions_ps", db_name, tbl_name, part_vals);
+      logStartPartitionFunction("get_partitions_ps", db_name, tbl_name,
+          part_vals);
       List<Partition> parts = null;
       List<Partition> matchingParts = new ArrayList<Partition>();
 
@@ -2157,8 +2245,575 @@ public class HiveMetaStore extends Thrif
       return ret;
     }
 
-  }
+    @Override
+    public PrincipalPrivilegeSet get_privilege_set(HiveObjectRef hiveObject,
+        String userName, List<String> groupNames) throws MetaException,
+        TException {
+      if (hiveObject.getObjectType() == HiveObjectType.COLUMN) {
+        String partName = getPartName(hiveObject);
+        return this.get_column_privilege_set(hiveObject.getDbName(), hiveObject
+            .getObjectName(), partName, hiveObject.getColumnName(), userName,
+            groupNames);
+      } else if (hiveObject.getObjectType() == HiveObjectType.PARTITION) {
+        String partName = getPartName(hiveObject);
+        return this.get_partition_privilege_set(hiveObject.getDbName(),
+            hiveObject.getObjectName(), partName, userName, groupNames);
+      } else if (hiveObject.getObjectType() == HiveObjectType.DATABASE) {
+        return this.get_db_privilege_set(hiveObject.getDbName(), userName,
+            groupNames);
+      } else if (hiveObject.getObjectType() == HiveObjectType.TABLE) {
+        return this.get_table_privilege_set(hiveObject.getDbName(), hiveObject
+            .getObjectName(), userName, groupNames);
+      }
+      return null;
+    }
+
+    private String getPartName(HiveObjectRef hiveObject) throws MetaException {
+      String partName = null;
+      List<String> partValue = hiveObject.getPartValues();
+      if (partValue != null && partValue.size() > 0) {
+        try {
+          Table table = get_table(hiveObject.getDbName(), hiveObject
+              .getObjectName());
+          partName = Warehouse
+              .makePartName(table.getPartitionKeys(), partValue);
+        } catch (NoSuchObjectException e) {
+          throw new MetaException(e.getMessage());
+        }
+      }
+      return partName;
+    }
+    
+    public PrincipalPrivilegeSet get_column_privilege_set(final String dbName,
+        final String tableName, final String partName, final String columnName,
+        final String userName, final List<String> groupNames) throws MetaException,
+        TException {
+      incrementCounter("get_column_privilege_set");
+
+      PrincipalPrivilegeSet ret = null;
+      try {
+        ret = executeWithRetry(new Command<PrincipalPrivilegeSet>() {
+          @Override
+          PrincipalPrivilegeSet run(RawStore ms) throws Exception {
+            return ms.getColumnPrivilegeSet(dbName, tableName, partName, columnName, userName, groupNames);
+          }
+        });
+      } catch (MetaException e) {
+        throw e;
+      } catch (Exception e) {
+        throw new RuntimeException(e);
+      }
+      return ret;
+    }
+
+    public PrincipalPrivilegeSet get_db_privilege_set(final String dbName,
+        final String userName, final List<String> groupNames) throws MetaException,
+        TException {
+      incrementCounter("get_db_privilege_set");
+
+      PrincipalPrivilegeSet ret = null;
+      try {
+        ret = executeWithRetry(new Command<PrincipalPrivilegeSet>() {
+          @Override
+          PrincipalPrivilegeSet run(RawStore ms) throws Exception {
+            return ms.getDBPrivilegeSet(dbName, userName, groupNames);
+          }
+        });
+      } catch (MetaException e) {
+        throw e;
+      } catch (Exception e) {
+        throw new RuntimeException(e);
+      }
+      return ret;
+    }
+
+    public PrincipalPrivilegeSet get_partition_privilege_set(
+        final String dbName, final String tableName, final String partName,
+        final String userName, final List<String> groupNames)
+        throws MetaException, TException {
+      incrementCounter("get_partition_privilege_set");
+
+      PrincipalPrivilegeSet ret = null;
+      try {
+        ret = executeWithRetry(new Command<PrincipalPrivilegeSet>() {
+          @Override
+          PrincipalPrivilegeSet run(RawStore ms) throws Exception {
+            return ms.getPartitionPrivilegeSet(dbName, tableName, partName,
+                userName, groupNames);
+          }
+        });
+      } catch (MetaException e) {
+        throw e;
+      } catch (Exception e) {
+        throw new RuntimeException(e);
+      }
+      return ret;
+    }
+
+    public PrincipalPrivilegeSet get_table_privilege_set(final String dbName,
+        final String tableName, final String userName,
+        final List<String> groupNames) throws MetaException, TException {
+      incrementCounter("get_table_privilege_set");
+
+      PrincipalPrivilegeSet ret = null;
+      try {
+        ret = executeWithRetry(new Command<PrincipalPrivilegeSet>() {
+          @Override
+          PrincipalPrivilegeSet run(RawStore ms) throws Exception {
+            return ms.getTablePrivilegeSet(dbName, tableName, userName,
+                groupNames);
+          }
+        });
+      } catch (MetaException e) {
+        throw e;
+      } catch (Exception e) {
+        throw new RuntimeException(e);
+      }
+      return ret;
+    }
+
+    @Override
+    public boolean grant_role(final String roleName,
+        final String userName, final PrincipalType principalType,
+        final String grantor, final PrincipalType grantorType, final boolean grantOption)
+        throws MetaException, TException {
+      incrementCounter("add_role_member");
+
+      Boolean ret = null;
+      try {
+        ret = executeWithRetry(new Command<Boolean>() {
+          @Override
+          Boolean run(RawStore ms) throws Exception {
+            Role role = ms.getRole(roleName);
+            return ms.grantRole(role, userName, principalType, grantor, grantorType, grantOption);
+          }
+        });
+      } catch (MetaException e) {
+        throw e;
+      } catch (Exception e) {
+        throw new RuntimeException(e);
+      }
+      return ret;
+    }
+    
+    public List<Role> list_roles(final String principalName,
+        final PrincipalType principalType) throws MetaException, TException {
+      incrementCounter("list_roles");
+
+      List<Role> ret = null;
+      try {
+        ret = executeWithRetry(new Command<List<Role>>() {
+          @Override
+          List<Role> run(RawStore ms) throws Exception {
+            List<Role> result = new ArrayList<Role>();
+            List<MRoleMap> roleMap = ms.listRoles(principalName,principalType);
+            if (roleMap!=null) {
+              for (MRoleMap role : roleMap) {
+                MRole r = role.getRole();
+                result.add(new Role(r.getRoleName(), r
+                    .getCreateTime(), r.getOwnerName()));
+              }
+            }
+            return result;
+          }
+        });
+      } catch (MetaException e) {
+        throw e;
+      } catch (Exception e) {
+        throw new RuntimeException(e);
+      }
+      return ret;
+    }
+
+    @Override
+    public boolean create_role(final Role role)
+        throws MetaException, TException {
+      incrementCounter("create_role");
+
+      Boolean ret = null;
+      try {
+        
+        ret = executeWithRetry(new Command<Boolean>() {
+          @Override
+          Boolean run(RawStore ms) throws Exception {
+            return ms.addRole(role.getRoleName(), role.getOwnerName());
+          }
+        });
+      } catch (MetaException e) {
+        throw e;
+      } catch (Exception e) {
+        throw new RuntimeException(e);
+      }
+      return ret;
+    }
+
+    @Override
+    public boolean drop_role(final String roleName)
+        throws MetaException, TException {
+      incrementCounter("drop_role");
+
+      Boolean ret = null;
+      try {
+        ret = executeWithRetry(new Command<Boolean>() {
+          @Override
+          Boolean run(RawStore ms) throws Exception {
+            return ms.removeRole(roleName);
+          }
+        });
+      } catch (MetaException e) {
+        throw e;
+      } catch (Exception e) {
+        throw new RuntimeException(e);
+      }
+      return ret;
+    }
+
+    @Override
+    public boolean grant_privileges(final PrivilegeBag privileges) throws MetaException,
+        TException {
+      incrementCounter("grant_privileges");
+
+      Boolean ret = null;
+      try {
+        ret = executeWithRetry(new Command<Boolean>() {
+          @Override
+          Boolean run(RawStore ms) throws Exception {
+            return ms.grantPrivileges(privileges);
+          }
+        });
+      } catch (MetaException e) {
+        e.printStackTrace();
+        throw e;
+      } catch (Exception e) {
+        throw new RuntimeException(e);
+      }
+      return ret;
+    }
+
+    @Override
+    public boolean revoke_role(final String roleName, final String userName,
+        final PrincipalType principalType) throws MetaException, TException {
+      incrementCounter("remove_role_member");
+
+      Boolean ret = null;
+      try {
+        ret = executeWithRetry(new Command<Boolean>() {
+          @Override
+          Boolean run(RawStore ms) throws Exception {
+            Role mRole = ms.getRole(roleName);
+            return ms.revokeRole(mRole, userName, principalType);
+          }
+        });
+      } catch (MetaException e) {
+        throw e;
+      } catch (Exception e) {
+        throw new RuntimeException(e);
+      }
+      return ret;
+    }
+
+    @Override
+    public boolean revoke_privileges(final PrivilegeBag privileges)
+        throws MetaException, TException {
+      incrementCounter("revoke_privileges");
+
+      Boolean ret = null;
+      try {
+        ret = executeWithRetry(new Command<Boolean>() {
+          @Override
+          Boolean run(RawStore ms) throws Exception {
+            return ms.revokePrivileges(privileges);
+          }
+        });
+      } catch (MetaException e) {
+        throw e;
+      } catch (Exception e) {
+        throw new RuntimeException(e);
+      }
+      return ret;
+    }
+
+    public PrincipalPrivilegeSet get_user_privilege_set(final String userName,
+        final List<String> groupNames) throws MetaException, TException {
+      incrementCounter("get_user_privilege_set");
+
+      PrincipalPrivilegeSet ret = null;
+      try {
+        ret = executeWithRetry(new Command<PrincipalPrivilegeSet>() {
+          @Override
+          PrincipalPrivilegeSet run(RawStore ms) throws Exception {
+            return ms.getUserPrivilegeSet(userName, groupNames);
+          }
+        });
+      } catch (MetaException e) {
+        throw e;
+      } catch (Exception e) {
+        throw new RuntimeException(e);
+      }
+      return ret;
+    }
+    
+    public PrincipalType getPrincipalType (String principalType) {
+      return PrincipalType.valueOf(principalType);
+    }
+    
+    @Override
+    public List<HiveObjectPrivilege> list_privileges(String principalName,
+        PrincipalType principalType, HiveObjectRef hiveObject)
+        throws MetaException, TException {
+      if (hiveObject.getObjectType() == HiveObjectType.GLOBAL) {
+        return this.list_global_privileges(principalName, principalType);
+      } else if (hiveObject.getObjectType() == HiveObjectType.DATABASE) {
+        return this.list_db_privileges(principalName, principalType, hiveObject
+            .getDbName());
+      } else if (hiveObject.getObjectType() == HiveObjectType.TABLE) {
+        return this.list_table_privileges(principalName, principalType,
+            hiveObject.getDbName(), hiveObject.getObjectName());
+      } else if (hiveObject.getObjectType() == HiveObjectType.PARTITION) {
+        return this.list_partition_privileges(principalName, principalType,
+            hiveObject.getDbName(), hiveObject.getObjectName(), hiveObject
+                .getPartValues());
+      } else if (hiveObject.getObjectType() == HiveObjectType.COLUMN) {
+        return this.list_column_privileges(principalName, principalType,
+            hiveObject.getDbName(), hiveObject.getObjectName(), hiveObject
+                .getPartValues(), hiveObject.getColumnName());
+      }
+      return null;
+    }
+
+    public List<HiveObjectPrivilege> list_column_privileges(
+        final String principalName, final PrincipalType principalType,
+        final String dbName, final String tableName, final List<String> partValues,
+        final String columnName) throws MetaException, TException {
+      incrementCounter("list_security_column_grant");
+
+      List<HiveObjectPrivilege> ret = null;
+      try {
+        ret = executeWithRetry(new Command<List<HiveObjectPrivilege>>() {
+          @Override
+          List<HiveObjectPrivilege> run(RawStore ms) throws Exception {
+            String partName = null;
+            if (partValues != null && partValues.size()>0) {
+              Table tbl = get_table(dbName, tableName);
+              partName = Warehouse.makePartName(tbl.getPartitionKeys(), partValues);
+            }
+            
+            List<HiveObjectPrivilege> result = null;
+            
+            if (partName != null) {
+              Partition part = null;
+              part = get_partition_by_name(dbName, tableName, partName);
+              List<MPartitionColumnPrivilege> mPartitionCols = ms.listPrincipalPartitionColumnGrants(principalName,
+                  principalType, dbName, tableName, partName, columnName);
+              if (mPartitionCols.size() > 0) {
+                result = new ArrayList<HiveObjectPrivilege>();
+                for (int i = 0; i < mPartitionCols.size(); i++) {
+                  MPartitionColumnPrivilege sCol = mPartitionCols.get(i);
+                  HiveObjectRef objectRef = new HiveObjectRef(
+                      HiveObjectType.COLUMN, dbName, tableName,
+                      part == null ? null : part.getValues(), sCol
+                          .getColumnName());
+                  HiveObjectPrivilege secObj = new HiveObjectPrivilege(objectRef,
+                      sCol.getPrincipalName(), principalType,
+                      new PrivilegeGrantInfo(sCol.getPrivilege(), sCol
+                          .getCreateTime(), sCol.getGrantor(), PrincipalType
+                          .valueOf(sCol.getGrantorType()), sCol.getGrantOption()));
+                  result.add(secObj);
+                }
+              }
+            } else {
+              List<MTableColumnPrivilege> mTableCols = ms
+                  .listPrincipalTableColumnGrants(principalName, principalType,
+                      dbName, tableName, columnName);
+              if (mTableCols.size() > 0) {
+                result = new ArrayList<HiveObjectPrivilege>();
+                for (int i = 0; i < mTableCols.size(); i++) {
+                  MTableColumnPrivilege sCol = mTableCols.get(i);
+                  HiveObjectRef objectRef = new HiveObjectRef(
+                      HiveObjectType.COLUMN, dbName, tableName, null, sCol
+                          .getColumnName());
+                  HiveObjectPrivilege secObj = new HiveObjectPrivilege(
+                      objectRef, sCol.getPrincipalName(), principalType,
+                      new PrivilegeGrantInfo(sCol.getPrivilege(), sCol
+                          .getCreateTime(), sCol.getGrantor(), PrincipalType
+                          .valueOf(sCol.getGrantorType()), sCol
+                          .getGrantOption()));
+                  result.add(secObj);
+                }
+              }
+            }
+             
+            return result;
+          }
+        });
+      } catch (MetaException e) {
+        throw e;
+      } catch (Exception e) {
+        throw new RuntimeException(e);
+      }
+      return ret;
+    }
+
+    public List<HiveObjectPrivilege> list_db_privileges(final String principalName,
+        final PrincipalType principalType, final String dbName)
+        throws MetaException, TException {
+      incrementCounter("list_security_db_grant");
+
+      List<HiveObjectPrivilege> ret = null;
+      try {
+        ret = executeWithRetry(new Command<List<HiveObjectPrivilege>>() {
+          @Override
+          List<HiveObjectPrivilege> run(RawStore ms) throws Exception {
+            List<MDBPrivilege> mDbs = ms.listPrincipalDBGrants(
+                principalName, principalType, dbName);
+            if (mDbs.size() > 0) {
+              List<HiveObjectPrivilege> result = new ArrayList<HiveObjectPrivilege>();
+              for (int i = 0; i < mDbs.size(); i++) {
+                MDBPrivilege sDB = mDbs.get(i);
+                HiveObjectRef objectRef = new HiveObjectRef(
+                    HiveObjectType.DATABASE, dbName, null, null, null);
+                HiveObjectPrivilege secObj = new HiveObjectPrivilege(objectRef,
+                    sDB.getPrincipalName(), principalType,
+                    new PrivilegeGrantInfo(sDB.getPrivilege(), sDB
+                        .getCreateTime(), sDB.getGrantor(), PrincipalType
+                        .valueOf(sDB.getGrantorType()), sDB.getGrantOption()));
+                result.add(secObj);
+              }
+              return result;
+            }
+            return null;
+          }
+        });
+      } catch (MetaException e) {
+        throw e;
+      } catch (Exception e) {
+        throw new RuntimeException(e);
+      }
+      return ret;
+    }
+
+    public List<HiveObjectPrivilege> list_partition_privileges(
+        final String principalName, final PrincipalType principalType,
+        final String dbName, final String tableName, final List<String> partValues)
+        throws MetaException, TException {
+      incrementCounter("list_security_partition_grant");
+
+      List<HiveObjectPrivilege> ret = null;
+      try {
+        ret = executeWithRetry(new Command<List<HiveObjectPrivilege>>() {
+          @Override
+          List<HiveObjectPrivilege> run(RawStore ms) throws Exception {
+            Table tbl = get_table(dbName, tableName);
+            String partName = Warehouse.makePartName(tbl.getPartitionKeys(), partValues);
+            List<MPartitionPrivilege> mParts = ms
+                .listPrincipalPartitionGrants(principalName, principalType, dbName, tableName, partName);
+            if (mParts.size() > 0) {
+              List<HiveObjectPrivilege> result = new ArrayList<HiveObjectPrivilege>();
+              for (int i = 0; i < mParts.size(); i++) {
+                MPartitionPrivilege sPart = mParts.get(i);
+                HiveObjectRef objectRef = new HiveObjectRef(
+                    HiveObjectType.PARTITION, dbName, tableName, partValues,
+                    null);
+                HiveObjectPrivilege secObj = new HiveObjectPrivilege(objectRef,
+                    sPart.getPrincipalName(), principalType,
+                    new PrivilegeGrantInfo(sPart.getPrivilege(), sPart
+                        .getCreateTime(), sPart.getGrantor(), PrincipalType
+                        .valueOf(sPart.getGrantorType()), sPart
+                        .getGrantOption()));
+
+                result.add(secObj);
+              }
+              return result;
+            }
+            return null;
+          }
+        });
+      } catch (MetaException e) {
+        throw e;
+      } catch (Exception e) {
+        throw new RuntimeException(e);
+      }
+      return ret;
+    }
+
+    public List<HiveObjectPrivilege> list_table_privileges(
+        final String principalName, final PrincipalType principalType,
+        final String dbName, final String tableName) throws MetaException,
+        TException {
+      incrementCounter("list_security_table_grant");
+
+      List<HiveObjectPrivilege> ret = null;
+      try {
+        ret = executeWithRetry(new Command<List<HiveObjectPrivilege>>() {
+          @Override
+          List<HiveObjectPrivilege> run(RawStore ms) throws Exception {
+            List<MTablePrivilege> mTbls = ms
+                .listAllTableGrants(principalName, principalType, dbName, tableName);
+            if (mTbls.size() > 0) {
+              List<HiveObjectPrivilege> result = new ArrayList<HiveObjectPrivilege>();
+              for (int i = 0; i < mTbls.size(); i++) {
+                MTablePrivilege sTbl = mTbls.get(i);
+                HiveObjectRef objectRef = new HiveObjectRef(
+                    HiveObjectType.TABLE, dbName, tableName, null,null);
+                HiveObjectPrivilege secObj = new HiveObjectPrivilege(objectRef,
+                    sTbl.getPrincipalName(), principalType,
+                    new PrivilegeGrantInfo(sTbl.getPrivilege(), sTbl.getCreateTime(), sTbl
+                        .getGrantor(), PrincipalType.valueOf(sTbl
+                        .getGrantorType()), sTbl.getGrantOption()));
+                result.add(secObj);
+              }
+              return result;
+            }
+            return null;
+          }
+        });
+      } catch (MetaException e) {
+        throw e;
+      } catch (Exception e) {
+        throw new RuntimeException(e);
+      }
+      return ret;
+    }
+
+    public List<HiveObjectPrivilege> list_global_privileges(
+        final String principalName, final PrincipalType principalType)
+        throws MetaException, TException {
+      incrementCounter("list_security_user_grant");
 
+      List<HiveObjectPrivilege> ret = null;
+      try {
+        ret = executeWithRetry(new Command<List<HiveObjectPrivilege>>() {
+          @Override
+          List<HiveObjectPrivilege> run(RawStore ms) throws Exception {
+            List<MGlobalPrivilege> mUsers = ms.listPrincipalGlobalGrants(
+                principalName, principalType);
+            if (mUsers.size() > 0) {
+              List<HiveObjectPrivilege> result = new ArrayList<HiveObjectPrivilege>();
+              for (int i = 0; i < mUsers.size(); i++) {
+                MGlobalPrivilege sUsr = mUsers.get(i);
+                HiveObjectRef objectRef = new HiveObjectRef(
+                    HiveObjectType.GLOBAL, null, null, null, null);
+                HiveObjectPrivilege secUser = new HiveObjectPrivilege(
+                    objectRef, sUsr.getPrincipalName(), principalType,
+                    new PrivilegeGrantInfo(sUsr.getPrivilege(), sUsr
+                        .getCreateTime(), sUsr.getGrantor(), PrincipalType
+                        .valueOf(sUsr.getGrantorType()), sUsr.getGrantOption()));
+                result.add(secUser);
+              }
+              return result;
+            }
+            return null;
+          }
+        });
+      } catch (MetaException e) {
+        throw e;
+      } catch (Exception e) {
+        throw new RuntimeException(e);
+      }
+      return ret;
+    }
+  }
+  
   /**
    * @param args
    */

Modified: hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java
URL: http://svn.apache.org/viewvc/hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java?rev=1057999&r1=1057998&r2=1057999&view=diff
==============================================================================
--- hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java (original)
+++ hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java Wed Jan 12 06:58:04 2011
@@ -40,12 +40,19 @@ import org.apache.hadoop.hive.metastore.
 import org.apache.hadoop.hive.metastore.api.ConfigValSecurityException;
 import org.apache.hadoop.hive.metastore.api.Database;
 import org.apache.hadoop.hive.metastore.api.FieldSchema;
+import org.apache.hadoop.hive.metastore.api.HiveObjectPrivilege;
+import org.apache.hadoop.hive.metastore.api.HiveObjectRef;
 import org.apache.hadoop.hive.metastore.api.Index;
 import org.apache.hadoop.hive.metastore.api.InvalidObjectException;
 import org.apache.hadoop.hive.metastore.api.InvalidOperationException;
 import org.apache.hadoop.hive.metastore.api.MetaException;
 import org.apache.hadoop.hive.metastore.api.NoSuchObjectException;
 import org.apache.hadoop.hive.metastore.api.Partition;
+import org.apache.hadoop.hive.metastore.api.PrincipalPrivilegeSet;
+import org.apache.hadoop.hive.metastore.api.PrincipalType;
+import org.apache.hadoop.hive.metastore.api.PrivilegeBag;
+import org.apache.hadoop.hive.metastore.api.PrivilegeGrantInfo;
+import org.apache.hadoop.hive.metastore.api.Role;
 import org.apache.hadoop.hive.metastore.api.Table;
 import org.apache.hadoop.hive.metastore.api.ThriftHiveMetastore;
 import org.apache.hadoop.hive.metastore.api.Type;
@@ -552,6 +559,23 @@ public class HiveMetaStoreClient impleme
     return deepCopyPartitions(
         client.get_partitions_ps(db_name, tbl_name, part_vals, max_parts));
   }
+  
+  @Override
+  public List<Partition> listPartitionsWithAuthInfo(String db_name,
+      String tbl_name, short max_parts, String user_name, List<String> group_names)
+       throws NoSuchObjectException, MetaException, TException {
+    return deepCopyPartitions(
+        client.get_partitions_with_auth(db_name, tbl_name, max_parts, user_name, group_names));
+  }
+
+  @Override
+  public List<Partition> listPartitionsWithAuthInfo(String db_name,
+      String tbl_name, List<String> part_vals, short max_parts,
+      String user_name, List<String> group_names) throws NoSuchObjectException,
+      MetaException, TException {
+    return deepCopyPartitions(client.get_partitions_ps_with_auth(db_name,
+        tbl_name, part_vals, max_parts, user_name, group_names));
+  }
 
   /**
    * Get list of partitions matching specified filter
@@ -601,6 +625,14 @@ public class HiveMetaStoreClient impleme
       List<String> part_vals) throws NoSuchObjectException, MetaException, TException {
     return deepCopy(client.get_partition(db_name, tbl_name, part_vals));
   }
+  
+  @Override
+  public Partition getPartitionWithAuthInfo(String db_name, String tbl_name,
+      List<String> part_vals, String user_name, List<String> group_names)
+      throws MetaException, UnknownTableException, NoSuchObjectException,
+      TException {
+    return deepCopy(client.get_partition_with_auth(db_name, tbl_name, part_vals, user_name, group_names));
+  }
 
   /**
    * @param name
@@ -932,6 +964,63 @@ public class HiveMetaStoreClient impleme
     return client.drop_index_by_name(dbName, tblName, name, deleteData);
   }
 
+  @Override
+  public boolean grant_role(String roleName, String userName,
+      PrincipalType principalType, String grantor, PrincipalType grantorType,
+      boolean grantOption) throws MetaException, TException {
+    return client.grant_role(roleName, userName, principalType, grantor,
+        grantorType, grantOption);
+  }
+
+  @Override
+  public boolean create_role(Role role)
+      throws MetaException, TException {
+    return client.create_role(role);
+  }
+
+  @Override
+  public boolean drop_role(String roleName) throws MetaException, TException {
+    return client.drop_role(roleName);
+  }
+  
+  @Override
+  public List<Role> list_roles(String principalName,
+      PrincipalType principalType) throws MetaException, TException {
+    return client.list_roles(principalName, principalType);
+  }
+
+  @Override
+  public boolean grant_privileges(PrivilegeBag privileges)
+      throws MetaException, TException {
+    return client.grant_privileges(privileges);
+  }
+
+  @Override
+  public boolean revoke_role(String roleName, String userName,
+      PrincipalType principalType) throws MetaException, TException {
+    return client.revoke_role(roleName, userName, principalType);
+  }
+
+  @Override
+  public boolean revoke_privileges(PrivilegeBag privileges) throws MetaException,
+      TException {
+    return client.revoke_privileges(privileges);
+  }
+
+  @Override
+  public PrincipalPrivilegeSet get_privilege_set(HiveObjectRef hiveObject,
+      String userName, List<String> groupNames) throws MetaException,
+      TException {
+    return client.get_privilege_set(hiveObject, userName, groupNames);
+  }
+
+  @Override
+  public List<HiveObjectPrivilege> list_privileges(String principalName,
+      PrincipalType principalType, HiveObjectRef hiveObject)
+      throws MetaException, TException {
+    return client.list_privileges(principalName, principalType, hiveObject);
+  }
+
   /**
    * Creates a synchronized wrapper for any {@link IMetaStoreClient}.
    * This may be used by multi-threaded applications until we have

Modified: hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java
URL: http://svn.apache.org/viewvc/hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java?rev=1057999&r1=1057998&r2=1057999&view=diff
==============================================================================
--- hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java (original)
+++ hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java Wed Jan 12 06:58:04 2011
@@ -25,12 +25,18 @@ import org.apache.hadoop.hive.metastore.
 import org.apache.hadoop.hive.metastore.api.ConfigValSecurityException;
 import org.apache.hadoop.hive.metastore.api.Database;
 import org.apache.hadoop.hive.metastore.api.FieldSchema;
+import org.apache.hadoop.hive.metastore.api.HiveObjectPrivilege;
+import org.apache.hadoop.hive.metastore.api.HiveObjectRef;
 import org.apache.hadoop.hive.metastore.api.Index;
 import org.apache.hadoop.hive.metastore.api.InvalidObjectException;
 import org.apache.hadoop.hive.metastore.api.InvalidOperationException;
 import org.apache.hadoop.hive.metastore.api.MetaException;
 import org.apache.hadoop.hive.metastore.api.NoSuchObjectException;
 import org.apache.hadoop.hive.metastore.api.Partition;
+import org.apache.hadoop.hive.metastore.api.PrincipalPrivilegeSet;
+import org.apache.hadoop.hive.metastore.api.PrincipalType;
+import org.apache.hadoop.hive.metastore.api.PrivilegeBag;
+import org.apache.hadoop.hive.metastore.api.Role;
 import org.apache.hadoop.hive.metastore.api.Table;
 import org.apache.hadoop.hive.metastore.api.UnknownDBException;
 import org.apache.hadoop.hive.metastore.api.UnknownTableException;
@@ -263,6 +269,23 @@ public interface IMetaStoreClient {
   public Partition getPartition(String dbName, String tblName,
       String name) throws MetaException, UnknownTableException, NoSuchObjectException, TException;
 
+  
+  /**
+   * @param dbName
+   * @param tableName
+   * @param pvals
+   * @param userName
+   * @param groupNames
+   * @return
+   * @throws MetaException
+   * @throws UnknownTableException
+   * @throws NoSuchObjectException
+   * @throws TException
+   */
+  public Partition getPartitionWithAuthInfo(String dbName, String tableName,
+      List<String> pvals, String userName, List<String> groupNames)
+      throws MetaException, UnknownTableException, NoSuchObjectException, TException;
+  
   /**
    * @param tbl_name
    * @param db_name
@@ -285,6 +308,33 @@ public interface IMetaStoreClient {
       List<String> part_vals, short max_parts) throws MetaException, TException;
 
   /**
+   * @param dbName
+   * @param tableName
+   * @param s
+   * @param userName
+   * @param groupNames
+   * @return
+   * @throws NoSuchObjectException 
+   */
+  public List<Partition> listPartitionsWithAuthInfo(String dbName,
+      String tableName, short s, String userName, List<String> groupNames)
+      throws MetaException, TException, NoSuchObjectException;
+
+  /**
+   * @param dbName
+   * @param tableName
+   * @param partialPvals
+   * @param s
+   * @param userName
+   * @param groupNames
+   * @return
+   * @throws NoSuchObjectException 
+   */
+  public List<Partition> listPartitionsWithAuthInfo(String dbName,
+      String tableName, List<String> partialPvals, short s, String userName,
+      List<String> groupNames) throws MetaException, TException, NoSuchObjectException;
+
+  /**
    * @param tbl
    * @throws AlreadyExistsException
    * @throws InvalidObjectException
@@ -481,4 +531,110 @@ public interface IMetaStoreClient {
   public boolean dropIndex(String db_name, String tbl_name,
       String name, boolean deleteData) throws NoSuchObjectException,
       MetaException, TException;
+  
+  /**
+   * @param Role
+   *          role object
+   * @return
+   * @throws MetaException
+   * @throws TException
+   */
+  public boolean create_role(Role role)
+      throws MetaException, TException;
+
+  /**
+   * @param role_name
+   *          role name
+   * @param db_name 
+   * 
+   * @return
+   * @throws MetaException
+   * @throws TException
+   */
+  public boolean drop_role(String role_name) throws MetaException, TException;
+
+  /**
+   * 
+   * @param role_name
+   * @param user_name
+   * @param principalType
+   * @param grantor
+   * @param grantorType
+   * @param grantOption
+   * @return
+   * @throws MetaException
+   * @throws TException
+   */
+  public boolean grant_role(String role_name, String user_name,
+      PrincipalType principalType, String grantor, PrincipalType grantorType,
+      boolean grantOption) throws MetaException, TException;
+
+  /**
+   * @param role_name
+   *          role name
+   * @param user_name
+   *          user name
+   * @param principalType
+   * @param db_name
+   * 
+   * @return
+   * @throws MetaException
+   * @throws TException
+   */
+  public boolean revoke_role(String role_name, String user_name,
+      PrincipalType principalType) throws MetaException, TException;
+
+  /**
+   * 
+   * @param principalName
+   * @param principalType
+   * @return
+   * @throws MetaException
+   * @throws TException
+   */
+  public List<Role> list_roles(String principalName, PrincipalType principalType)
+      throws MetaException, TException;
+
+  /**
+   * @param hiveObject
+   * @param user_name
+   * @param group_names
+   * @return
+   * @throws MetaException
+   * @throws TException
+   */
+  public PrincipalPrivilegeSet get_privilege_set(HiveObjectRef hiveObject,
+      String user_name, List<String> group_names) throws MetaException,
+      TException;
+  
+  /**
+   * @param principal_name
+   * @param principal_type
+   * @param hiveObject
+   * @return
+   * @throws MetaException
+   * @throws TException
+   */
+  public List<HiveObjectPrivilege> list_privileges(String principal_name,
+      PrincipalType principal_type, HiveObjectRef hiveObject)
+      throws MetaException, TException;
+
+  /**
+   * @param privileges
+   * @return
+   * @throws MetaException
+   * @throws TException
+   */
+  public boolean grant_privileges(PrivilegeBag privileges)
+      throws MetaException, TException;
+
+  /**
+   * @param privileges
+   * @return
+   * @throws MetaException
+   * @throws TException
+   */
+  public boolean revoke_privileges(PrivilegeBag privileges)
+      throws MetaException, TException;
+
 }