You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sentry.apache.org by pr...@apache.org on 2014/05/08 01:07:19 UTC

[1/3] Add Sentry service APIs to query roles and privileges (Sravya Tirukkovalur via Prasad Mujumdar)

Repository: incubator-sentry
Updated Branches:
  refs/heads/master 8f1ef00be -> 0fea11ab3


http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0fea11ab/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryRole.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryRole.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryRole.java
index dbddcad..0e004f6 100644
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryRole.java
+++ b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryRole.java
@@ -35,7 +35,7 @@ public class TSentryRole implements org.apache.thrift.TBase<TSentryRole, TSentry
   private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TSentryRole");
 
   private static final org.apache.thrift.protocol.TField ROLE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("roleName", org.apache.thrift.protocol.TType.STRING, (short)1);
-  private static final org.apache.thrift.protocol.TField PRIVILEGES_FIELD_DESC = new org.apache.thrift.protocol.TField("privileges", org.apache.thrift.protocol.TType.SET, (short)2);
+  private static final org.apache.thrift.protocol.TField GROUPS_FIELD_DESC = new org.apache.thrift.protocol.TField("groups", org.apache.thrift.protocol.TType.SET, (short)2);
   private static final org.apache.thrift.protocol.TField GRANTOR_PRINCIPAL_FIELD_DESC = new org.apache.thrift.protocol.TField("grantorPrincipal", org.apache.thrift.protocol.TType.STRING, (short)3);
 
   private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
@@ -45,13 +45,13 @@ public class TSentryRole implements org.apache.thrift.TBase<TSentryRole, TSentry
   }
 
   private String roleName; // required
-  private Set<TSentryPrivilege> privileges; // required
+  private Set<TSentryGroup> groups; // required
   private String grantorPrincipal; // required
 
   /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
   public enum _Fields implements org.apache.thrift.TFieldIdEnum {
     ROLE_NAME((short)1, "roleName"),
-    PRIVILEGES((short)2, "privileges"),
+    GROUPS((short)2, "groups"),
     GRANTOR_PRINCIPAL((short)3, "grantorPrincipal");
 
     private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
@@ -69,8 +69,8 @@ public class TSentryRole implements org.apache.thrift.TBase<TSentryRole, TSentry
       switch(fieldId) {
         case 1: // ROLE_NAME
           return ROLE_NAME;
-        case 2: // PRIVILEGES
-          return PRIVILEGES;
+        case 2: // GROUPS
+          return GROUPS;
         case 3: // GRANTOR_PRINCIPAL
           return GRANTOR_PRINCIPAL;
         default:
@@ -118,9 +118,9 @@ public class TSentryRole implements org.apache.thrift.TBase<TSentryRole, TSentry
     Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
     tmpMap.put(_Fields.ROLE_NAME, new org.apache.thrift.meta_data.FieldMetaData("roleName", org.apache.thrift.TFieldRequirementType.REQUIRED, 
         new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
-    tmpMap.put(_Fields.PRIVILEGES, new org.apache.thrift.meta_data.FieldMetaData("privileges", org.apache.thrift.TFieldRequirementType.REQUIRED, 
+    tmpMap.put(_Fields.GROUPS, new org.apache.thrift.meta_data.FieldMetaData("groups", org.apache.thrift.TFieldRequirementType.REQUIRED, 
         new org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET, 
-            new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TSentryPrivilege.class))));
+            new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TSentryGroup.class))));
     tmpMap.put(_Fields.GRANTOR_PRINCIPAL, new org.apache.thrift.meta_data.FieldMetaData("grantorPrincipal", org.apache.thrift.TFieldRequirementType.REQUIRED, 
         new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
     metaDataMap = Collections.unmodifiableMap(tmpMap);
@@ -132,12 +132,12 @@ public class TSentryRole implements org.apache.thrift.TBase<TSentryRole, TSentry
 
   public TSentryRole(
     String roleName,
-    Set<TSentryPrivilege> privileges,
+    Set<TSentryGroup> groups,
     String grantorPrincipal)
   {
     this();
     this.roleName = roleName;
-    this.privileges = privileges;
+    this.groups = groups;
     this.grantorPrincipal = grantorPrincipal;
   }
 
@@ -148,12 +148,12 @@ public class TSentryRole implements org.apache.thrift.TBase<TSentryRole, TSentry
     if (other.isSetRoleName()) {
       this.roleName = other.roleName;
     }
-    if (other.isSetPrivileges()) {
-      Set<TSentryPrivilege> __this__privileges = new HashSet<TSentryPrivilege>();
-      for (TSentryPrivilege other_element : other.privileges) {
-        __this__privileges.add(new TSentryPrivilege(other_element));
+    if (other.isSetGroups()) {
+      Set<TSentryGroup> __this__groups = new HashSet<TSentryGroup>();
+      for (TSentryGroup other_element : other.groups) {
+        __this__groups.add(new TSentryGroup(other_element));
       }
-      this.privileges = __this__privileges;
+      this.groups = __this__groups;
     }
     if (other.isSetGrantorPrincipal()) {
       this.grantorPrincipal = other.grantorPrincipal;
@@ -167,7 +167,7 @@ public class TSentryRole implements org.apache.thrift.TBase<TSentryRole, TSentry
   @Override
   public void clear() {
     this.roleName = null;
-    this.privileges = null;
+    this.groups = null;
     this.grantorPrincipal = null;
   }
 
@@ -194,41 +194,41 @@ public class TSentryRole implements org.apache.thrift.TBase<TSentryRole, TSentry
     }
   }
 
-  public int getPrivilegesSize() {
-    return (this.privileges == null) ? 0 : this.privileges.size();
+  public int getGroupsSize() {
+    return (this.groups == null) ? 0 : this.groups.size();
   }
 
-  public java.util.Iterator<TSentryPrivilege> getPrivilegesIterator() {
-    return (this.privileges == null) ? null : this.privileges.iterator();
+  public java.util.Iterator<TSentryGroup> getGroupsIterator() {
+    return (this.groups == null) ? null : this.groups.iterator();
   }
 
-  public void addToPrivileges(TSentryPrivilege elem) {
-    if (this.privileges == null) {
-      this.privileges = new HashSet<TSentryPrivilege>();
+  public void addToGroups(TSentryGroup elem) {
+    if (this.groups == null) {
+      this.groups = new HashSet<TSentryGroup>();
     }
-    this.privileges.add(elem);
+    this.groups.add(elem);
   }
 
-  public Set<TSentryPrivilege> getPrivileges() {
-    return this.privileges;
+  public Set<TSentryGroup> getGroups() {
+    return this.groups;
   }
 
-  public void setPrivileges(Set<TSentryPrivilege> privileges) {
-    this.privileges = privileges;
+  public void setGroups(Set<TSentryGroup> groups) {
+    this.groups = groups;
   }
 
-  public void unsetPrivileges() {
-    this.privileges = null;
+  public void unsetGroups() {
+    this.groups = null;
   }
 
-  /** Returns true if field privileges is set (has been assigned a value) and false otherwise */
-  public boolean isSetPrivileges() {
-    return this.privileges != null;
+  /** Returns true if field groups is set (has been assigned a value) and false otherwise */
+  public boolean isSetGroups() {
+    return this.groups != null;
   }
 
-  public void setPrivilegesIsSet(boolean value) {
+  public void setGroupsIsSet(boolean value) {
     if (!value) {
-      this.privileges = null;
+      this.groups = null;
     }
   }
 
@@ -265,11 +265,11 @@ public class TSentryRole implements org.apache.thrift.TBase<TSentryRole, TSentry
       }
       break;
 
-    case PRIVILEGES:
+    case GROUPS:
       if (value == null) {
-        unsetPrivileges();
+        unsetGroups();
       } else {
-        setPrivileges((Set<TSentryPrivilege>)value);
+        setGroups((Set<TSentryGroup>)value);
       }
       break;
 
@@ -289,8 +289,8 @@ public class TSentryRole implements org.apache.thrift.TBase<TSentryRole, TSentry
     case ROLE_NAME:
       return getRoleName();
 
-    case PRIVILEGES:
-      return getPrivileges();
+    case GROUPS:
+      return getGroups();
 
     case GRANTOR_PRINCIPAL:
       return getGrantorPrincipal();
@@ -308,8 +308,8 @@ public class TSentryRole implements org.apache.thrift.TBase<TSentryRole, TSentry
     switch (field) {
     case ROLE_NAME:
       return isSetRoleName();
-    case PRIVILEGES:
-      return isSetPrivileges();
+    case GROUPS:
+      return isSetGroups();
     case GRANTOR_PRINCIPAL:
       return isSetGrantorPrincipal();
     }
@@ -338,12 +338,12 @@ public class TSentryRole implements org.apache.thrift.TBase<TSentryRole, TSentry
         return false;
     }
 
-    boolean this_present_privileges = true && this.isSetPrivileges();
-    boolean that_present_privileges = true && that.isSetPrivileges();
-    if (this_present_privileges || that_present_privileges) {
-      if (!(this_present_privileges && that_present_privileges))
+    boolean this_present_groups = true && this.isSetGroups();
+    boolean that_present_groups = true && that.isSetGroups();
+    if (this_present_groups || that_present_groups) {
+      if (!(this_present_groups && that_present_groups))
         return false;
-      if (!this.privileges.equals(that.privileges))
+      if (!this.groups.equals(that.groups))
         return false;
     }
 
@@ -368,10 +368,10 @@ public class TSentryRole implements org.apache.thrift.TBase<TSentryRole, TSentry
     if (present_roleName)
       builder.append(roleName);
 
-    boolean present_privileges = true && (isSetPrivileges());
-    builder.append(present_privileges);
-    if (present_privileges)
-      builder.append(privileges);
+    boolean present_groups = true && (isSetGroups());
+    builder.append(present_groups);
+    if (present_groups)
+      builder.append(groups);
 
     boolean present_grantorPrincipal = true && (isSetGrantorPrincipal());
     builder.append(present_grantorPrincipal);
@@ -399,12 +399,12 @@ public class TSentryRole implements org.apache.thrift.TBase<TSentryRole, TSentry
         return lastComparison;
       }
     }
-    lastComparison = Boolean.valueOf(isSetPrivileges()).compareTo(typedOther.isSetPrivileges());
+    lastComparison = Boolean.valueOf(isSetGroups()).compareTo(typedOther.isSetGroups());
     if (lastComparison != 0) {
       return lastComparison;
     }
-    if (isSetPrivileges()) {
-      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.privileges, typedOther.privileges);
+    if (isSetGroups()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.groups, typedOther.groups);
       if (lastComparison != 0) {
         return lastComparison;
       }
@@ -447,11 +447,11 @@ public class TSentryRole implements org.apache.thrift.TBase<TSentryRole, TSentry
     }
     first = false;
     if (!first) sb.append(", ");
-    sb.append("privileges:");
-    if (this.privileges == null) {
+    sb.append("groups:");
+    if (this.groups == null) {
       sb.append("null");
     } else {
-      sb.append(this.privileges);
+      sb.append(this.groups);
     }
     first = false;
     if (!first) sb.append(", ");
@@ -472,8 +472,8 @@ public class TSentryRole implements org.apache.thrift.TBase<TSentryRole, TSentry
       throw new org.apache.thrift.protocol.TProtocolException("Required field 'roleName' is unset! Struct:" + toString());
     }
 
-    if (!isSetPrivileges()) {
-      throw new org.apache.thrift.protocol.TProtocolException("Required field 'privileges' is unset! Struct:" + toString());
+    if (!isSetGroups()) {
+      throw new org.apache.thrift.protocol.TProtocolException("Required field 'groups' is unset! Struct:" + toString());
     }
 
     if (!isSetGrantorPrincipal()) {
@@ -525,21 +525,21 @@ public class TSentryRole implements org.apache.thrift.TBase<TSentryRole, TSentry
               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
             }
             break;
-          case 2: // PRIVILEGES
+          case 2: // GROUPS
             if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
               {
-                org.apache.thrift.protocol.TSet _set16 = iprot.readSetBegin();
-                struct.privileges = new HashSet<TSentryPrivilege>(2*_set16.size);
-                for (int _i17 = 0; _i17 < _set16.size; ++_i17)
+                org.apache.thrift.protocol.TSet _set72 = iprot.readSetBegin();
+                struct.groups = new HashSet<TSentryGroup>(2*_set72.size);
+                for (int _i73 = 0; _i73 < _set72.size; ++_i73)
                 {
-                  TSentryPrivilege _elem18; // required
-                  _elem18 = new TSentryPrivilege();
-                  _elem18.read(iprot);
-                  struct.privileges.add(_elem18);
+                  TSentryGroup _elem74; // required
+                  _elem74 = new TSentryGroup();
+                  _elem74.read(iprot);
+                  struct.groups.add(_elem74);
                 }
                 iprot.readSetEnd();
               }
-              struct.setPrivilegesIsSet(true);
+              struct.setGroupsIsSet(true);
             } else { 
               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
             }
@@ -570,13 +570,13 @@ public class TSentryRole implements org.apache.thrift.TBase<TSentryRole, TSentry
         oprot.writeString(struct.roleName);
         oprot.writeFieldEnd();
       }
-      if (struct.privileges != null) {
-        oprot.writeFieldBegin(PRIVILEGES_FIELD_DESC);
+      if (struct.groups != null) {
+        oprot.writeFieldBegin(GROUPS_FIELD_DESC);
         {
-          oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, struct.privileges.size()));
-          for (TSentryPrivilege _iter19 : struct.privileges)
+          oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, struct.groups.size()));
+          for (TSentryGroup _iter75 : struct.groups)
           {
-            _iter19.write(oprot);
+            _iter75.write(oprot);
           }
           oprot.writeSetEnd();
         }
@@ -606,10 +606,10 @@ public class TSentryRole implements org.apache.thrift.TBase<TSentryRole, TSentry
       TTupleProtocol oprot = (TTupleProtocol) prot;
       oprot.writeString(struct.roleName);
       {
-        oprot.writeI32(struct.privileges.size());
-        for (TSentryPrivilege _iter20 : struct.privileges)
+        oprot.writeI32(struct.groups.size());
+        for (TSentryGroup _iter76 : struct.groups)
         {
-          _iter20.write(oprot);
+          _iter76.write(oprot);
         }
       }
       oprot.writeString(struct.grantorPrincipal);
@@ -621,17 +621,17 @@ public class TSentryRole implements org.apache.thrift.TBase<TSentryRole, TSentry
       struct.roleName = iprot.readString();
       struct.setRoleNameIsSet(true);
       {
-        org.apache.thrift.protocol.TSet _set21 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
-        struct.privileges = new HashSet<TSentryPrivilege>(2*_set21.size);
-        for (int _i22 = 0; _i22 < _set21.size; ++_i22)
+        org.apache.thrift.protocol.TSet _set77 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
+        struct.groups = new HashSet<TSentryGroup>(2*_set77.size);
+        for (int _i78 = 0; _i78 < _set77.size; ++_i78)
         {
-          TSentryPrivilege _elem23; // required
-          _elem23 = new TSentryPrivilege();
-          _elem23.read(iprot);
-          struct.privileges.add(_elem23);
+          TSentryGroup _elem79; // required
+          _elem79 = new TSentryGroup();
+          _elem79.read(iprot);
+          struct.groups.add(_elem79);
         }
       }
-      struct.setPrivilegesIsSet(true);
+      struct.setGroupsIsSet(true);
       struct.grantorPrincipal = iprot.readString();
       struct.setGrantorPrincipalIsSet(true);
     }

http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0fea11ab/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/SimpleDBProviderBackend.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/SimpleDBProviderBackend.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/SimpleDBProviderBackend.java
index dd4a977..13af593 100644
--- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/SimpleDBProviderBackend.java
+++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/SimpleDBProviderBackend.java
@@ -77,7 +77,7 @@ public class SimpleDBProviderBackend implements ProviderBackend {
       throw new IllegalStateException("Backend has not been properly initialized");
     }
     try {
-      return ImmutableSet.copyOf(policyServiceClient.listPrivileges(groups, roleSet));
+      return ImmutableSet.copyOf(policyServiceClient.listPrivilegesForProvider(groups, roleSet));
     } catch (SentryUserException e) {
       String msg = "Unable to obtain privileges from server: " + e.getMessage();
       LOGGER.error(msg, e);

http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0fea11ab/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/model/MSentryRole.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/model/MSentryRole.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/model/MSentryRole.java
index 1dfc0cf..e375a4c 100644
--- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/model/MSentryRole.java
+++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/model/MSentryRole.java
@@ -18,14 +18,13 @@
 
 package org.apache.sentry.provider.db.service.model;
 
-import java.util.HashSet;
-import java.util.Set;
-
-import javax.jdo.annotations.PersistenceCapable;
-
 import com.google.common.base.Preconditions;
 import com.google.common.collect.ImmutableSet;
 
+import javax.jdo.annotations.PersistenceCapable;
+import java.util.HashSet;
+import java.util.Set;
+
 /**
  * Database backed Sentry Role. Any changes to this object
  * require re-running the maven build so DN an re-enhance.
@@ -41,17 +40,12 @@ public class MSentryRole {
   private long createTime;
   private String grantorPrincipal;
 
-  public MSentryRole() {
-    privileges = new HashSet<MSentryPrivilege>();
-  }
-
-  MSentryRole(String roleName, long createTime, String grantorPrincipal,
-      Set<MSentryPrivilege> privileges, Set<MSentryGroup> groups) {
+  public MSentryRole(String roleName, long createTime, String grantorPrincipal) {
     this.roleName = roleName;
     this.createTime = createTime;
     this.grantorPrincipal = grantorPrincipal;
-    this.privileges = privileges;
-    this.groups = groups;
+    privileges = new HashSet<MSentryPrivilege>();
+    groups = new HashSet<MSentryGroup>();
   }
 
   public long getCreateTime() {
@@ -166,4 +160,4 @@ public class MSentryRole {
       return false;
     return true;
   }
-}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0fea11ab/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryStore.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryStore.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryStore.java
index 33c8d1a..7301a1a 100644
--- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryStore.java
+++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryStore.java
@@ -169,21 +169,42 @@ public class SentryStore {
       }
     }
   }
+  /**
+  Get the MSentry object from roleName
+  Note: Should be called inside a transaction
+   */
+  private MSentryRole getMSentryRole(PersistenceManager pm, String roleName) {
+    Query query = pm.newQuery(MSentryRole.class);
+    query.setFilter("this.roleName == t");
+    query.declareParameters("java.lang.String t");
+    query.setUnique(true);
+    MSentryRole sentryRole = (MSentryRole) query.execute(roleName);
+    return sentryRole;
+  }
 
+  /**
+   * Normalize the string values
+   */
+  private String trimAndLower(String input) {
+    return input.trim().toLowerCase();
+  }
+  /**
+   * Create a sentry role and persist it.
+   * @param roleName: Name of the role being persisted
+   * @param grantorPrincipal: TODO: Currently not used
+   * @returns commit context used for notification handlers
+   * @throws SentryAlreadyExistsException
+   */
   public CommitContext createSentryRole(String roleName, String grantorPrincipal)
   throws SentryAlreadyExistsException {
+    roleName = trimAndLower(roleName);
     boolean rollbackTransaction = true;
     PersistenceManager pm = null;
-    roleName = roleName.trim().toLowerCase();
     try {
       pm = openTransaction();
-      Query query = pm.newQuery(MSentryRole.class);
-      query.setFilter("this.roleName == t");
-      query.declareParameters("java.lang.String t");
-      query.setUnique(true);
-      MSentryRole sentryRole = (MSentryRole) query.execute(roleName);
-      if (sentryRole == null) {
-        MSentryRole mRole = convertToMSentryRole(roleName, grantorPrincipal);
+      MSentryRole mSentryRole = getMSentryRole(pm, roleName);
+      if (mSentryRole == null) {
+        MSentryRole mRole = new MSentryRole(roleName, System.currentTimeMillis(), grantorPrincipal);
         pm.makePersistent(mRole);
         CommitContext commit = commitUpdateTransaction(pm);
         rollbackTransaction = false;
@@ -199,23 +220,19 @@ public class SentryStore {
   }
 
   //TODO: handle case where a) privilege already exists, b) role to privilege mapping already exists
-  public CommitContext alterSentryRoleGrantPrivilege(String roleName,
-      TSentryPrivilege privilege) throws SentryNoSuchObjectException, SentryInvalidInputException {
+  public CommitContext alterSentryRoleGrantPrivilege(String roleName, TSentryPrivilege privilege)
+      throws SentryNoSuchObjectException, SentryInvalidInputException {
     boolean rollbackTransaction = true;
     PersistenceManager pm = null;
-    roleName = roleName.trim().toLowerCase();
+    roleName = trimAndLower(roleName);
     try {
       pm = openTransaction();
-      Query query = pm.newQuery(MSentryRole.class);
-      query.setFilter("this.roleName == t");
-      query.declareParameters("java.lang.String t");
-      query.setUnique(true);
-      MSentryRole mRole = (MSentryRole) query.execute(roleName);
+      MSentryRole mRole = getMSentryRole(pm, roleName);
       if (mRole == null) {
         throw new SentryNoSuchObjectException("Role: " + roleName);
       } else {
         MSentryPrivilege mPrivilege = convertToMSentryPrivilege(privilege);
-        // add privilege and role objects to each other. needed by datanucleus to model
+        // Add privilege and role objects to each other. needed by datanucleus to model
         // m:n relationships correctly through a join table.
         mPrivilege.appendRole(mRole);
         mRole.appendPrivilege(mPrivilege);
@@ -530,9 +547,73 @@ public class SentryStore {
     }
   }
 
-  public TSentryRole getSentryRoleByName(String roleName)
-  throws SentryNoSuchObjectException {
-    return convertToSentryRole(getMSentryRoleByName(roleName));
+  private Set<MSentryPrivilege> getMSentryPrivilegesByRoleName(String roleName)
+    throws SentryNoSuchObjectException {
+      MSentryRole mSentryRole = getMSentryRoleByName(roleName);
+      return mSentryRole.getPrivileges();
+    }
+
+  /**
+   * Gets sentry privilege objects for a given roleName from the persistence layer
+   * @param roleName : roleName to look up
+   * @return : Set of thrift sentry privilege objects
+   * @throws SentryNoSuchObjectException
+   */
+
+  public Set<TSentryPrivilege> getTSentryPrivilegesByRoleName(String roleName)
+      throws SentryNoSuchObjectException {
+    return convertToTSentryPrivileges(getMSentryPrivilegesByRoleName(roleName));
+  }
+
+  private Set<MSentryRole> getMSentryRolesByGroupName(String groupName)
+      throws SentryNoSuchObjectException {
+    boolean rollbackTransaction = true;
+    PersistenceManager pm = null;
+    try {
+      Set<MSentryRole> roles;
+      pm = openTransaction();
+
+      //If no group name was specified, return all roles
+      if (groupName == null) {
+        Query query = pm.newQuery(MSentryRole.class);
+        roles = new HashSet<MSentryRole>((List<MSentryRole>)query.execute());
+      } else {
+        Query query = pm.newQuery(MSentryGroup.class);
+        MSentryGroup sentryGroup;
+        groupName = groupName.trim().toLowerCase();
+        query.setFilter("this.groupName == t");
+        query.declareParameters("java.lang.String t");
+        query.setUnique(true);
+        sentryGroup = (MSentryGroup) query.execute(groupName);
+        if (sentryGroup == null) {
+          throw new SentryNoSuchObjectException("Group " + groupName);
+        } else {
+          pm.retrieve(sentryGroup);
+        }
+        roles = sentryGroup.getRoles();
+      }
+      for ( MSentryRole role: roles) {
+        pm.retrieve(role);
+      }
+      commitTransaction(pm);
+      rollbackTransaction = false;
+      return roles;
+    } finally {
+      if (rollbackTransaction) {
+        rollbackTransaction(pm);
+      }
+    }
+  }
+
+  /**
+   * Gets sentry role objects for a given groupName from the persistence layer
+   * @param groupName : groupName to look up ( if null returns all roles for all groups)
+   * @return : Set of thrift sentry role objects
+   * @throws SentryNoSuchObjectException
+   */
+  public Set<TSentryRole> getTSentryRolesByGroupName(String groupName)
+      throws SentryNoSuchObjectException {
+    return convertToTSentryRoles(getMSentryRolesByGroupName(groupName));
   }
 
   private SetMultimap<String, String> getRoleToPrivilegeMap(Set<String> groups) {
@@ -613,35 +694,52 @@ public class SentryStore {
     return result;
   }
 
+
   /**
-   * Converts thrift object to model object. Additionally does normalization
+   * Converts model object(s) to thrift object(s).
+   * Additionally does normalization
    * such as trimming whitespace and setting appropriate case. Also sets the create
    * time.
    */
-  private MSentryRole convertToMSentryRole(String roleName, String grantorPrincipal) {
-    MSentryRole mRole = new MSentryRole();
-    mRole.setCreateTime(System.currentTimeMillis());
-    mRole.setRoleName(roleName.trim().toLowerCase());
-    mRole.setGrantorPrincipal(grantorPrincipal.trim());
-    return mRole;
+
+  private Set<TSentryPrivilege> convertToTSentryPrivileges(Set<MSentryPrivilege> mSentryPrivileges) {
+    Set<TSentryPrivilege> privileges = new HashSet<TSentryPrivilege>();
+    for(MSentryPrivilege mSentryPrivilege:mSentryPrivileges) {
+      privileges.add(convertToTSentryPrivilege(mSentryPrivilege));
+    }
+    return privileges;
+  }
+
+  private Set<TSentryRole> convertToTSentryRoles(Set<MSentryRole> mSentryRoles) {
+    Set<TSentryRole> roles = new HashSet<TSentryRole>();
+    for(MSentryRole mSentryRole:mSentryRoles) {
+      roles.add(convertToTSentryRole(mSentryRole));
+    }
+    return roles;
   }
 
-  private TSentryRole convertToSentryRole(MSentryRole mSentryRole) {
+  private TSentryRole convertToTSentryRole(MSentryRole mSentryRole) {
     TSentryRole role = new TSentryRole();
     role.setRoleName(mSentryRole.getRoleName());
     role.setGrantorPrincipal(mSentryRole.getGrantorPrincipal());
 
-    Set<TSentryPrivilege> sentryPrivileges = new HashSet<TSentryPrivilege>();
-    for(MSentryPrivilege mSentryPrivilege:mSentryRole.getPrivileges()) {
-      TSentryPrivilege privilege = convertToSentryPrivilege(mSentryPrivilege);
-      sentryPrivileges.add(privilege);
+    Set<TSentryGroup> sentryGroups = new HashSet<TSentryGroup>();
+    for(MSentryGroup mSentryGroup:mSentryRole.getGroups()) {
+      TSentryGroup group = convertToTSentryGroup(mSentryGroup);
+      sentryGroups.add(group);
     }
 
-    role.setPrivileges(sentryPrivileges);
+    role.setGroups(sentryGroups);
     return role;
   }
 
-  private TSentryPrivilege convertToSentryPrivilege(MSentryPrivilege mSentryPrivilege) {
+  private TSentryGroup convertToTSentryGroup(MSentryGroup mSentryGroup) {
+    TSentryGroup group = new TSentryGroup();
+    group.setGroupName(mSentryGroup.getGroupName());
+    return group;
+  }
+
+  private TSentryPrivilege convertToTSentryPrivilege(MSentryPrivilege mSentryPrivilege) {
     TSentryPrivilege privilege = new TSentryPrivilege();
     privilege.setCreateTime(mSentryPrivilege.getCreateTime());
     privilege.setPrivilegeName(mSentryPrivilege.getPrivilegeName());
@@ -680,4 +778,4 @@ public class SentryStore {
     }
     return s.trim();
   }
-}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0fea11ab/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/SentryPolicyServiceClient.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/SentryPolicyServiceClient.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/SentryPolicyServiceClient.java
index 7e73b2c..33b8735 100644
--- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/SentryPolicyServiceClient.java
+++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/SentryPolicyServiceClient.java
@@ -18,10 +18,8 @@
 
 package org.apache.sentry.provider.db.service.thrift;
 
-import java.io.IOException;
-import java.net.InetSocketAddress;
-import java.util.Set;
-
+import com.google.common.base.Preconditions;
+import com.google.common.collect.Sets;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.net.NetUtils;
 import org.apache.hadoop.security.SaslRpcServer;
@@ -44,8 +42,10 @@ import org.apache.thrift.transport.TTransportException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.google.common.base.Preconditions;
-import com.google.common.collect.Sets;
+import java.io.IOException;
+import java.net.InetSocketAddress;
+import java.util.HashSet;
+import java.util.Set;
 
 public class SentryPolicyServiceClient {
 
@@ -58,6 +58,7 @@ public class SentryPolicyServiceClient {
   private int connectionTimeout;
   private static final Logger LOGGER = LoggerFactory
                                        .getLogger(SentryPolicyServiceClient.class);
+  private static final String THRIFT_EXCEPTION_MESSAGE = "Thrift exception occured ";
 
   public SentryPolicyServiceClient(Configuration conf) throws IOException {
     this.conf = conf;
@@ -109,8 +110,7 @@ public class SentryPolicyServiceClient {
       TCreateSentryRoleResponse response = client.create_sentry_role(request);
       Status.throwIfNotOk(response.getStatus());
     } catch (TException e) {
-      String msg = "Thrift exception occured: " + e.getMessage();
-      throw new SentryUserException(msg, e);
+      throw new SentryUserException(THRIFT_EXCEPTION_MESSAGE, e);
     }
   }
 
@@ -142,14 +142,66 @@ public class SentryPolicyServiceClient {
       }
       Status.throwIfNotOk(response.getStatus());
     } catch (TException e) {
-      String msg = "Thrift exception occured: " + e.getMessage();
-      throw new SentryUserException(msg, e);
+      throw new SentryUserException(THRIFT_EXCEPTION_MESSAGE, e);
+    }
+  }
+
+  /**
+   * Gets sentry role objects for a given groupName using the Sentry service
+   * @param requestorUserName : user on whose behalf the request is issued
+   * @param requestorUserGroupNames :groups the requesting user belongs to
+   * @param groupName : groupName to look up ( if null returns all roles for all groups)
+   * @return Set of thrift sentry role objects
+   * @throws SentryUserException
+   */
+  public Set<TSentryRole> listRolesByGroupName(String requestorUserName,
+      Set<String> requestorUserGroupNames, String groupName)
+  throws SentryUserException {
+    TListSentryRolesRequest request = new TListSentryRolesRequest();
+    request.setProtocol_version(ThriftConstants.TSENTRY_SERVICE_VERSION_CURRENT);
+    request.setRequestorUserName(requestorUserName);
+    request.setRequestorGroupNames(requestorUserGroupNames);
+    request.setGroupName(groupName);
+    TListSentryRolesResponse response;
+    Set<String> roles = new HashSet<String>();
+    try {
+      response = client.list_sentry_roles_by_group(request);
+      Status.throwIfNotOk(response.getStatus());
+      return response.getRoles();
+    } catch (TException e) {
+      throw new SentryUserException(THRIFT_EXCEPTION_MESSAGE, e);
+    }
+  }
+
+  /**
+   * Gets sentry privilege objects for a given roleName using the Sentry service
+   * @param requestorUserName : user on whose behalf the request is issued
+   * @param requestorUserGroupNames :groups the requesting user belongs to
+   * @param roleName : roleName to look up
+   * @return Set of thrift sentry privilege objects
+   * @throws SentryUserException
+   */
+  public Set<TSentryPrivilege> listPrivilegesByRoleName(String requestorUserName,
+      Set<String> requestorUserGroupNames, String roleName)
+  throws SentryUserException {
+    TListSentryPrivilegesRequest request = new TListSentryPrivilegesRequest();
+    request.setProtocol_version(ThriftConstants.TSENTRY_SERVICE_VERSION_CURRENT);
+    request.setRequestorUserName(requestorUserName);
+    request.setRequestorGroupNames(requestorUserGroupNames);
+    request.setRoleName(roleName);
+    TListSentryPrivilegesResponse response;
+    try {
+      response = client.list_sentry_privileges_by_role(request);
+      Status.throwIfNotOk(response.getStatus());
+      return response.getPrivileges();
+    } catch (TException e) {
+      throw new SentryUserException(THRIFT_EXCEPTION_MESSAGE, e);
     }
   }
 
-  public TListSentryRolesResponse listRoleByName(TListSentryRolesRequest req)
-  throws TException {
-    return client.list_sentry_roles_by_role_name(req);
+  public Set<TSentryRole> listRoles(String requestorUserName, Set<String> requestorUserGroupNames)
+       throws SentryUserException {
+    return listRolesByGroupName(requestorUserName, requestorUserGroupNames, null);
   }
 
   public void grantURIPrivilege(String requestorUserName, Set<String> requestorUserGroupNames,
@@ -202,8 +254,7 @@ public class SentryPolicyServiceClient {
       TAlterSentryRoleGrantPrivilegeResponse response = client.alter_sentry_role_grant_privilege(request);
       Status.throwIfNotOk(response.getStatus());
     } catch (TException e) {
-      String msg = "Thrift exception occured: " + e.getMessage();
-      throw new SentryUserException(msg, e);
+      throw new SentryUserException(THRIFT_EXCEPTION_MESSAGE, e);
     }
   }
 
@@ -257,12 +308,11 @@ public class SentryPolicyServiceClient {
       TAlterSentryRoleRevokePrivilegeResponse response = client.alter_sentry_role_revoke_privilege(request);
       Status.throwIfNotOk(response.getStatus());
     } catch (TException e) {
-      String msg = "Thrift exception occured: " + e.getMessage();
-      throw new SentryUserException(msg, e);
+      throw new SentryUserException(THRIFT_EXCEPTION_MESSAGE, e);
     }
   }
 
-  public Set<String> listPrivileges(Set<String> groups, ActiveRoleSet roleSet)
+  public Set<String> listPrivilegesForProvider(Set<String> groups, ActiveRoleSet roleSet)
   throws SentryUserException {
     TSentryActiveRoleSet thriftRoleSet = new TSentryActiveRoleSet(roleSet.isAll(), roleSet.getRoles());
     TListSentryPrivilegesForProviderRequest request =
@@ -273,8 +323,7 @@ public class SentryPolicyServiceClient {
       Status.throwIfNotOk(response.getStatus());
       return response.getPrivileges();
     } catch (TException e) {
-      String msg = "Thrift exception occured: " + e.getMessage();
-      throw new SentryUserException(msg, e);
+      throw new SentryUserException(THRIFT_EXCEPTION_MESSAGE, e);
     }
   }
 
@@ -288,8 +337,7 @@ public class SentryPolicyServiceClient {
       TAlterSentryRoleAddGroupsResponse response = client.alter_sentry_role_add_groups(request);
       Status.throwIfNotOk(response.getStatus());
     } catch (TException e) {
-      String msg = "Thrift exception occured: " + e.getMessage();
-      throw new SentryUserException(msg, e);
+      throw new SentryUserException(THRIFT_EXCEPTION_MESSAGE, e);
     }
   }
 
@@ -303,8 +351,7 @@ public class SentryPolicyServiceClient {
       TAlterSentryRoleDeleteGroupsResponse response = client.alter_sentry_role_delete_groups(request);
       Status.throwIfNotOk(response.getStatus());
     } catch (TException e) {
-      String msg = "Thrift exception occured: " + e.getMessage();
-      throw new SentryUserException(msg, e);
+      throw new SentryUserException(THRIFT_EXCEPTION_MESSAGE, e);
     }
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0fea11ab/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/SentryPolicyStoreProcessor.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/SentryPolicyStoreProcessor.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/SentryPolicyStoreProcessor.java
index 6c52fa4..3b3bdc3 100644
--- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/SentryPolicyStoreProcessor.java
+++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/SentryPolicyStoreProcessor.java
@@ -18,12 +18,12 @@
 
 package org.apache.sentry.provider.db.service.thrift;
 
-import java.lang.reflect.Constructor;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.commons.lang.StringUtils;
+import com.google.common.annotations.VisibleForTesting;
+import com.google.common.base.Preconditions;
+import com.google.common.base.Splitter;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.sentry.provider.db.SentryAccessDeniedException;
 import org.apache.sentry.provider.db.SentryAlreadyExistsException;
@@ -32,19 +32,17 @@ import org.apache.sentry.provider.db.SentryNoSuchObjectException;
 import org.apache.sentry.provider.db.service.persistent.CommitContext;
 import org.apache.sentry.provider.db.service.persistent.SentryStore;
 import org.apache.sentry.provider.db.service.thrift.PolicyStoreConstants.PolicyStoreServerConfig;
+import org.apache.sentry.service.thrift.ServiceConstants.ServerConfig;
 import org.apache.sentry.service.thrift.Status;
 import org.apache.sentry.service.thrift.TSentryResponseStatus;
-import org.apache.sentry.service.thrift.ServiceConstants.ServerConfig;
 import org.apache.thrift.TException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Preconditions;
-import com.google.common.base.Splitter;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Sets;
+import java.lang.reflect.Constructor;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
 
 @SuppressWarnings("unused")
 public class SentryPolicyStoreProcessor implements SentryPolicyService.Iface {
@@ -298,12 +296,11 @@ public class SentryPolicyStoreProcessor implements SentryPolicyService.Iface {
     TListSentryRolesRequest request) throws TException {
     TListSentryRolesResponse response = new TListSentryRolesResponse();
     TSentryResponseStatus status;
-    TSentryRole role = null;
     Set<TSentryRole> roleSet = new HashSet<TSentryRole>();
     try {
-      // TODO implement
-      role = sentryStore.getSentryRoleByName(request.getRoleName());
-      roleSet.add(role);
+      //TODO: Handle authorization for metadata queries
+      authorize(request.getRequestorUserName(), request.getRequestorGroupNames());
+      roleSet = sentryStore.getTSentryRolesByGroupName(request.getGroupName());
       response.setRoles(roleSet);
       response.setStatus(Status.OK());
     } catch (SentryNoSuchObjectException e) {
@@ -320,19 +317,22 @@ public class SentryPolicyStoreProcessor implements SentryPolicyService.Iface {
   }
 
   @Override
-  public TListSentryRolesResponse list_sentry_roles_by_role_name(
-    TListSentryRolesRequest request) throws TException {
-    TListSentryRolesResponse response = new TListSentryRolesResponse();
-    TSentryRole role = null;
-    Set<TSentryRole> roleSet = new HashSet<TSentryRole>();
+  public TListSentryPrivilegesResponse list_sentry_privileges_by_role(
+      TListSentryPrivilegesRequest request) throws TException {
+    TListSentryPrivilegesResponse response = new TListSentryPrivilegesResponse();
+    TSentryResponseStatus status;
+    Set<TSentryPrivilege> privilegeSet = new HashSet<TSentryPrivilege>();
     try {
-      role = sentryStore.getSentryRoleByName(request.getRoleName());
-      roleSet.add(role);
-      response.setRoles(roleSet);
+      //TODO: Handle authorization for metadata queries
+      // Shall we allow only admin users to list privileges
+      // or allow all users as long as user is granted this role?
+      authorize(request.getRequestorUserName(), request.getRequestorGroupNames());
+      privilegeSet = sentryStore.getTSentryPrivilegesByRoleName(request.getRoleName());
+      response.setPrivileges(privilegeSet);
       response.setStatus(Status.OK());
     } catch (SentryNoSuchObjectException e) {
-      response.setRoles(roleSet);
-      String msg = "Role: " + request + " couldn't be retrieved.";
+      response.setPrivileges(privilegeSet);
+      String msg = "Privilege: " + request + " couldn't be retrieved.";
       LOGGER.error(msg, e);
       response.setStatus(Status.NoSuchObject(msg, e));
     } catch (Exception e) {

http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0fea11ab/sentry-provider/sentry-provider-db/src/main/resources/sentry_policy_service.thrift
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/resources/sentry_policy_service.thrift b/sentry-provider/sentry-provider-db/src/main/resources/sentry_policy_service.thrift
index 677047f..a8b511d 100644
--- a/sentry-provider/sentry-provider-db/src/main/resources/sentry_policy_service.thrift
+++ b/sentry-provider/sentry-provider-db/src/main/resources/sentry_policy_service.thrift
@@ -70,25 +70,6 @@ struct TDropSentryRoleResponse {
 1: required sentry_common_service.TSentryResponseStatus status
 }
 
-# TODO what is this implementing SHOW GRANT/SHOW ROLE GRANT?
-# We should have seperate requests for those commands
-struct TListSentryRolesRequest {
-1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V1,
-2: required string requestorUserName, # user on whose behalf the request is issued
-3: optional string rolerequestorGroupNames, # list roles for this group
-4: required string roleName # role get prirvilges for
-}
-# used only for TListSentryRolesResponse
-struct TSentryRole {
-1: required string roleName,
-2: required set<TSentryPrivilege> privileges,
-3: required string grantorPrincipal
-}
-struct TListSentryRolesResponse {
-1: required sentry_common_service.TSentryResponseStatus status
-2: required set<TSentryRole> roles
-}
-
 # GRANT ROLE r1 TO GROUP g1
 struct TAlterSentryRoleAddGroupsRequest {
 1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V1,
@@ -138,6 +119,36 @@ struct TAlterSentryRoleRevokePrivilegeResponse {
 1: required sentry_common_service.TSentryResponseStatus status
 }
 
+# SHOW ROLE GRANT
+struct TListSentryRolesRequest {
+1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V1,
+2: required string requestorUserName, # user on whose behalf the request is issued
+3: required set<string> requestorGroupNames,# groups the requesting user belongs to
+4: optional string groupName # for this group, or all roles for all groups if null
+}
+# used only for TListSentryRolesResponse
+struct TSentryRole {
+1: required string roleName,
+2: required set<TSentryGroup> groups,
+3: required string grantorPrincipal
+}
+struct TListSentryRolesResponse {
+1: required sentry_common_service.TSentryResponseStatus status
+2: required set<TSentryRole> roles
+}
+
+# SHOW GRANT
+struct TListSentryPrivilegesRequest {
+1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V1,
+2: required string requestorUserName, # user on whose behalf the request is issued
+3: required set<string> requestorGroupNames,# groups the requesting user belongs to
+4: required string roleName # get privileges assigned for this role
+}
+struct TListSentryPrivilegesResponse {
+1: required sentry_common_service.TSentryResponseStatus status
+2: required set<TSentryPrivilege> privileges
+}
+
 # This API was created specifically for ProviderBackend.getPrivileges
 # and is not mean for general purpose privilege retrieval.
 # This request/response pair are created specifically so we can
@@ -168,8 +179,9 @@ service SentryPolicyService
   TAlterSentryRoleDeleteGroupsResponse alter_sentry_role_delete_groups(1:TAlterSentryRoleDeleteGroupsRequest request)
 
   TListSentryRolesResponse list_sentry_roles_by_group(1:TListSentryRolesRequest request)
-  TListSentryRolesResponse list_sentry_roles_by_role_name(1:TListSentryRolesRequest request)
+
+  TListSentryPrivilegesResponse list_sentry_privileges_by_role(1:TListSentryPrivilegesRequest request)
 
   # For use with ProviderBackend.getPrivileges only
   TListSentryPrivilegesForProviderResponse list_sentry_privileges_for_provider(1:TListSentryPrivilegesForProviderRequest request)
-}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0fea11ab/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServiceIntegration.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServiceIntegration.java b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServiceIntegration.java
index dcaa246..e211079 100644
--- a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServiceIntegration.java
+++ b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServiceIntegration.java
@@ -17,25 +17,22 @@
  */
 
 package org.apache.sentry.provider.db.service.thrift;
-import static junit.framework.Assert.assertEquals;
-
-import java.util.HashSet;
-import java.util.Set;
 
-import org.apache.sentry.core.common.ActiveRoleSet;
-import org.apache.sentry.provider.common.ProviderBackendContext;
-import org.apache.sentry.provider.db.SimpleDBProviderBackend;
+import com.google.common.collect.Sets;
+import org.apache.sentry.provider.db.service.persistent.SentryStore;
 import org.apache.sentry.service.thrift.SentryServiceIntegrationBase;
-import org.apache.sentry.service.thrift.ServiceConstants.ThriftConstants;
 import org.junit.Test;
 
-import com.google.common.collect.Sets;
+import java.util.Set;
+
+import static junit.framework.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
 
 
 public class TestSentryServiceIntegration extends SentryServiceIntegrationBase {
 
   @Test
-  public void testCreateRole() throws Exception {
+  public void testCreateDropShowRole() throws Exception {
     String requestorUserName = ADMIN_USER;
     Set<String> requestorUserGroupNames = Sets.newHashSet(ADMIN_GROUP);
     String roleName = "admin_r";
@@ -44,56 +41,68 @@ public class TestSentryServiceIntegration extends SentryServiceIntegrationBase {
 
     client.createRole(requestorUserName, requestorUserGroupNames, roleName);
 
-    TListSentryRolesRequest listReq = new TListSentryRolesRequest();
-    listReq.setProtocol_version(ThriftConstants.TSENTRY_SERVICE_VERSION_CURRENT);
-    listReq.setRoleName(roleName);
-    listReq.setRequestorUserName(requestorUserName);
-    TListSentryRolesResponse listResp = client.listRoleByName(listReq);
-    Set<TSentryRole> roles = listResp.getRoles();
-    assertEquals("Incorrect number of roles:" + roles, 1, roles.size());
+    Set<TSentryRole> roles = client.listRoles(requestorUserName, requestorUserGroupNames);
+    assertEquals("Incorrect number of roles", 1, roles.size());
 
+    for (TSentryRole role:roles) {
+      assertTrue(role.getRoleName(), role.getRoleName().equalsIgnoreCase(roleName));
+    }
     client.dropRole(requestorUserName, requestorUserGroupNames, roleName);
   }
 
   @Test
-  public void testGrantRevokePrivilege() throws Exception {
-    String server = "server1";
+  public void testShowRoleGrant() throws Exception {
     String requestorUserName = ADMIN_USER;
     Set<String> requestorUserGroupNames = Sets.newHashSet(ADMIN_GROUP);
     String roleName = "admin_testdb";
+    String groupName = "group1";
+
+    client.dropRoleIfExists(requestorUserName, requestorUserGroupNames, roleName);
+    client.createRole(requestorUserName, requestorUserGroupNames, roleName);
+
+    Set<TSentryRole> roles = client.listRoles(requestorUserName, requestorUserGroupNames);
+    assertEquals("Incorrect number of roles", 1, roles.size());
+
+    client.grantRoleToGroup(requestorUserName, requestorUserGroupNames, groupName, roleName);
+    Set<TSentryRole> groupRoles = client.listRolesByGroupName(requestorUserName,
+        requestorUserGroupNames, groupName);
+    assertTrue(groupRoles.size() == 1);
+    for (TSentryRole role:groupRoles) {
+      assertTrue(role.getRoleName(), role.getRoleName().equalsIgnoreCase(roleName));
+      assertTrue(role.getGroups().size() == 1);
+      for (TSentryGroup group :role.getGroups()) {
+        assertTrue(group.getGroupName(), group.getGroupName().equalsIgnoreCase(groupName));
+      }
+    }
+
+    client.dropRole(requestorUserName, requestorUserGroupNames, roleName);
+  }
+
+  @Test
+  public void testShowGrant() throws Exception {
+    String requestorUserName = ADMIN_USER;
+    Set<String> requestorUserGroupNames = Sets.newHashSet(ADMIN_GROUP);
+    String roleName = "admin_testdb";
+    String server = "server1";
     String db = "testDB";
-    String group = "group1";
 
     client.dropRoleIfExists(requestorUserName, requestorUserGroupNames, roleName);
     client.createRole(requestorUserName, requestorUserGroupNames, roleName);
 
-    TListSentryRolesRequest listReq = new TListSentryRolesRequest();
-    listReq.setProtocol_version(ThriftConstants.TSENTRY_SERVICE_VERSION_CURRENT);
-    listReq.setRoleName("admin_testdb");
-    listReq.setRequestorUserName(requestorUserName);
-    TListSentryRolesResponse listResp = client.listRoleByName(listReq);
-    Set<TSentryRole> roles = listResp.getRoles();
-    assertEquals("Incorrect number of roles:" + roles, 1, roles.size());
+    Set<TSentryRole> roles = client.listRoles(requestorUserName, requestorUserGroupNames);
+    assertEquals("Incorrect number of roles", 1, roles.size());
 
     client.grantDatabasePrivilege(requestorUserName, requestorUserGroupNames, roleName, server, db);
-
-    // verify we can get the privileges from the backend
-    SimpleDBProviderBackend dbBackend = new SimpleDBProviderBackend(client);
-    dbBackend.initialize(new ProviderBackendContext());
-    assertEquals(Sets.newHashSet(), dbBackend.getPrivileges(Sets.newHashSet(group),
-        new ActiveRoleSet(true)));
-    client.grantRoleToGroup(requestorUserName, requestorUserGroupNames, group, roleName);
-    assertEquals(Sets.newHashSet(), dbBackend.getPrivileges(Sets.newHashSet(group),
-        new ActiveRoleSet(new HashSet<String>())));
-    assertEquals(Sets.newHashSet("server="+ server + "->db=" + db + "->action=*"),
-        dbBackend.getPrivileges(Sets.newHashSet("group1"),
-        new ActiveRoleSet(true)));
-    assertEquals(Sets.newHashSet("server="+ server + "->db=" + db + "->action=*"),
-        dbBackend.getPrivileges(Sets.newHashSet(group),
-        new ActiveRoleSet(Sets.newHashSet(roleName))));
+    Set<TSentryPrivilege> privileges = client.listPrivilegesByRoleName(requestorUserName,
+        requestorUserGroupNames, roleName);
+    assertTrue(privileges.size() == 1);
+    for (TSentryPrivilege privilege:privileges) {
+      assertTrue(privilege.getPrivilegeName(),
+        privilege.getPrivilegeName().equalsIgnoreCase(SentryStore.constructPrivilegeName(privilege)));
+    }
 
     client.revokeDatabasePrivilege(requestorUserName, requestorUserGroupNames, roleName, server, db);
     client.dropRole(requestorUserName, requestorUserGroupNames, roleName);
   }
 
-}
+}
\ No newline at end of file


[2/3] Add Sentry service APIs to query roles and privileges (Sravya Tirukkovalur via Prasad Mujumdar)

Posted by pr...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0fea11ab/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryPrivilegesRequest.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryPrivilegesRequest.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryPrivilegesRequest.java
new file mode 100644
index 0000000..56e4cc7
--- /dev/null
+++ b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryPrivilegesRequest.java
@@ -0,0 +1,740 @@
+/**
+ * Autogenerated by Thrift Compiler (0.9.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ *  @generated
+ */
+package org.apache.sentry.provider.db.service.thrift;
+
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EnumMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.EnumSet;
+import java.util.Collections;
+import java.util.BitSet;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class TListSentryPrivilegesRequest implements org.apache.thrift.TBase<TListSentryPrivilegesRequest, TListSentryPrivilegesRequest._Fields>, java.io.Serializable, Cloneable {
+  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TListSentryPrivilegesRequest");
+
+  private static final org.apache.thrift.protocol.TField PROTOCOL_VERSION_FIELD_DESC = new org.apache.thrift.protocol.TField("protocol_version", org.apache.thrift.protocol.TType.I32, (short)1);
+  private static final org.apache.thrift.protocol.TField REQUESTOR_USER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("requestorUserName", org.apache.thrift.protocol.TType.STRING, (short)2);
+  private static final org.apache.thrift.protocol.TField REQUESTOR_GROUP_NAMES_FIELD_DESC = new org.apache.thrift.protocol.TField("requestorGroupNames", org.apache.thrift.protocol.TType.SET, (short)3);
+  private static final org.apache.thrift.protocol.TField ROLE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("roleName", org.apache.thrift.protocol.TType.STRING, (short)4);
+
+  private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+  static {
+    schemes.put(StandardScheme.class, new TListSentryPrivilegesRequestStandardSchemeFactory());
+    schemes.put(TupleScheme.class, new TListSentryPrivilegesRequestTupleSchemeFactory());
+  }
+
+  private int protocol_version; // required
+  private String requestorUserName; // required
+  private Set<String> requestorGroupNames; // required
+  private String roleName; // required
+
+  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+    PROTOCOL_VERSION((short)1, "protocol_version"),
+    REQUESTOR_USER_NAME((short)2, "requestorUserName"),
+    REQUESTOR_GROUP_NAMES((short)3, "requestorGroupNames"),
+    ROLE_NAME((short)4, "roleName");
+
+    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+    static {
+      for (_Fields field : EnumSet.allOf(_Fields.class)) {
+        byName.put(field.getFieldName(), field);
+      }
+    }
+
+    /**
+     * Find the _Fields constant that matches fieldId, or null if its not found.
+     */
+    public static _Fields findByThriftId(int fieldId) {
+      switch(fieldId) {
+        case 1: // PROTOCOL_VERSION
+          return PROTOCOL_VERSION;
+        case 2: // REQUESTOR_USER_NAME
+          return REQUESTOR_USER_NAME;
+        case 3: // REQUESTOR_GROUP_NAMES
+          return REQUESTOR_GROUP_NAMES;
+        case 4: // ROLE_NAME
+          return ROLE_NAME;
+        default:
+          return null;
+      }
+    }
+
+    /**
+     * Find the _Fields constant that matches fieldId, throwing an exception
+     * if it is not found.
+     */
+    public static _Fields findByThriftIdOrThrow(int fieldId) {
+      _Fields fields = findByThriftId(fieldId);
+      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+      return fields;
+    }
+
+    /**
+     * Find the _Fields constant that matches name, or null if its not found.
+     */
+    public static _Fields findByName(String name) {
+      return byName.get(name);
+    }
+
+    private final short _thriftId;
+    private final String _fieldName;
+
+    _Fields(short thriftId, String fieldName) {
+      _thriftId = thriftId;
+      _fieldName = fieldName;
+    }
+
+    public short getThriftFieldId() {
+      return _thriftId;
+    }
+
+    public String getFieldName() {
+      return _fieldName;
+    }
+  }
+
+  // isset id assignments
+  private static final int __PROTOCOL_VERSION_ISSET_ID = 0;
+  private byte __isset_bitfield = 0;
+  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+  static {
+    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+    tmpMap.put(_Fields.PROTOCOL_VERSION, new org.apache.thrift.meta_data.FieldMetaData("protocol_version", org.apache.thrift.TFieldRequirementType.REQUIRED, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
+    tmpMap.put(_Fields.REQUESTOR_USER_NAME, new org.apache.thrift.meta_data.FieldMetaData("requestorUserName", org.apache.thrift.TFieldRequirementType.REQUIRED, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+    tmpMap.put(_Fields.REQUESTOR_GROUP_NAMES, new org.apache.thrift.meta_data.FieldMetaData("requestorGroupNames", org.apache.thrift.TFieldRequirementType.REQUIRED, 
+        new org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET, 
+            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
+    tmpMap.put(_Fields.ROLE_NAME, new org.apache.thrift.meta_data.FieldMetaData("roleName", org.apache.thrift.TFieldRequirementType.REQUIRED, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+    metaDataMap = Collections.unmodifiableMap(tmpMap);
+    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TListSentryPrivilegesRequest.class, metaDataMap);
+  }
+
+  public TListSentryPrivilegesRequest() {
+    this.protocol_version = 1;
+
+  }
+
+  public TListSentryPrivilegesRequest(
+    int protocol_version,
+    String requestorUserName,
+    Set<String> requestorGroupNames,
+    String roleName)
+  {
+    this();
+    this.protocol_version = protocol_version;
+    setProtocol_versionIsSet(true);
+    this.requestorUserName = requestorUserName;
+    this.requestorGroupNames = requestorGroupNames;
+    this.roleName = roleName;
+  }
+
+  /**
+   * Performs a deep copy on <i>other</i>.
+   */
+  public TListSentryPrivilegesRequest(TListSentryPrivilegesRequest other) {
+    __isset_bitfield = other.__isset_bitfield;
+    this.protocol_version = other.protocol_version;
+    if (other.isSetRequestorUserName()) {
+      this.requestorUserName = other.requestorUserName;
+    }
+    if (other.isSetRequestorGroupNames()) {
+      Set<String> __this__requestorGroupNames = new HashSet<String>();
+      for (String other_element : other.requestorGroupNames) {
+        __this__requestorGroupNames.add(other_element);
+      }
+      this.requestorGroupNames = __this__requestorGroupNames;
+    }
+    if (other.isSetRoleName()) {
+      this.roleName = other.roleName;
+    }
+  }
+
+  public TListSentryPrivilegesRequest deepCopy() {
+    return new TListSentryPrivilegesRequest(this);
+  }
+
+  @Override
+  public void clear() {
+    this.protocol_version = 1;
+
+    this.requestorUserName = null;
+    this.requestorGroupNames = null;
+    this.roleName = null;
+  }
+
+  public int getProtocol_version() {
+    return this.protocol_version;
+  }
+
+  public void setProtocol_version(int protocol_version) {
+    this.protocol_version = protocol_version;
+    setProtocol_versionIsSet(true);
+  }
+
+  public void unsetProtocol_version() {
+    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __PROTOCOL_VERSION_ISSET_ID);
+  }
+
+  /** Returns true if field protocol_version is set (has been assigned a value) and false otherwise */
+  public boolean isSetProtocol_version() {
+    return EncodingUtils.testBit(__isset_bitfield, __PROTOCOL_VERSION_ISSET_ID);
+  }
+
+  public void setProtocol_versionIsSet(boolean value) {
+    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __PROTOCOL_VERSION_ISSET_ID, value);
+  }
+
+  public String getRequestorUserName() {
+    return this.requestorUserName;
+  }
+
+  public void setRequestorUserName(String requestorUserName) {
+    this.requestorUserName = requestorUserName;
+  }
+
+  public void unsetRequestorUserName() {
+    this.requestorUserName = null;
+  }
+
+  /** Returns true if field requestorUserName is set (has been assigned a value) and false otherwise */
+  public boolean isSetRequestorUserName() {
+    return this.requestorUserName != null;
+  }
+
+  public void setRequestorUserNameIsSet(boolean value) {
+    if (!value) {
+      this.requestorUserName = null;
+    }
+  }
+
+  public int getRequestorGroupNamesSize() {
+    return (this.requestorGroupNames == null) ? 0 : this.requestorGroupNames.size();
+  }
+
+  public java.util.Iterator<String> getRequestorGroupNamesIterator() {
+    return (this.requestorGroupNames == null) ? null : this.requestorGroupNames.iterator();
+  }
+
+  public void addToRequestorGroupNames(String elem) {
+    if (this.requestorGroupNames == null) {
+      this.requestorGroupNames = new HashSet<String>();
+    }
+    this.requestorGroupNames.add(elem);
+  }
+
+  public Set<String> getRequestorGroupNames() {
+    return this.requestorGroupNames;
+  }
+
+  public void setRequestorGroupNames(Set<String> requestorGroupNames) {
+    this.requestorGroupNames = requestorGroupNames;
+  }
+
+  public void unsetRequestorGroupNames() {
+    this.requestorGroupNames = null;
+  }
+
+  /** Returns true if field requestorGroupNames is set (has been assigned a value) and false otherwise */
+  public boolean isSetRequestorGroupNames() {
+    return this.requestorGroupNames != null;
+  }
+
+  public void setRequestorGroupNamesIsSet(boolean value) {
+    if (!value) {
+      this.requestorGroupNames = null;
+    }
+  }
+
+  public String getRoleName() {
+    return this.roleName;
+  }
+
+  public void setRoleName(String roleName) {
+    this.roleName = roleName;
+  }
+
+  public void unsetRoleName() {
+    this.roleName = null;
+  }
+
+  /** Returns true if field roleName is set (has been assigned a value) and false otherwise */
+  public boolean isSetRoleName() {
+    return this.roleName != null;
+  }
+
+  public void setRoleNameIsSet(boolean value) {
+    if (!value) {
+      this.roleName = null;
+    }
+  }
+
+  public void setFieldValue(_Fields field, Object value) {
+    switch (field) {
+    case PROTOCOL_VERSION:
+      if (value == null) {
+        unsetProtocol_version();
+      } else {
+        setProtocol_version((Integer)value);
+      }
+      break;
+
+    case REQUESTOR_USER_NAME:
+      if (value == null) {
+        unsetRequestorUserName();
+      } else {
+        setRequestorUserName((String)value);
+      }
+      break;
+
+    case REQUESTOR_GROUP_NAMES:
+      if (value == null) {
+        unsetRequestorGroupNames();
+      } else {
+        setRequestorGroupNames((Set<String>)value);
+      }
+      break;
+
+    case ROLE_NAME:
+      if (value == null) {
+        unsetRoleName();
+      } else {
+        setRoleName((String)value);
+      }
+      break;
+
+    }
+  }
+
+  public Object getFieldValue(_Fields field) {
+    switch (field) {
+    case PROTOCOL_VERSION:
+      return Integer.valueOf(getProtocol_version());
+
+    case REQUESTOR_USER_NAME:
+      return getRequestorUserName();
+
+    case REQUESTOR_GROUP_NAMES:
+      return getRequestorGroupNames();
+
+    case ROLE_NAME:
+      return getRoleName();
+
+    }
+    throw new IllegalStateException();
+  }
+
+  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+  public boolean isSet(_Fields field) {
+    if (field == null) {
+      throw new IllegalArgumentException();
+    }
+
+    switch (field) {
+    case PROTOCOL_VERSION:
+      return isSetProtocol_version();
+    case REQUESTOR_USER_NAME:
+      return isSetRequestorUserName();
+    case REQUESTOR_GROUP_NAMES:
+      return isSetRequestorGroupNames();
+    case ROLE_NAME:
+      return isSetRoleName();
+    }
+    throw new IllegalStateException();
+  }
+
+  @Override
+  public boolean equals(Object that) {
+    if (that == null)
+      return false;
+    if (that instanceof TListSentryPrivilegesRequest)
+      return this.equals((TListSentryPrivilegesRequest)that);
+    return false;
+  }
+
+  public boolean equals(TListSentryPrivilegesRequest that) {
+    if (that == null)
+      return false;
+
+    boolean this_present_protocol_version = true;
+    boolean that_present_protocol_version = true;
+    if (this_present_protocol_version || that_present_protocol_version) {
+      if (!(this_present_protocol_version && that_present_protocol_version))
+        return false;
+      if (this.protocol_version != that.protocol_version)
+        return false;
+    }
+
+    boolean this_present_requestorUserName = true && this.isSetRequestorUserName();
+    boolean that_present_requestorUserName = true && that.isSetRequestorUserName();
+    if (this_present_requestorUserName || that_present_requestorUserName) {
+      if (!(this_present_requestorUserName && that_present_requestorUserName))
+        return false;
+      if (!this.requestorUserName.equals(that.requestorUserName))
+        return false;
+    }
+
+    boolean this_present_requestorGroupNames = true && this.isSetRequestorGroupNames();
+    boolean that_present_requestorGroupNames = true && that.isSetRequestorGroupNames();
+    if (this_present_requestorGroupNames || that_present_requestorGroupNames) {
+      if (!(this_present_requestorGroupNames && that_present_requestorGroupNames))
+        return false;
+      if (!this.requestorGroupNames.equals(that.requestorGroupNames))
+        return false;
+    }
+
+    boolean this_present_roleName = true && this.isSetRoleName();
+    boolean that_present_roleName = true && that.isSetRoleName();
+    if (this_present_roleName || that_present_roleName) {
+      if (!(this_present_roleName && that_present_roleName))
+        return false;
+      if (!this.roleName.equals(that.roleName))
+        return false;
+    }
+
+    return true;
+  }
+
+  @Override
+  public int hashCode() {
+    HashCodeBuilder builder = new HashCodeBuilder();
+
+    boolean present_protocol_version = true;
+    builder.append(present_protocol_version);
+    if (present_protocol_version)
+      builder.append(protocol_version);
+
+    boolean present_requestorUserName = true && (isSetRequestorUserName());
+    builder.append(present_requestorUserName);
+    if (present_requestorUserName)
+      builder.append(requestorUserName);
+
+    boolean present_requestorGroupNames = true && (isSetRequestorGroupNames());
+    builder.append(present_requestorGroupNames);
+    if (present_requestorGroupNames)
+      builder.append(requestorGroupNames);
+
+    boolean present_roleName = true && (isSetRoleName());
+    builder.append(present_roleName);
+    if (present_roleName)
+      builder.append(roleName);
+
+    return builder.toHashCode();
+  }
+
+  public int compareTo(TListSentryPrivilegesRequest other) {
+    if (!getClass().equals(other.getClass())) {
+      return getClass().getName().compareTo(other.getClass().getName());
+    }
+
+    int lastComparison = 0;
+    TListSentryPrivilegesRequest typedOther = (TListSentryPrivilegesRequest)other;
+
+    lastComparison = Boolean.valueOf(isSetProtocol_version()).compareTo(typedOther.isSetProtocol_version());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetProtocol_version()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.protocol_version, typedOther.protocol_version);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    lastComparison = Boolean.valueOf(isSetRequestorUserName()).compareTo(typedOther.isSetRequestorUserName());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetRequestorUserName()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.requestorUserName, typedOther.requestorUserName);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    lastComparison = Boolean.valueOf(isSetRequestorGroupNames()).compareTo(typedOther.isSetRequestorGroupNames());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetRequestorGroupNames()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.requestorGroupNames, typedOther.requestorGroupNames);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    lastComparison = Boolean.valueOf(isSetRoleName()).compareTo(typedOther.isSetRoleName());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetRoleName()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.roleName, typedOther.roleName);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    return 0;
+  }
+
+  public _Fields fieldForId(int fieldId) {
+    return _Fields.findByThriftId(fieldId);
+  }
+
+  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
+    schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
+  }
+
+  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
+    schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
+  }
+
+  @Override
+  public String toString() {
+    StringBuilder sb = new StringBuilder("TListSentryPrivilegesRequest(");
+    boolean first = true;
+
+    sb.append("protocol_version:");
+    sb.append(this.protocol_version);
+    first = false;
+    if (!first) sb.append(", ");
+    sb.append("requestorUserName:");
+    if (this.requestorUserName == null) {
+      sb.append("null");
+    } else {
+      sb.append(this.requestorUserName);
+    }
+    first = false;
+    if (!first) sb.append(", ");
+    sb.append("requestorGroupNames:");
+    if (this.requestorGroupNames == null) {
+      sb.append("null");
+    } else {
+      sb.append(this.requestorGroupNames);
+    }
+    first = false;
+    if (!first) sb.append(", ");
+    sb.append("roleName:");
+    if (this.roleName == null) {
+      sb.append("null");
+    } else {
+      sb.append(this.roleName);
+    }
+    first = false;
+    sb.append(")");
+    return sb.toString();
+  }
+
+  public void validate() throws org.apache.thrift.TException {
+    // check for required fields
+    if (!isSetProtocol_version()) {
+      throw new org.apache.thrift.protocol.TProtocolException("Required field 'protocol_version' is unset! Struct:" + toString());
+    }
+
+    if (!isSetRequestorUserName()) {
+      throw new org.apache.thrift.protocol.TProtocolException("Required field 'requestorUserName' is unset! Struct:" + toString());
+    }
+
+    if (!isSetRequestorGroupNames()) {
+      throw new org.apache.thrift.protocol.TProtocolException("Required field 'requestorGroupNames' is unset! Struct:" + toString());
+    }
+
+    if (!isSetRoleName()) {
+      throw new org.apache.thrift.protocol.TProtocolException("Required field 'roleName' is unset! Struct:" + toString());
+    }
+
+    // check for sub-struct validity
+  }
+
+  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+    try {
+      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+    } catch (org.apache.thrift.TException te) {
+      throw new java.io.IOException(te);
+    }
+  }
+
+  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+    try {
+      // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
+      __isset_bitfield = 0;
+      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+    } catch (org.apache.thrift.TException te) {
+      throw new java.io.IOException(te);
+    }
+  }
+
+  private static class TListSentryPrivilegesRequestStandardSchemeFactory implements SchemeFactory {
+    public TListSentryPrivilegesRequestStandardScheme getScheme() {
+      return new TListSentryPrivilegesRequestStandardScheme();
+    }
+  }
+
+  private static class TListSentryPrivilegesRequestStandardScheme extends StandardScheme<TListSentryPrivilegesRequest> {
+
+    public void read(org.apache.thrift.protocol.TProtocol iprot, TListSentryPrivilegesRequest struct) throws org.apache.thrift.TException {
+      org.apache.thrift.protocol.TField schemeField;
+      iprot.readStructBegin();
+      while (true)
+      {
+        schemeField = iprot.readFieldBegin();
+        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
+          break;
+        }
+        switch (schemeField.id) {
+          case 1: // PROTOCOL_VERSION
+            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
+              struct.protocol_version = iprot.readI32();
+              struct.setProtocol_versionIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 2: // REQUESTOR_USER_NAME
+            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+              struct.requestorUserName = iprot.readString();
+              struct.setRequestorUserNameIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 3: // REQUESTOR_GROUP_NAMES
+            if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
+              {
+                org.apache.thrift.protocol.TSet _set88 = iprot.readSetBegin();
+                struct.requestorGroupNames = new HashSet<String>(2*_set88.size);
+                for (int _i89 = 0; _i89 < _set88.size; ++_i89)
+                {
+                  String _elem90; // required
+                  _elem90 = iprot.readString();
+                  struct.requestorGroupNames.add(_elem90);
+                }
+                iprot.readSetEnd();
+              }
+              struct.setRequestorGroupNamesIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 4: // ROLE_NAME
+            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+              struct.roleName = iprot.readString();
+              struct.setRoleNameIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          default:
+            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+        }
+        iprot.readFieldEnd();
+      }
+      iprot.readStructEnd();
+      struct.validate();
+    }
+
+    public void write(org.apache.thrift.protocol.TProtocol oprot, TListSentryPrivilegesRequest struct) throws org.apache.thrift.TException {
+      struct.validate();
+
+      oprot.writeStructBegin(STRUCT_DESC);
+      oprot.writeFieldBegin(PROTOCOL_VERSION_FIELD_DESC);
+      oprot.writeI32(struct.protocol_version);
+      oprot.writeFieldEnd();
+      if (struct.requestorUserName != null) {
+        oprot.writeFieldBegin(REQUESTOR_USER_NAME_FIELD_DESC);
+        oprot.writeString(struct.requestorUserName);
+        oprot.writeFieldEnd();
+      }
+      if (struct.requestorGroupNames != null) {
+        oprot.writeFieldBegin(REQUESTOR_GROUP_NAMES_FIELD_DESC);
+        {
+          oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, struct.requestorGroupNames.size()));
+          for (String _iter91 : struct.requestorGroupNames)
+          {
+            oprot.writeString(_iter91);
+          }
+          oprot.writeSetEnd();
+        }
+        oprot.writeFieldEnd();
+      }
+      if (struct.roleName != null) {
+        oprot.writeFieldBegin(ROLE_NAME_FIELD_DESC);
+        oprot.writeString(struct.roleName);
+        oprot.writeFieldEnd();
+      }
+      oprot.writeFieldStop();
+      oprot.writeStructEnd();
+    }
+
+  }
+
+  private static class TListSentryPrivilegesRequestTupleSchemeFactory implements SchemeFactory {
+    public TListSentryPrivilegesRequestTupleScheme getScheme() {
+      return new TListSentryPrivilegesRequestTupleScheme();
+    }
+  }
+
+  private static class TListSentryPrivilegesRequestTupleScheme extends TupleScheme<TListSentryPrivilegesRequest> {
+
+    @Override
+    public void write(org.apache.thrift.protocol.TProtocol prot, TListSentryPrivilegesRequest struct) throws org.apache.thrift.TException {
+      TTupleProtocol oprot = (TTupleProtocol) prot;
+      oprot.writeI32(struct.protocol_version);
+      oprot.writeString(struct.requestorUserName);
+      {
+        oprot.writeI32(struct.requestorGroupNames.size());
+        for (String _iter92 : struct.requestorGroupNames)
+        {
+          oprot.writeString(_iter92);
+        }
+      }
+      oprot.writeString(struct.roleName);
+    }
+
+    @Override
+    public void read(org.apache.thrift.protocol.TProtocol prot, TListSentryPrivilegesRequest struct) throws org.apache.thrift.TException {
+      TTupleProtocol iprot = (TTupleProtocol) prot;
+      struct.protocol_version = iprot.readI32();
+      struct.setProtocol_versionIsSet(true);
+      struct.requestorUserName = iprot.readString();
+      struct.setRequestorUserNameIsSet(true);
+      {
+        org.apache.thrift.protocol.TSet _set93 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
+        struct.requestorGroupNames = new HashSet<String>(2*_set93.size);
+        for (int _i94 = 0; _i94 < _set93.size; ++_i94)
+        {
+          String _elem95; // required
+          _elem95 = iprot.readString();
+          struct.requestorGroupNames.add(_elem95);
+        }
+      }
+      struct.setRequestorGroupNamesIsSet(true);
+      struct.roleName = iprot.readString();
+      struct.setRoleNameIsSet(true);
+    }
+  }
+
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0fea11ab/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryPrivilegesResponse.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryPrivilegesResponse.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryPrivilegesResponse.java
new file mode 100644
index 0000000..53a0f78
--- /dev/null
+++ b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryPrivilegesResponse.java
@@ -0,0 +1,545 @@
+/**
+ * Autogenerated by Thrift Compiler (0.9.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ *  @generated
+ */
+package org.apache.sentry.provider.db.service.thrift;
+
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EnumMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.EnumSet;
+import java.util.Collections;
+import java.util.BitSet;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class TListSentryPrivilegesResponse implements org.apache.thrift.TBase<TListSentryPrivilegesResponse, TListSentryPrivilegesResponse._Fields>, java.io.Serializable, Cloneable {
+  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TListSentryPrivilegesResponse");
+
+  private static final org.apache.thrift.protocol.TField STATUS_FIELD_DESC = new org.apache.thrift.protocol.TField("status", org.apache.thrift.protocol.TType.STRUCT, (short)1);
+  private static final org.apache.thrift.protocol.TField PRIVILEGES_FIELD_DESC = new org.apache.thrift.protocol.TField("privileges", org.apache.thrift.protocol.TType.SET, (short)2);
+
+  private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+  static {
+    schemes.put(StandardScheme.class, new TListSentryPrivilegesResponseStandardSchemeFactory());
+    schemes.put(TupleScheme.class, new TListSentryPrivilegesResponseTupleSchemeFactory());
+  }
+
+  private org.apache.sentry.service.thrift.TSentryResponseStatus status; // required
+  private Set<TSentryPrivilege> privileges; // required
+
+  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+    STATUS((short)1, "status"),
+    PRIVILEGES((short)2, "privileges");
+
+    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+    static {
+      for (_Fields field : EnumSet.allOf(_Fields.class)) {
+        byName.put(field.getFieldName(), field);
+      }
+    }
+
+    /**
+     * Find the _Fields constant that matches fieldId, or null if its not found.
+     */
+    public static _Fields findByThriftId(int fieldId) {
+      switch(fieldId) {
+        case 1: // STATUS
+          return STATUS;
+        case 2: // PRIVILEGES
+          return PRIVILEGES;
+        default:
+          return null;
+      }
+    }
+
+    /**
+     * Find the _Fields constant that matches fieldId, throwing an exception
+     * if it is not found.
+     */
+    public static _Fields findByThriftIdOrThrow(int fieldId) {
+      _Fields fields = findByThriftId(fieldId);
+      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+      return fields;
+    }
+
+    /**
+     * Find the _Fields constant that matches name, or null if its not found.
+     */
+    public static _Fields findByName(String name) {
+      return byName.get(name);
+    }
+
+    private final short _thriftId;
+    private final String _fieldName;
+
+    _Fields(short thriftId, String fieldName) {
+      _thriftId = thriftId;
+      _fieldName = fieldName;
+    }
+
+    public short getThriftFieldId() {
+      return _thriftId;
+    }
+
+    public String getFieldName() {
+      return _fieldName;
+    }
+  }
+
+  // isset id assignments
+  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+  static {
+    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+    tmpMap.put(_Fields.STATUS, new org.apache.thrift.meta_data.FieldMetaData("status", org.apache.thrift.TFieldRequirementType.REQUIRED, 
+        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.sentry.service.thrift.TSentryResponseStatus.class)));
+    tmpMap.put(_Fields.PRIVILEGES, new org.apache.thrift.meta_data.FieldMetaData("privileges", org.apache.thrift.TFieldRequirementType.REQUIRED, 
+        new org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET, 
+            new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TSentryPrivilege.class))));
+    metaDataMap = Collections.unmodifiableMap(tmpMap);
+    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TListSentryPrivilegesResponse.class, metaDataMap);
+  }
+
+  public TListSentryPrivilegesResponse() {
+  }
+
+  public TListSentryPrivilegesResponse(
+    org.apache.sentry.service.thrift.TSentryResponseStatus status,
+    Set<TSentryPrivilege> privileges)
+  {
+    this();
+    this.status = status;
+    this.privileges = privileges;
+  }
+
+  /**
+   * Performs a deep copy on <i>other</i>.
+   */
+  public TListSentryPrivilegesResponse(TListSentryPrivilegesResponse other) {
+    if (other.isSetStatus()) {
+      this.status = new org.apache.sentry.service.thrift.TSentryResponseStatus(other.status);
+    }
+    if (other.isSetPrivileges()) {
+      Set<TSentryPrivilege> __this__privileges = new HashSet<TSentryPrivilege>();
+      for (TSentryPrivilege other_element : other.privileges) {
+        __this__privileges.add(new TSentryPrivilege(other_element));
+      }
+      this.privileges = __this__privileges;
+    }
+  }
+
+  public TListSentryPrivilegesResponse deepCopy() {
+    return new TListSentryPrivilegesResponse(this);
+  }
+
+  @Override
+  public void clear() {
+    this.status = null;
+    this.privileges = null;
+  }
+
+  public org.apache.sentry.service.thrift.TSentryResponseStatus getStatus() {
+    return this.status;
+  }
+
+  public void setStatus(org.apache.sentry.service.thrift.TSentryResponseStatus status) {
+    this.status = status;
+  }
+
+  public void unsetStatus() {
+    this.status = null;
+  }
+
+  /** Returns true if field status is set (has been assigned a value) and false otherwise */
+  public boolean isSetStatus() {
+    return this.status != null;
+  }
+
+  public void setStatusIsSet(boolean value) {
+    if (!value) {
+      this.status = null;
+    }
+  }
+
+  public int getPrivilegesSize() {
+    return (this.privileges == null) ? 0 : this.privileges.size();
+  }
+
+  public java.util.Iterator<TSentryPrivilege> getPrivilegesIterator() {
+    return (this.privileges == null) ? null : this.privileges.iterator();
+  }
+
+  public void addToPrivileges(TSentryPrivilege elem) {
+    if (this.privileges == null) {
+      this.privileges = new HashSet<TSentryPrivilege>();
+    }
+    this.privileges.add(elem);
+  }
+
+  public Set<TSentryPrivilege> getPrivileges() {
+    return this.privileges;
+  }
+
+  public void setPrivileges(Set<TSentryPrivilege> privileges) {
+    this.privileges = privileges;
+  }
+
+  public void unsetPrivileges() {
+    this.privileges = null;
+  }
+
+  /** Returns true if field privileges is set (has been assigned a value) and false otherwise */
+  public boolean isSetPrivileges() {
+    return this.privileges != null;
+  }
+
+  public void setPrivilegesIsSet(boolean value) {
+    if (!value) {
+      this.privileges = null;
+    }
+  }
+
+  public void setFieldValue(_Fields field, Object value) {
+    switch (field) {
+    case STATUS:
+      if (value == null) {
+        unsetStatus();
+      } else {
+        setStatus((org.apache.sentry.service.thrift.TSentryResponseStatus)value);
+      }
+      break;
+
+    case PRIVILEGES:
+      if (value == null) {
+        unsetPrivileges();
+      } else {
+        setPrivileges((Set<TSentryPrivilege>)value);
+      }
+      break;
+
+    }
+  }
+
+  public Object getFieldValue(_Fields field) {
+    switch (field) {
+    case STATUS:
+      return getStatus();
+
+    case PRIVILEGES:
+      return getPrivileges();
+
+    }
+    throw new IllegalStateException();
+  }
+
+  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+  public boolean isSet(_Fields field) {
+    if (field == null) {
+      throw new IllegalArgumentException();
+    }
+
+    switch (field) {
+    case STATUS:
+      return isSetStatus();
+    case PRIVILEGES:
+      return isSetPrivileges();
+    }
+    throw new IllegalStateException();
+  }
+
+  @Override
+  public boolean equals(Object that) {
+    if (that == null)
+      return false;
+    if (that instanceof TListSentryPrivilegesResponse)
+      return this.equals((TListSentryPrivilegesResponse)that);
+    return false;
+  }
+
+  public boolean equals(TListSentryPrivilegesResponse that) {
+    if (that == null)
+      return false;
+
+    boolean this_present_status = true && this.isSetStatus();
+    boolean that_present_status = true && that.isSetStatus();
+    if (this_present_status || that_present_status) {
+      if (!(this_present_status && that_present_status))
+        return false;
+      if (!this.status.equals(that.status))
+        return false;
+    }
+
+    boolean this_present_privileges = true && this.isSetPrivileges();
+    boolean that_present_privileges = true && that.isSetPrivileges();
+    if (this_present_privileges || that_present_privileges) {
+      if (!(this_present_privileges && that_present_privileges))
+        return false;
+      if (!this.privileges.equals(that.privileges))
+        return false;
+    }
+
+    return true;
+  }
+
+  @Override
+  public int hashCode() {
+    HashCodeBuilder builder = new HashCodeBuilder();
+
+    boolean present_status = true && (isSetStatus());
+    builder.append(present_status);
+    if (present_status)
+      builder.append(status);
+
+    boolean present_privileges = true && (isSetPrivileges());
+    builder.append(present_privileges);
+    if (present_privileges)
+      builder.append(privileges);
+
+    return builder.toHashCode();
+  }
+
+  public int compareTo(TListSentryPrivilegesResponse other) {
+    if (!getClass().equals(other.getClass())) {
+      return getClass().getName().compareTo(other.getClass().getName());
+    }
+
+    int lastComparison = 0;
+    TListSentryPrivilegesResponse typedOther = (TListSentryPrivilegesResponse)other;
+
+    lastComparison = Boolean.valueOf(isSetStatus()).compareTo(typedOther.isSetStatus());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetStatus()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.status, typedOther.status);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    lastComparison = Boolean.valueOf(isSetPrivileges()).compareTo(typedOther.isSetPrivileges());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetPrivileges()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.privileges, typedOther.privileges);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    return 0;
+  }
+
+  public _Fields fieldForId(int fieldId) {
+    return _Fields.findByThriftId(fieldId);
+  }
+
+  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
+    schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
+  }
+
+  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
+    schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
+  }
+
+  @Override
+  public String toString() {
+    StringBuilder sb = new StringBuilder("TListSentryPrivilegesResponse(");
+    boolean first = true;
+
+    sb.append("status:");
+    if (this.status == null) {
+      sb.append("null");
+    } else {
+      sb.append(this.status);
+    }
+    first = false;
+    if (!first) sb.append(", ");
+    sb.append("privileges:");
+    if (this.privileges == null) {
+      sb.append("null");
+    } else {
+      sb.append(this.privileges);
+    }
+    first = false;
+    sb.append(")");
+    return sb.toString();
+  }
+
+  public void validate() throws org.apache.thrift.TException {
+    // check for required fields
+    if (!isSetStatus()) {
+      throw new org.apache.thrift.protocol.TProtocolException("Required field 'status' is unset! Struct:" + toString());
+    }
+
+    if (!isSetPrivileges()) {
+      throw new org.apache.thrift.protocol.TProtocolException("Required field 'privileges' is unset! Struct:" + toString());
+    }
+
+    // check for sub-struct validity
+    if (status != null) {
+      status.validate();
+    }
+  }
+
+  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+    try {
+      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+    } catch (org.apache.thrift.TException te) {
+      throw new java.io.IOException(te);
+    }
+  }
+
+  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+    try {
+      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+    } catch (org.apache.thrift.TException te) {
+      throw new java.io.IOException(te);
+    }
+  }
+
+  private static class TListSentryPrivilegesResponseStandardSchemeFactory implements SchemeFactory {
+    public TListSentryPrivilegesResponseStandardScheme getScheme() {
+      return new TListSentryPrivilegesResponseStandardScheme();
+    }
+  }
+
+  private static class TListSentryPrivilegesResponseStandardScheme extends StandardScheme<TListSentryPrivilegesResponse> {
+
+    public void read(org.apache.thrift.protocol.TProtocol iprot, TListSentryPrivilegesResponse struct) throws org.apache.thrift.TException {
+      org.apache.thrift.protocol.TField schemeField;
+      iprot.readStructBegin();
+      while (true)
+      {
+        schemeField = iprot.readFieldBegin();
+        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
+          break;
+        }
+        switch (schemeField.id) {
+          case 1: // STATUS
+            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+              struct.status = new org.apache.sentry.service.thrift.TSentryResponseStatus();
+              struct.status.read(iprot);
+              struct.setStatusIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 2: // PRIVILEGES
+            if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
+              {
+                org.apache.thrift.protocol.TSet _set96 = iprot.readSetBegin();
+                struct.privileges = new HashSet<TSentryPrivilege>(2*_set96.size);
+                for (int _i97 = 0; _i97 < _set96.size; ++_i97)
+                {
+                  TSentryPrivilege _elem98; // required
+                  _elem98 = new TSentryPrivilege();
+                  _elem98.read(iprot);
+                  struct.privileges.add(_elem98);
+                }
+                iprot.readSetEnd();
+              }
+              struct.setPrivilegesIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          default:
+            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+        }
+        iprot.readFieldEnd();
+      }
+      iprot.readStructEnd();
+      struct.validate();
+    }
+
+    public void write(org.apache.thrift.protocol.TProtocol oprot, TListSentryPrivilegesResponse struct) throws org.apache.thrift.TException {
+      struct.validate();
+
+      oprot.writeStructBegin(STRUCT_DESC);
+      if (struct.status != null) {
+        oprot.writeFieldBegin(STATUS_FIELD_DESC);
+        struct.status.write(oprot);
+        oprot.writeFieldEnd();
+      }
+      if (struct.privileges != null) {
+        oprot.writeFieldBegin(PRIVILEGES_FIELD_DESC);
+        {
+          oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, struct.privileges.size()));
+          for (TSentryPrivilege _iter99 : struct.privileges)
+          {
+            _iter99.write(oprot);
+          }
+          oprot.writeSetEnd();
+        }
+        oprot.writeFieldEnd();
+      }
+      oprot.writeFieldStop();
+      oprot.writeStructEnd();
+    }
+
+  }
+
+  private static class TListSentryPrivilegesResponseTupleSchemeFactory implements SchemeFactory {
+    public TListSentryPrivilegesResponseTupleScheme getScheme() {
+      return new TListSentryPrivilegesResponseTupleScheme();
+    }
+  }
+
+  private static class TListSentryPrivilegesResponseTupleScheme extends TupleScheme<TListSentryPrivilegesResponse> {
+
+    @Override
+    public void write(org.apache.thrift.protocol.TProtocol prot, TListSentryPrivilegesResponse struct) throws org.apache.thrift.TException {
+      TTupleProtocol oprot = (TTupleProtocol) prot;
+      struct.status.write(oprot);
+      {
+        oprot.writeI32(struct.privileges.size());
+        for (TSentryPrivilege _iter100 : struct.privileges)
+        {
+          _iter100.write(oprot);
+        }
+      }
+    }
+
+    @Override
+    public void read(org.apache.thrift.protocol.TProtocol prot, TListSentryPrivilegesResponse struct) throws org.apache.thrift.TException {
+      TTupleProtocol iprot = (TTupleProtocol) prot;
+      struct.status = new org.apache.sentry.service.thrift.TSentryResponseStatus();
+      struct.status.read(iprot);
+      struct.setStatusIsSet(true);
+      {
+        org.apache.thrift.protocol.TSet _set101 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
+        struct.privileges = new HashSet<TSentryPrivilege>(2*_set101.size);
+        for (int _i102 = 0; _i102 < _set101.size; ++_i102)
+        {
+          TSentryPrivilege _elem103; // required
+          _elem103 = new TSentryPrivilege();
+          _elem103.read(iprot);
+          struct.privileges.add(_elem103);
+        }
+      }
+      struct.setPrivilegesIsSet(true);
+    }
+  }
+
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0fea11ab/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryRolesRequest.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryRolesRequest.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryRolesRequest.java
index eef34f8..c8873a8 100644
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryRolesRequest.java
+++ b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryRolesRequest.java
@@ -36,8 +36,8 @@ public class TListSentryRolesRequest implements org.apache.thrift.TBase<TListSen
 
   private static final org.apache.thrift.protocol.TField PROTOCOL_VERSION_FIELD_DESC = new org.apache.thrift.protocol.TField("protocol_version", org.apache.thrift.protocol.TType.I32, (short)1);
   private static final org.apache.thrift.protocol.TField REQUESTOR_USER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("requestorUserName", org.apache.thrift.protocol.TType.STRING, (short)2);
-  private static final org.apache.thrift.protocol.TField ROLEREQUESTOR_GROUP_NAMES_FIELD_DESC = new org.apache.thrift.protocol.TField("rolerequestorGroupNames", org.apache.thrift.protocol.TType.STRING, (short)3);
-  private static final org.apache.thrift.protocol.TField ROLE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("roleName", org.apache.thrift.protocol.TType.STRING, (short)4);
+  private static final org.apache.thrift.protocol.TField REQUESTOR_GROUP_NAMES_FIELD_DESC = new org.apache.thrift.protocol.TField("requestorGroupNames", org.apache.thrift.protocol.TType.SET, (short)3);
+  private static final org.apache.thrift.protocol.TField GROUP_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("groupName", org.apache.thrift.protocol.TType.STRING, (short)4);
 
   private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
   static {
@@ -47,15 +47,15 @@ public class TListSentryRolesRequest implements org.apache.thrift.TBase<TListSen
 
   private int protocol_version; // required
   private String requestorUserName; // required
-  private String rolerequestorGroupNames; // optional
-  private String roleName; // required
+  private Set<String> requestorGroupNames; // required
+  private String groupName; // optional
 
   /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
   public enum _Fields implements org.apache.thrift.TFieldIdEnum {
     PROTOCOL_VERSION((short)1, "protocol_version"),
     REQUESTOR_USER_NAME((short)2, "requestorUserName"),
-    ROLEREQUESTOR_GROUP_NAMES((short)3, "rolerequestorGroupNames"),
-    ROLE_NAME((short)4, "roleName");
+    REQUESTOR_GROUP_NAMES((short)3, "requestorGroupNames"),
+    GROUP_NAME((short)4, "groupName");
 
     private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
 
@@ -74,10 +74,10 @@ public class TListSentryRolesRequest implements org.apache.thrift.TBase<TListSen
           return PROTOCOL_VERSION;
         case 2: // REQUESTOR_USER_NAME
           return REQUESTOR_USER_NAME;
-        case 3: // ROLEREQUESTOR_GROUP_NAMES
-          return ROLEREQUESTOR_GROUP_NAMES;
-        case 4: // ROLE_NAME
-          return ROLE_NAME;
+        case 3: // REQUESTOR_GROUP_NAMES
+          return REQUESTOR_GROUP_NAMES;
+        case 4: // GROUP_NAME
+          return GROUP_NAME;
         default:
           return null;
       }
@@ -120,7 +120,7 @@ public class TListSentryRolesRequest implements org.apache.thrift.TBase<TListSen
   // isset id assignments
   private static final int __PROTOCOL_VERSION_ISSET_ID = 0;
   private byte __isset_bitfield = 0;
-  private _Fields optionals[] = {_Fields.ROLEREQUESTOR_GROUP_NAMES};
+  private _Fields optionals[] = {_Fields.GROUP_NAME};
   public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
   static {
     Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
@@ -128,9 +128,10 @@ public class TListSentryRolesRequest implements org.apache.thrift.TBase<TListSen
         new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
     tmpMap.put(_Fields.REQUESTOR_USER_NAME, new org.apache.thrift.meta_data.FieldMetaData("requestorUserName", org.apache.thrift.TFieldRequirementType.REQUIRED, 
         new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
-    tmpMap.put(_Fields.ROLEREQUESTOR_GROUP_NAMES, new org.apache.thrift.meta_data.FieldMetaData("rolerequestorGroupNames", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
-        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
-    tmpMap.put(_Fields.ROLE_NAME, new org.apache.thrift.meta_data.FieldMetaData("roleName", org.apache.thrift.TFieldRequirementType.REQUIRED, 
+    tmpMap.put(_Fields.REQUESTOR_GROUP_NAMES, new org.apache.thrift.meta_data.FieldMetaData("requestorGroupNames", org.apache.thrift.TFieldRequirementType.REQUIRED, 
+        new org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET, 
+            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
+    tmpMap.put(_Fields.GROUP_NAME, new org.apache.thrift.meta_data.FieldMetaData("groupName", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
         new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
     metaDataMap = Collections.unmodifiableMap(tmpMap);
     org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TListSentryRolesRequest.class, metaDataMap);
@@ -144,13 +145,13 @@ public class TListSentryRolesRequest implements org.apache.thrift.TBase<TListSen
   public TListSentryRolesRequest(
     int protocol_version,
     String requestorUserName,
-    String roleName)
+    Set<String> requestorGroupNames)
   {
     this();
     this.protocol_version = protocol_version;
     setProtocol_versionIsSet(true);
     this.requestorUserName = requestorUserName;
-    this.roleName = roleName;
+    this.requestorGroupNames = requestorGroupNames;
   }
 
   /**
@@ -162,11 +163,15 @@ public class TListSentryRolesRequest implements org.apache.thrift.TBase<TListSen
     if (other.isSetRequestorUserName()) {
       this.requestorUserName = other.requestorUserName;
     }
-    if (other.isSetRolerequestorGroupNames()) {
-      this.rolerequestorGroupNames = other.rolerequestorGroupNames;
+    if (other.isSetRequestorGroupNames()) {
+      Set<String> __this__requestorGroupNames = new HashSet<String>();
+      for (String other_element : other.requestorGroupNames) {
+        __this__requestorGroupNames.add(other_element);
+      }
+      this.requestorGroupNames = __this__requestorGroupNames;
     }
-    if (other.isSetRoleName()) {
-      this.roleName = other.roleName;
+    if (other.isSetGroupName()) {
+      this.groupName = other.groupName;
     }
   }
 
@@ -179,8 +184,8 @@ public class TListSentryRolesRequest implements org.apache.thrift.TBase<TListSen
     this.protocol_version = 1;
 
     this.requestorUserName = null;
-    this.rolerequestorGroupNames = null;
-    this.roleName = null;
+    this.requestorGroupNames = null;
+    this.groupName = null;
   }
 
   public int getProtocol_version() {
@@ -228,49 +233,64 @@ public class TListSentryRolesRequest implements org.apache.thrift.TBase<TListSen
     }
   }
 
-  public String getRolerequestorGroupNames() {
-    return this.rolerequestorGroupNames;
+  public int getRequestorGroupNamesSize() {
+    return (this.requestorGroupNames == null) ? 0 : this.requestorGroupNames.size();
+  }
+
+  public java.util.Iterator<String> getRequestorGroupNamesIterator() {
+    return (this.requestorGroupNames == null) ? null : this.requestorGroupNames.iterator();
+  }
+
+  public void addToRequestorGroupNames(String elem) {
+    if (this.requestorGroupNames == null) {
+      this.requestorGroupNames = new HashSet<String>();
+    }
+    this.requestorGroupNames.add(elem);
+  }
+
+  public Set<String> getRequestorGroupNames() {
+    return this.requestorGroupNames;
   }
 
-  public void setRolerequestorGroupNames(String rolerequestorGroupNames) {
-    this.rolerequestorGroupNames = rolerequestorGroupNames;
+  public void setRequestorGroupNames(Set<String> requestorGroupNames) {
+    this.requestorGroupNames = requestorGroupNames;
   }
 
-  public void unsetRolerequestorGroupNames() {
-    this.rolerequestorGroupNames = null;
+  public void unsetRequestorGroupNames() {
+    this.requestorGroupNames = null;
   }
 
-  /** Returns true if field rolerequestorGroupNames is set (has been assigned a value) and false otherwise */
-  public boolean isSetRolerequestorGroupNames() {
-    return this.rolerequestorGroupNames != null;
+  /** Returns true if field requestorGroupNames is set (has been assigned a value) and false otherwise */
+  public boolean isSetRequestorGroupNames() {
+    return this.requestorGroupNames != null;
   }
 
-  public void setRolerequestorGroupNamesIsSet(boolean value) {
+  public void setRequestorGroupNamesIsSet(boolean value) {
     if (!value) {
-      this.rolerequestorGroupNames = null;
+      this.requestorGroupNames = null;
     }
   }
 
-  public String getRoleName() {
-    return this.roleName;
+  public String getGroupName() {
+    return this.groupName;
   }
 
-  public void setRoleName(String roleName) {
-    this.roleName = roleName;
+  public void setGroupName(String groupName) {
+    this.groupName = groupName;
   }
 
-  public void unsetRoleName() {
-    this.roleName = null;
+  public void unsetGroupName() {
+    this.groupName = null;
   }
 
-  /** Returns true if field roleName is set (has been assigned a value) and false otherwise */
-  public boolean isSetRoleName() {
-    return this.roleName != null;
+  /** Returns true if field groupName is set (has been assigned a value) and false otherwise */
+  public boolean isSetGroupName() {
+    return this.groupName != null;
   }
 
-  public void setRoleNameIsSet(boolean value) {
+  public void setGroupNameIsSet(boolean value) {
     if (!value) {
-      this.roleName = null;
+      this.groupName = null;
     }
   }
 
@@ -292,19 +312,19 @@ public class TListSentryRolesRequest implements org.apache.thrift.TBase<TListSen
       }
       break;
 
-    case ROLEREQUESTOR_GROUP_NAMES:
+    case REQUESTOR_GROUP_NAMES:
       if (value == null) {
-        unsetRolerequestorGroupNames();
+        unsetRequestorGroupNames();
       } else {
-        setRolerequestorGroupNames((String)value);
+        setRequestorGroupNames((Set<String>)value);
       }
       break;
 
-    case ROLE_NAME:
+    case GROUP_NAME:
       if (value == null) {
-        unsetRoleName();
+        unsetGroupName();
       } else {
-        setRoleName((String)value);
+        setGroupName((String)value);
       }
       break;
 
@@ -319,11 +339,11 @@ public class TListSentryRolesRequest implements org.apache.thrift.TBase<TListSen
     case REQUESTOR_USER_NAME:
       return getRequestorUserName();
 
-    case ROLEREQUESTOR_GROUP_NAMES:
-      return getRolerequestorGroupNames();
+    case REQUESTOR_GROUP_NAMES:
+      return getRequestorGroupNames();
 
-    case ROLE_NAME:
-      return getRoleName();
+    case GROUP_NAME:
+      return getGroupName();
 
     }
     throw new IllegalStateException();
@@ -340,10 +360,10 @@ public class TListSentryRolesRequest implements org.apache.thrift.TBase<TListSen
       return isSetProtocol_version();
     case REQUESTOR_USER_NAME:
       return isSetRequestorUserName();
-    case ROLEREQUESTOR_GROUP_NAMES:
-      return isSetRolerequestorGroupNames();
-    case ROLE_NAME:
-      return isSetRoleName();
+    case REQUESTOR_GROUP_NAMES:
+      return isSetRequestorGroupNames();
+    case GROUP_NAME:
+      return isSetGroupName();
     }
     throw new IllegalStateException();
   }
@@ -379,21 +399,21 @@ public class TListSentryRolesRequest implements org.apache.thrift.TBase<TListSen
         return false;
     }
 
-    boolean this_present_rolerequestorGroupNames = true && this.isSetRolerequestorGroupNames();
-    boolean that_present_rolerequestorGroupNames = true && that.isSetRolerequestorGroupNames();
-    if (this_present_rolerequestorGroupNames || that_present_rolerequestorGroupNames) {
-      if (!(this_present_rolerequestorGroupNames && that_present_rolerequestorGroupNames))
+    boolean this_present_requestorGroupNames = true && this.isSetRequestorGroupNames();
+    boolean that_present_requestorGroupNames = true && that.isSetRequestorGroupNames();
+    if (this_present_requestorGroupNames || that_present_requestorGroupNames) {
+      if (!(this_present_requestorGroupNames && that_present_requestorGroupNames))
         return false;
-      if (!this.rolerequestorGroupNames.equals(that.rolerequestorGroupNames))
+      if (!this.requestorGroupNames.equals(that.requestorGroupNames))
         return false;
     }
 
-    boolean this_present_roleName = true && this.isSetRoleName();
-    boolean that_present_roleName = true && that.isSetRoleName();
-    if (this_present_roleName || that_present_roleName) {
-      if (!(this_present_roleName && that_present_roleName))
+    boolean this_present_groupName = true && this.isSetGroupName();
+    boolean that_present_groupName = true && that.isSetGroupName();
+    if (this_present_groupName || that_present_groupName) {
+      if (!(this_present_groupName && that_present_groupName))
         return false;
-      if (!this.roleName.equals(that.roleName))
+      if (!this.groupName.equals(that.groupName))
         return false;
     }
 
@@ -414,15 +434,15 @@ public class TListSentryRolesRequest implements org.apache.thrift.TBase<TListSen
     if (present_requestorUserName)
       builder.append(requestorUserName);
 
-    boolean present_rolerequestorGroupNames = true && (isSetRolerequestorGroupNames());
-    builder.append(present_rolerequestorGroupNames);
-    if (present_rolerequestorGroupNames)
-      builder.append(rolerequestorGroupNames);
+    boolean present_requestorGroupNames = true && (isSetRequestorGroupNames());
+    builder.append(present_requestorGroupNames);
+    if (present_requestorGroupNames)
+      builder.append(requestorGroupNames);
 
-    boolean present_roleName = true && (isSetRoleName());
-    builder.append(present_roleName);
-    if (present_roleName)
-      builder.append(roleName);
+    boolean present_groupName = true && (isSetGroupName());
+    builder.append(present_groupName);
+    if (present_groupName)
+      builder.append(groupName);
 
     return builder.toHashCode();
   }
@@ -455,22 +475,22 @@ public class TListSentryRolesRequest implements org.apache.thrift.TBase<TListSen
         return lastComparison;
       }
     }
-    lastComparison = Boolean.valueOf(isSetRolerequestorGroupNames()).compareTo(typedOther.isSetRolerequestorGroupNames());
+    lastComparison = Boolean.valueOf(isSetRequestorGroupNames()).compareTo(typedOther.isSetRequestorGroupNames());
     if (lastComparison != 0) {
       return lastComparison;
     }
-    if (isSetRolerequestorGroupNames()) {
-      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.rolerequestorGroupNames, typedOther.rolerequestorGroupNames);
+    if (isSetRequestorGroupNames()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.requestorGroupNames, typedOther.requestorGroupNames);
       if (lastComparison != 0) {
         return lastComparison;
       }
     }
-    lastComparison = Boolean.valueOf(isSetRoleName()).compareTo(typedOther.isSetRoleName());
+    lastComparison = Boolean.valueOf(isSetGroupName()).compareTo(typedOther.isSetGroupName());
     if (lastComparison != 0) {
       return lastComparison;
     }
-    if (isSetRoleName()) {
-      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.roleName, typedOther.roleName);
+    if (isSetGroupName()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.groupName, typedOther.groupName);
       if (lastComparison != 0) {
         return lastComparison;
       }
@@ -506,24 +526,24 @@ public class TListSentryRolesRequest implements org.apache.thrift.TBase<TListSen
       sb.append(this.requestorUserName);
     }
     first = false;
-    if (isSetRolerequestorGroupNames()) {
+    if (!first) sb.append(", ");
+    sb.append("requestorGroupNames:");
+    if (this.requestorGroupNames == null) {
+      sb.append("null");
+    } else {
+      sb.append(this.requestorGroupNames);
+    }
+    first = false;
+    if (isSetGroupName()) {
       if (!first) sb.append(", ");
-      sb.append("rolerequestorGroupNames:");
-      if (this.rolerequestorGroupNames == null) {
+      sb.append("groupName:");
+      if (this.groupName == null) {
         sb.append("null");
       } else {
-        sb.append(this.rolerequestorGroupNames);
+        sb.append(this.groupName);
       }
       first = false;
     }
-    if (!first) sb.append(", ");
-    sb.append("roleName:");
-    if (this.roleName == null) {
-      sb.append("null");
-    } else {
-      sb.append(this.roleName);
-    }
-    first = false;
     sb.append(")");
     return sb.toString();
   }
@@ -538,8 +558,8 @@ public class TListSentryRolesRequest implements org.apache.thrift.TBase<TListSen
       throw new org.apache.thrift.protocol.TProtocolException("Required field 'requestorUserName' is unset! Struct:" + toString());
     }
 
-    if (!isSetRoleName()) {
-      throw new org.apache.thrift.protocol.TProtocolException("Required field 'roleName' is unset! Struct:" + toString());
+    if (!isSetRequestorGroupNames()) {
+      throw new org.apache.thrift.protocol.TProtocolException("Required field 'requestorGroupNames' is unset! Struct:" + toString());
     }
 
     // check for sub-struct validity
@@ -597,18 +617,28 @@ public class TListSentryRolesRequest implements org.apache.thrift.TBase<TListSen
               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
             }
             break;
-          case 3: // ROLEREQUESTOR_GROUP_NAMES
-            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
-              struct.rolerequestorGroupNames = iprot.readString();
-              struct.setRolerequestorGroupNamesIsSet(true);
+          case 3: // REQUESTOR_GROUP_NAMES
+            if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
+              {
+                org.apache.thrift.protocol.TSet _set64 = iprot.readSetBegin();
+                struct.requestorGroupNames = new HashSet<String>(2*_set64.size);
+                for (int _i65 = 0; _i65 < _set64.size; ++_i65)
+                {
+                  String _elem66; // required
+                  _elem66 = iprot.readString();
+                  struct.requestorGroupNames.add(_elem66);
+                }
+                iprot.readSetEnd();
+              }
+              struct.setRequestorGroupNamesIsSet(true);
             } else { 
               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
             }
             break;
-          case 4: // ROLE_NAME
+          case 4: // GROUP_NAME
             if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
-              struct.roleName = iprot.readString();
-              struct.setRoleNameIsSet(true);
+              struct.groupName = iprot.readString();
+              struct.setGroupNameIsSet(true);
             } else { 
               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
             }
@@ -634,18 +664,25 @@ public class TListSentryRolesRequest implements org.apache.thrift.TBase<TListSen
         oprot.writeString(struct.requestorUserName);
         oprot.writeFieldEnd();
       }
-      if (struct.rolerequestorGroupNames != null) {
-        if (struct.isSetRolerequestorGroupNames()) {
-          oprot.writeFieldBegin(ROLEREQUESTOR_GROUP_NAMES_FIELD_DESC);
-          oprot.writeString(struct.rolerequestorGroupNames);
-          oprot.writeFieldEnd();
+      if (struct.requestorGroupNames != null) {
+        oprot.writeFieldBegin(REQUESTOR_GROUP_NAMES_FIELD_DESC);
+        {
+          oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, struct.requestorGroupNames.size()));
+          for (String _iter67 : struct.requestorGroupNames)
+          {
+            oprot.writeString(_iter67);
+          }
+          oprot.writeSetEnd();
         }
-      }
-      if (struct.roleName != null) {
-        oprot.writeFieldBegin(ROLE_NAME_FIELD_DESC);
-        oprot.writeString(struct.roleName);
         oprot.writeFieldEnd();
       }
+      if (struct.groupName != null) {
+        if (struct.isSetGroupName()) {
+          oprot.writeFieldBegin(GROUP_NAME_FIELD_DESC);
+          oprot.writeString(struct.groupName);
+          oprot.writeFieldEnd();
+        }
+      }
       oprot.writeFieldStop();
       oprot.writeStructEnd();
     }
@@ -665,14 +702,20 @@ public class TListSentryRolesRequest implements org.apache.thrift.TBase<TListSen
       TTupleProtocol oprot = (TTupleProtocol) prot;
       oprot.writeI32(struct.protocol_version);
       oprot.writeString(struct.requestorUserName);
-      oprot.writeString(struct.roleName);
+      {
+        oprot.writeI32(struct.requestorGroupNames.size());
+        for (String _iter68 : struct.requestorGroupNames)
+        {
+          oprot.writeString(_iter68);
+        }
+      }
       BitSet optionals = new BitSet();
-      if (struct.isSetRolerequestorGroupNames()) {
+      if (struct.isSetGroupName()) {
         optionals.set(0);
       }
       oprot.writeBitSet(optionals, 1);
-      if (struct.isSetRolerequestorGroupNames()) {
-        oprot.writeString(struct.rolerequestorGroupNames);
+      if (struct.isSetGroupName()) {
+        oprot.writeString(struct.groupName);
       }
     }
 
@@ -683,12 +726,21 @@ public class TListSentryRolesRequest implements org.apache.thrift.TBase<TListSen
       struct.setProtocol_versionIsSet(true);
       struct.requestorUserName = iprot.readString();
       struct.setRequestorUserNameIsSet(true);
-      struct.roleName = iprot.readString();
-      struct.setRoleNameIsSet(true);
+      {
+        org.apache.thrift.protocol.TSet _set69 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
+        struct.requestorGroupNames = new HashSet<String>(2*_set69.size);
+        for (int _i70 = 0; _i70 < _set69.size; ++_i70)
+        {
+          String _elem71; // required
+          _elem71 = iprot.readString();
+          struct.requestorGroupNames.add(_elem71);
+        }
+      }
+      struct.setRequestorGroupNamesIsSet(true);
       BitSet incoming = iprot.readBitSet(1);
       if (incoming.get(0)) {
-        struct.rolerequestorGroupNames = iprot.readString();
-        struct.setRolerequestorGroupNamesIsSet(true);
+        struct.groupName = iprot.readString();
+        struct.setGroupNameIsSet(true);
       }
     }
   }

http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0fea11ab/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryRolesResponse.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryRolesResponse.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryRolesResponse.java
index f3dfac2..3440b5e 100644
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryRolesResponse.java
+++ b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryRolesResponse.java
@@ -447,14 +447,14 @@ public class TListSentryRolesResponse implements org.apache.thrift.TBase<TListSe
           case 2: // ROLES
             if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
               {
-                org.apache.thrift.protocol.TSet _set24 = iprot.readSetBegin();
-                struct.roles = new HashSet<TSentryRole>(2*_set24.size);
-                for (int _i25 = 0; _i25 < _set24.size; ++_i25)
+                org.apache.thrift.protocol.TSet _set80 = iprot.readSetBegin();
+                struct.roles = new HashSet<TSentryRole>(2*_set80.size);
+                for (int _i81 = 0; _i81 < _set80.size; ++_i81)
                 {
-                  TSentryRole _elem26; // required
-                  _elem26 = new TSentryRole();
-                  _elem26.read(iprot);
-                  struct.roles.add(_elem26);
+                  TSentryRole _elem82; // required
+                  _elem82 = new TSentryRole();
+                  _elem82.read(iprot);
+                  struct.roles.add(_elem82);
                 }
                 iprot.readSetEnd();
               }
@@ -485,9 +485,9 @@ public class TListSentryRolesResponse implements org.apache.thrift.TBase<TListSe
         oprot.writeFieldBegin(ROLES_FIELD_DESC);
         {
           oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, struct.roles.size()));
-          for (TSentryRole _iter27 : struct.roles)
+          for (TSentryRole _iter83 : struct.roles)
           {
-            _iter27.write(oprot);
+            _iter83.write(oprot);
           }
           oprot.writeSetEnd();
         }
@@ -513,9 +513,9 @@ public class TListSentryRolesResponse implements org.apache.thrift.TBase<TListSe
       struct.status.write(oprot);
       {
         oprot.writeI32(struct.roles.size());
-        for (TSentryRole _iter28 : struct.roles)
+        for (TSentryRole _iter84 : struct.roles)
         {
-          _iter28.write(oprot);
+          _iter84.write(oprot);
         }
       }
     }
@@ -527,14 +527,14 @@ public class TListSentryRolesResponse implements org.apache.thrift.TBase<TListSe
       struct.status.read(iprot);
       struct.setStatusIsSet(true);
       {
-        org.apache.thrift.protocol.TSet _set29 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
-        struct.roles = new HashSet<TSentryRole>(2*_set29.size);
-        for (int _i30 = 0; _i30 < _set29.size; ++_i30)
+        org.apache.thrift.protocol.TSet _set85 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
+        struct.roles = new HashSet<TSentryRole>(2*_set85.size);
+        for (int _i86 = 0; _i86 < _set85.size; ++_i86)
         {
-          TSentryRole _elem31; // required
-          _elem31 = new TSentryRole();
-          _elem31.read(iprot);
-          struct.roles.add(_elem31);
+          TSentryRole _elem87; // required
+          _elem87 = new TSentryRole();
+          _elem87.read(iprot);
+          struct.roles.add(_elem87);
         }
       }
       struct.setRolesIsSet(true);

http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0fea11ab/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryActiveRoleSet.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryActiveRoleSet.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryActiveRoleSet.java
index 9d96139..8a4f62a 100644
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryActiveRoleSet.java
+++ b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryActiveRoleSet.java
@@ -443,13 +443,13 @@ public class TSentryActiveRoleSet implements org.apache.thrift.TBase<TSentryActi
           case 2: // ROLES
             if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
               {
-                org.apache.thrift.protocol.TSet _set80 = iprot.readSetBegin();
-                struct.roles = new HashSet<String>(2*_set80.size);
-                for (int _i81 = 0; _i81 < _set80.size; ++_i81)
+                org.apache.thrift.protocol.TSet _set104 = iprot.readSetBegin();
+                struct.roles = new HashSet<String>(2*_set104.size);
+                for (int _i105 = 0; _i105 < _set104.size; ++_i105)
                 {
-                  String _elem82; // required
-                  _elem82 = iprot.readString();
-                  struct.roles.add(_elem82);
+                  String _elem106; // required
+                  _elem106 = iprot.readString();
+                  struct.roles.add(_elem106);
                 }
                 iprot.readSetEnd();
               }
@@ -478,9 +478,9 @@ public class TSentryActiveRoleSet implements org.apache.thrift.TBase<TSentryActi
         oprot.writeFieldBegin(ROLES_FIELD_DESC);
         {
           oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, struct.roles.size()));
-          for (String _iter83 : struct.roles)
+          for (String _iter107 : struct.roles)
           {
-            oprot.writeString(_iter83);
+            oprot.writeString(_iter107);
           }
           oprot.writeSetEnd();
         }
@@ -506,9 +506,9 @@ public class TSentryActiveRoleSet implements org.apache.thrift.TBase<TSentryActi
       oprot.writeBool(struct.all);
       {
         oprot.writeI32(struct.roles.size());
-        for (String _iter84 : struct.roles)
+        for (String _iter108 : struct.roles)
         {
-          oprot.writeString(_iter84);
+          oprot.writeString(_iter108);
         }
       }
     }
@@ -519,13 +519,13 @@ public class TSentryActiveRoleSet implements org.apache.thrift.TBase<TSentryActi
       struct.all = iprot.readBool();
       struct.setAllIsSet(true);
       {
-        org.apache.thrift.protocol.TSet _set85 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
-        struct.roles = new HashSet<String>(2*_set85.size);
-        for (int _i86 = 0; _i86 < _set85.size; ++_i86)
+        org.apache.thrift.protocol.TSet _set109 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
+        struct.roles = new HashSet<String>(2*_set109.size);
+        for (int _i110 = 0; _i110 < _set109.size; ++_i110)
         {
-          String _elem87; // required
-          _elem87 = iprot.readString();
-          struct.roles.add(_elem87);
+          String _elem111; // required
+          _elem111 = iprot.readString();
+          struct.roles.add(_elem111);
         }
       }
       struct.setRolesIsSet(true);


[3/3] git commit: Add Sentry service APIs to query roles and privileges (Sravya Tirukkovalur via Prasad Mujumdar)

Posted by pr...@apache.org.
Add Sentry service APIs to query roles and privileges (Sravya Tirukkovalur via Prasad Mujumdar)


Project: http://git-wip-us.apache.org/repos/asf/incubator-sentry/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-sentry/commit/0fea11ab
Tree: http://git-wip-us.apache.org/repos/asf/incubator-sentry/tree/0fea11ab
Diff: http://git-wip-us.apache.org/repos/asf/incubator-sentry/diff/0fea11ab

Branch: refs/heads/master
Commit: 0fea11ab366eb0e4d3aa090d470e4523ec987fd7
Parents: 8f1ef00
Author: Prasad Mujumdar <pr...@cloudera.com>
Authored: Wed May 7 16:06:15 2014 -0700
Committer: Prasad Mujumdar <pr...@cloudera.com>
Committed: Wed May 7 16:06:15 2014 -0700

----------------------------------------------------------------------
 .../db/service/thrift/SentryPolicyService.java  | 208 +++---
 .../TAlterSentryRoleAddGroupsRequest.java       |  68 +-
 .../TAlterSentryRoleDeleteGroupsRequest.java    |  68 +-
 .../TAlterSentryRoleGrantPrivilegeRequest.java  |  32 +-
 .../TAlterSentryRoleRevokePrivilegeRequest.java |  32 +-
 ...TListSentryPrivilegesForProviderRequest.java |  32 +-
 ...ListSentryPrivilegesForProviderResponse.java |  32 +-
 .../thrift/TListSentryPrivilegesRequest.java    | 740 +++++++++++++++++++
 .../thrift/TListSentryPrivilegesResponse.java   | 545 ++++++++++++++
 .../service/thrift/TListSentryRolesRequest.java | 292 +++++---
 .../thrift/TListSentryRolesResponse.java        |  36 +-
 .../db/service/thrift/TSentryActiveRoleSet.java |  32 +-
 .../provider/db/service/thrift/TSentryRole.java | 166 ++---
 .../provider/db/SimpleDBProviderBackend.java    |   2 +-
 .../provider/db/service/model/MSentryRole.java  |  22 +-
 .../db/service/persistent/SentryStore.java      | 168 ++++-
 .../thrift/SentryPolicyServiceClient.java       |  95 ++-
 .../thrift/SentryPolicyStoreProcessor.java      |  54 +-
 .../main/resources/sentry_policy_service.thrift |  54 +-
 .../thrift/TestSentryServiceIntegration.java    |  95 +--
 20 files changed, 2135 insertions(+), 638 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0fea11ab/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/SentryPolicyService.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/SentryPolicyService.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/SentryPolicyService.java
index cc6eb4f..ff09fdf 100644
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/SentryPolicyService.java
+++ b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/SentryPolicyService.java
@@ -49,7 +49,7 @@ public class SentryPolicyService {
 
     public TListSentryRolesResponse list_sentry_roles_by_group(TListSentryRolesRequest request) throws org.apache.thrift.TException;
 
-    public TListSentryRolesResponse list_sentry_roles_by_role_name(TListSentryRolesRequest request) throws org.apache.thrift.TException;
+    public TListSentryPrivilegesResponse list_sentry_privileges_by_role(TListSentryPrivilegesRequest request) throws org.apache.thrift.TException;
 
     public TListSentryPrivilegesForProviderResponse list_sentry_privileges_for_provider(TListSentryPrivilegesForProviderRequest request) throws org.apache.thrift.TException;
 
@@ -71,7 +71,7 @@ public class SentryPolicyService {
 
     public void list_sentry_roles_by_group(TListSentryRolesRequest request, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.list_sentry_roles_by_group_call> resultHandler) throws org.apache.thrift.TException;
 
-    public void list_sentry_roles_by_role_name(TListSentryRolesRequest request, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.list_sentry_roles_by_role_name_call> resultHandler) throws org.apache.thrift.TException;
+    public void list_sentry_privileges_by_role(TListSentryPrivilegesRequest request, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.list_sentry_privileges_by_role_call> resultHandler) throws org.apache.thrift.TException;
 
     public void list_sentry_privileges_for_provider(TListSentryPrivilegesForProviderRequest request, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.list_sentry_privileges_for_provider_call> resultHandler) throws org.apache.thrift.TException;
 
@@ -258,27 +258,27 @@ public class SentryPolicyService {
       throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "list_sentry_roles_by_group failed: unknown result");
     }
 
-    public TListSentryRolesResponse list_sentry_roles_by_role_name(TListSentryRolesRequest request) throws org.apache.thrift.TException
+    public TListSentryPrivilegesResponse list_sentry_privileges_by_role(TListSentryPrivilegesRequest request) throws org.apache.thrift.TException
     {
-      send_list_sentry_roles_by_role_name(request);
-      return recv_list_sentry_roles_by_role_name();
+      send_list_sentry_privileges_by_role(request);
+      return recv_list_sentry_privileges_by_role();
     }
 
-    public void send_list_sentry_roles_by_role_name(TListSentryRolesRequest request) throws org.apache.thrift.TException
+    public void send_list_sentry_privileges_by_role(TListSentryPrivilegesRequest request) throws org.apache.thrift.TException
     {
-      list_sentry_roles_by_role_name_args args = new list_sentry_roles_by_role_name_args();
+      list_sentry_privileges_by_role_args args = new list_sentry_privileges_by_role_args();
       args.setRequest(request);
-      sendBase("list_sentry_roles_by_role_name", args);
+      sendBase("list_sentry_privileges_by_role", args);
     }
 
-    public TListSentryRolesResponse recv_list_sentry_roles_by_role_name() throws org.apache.thrift.TException
+    public TListSentryPrivilegesResponse recv_list_sentry_privileges_by_role() throws org.apache.thrift.TException
     {
-      list_sentry_roles_by_role_name_result result = new list_sentry_roles_by_role_name_result();
-      receiveBase(result, "list_sentry_roles_by_role_name");
+      list_sentry_privileges_by_role_result result = new list_sentry_privileges_by_role_result();
+      receiveBase(result, "list_sentry_privileges_by_role");
       if (result.isSetSuccess()) {
         return result.success;
       }
-      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "list_sentry_roles_by_role_name failed: unknown result");
+      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "list_sentry_privileges_by_role failed: unknown result");
     }
 
     public TListSentryPrivilegesForProviderResponse list_sentry_privileges_for_provider(TListSentryPrivilegesForProviderRequest request) throws org.apache.thrift.TException
@@ -546,35 +546,35 @@ public class SentryPolicyService {
       }
     }
 
-    public void list_sentry_roles_by_role_name(TListSentryRolesRequest request, org.apache.thrift.async.AsyncMethodCallback<list_sentry_roles_by_role_name_call> resultHandler) throws org.apache.thrift.TException {
+    public void list_sentry_privileges_by_role(TListSentryPrivilegesRequest request, org.apache.thrift.async.AsyncMethodCallback<list_sentry_privileges_by_role_call> resultHandler) throws org.apache.thrift.TException {
       checkReady();
-      list_sentry_roles_by_role_name_call method_call = new list_sentry_roles_by_role_name_call(request, resultHandler, this, ___protocolFactory, ___transport);
+      list_sentry_privileges_by_role_call method_call = new list_sentry_privileges_by_role_call(request, resultHandler, this, ___protocolFactory, ___transport);
       this.___currentMethod = method_call;
       ___manager.call(method_call);
     }
 
-    public static class list_sentry_roles_by_role_name_call extends org.apache.thrift.async.TAsyncMethodCall {
-      private TListSentryRolesRequest request;
-      public list_sentry_roles_by_role_name_call(TListSentryRolesRequest request, org.apache.thrift.async.AsyncMethodCallback<list_sentry_roles_by_role_name_call> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
+    public static class list_sentry_privileges_by_role_call extends org.apache.thrift.async.TAsyncMethodCall {
+      private TListSentryPrivilegesRequest request;
+      public list_sentry_privileges_by_role_call(TListSentryPrivilegesRequest request, org.apache.thrift.async.AsyncMethodCallback<list_sentry_privileges_by_role_call> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
         super(client, protocolFactory, transport, resultHandler, false);
         this.request = request;
       }
 
       public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
-        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("list_sentry_roles_by_role_name", org.apache.thrift.protocol.TMessageType.CALL, 0));
-        list_sentry_roles_by_role_name_args args = new list_sentry_roles_by_role_name_args();
+        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("list_sentry_privileges_by_role", org.apache.thrift.protocol.TMessageType.CALL, 0));
+        list_sentry_privileges_by_role_args args = new list_sentry_privileges_by_role_args();
         args.setRequest(request);
         args.write(prot);
         prot.writeMessageEnd();
       }
 
-      public TListSentryRolesResponse getResult() throws org.apache.thrift.TException {
+      public TListSentryPrivilegesResponse getResult() throws org.apache.thrift.TException {
         if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
           throw new IllegalStateException("Method call not finished!");
         }
         org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
         org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
-        return (new Client(prot)).recv_list_sentry_roles_by_role_name();
+        return (new Client(prot)).recv_list_sentry_privileges_by_role();
       }
     }
 
@@ -630,7 +630,7 @@ public class SentryPolicyService {
       processMap.put("alter_sentry_role_add_groups", new alter_sentry_role_add_groups());
       processMap.put("alter_sentry_role_delete_groups", new alter_sentry_role_delete_groups());
       processMap.put("list_sentry_roles_by_group", new list_sentry_roles_by_group());
-      processMap.put("list_sentry_roles_by_role_name", new list_sentry_roles_by_role_name());
+      processMap.put("list_sentry_privileges_by_role", new list_sentry_privileges_by_role());
       processMap.put("list_sentry_privileges_for_provider", new list_sentry_privileges_for_provider());
       return processMap;
     }
@@ -775,22 +775,22 @@ public class SentryPolicyService {
       }
     }
 
-    public static class list_sentry_roles_by_role_name<I extends Iface> extends org.apache.thrift.ProcessFunction<I, list_sentry_roles_by_role_name_args> {
-      public list_sentry_roles_by_role_name() {
-        super("list_sentry_roles_by_role_name");
+    public static class list_sentry_privileges_by_role<I extends Iface> extends org.apache.thrift.ProcessFunction<I, list_sentry_privileges_by_role_args> {
+      public list_sentry_privileges_by_role() {
+        super("list_sentry_privileges_by_role");
       }
 
-      public list_sentry_roles_by_role_name_args getEmptyArgsInstance() {
-        return new list_sentry_roles_by_role_name_args();
+      public list_sentry_privileges_by_role_args getEmptyArgsInstance() {
+        return new list_sentry_privileges_by_role_args();
       }
 
       protected boolean isOneway() {
         return false;
       }
 
-      public list_sentry_roles_by_role_name_result getResult(I iface, list_sentry_roles_by_role_name_args args) throws org.apache.thrift.TException {
-        list_sentry_roles_by_role_name_result result = new list_sentry_roles_by_role_name_result();
-        result.success = iface.list_sentry_roles_by_role_name(args.request);
+      public list_sentry_privileges_by_role_result getResult(I iface, list_sentry_privileges_by_role_args args) throws org.apache.thrift.TException {
+        list_sentry_privileges_by_role_result result = new list_sentry_privileges_by_role_result();
+        result.success = iface.list_sentry_privileges_by_role(args.request);
         return result;
       }
     }
@@ -5899,18 +5899,18 @@ public class SentryPolicyService {
 
   }
 
-  public static class list_sentry_roles_by_role_name_args implements org.apache.thrift.TBase<list_sentry_roles_by_role_name_args, list_sentry_roles_by_role_name_args._Fields>, java.io.Serializable, Cloneable   {
-    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("list_sentry_roles_by_role_name_args");
+  public static class list_sentry_privileges_by_role_args implements org.apache.thrift.TBase<list_sentry_privileges_by_role_args, list_sentry_privileges_by_role_args._Fields>, java.io.Serializable, Cloneable   {
+    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("list_sentry_privileges_by_role_args");
 
     private static final org.apache.thrift.protocol.TField REQUEST_FIELD_DESC = new org.apache.thrift.protocol.TField("request", org.apache.thrift.protocol.TType.STRUCT, (short)1);
 
     private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
     static {
-      schemes.put(StandardScheme.class, new list_sentry_roles_by_role_name_argsStandardSchemeFactory());
-      schemes.put(TupleScheme.class, new list_sentry_roles_by_role_name_argsTupleSchemeFactory());
+      schemes.put(StandardScheme.class, new list_sentry_privileges_by_role_argsStandardSchemeFactory());
+      schemes.put(TupleScheme.class, new list_sentry_privileges_by_role_argsTupleSchemeFactory());
     }
 
-    private TListSentryRolesRequest request; // required
+    private TListSentryPrivilegesRequest request; // required
 
     /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
     public enum _Fields implements org.apache.thrift.TFieldIdEnum {
@@ -5975,16 +5975,16 @@ public class SentryPolicyService {
     static {
       Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
       tmpMap.put(_Fields.REQUEST, new org.apache.thrift.meta_data.FieldMetaData("request", org.apache.thrift.TFieldRequirementType.DEFAULT, 
-          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TListSentryRolesRequest.class)));
+          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TListSentryPrivilegesRequest.class)));
       metaDataMap = Collections.unmodifiableMap(tmpMap);
-      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(list_sentry_roles_by_role_name_args.class, metaDataMap);
+      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(list_sentry_privileges_by_role_args.class, metaDataMap);
     }
 
-    public list_sentry_roles_by_role_name_args() {
+    public list_sentry_privileges_by_role_args() {
     }
 
-    public list_sentry_roles_by_role_name_args(
-      TListSentryRolesRequest request)
+    public list_sentry_privileges_by_role_args(
+      TListSentryPrivilegesRequest request)
     {
       this();
       this.request = request;
@@ -5993,14 +5993,14 @@ public class SentryPolicyService {
     /**
      * Performs a deep copy on <i>other</i>.
      */
-    public list_sentry_roles_by_role_name_args(list_sentry_roles_by_role_name_args other) {
+    public list_sentry_privileges_by_role_args(list_sentry_privileges_by_role_args other) {
       if (other.isSetRequest()) {
-        this.request = new TListSentryRolesRequest(other.request);
+        this.request = new TListSentryPrivilegesRequest(other.request);
       }
     }
 
-    public list_sentry_roles_by_role_name_args deepCopy() {
-      return new list_sentry_roles_by_role_name_args(this);
+    public list_sentry_privileges_by_role_args deepCopy() {
+      return new list_sentry_privileges_by_role_args(this);
     }
 
     @Override
@@ -6008,11 +6008,11 @@ public class SentryPolicyService {
       this.request = null;
     }
 
-    public TListSentryRolesRequest getRequest() {
+    public TListSentryPrivilegesRequest getRequest() {
       return this.request;
     }
 
-    public void setRequest(TListSentryRolesRequest request) {
+    public void setRequest(TListSentryPrivilegesRequest request) {
       this.request = request;
     }
 
@@ -6037,7 +6037,7 @@ public class SentryPolicyService {
         if (value == null) {
           unsetRequest();
         } else {
-          setRequest((TListSentryRolesRequest)value);
+          setRequest((TListSentryPrivilegesRequest)value);
         }
         break;
 
@@ -6070,12 +6070,12 @@ public class SentryPolicyService {
     public boolean equals(Object that) {
       if (that == null)
         return false;
-      if (that instanceof list_sentry_roles_by_role_name_args)
-        return this.equals((list_sentry_roles_by_role_name_args)that);
+      if (that instanceof list_sentry_privileges_by_role_args)
+        return this.equals((list_sentry_privileges_by_role_args)that);
       return false;
     }
 
-    public boolean equals(list_sentry_roles_by_role_name_args that) {
+    public boolean equals(list_sentry_privileges_by_role_args that) {
       if (that == null)
         return false;
 
@@ -6103,13 +6103,13 @@ public class SentryPolicyService {
       return builder.toHashCode();
     }
 
-    public int compareTo(list_sentry_roles_by_role_name_args other) {
+    public int compareTo(list_sentry_privileges_by_role_args other) {
       if (!getClass().equals(other.getClass())) {
         return getClass().getName().compareTo(other.getClass().getName());
       }
 
       int lastComparison = 0;
-      list_sentry_roles_by_role_name_args typedOther = (list_sentry_roles_by_role_name_args)other;
+      list_sentry_privileges_by_role_args typedOther = (list_sentry_privileges_by_role_args)other;
 
       lastComparison = Boolean.valueOf(isSetRequest()).compareTo(typedOther.isSetRequest());
       if (lastComparison != 0) {
@@ -6138,7 +6138,7 @@ public class SentryPolicyService {
 
     @Override
     public String toString() {
-      StringBuilder sb = new StringBuilder("list_sentry_roles_by_role_name_args(");
+      StringBuilder sb = new StringBuilder("list_sentry_privileges_by_role_args(");
       boolean first = true;
 
       sb.append("request:");
@@ -6176,15 +6176,15 @@ public class SentryPolicyService {
       }
     }
 
-    private static class list_sentry_roles_by_role_name_argsStandardSchemeFactory implements SchemeFactory {
-      public list_sentry_roles_by_role_name_argsStandardScheme getScheme() {
-        return new list_sentry_roles_by_role_name_argsStandardScheme();
+    private static class list_sentry_privileges_by_role_argsStandardSchemeFactory implements SchemeFactory {
+      public list_sentry_privileges_by_role_argsStandardScheme getScheme() {
+        return new list_sentry_privileges_by_role_argsStandardScheme();
       }
     }
 
-    private static class list_sentry_roles_by_role_name_argsStandardScheme extends StandardScheme<list_sentry_roles_by_role_name_args> {
+    private static class list_sentry_privileges_by_role_argsStandardScheme extends StandardScheme<list_sentry_privileges_by_role_args> {
 
-      public void read(org.apache.thrift.protocol.TProtocol iprot, list_sentry_roles_by_role_name_args struct) throws org.apache.thrift.TException {
+      public void read(org.apache.thrift.protocol.TProtocol iprot, list_sentry_privileges_by_role_args struct) throws org.apache.thrift.TException {
         org.apache.thrift.protocol.TField schemeField;
         iprot.readStructBegin();
         while (true)
@@ -6196,7 +6196,7 @@ public class SentryPolicyService {
           switch (schemeField.id) {
             case 1: // REQUEST
               if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
-                struct.request = new TListSentryRolesRequest();
+                struct.request = new TListSentryPrivilegesRequest();
                 struct.request.read(iprot);
                 struct.setRequestIsSet(true);
               } else { 
@@ -6212,7 +6212,7 @@ public class SentryPolicyService {
         struct.validate();
       }
 
-      public void write(org.apache.thrift.protocol.TProtocol oprot, list_sentry_roles_by_role_name_args struct) throws org.apache.thrift.TException {
+      public void write(org.apache.thrift.protocol.TProtocol oprot, list_sentry_privileges_by_role_args struct) throws org.apache.thrift.TException {
         struct.validate();
 
         oprot.writeStructBegin(STRUCT_DESC);
@@ -6227,16 +6227,16 @@ public class SentryPolicyService {
 
     }
 
-    private static class list_sentry_roles_by_role_name_argsTupleSchemeFactory implements SchemeFactory {
-      public list_sentry_roles_by_role_name_argsTupleScheme getScheme() {
-        return new list_sentry_roles_by_role_name_argsTupleScheme();
+    private static class list_sentry_privileges_by_role_argsTupleSchemeFactory implements SchemeFactory {
+      public list_sentry_privileges_by_role_argsTupleScheme getScheme() {
+        return new list_sentry_privileges_by_role_argsTupleScheme();
       }
     }
 
-    private static class list_sentry_roles_by_role_name_argsTupleScheme extends TupleScheme<list_sentry_roles_by_role_name_args> {
+    private static class list_sentry_privileges_by_role_argsTupleScheme extends TupleScheme<list_sentry_privileges_by_role_args> {
 
       @Override
-      public void write(org.apache.thrift.protocol.TProtocol prot, list_sentry_roles_by_role_name_args struct) throws org.apache.thrift.TException {
+      public void write(org.apache.thrift.protocol.TProtocol prot, list_sentry_privileges_by_role_args struct) throws org.apache.thrift.TException {
         TTupleProtocol oprot = (TTupleProtocol) prot;
         BitSet optionals = new BitSet();
         if (struct.isSetRequest()) {
@@ -6249,11 +6249,11 @@ public class SentryPolicyService {
       }
 
       @Override
-      public void read(org.apache.thrift.protocol.TProtocol prot, list_sentry_roles_by_role_name_args struct) throws org.apache.thrift.TException {
+      public void read(org.apache.thrift.protocol.TProtocol prot, list_sentry_privileges_by_role_args struct) throws org.apache.thrift.TException {
         TTupleProtocol iprot = (TTupleProtocol) prot;
         BitSet incoming = iprot.readBitSet(1);
         if (incoming.get(0)) {
-          struct.request = new TListSentryRolesRequest();
+          struct.request = new TListSentryPrivilegesRequest();
           struct.request.read(iprot);
           struct.setRequestIsSet(true);
         }
@@ -6262,18 +6262,18 @@ public class SentryPolicyService {
 
   }
 
-  public static class list_sentry_roles_by_role_name_result implements org.apache.thrift.TBase<list_sentry_roles_by_role_name_result, list_sentry_roles_by_role_name_result._Fields>, java.io.Serializable, Cloneable   {
-    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("list_sentry_roles_by_role_name_result");
+  public static class list_sentry_privileges_by_role_result implements org.apache.thrift.TBase<list_sentry_privileges_by_role_result, list_sentry_privileges_by_role_result._Fields>, java.io.Serializable, Cloneable   {
+    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("list_sentry_privileges_by_role_result");
 
     private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRUCT, (short)0);
 
     private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
     static {
-      schemes.put(StandardScheme.class, new list_sentry_roles_by_role_name_resultStandardSchemeFactory());
-      schemes.put(TupleScheme.class, new list_sentry_roles_by_role_name_resultTupleSchemeFactory());
+      schemes.put(StandardScheme.class, new list_sentry_privileges_by_role_resultStandardSchemeFactory());
+      schemes.put(TupleScheme.class, new list_sentry_privileges_by_role_resultTupleSchemeFactory());
     }
 
-    private TListSentryRolesResponse success; // required
+    private TListSentryPrivilegesResponse success; // required
 
     /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
     public enum _Fields implements org.apache.thrift.TFieldIdEnum {
@@ -6338,16 +6338,16 @@ public class SentryPolicyService {
     static {
       Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
       tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, 
-          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TListSentryRolesResponse.class)));
+          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TListSentryPrivilegesResponse.class)));
       metaDataMap = Collections.unmodifiableMap(tmpMap);
-      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(list_sentry_roles_by_role_name_result.class, metaDataMap);
+      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(list_sentry_privileges_by_role_result.class, metaDataMap);
     }
 
-    public list_sentry_roles_by_role_name_result() {
+    public list_sentry_privileges_by_role_result() {
     }
 
-    public list_sentry_roles_by_role_name_result(
-      TListSentryRolesResponse success)
+    public list_sentry_privileges_by_role_result(
+      TListSentryPrivilegesResponse success)
     {
       this();
       this.success = success;
@@ -6356,14 +6356,14 @@ public class SentryPolicyService {
     /**
      * Performs a deep copy on <i>other</i>.
      */
-    public list_sentry_roles_by_role_name_result(list_sentry_roles_by_role_name_result other) {
+    public list_sentry_privileges_by_role_result(list_sentry_privileges_by_role_result other) {
       if (other.isSetSuccess()) {
-        this.success = new TListSentryRolesResponse(other.success);
+        this.success = new TListSentryPrivilegesResponse(other.success);
       }
     }
 
-    public list_sentry_roles_by_role_name_result deepCopy() {
-      return new list_sentry_roles_by_role_name_result(this);
+    public list_sentry_privileges_by_role_result deepCopy() {
+      return new list_sentry_privileges_by_role_result(this);
     }
 
     @Override
@@ -6371,11 +6371,11 @@ public class SentryPolicyService {
       this.success = null;
     }
 
-    public TListSentryRolesResponse getSuccess() {
+    public TListSentryPrivilegesResponse getSuccess() {
       return this.success;
     }
 
-    public void setSuccess(TListSentryRolesResponse success) {
+    public void setSuccess(TListSentryPrivilegesResponse success) {
       this.success = success;
     }
 
@@ -6400,7 +6400,7 @@ public class SentryPolicyService {
         if (value == null) {
           unsetSuccess();
         } else {
-          setSuccess((TListSentryRolesResponse)value);
+          setSuccess((TListSentryPrivilegesResponse)value);
         }
         break;
 
@@ -6433,12 +6433,12 @@ public class SentryPolicyService {
     public boolean equals(Object that) {
       if (that == null)
         return false;
-      if (that instanceof list_sentry_roles_by_role_name_result)
-        return this.equals((list_sentry_roles_by_role_name_result)that);
+      if (that instanceof list_sentry_privileges_by_role_result)
+        return this.equals((list_sentry_privileges_by_role_result)that);
       return false;
     }
 
-    public boolean equals(list_sentry_roles_by_role_name_result that) {
+    public boolean equals(list_sentry_privileges_by_role_result that) {
       if (that == null)
         return false;
 
@@ -6466,13 +6466,13 @@ public class SentryPolicyService {
       return builder.toHashCode();
     }
 
-    public int compareTo(list_sentry_roles_by_role_name_result other) {
+    public int compareTo(list_sentry_privileges_by_role_result other) {
       if (!getClass().equals(other.getClass())) {
         return getClass().getName().compareTo(other.getClass().getName());
       }
 
       int lastComparison = 0;
-      list_sentry_roles_by_role_name_result typedOther = (list_sentry_roles_by_role_name_result)other;
+      list_sentry_privileges_by_role_result typedOther = (list_sentry_privileges_by_role_result)other;
 
       lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess());
       if (lastComparison != 0) {
@@ -6501,7 +6501,7 @@ public class SentryPolicyService {
 
     @Override
     public String toString() {
-      StringBuilder sb = new StringBuilder("list_sentry_roles_by_role_name_result(");
+      StringBuilder sb = new StringBuilder("list_sentry_privileges_by_role_result(");
       boolean first = true;
 
       sb.append("success:");
@@ -6539,15 +6539,15 @@ public class SentryPolicyService {
       }
     }
 
-    private static class list_sentry_roles_by_role_name_resultStandardSchemeFactory implements SchemeFactory {
-      public list_sentry_roles_by_role_name_resultStandardScheme getScheme() {
-        return new list_sentry_roles_by_role_name_resultStandardScheme();
+    private static class list_sentry_privileges_by_role_resultStandardSchemeFactory implements SchemeFactory {
+      public list_sentry_privileges_by_role_resultStandardScheme getScheme() {
+        return new list_sentry_privileges_by_role_resultStandardScheme();
       }
     }
 
-    private static class list_sentry_roles_by_role_name_resultStandardScheme extends StandardScheme<list_sentry_roles_by_role_name_result> {
+    private static class list_sentry_privileges_by_role_resultStandardScheme extends StandardScheme<list_sentry_privileges_by_role_result> {
 
-      public void read(org.apache.thrift.protocol.TProtocol iprot, list_sentry_roles_by_role_name_result struct) throws org.apache.thrift.TException {
+      public void read(org.apache.thrift.protocol.TProtocol iprot, list_sentry_privileges_by_role_result struct) throws org.apache.thrift.TException {
         org.apache.thrift.protocol.TField schemeField;
         iprot.readStructBegin();
         while (true)
@@ -6559,7 +6559,7 @@ public class SentryPolicyService {
           switch (schemeField.id) {
             case 0: // SUCCESS
               if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
-                struct.success = new TListSentryRolesResponse();
+                struct.success = new TListSentryPrivilegesResponse();
                 struct.success.read(iprot);
                 struct.setSuccessIsSet(true);
               } else { 
@@ -6575,7 +6575,7 @@ public class SentryPolicyService {
         struct.validate();
       }
 
-      public void write(org.apache.thrift.protocol.TProtocol oprot, list_sentry_roles_by_role_name_result struct) throws org.apache.thrift.TException {
+      public void write(org.apache.thrift.protocol.TProtocol oprot, list_sentry_privileges_by_role_result struct) throws org.apache.thrift.TException {
         struct.validate();
 
         oprot.writeStructBegin(STRUCT_DESC);
@@ -6590,16 +6590,16 @@ public class SentryPolicyService {
 
     }
 
-    private static class list_sentry_roles_by_role_name_resultTupleSchemeFactory implements SchemeFactory {
-      public list_sentry_roles_by_role_name_resultTupleScheme getScheme() {
-        return new list_sentry_roles_by_role_name_resultTupleScheme();
+    private static class list_sentry_privileges_by_role_resultTupleSchemeFactory implements SchemeFactory {
+      public list_sentry_privileges_by_role_resultTupleScheme getScheme() {
+        return new list_sentry_privileges_by_role_resultTupleScheme();
       }
     }
 
-    private static class list_sentry_roles_by_role_name_resultTupleScheme extends TupleScheme<list_sentry_roles_by_role_name_result> {
+    private static class list_sentry_privileges_by_role_resultTupleScheme extends TupleScheme<list_sentry_privileges_by_role_result> {
 
       @Override
-      public void write(org.apache.thrift.protocol.TProtocol prot, list_sentry_roles_by_role_name_result struct) throws org.apache.thrift.TException {
+      public void write(org.apache.thrift.protocol.TProtocol prot, list_sentry_privileges_by_role_result struct) throws org.apache.thrift.TException {
         TTupleProtocol oprot = (TTupleProtocol) prot;
         BitSet optionals = new BitSet();
         if (struct.isSetSuccess()) {
@@ -6612,11 +6612,11 @@ public class SentryPolicyService {
       }
 
       @Override
-      public void read(org.apache.thrift.protocol.TProtocol prot, list_sentry_roles_by_role_name_result struct) throws org.apache.thrift.TException {
+      public void read(org.apache.thrift.protocol.TProtocol prot, list_sentry_privileges_by_role_result struct) throws org.apache.thrift.TException {
         TTupleProtocol iprot = (TTupleProtocol) prot;
         BitSet incoming = iprot.readBitSet(1);
         if (incoming.get(0)) {
-          struct.success = new TListSentryRolesResponse();
+          struct.success = new TListSentryPrivilegesResponse();
           struct.success.read(iprot);
           struct.setSuccessIsSet(true);
         }

http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0fea11ab/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleAddGroupsRequest.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleAddGroupsRequest.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleAddGroupsRequest.java
index 397813f..2701837 100644
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleAddGroupsRequest.java
+++ b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleAddGroupsRequest.java
@@ -728,13 +728,13 @@ public class TAlterSentryRoleAddGroupsRequest implements org.apache.thrift.TBase
           case 3: // REQUESTOR_GROUP_NAMES
             if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
               {
-                org.apache.thrift.protocol.TSet _set32 = iprot.readSetBegin();
-                struct.requestorGroupNames = new HashSet<String>(2*_set32.size);
-                for (int _i33 = 0; _i33 < _set32.size; ++_i33)
+                org.apache.thrift.protocol.TSet _set16 = iprot.readSetBegin();
+                struct.requestorGroupNames = new HashSet<String>(2*_set16.size);
+                for (int _i17 = 0; _i17 < _set16.size; ++_i17)
                 {
-                  String _elem34; // required
-                  _elem34 = iprot.readString();
-                  struct.requestorGroupNames.add(_elem34);
+                  String _elem18; // required
+                  _elem18 = iprot.readString();
+                  struct.requestorGroupNames.add(_elem18);
                 }
                 iprot.readSetEnd();
               }
@@ -754,14 +754,14 @@ public class TAlterSentryRoleAddGroupsRequest implements org.apache.thrift.TBase
           case 5: // GROUPS
             if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
               {
-                org.apache.thrift.protocol.TSet _set35 = iprot.readSetBegin();
-                struct.groups = new HashSet<TSentryGroup>(2*_set35.size);
-                for (int _i36 = 0; _i36 < _set35.size; ++_i36)
+                org.apache.thrift.protocol.TSet _set19 = iprot.readSetBegin();
+                struct.groups = new HashSet<TSentryGroup>(2*_set19.size);
+                for (int _i20 = 0; _i20 < _set19.size; ++_i20)
                 {
-                  TSentryGroup _elem37; // required
-                  _elem37 = new TSentryGroup();
-                  _elem37.read(iprot);
-                  struct.groups.add(_elem37);
+                  TSentryGroup _elem21; // required
+                  _elem21 = new TSentryGroup();
+                  _elem21.read(iprot);
+                  struct.groups.add(_elem21);
                 }
                 iprot.readSetEnd();
               }
@@ -795,9 +795,9 @@ public class TAlterSentryRoleAddGroupsRequest implements org.apache.thrift.TBase
         oprot.writeFieldBegin(REQUESTOR_GROUP_NAMES_FIELD_DESC);
         {
           oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, struct.requestorGroupNames.size()));
-          for (String _iter38 : struct.requestorGroupNames)
+          for (String _iter22 : struct.requestorGroupNames)
           {
-            oprot.writeString(_iter38);
+            oprot.writeString(_iter22);
           }
           oprot.writeSetEnd();
         }
@@ -812,9 +812,9 @@ public class TAlterSentryRoleAddGroupsRequest implements org.apache.thrift.TBase
         oprot.writeFieldBegin(GROUPS_FIELD_DESC);
         {
           oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, struct.groups.size()));
-          for (TSentryGroup _iter39 : struct.groups)
+          for (TSentryGroup _iter23 : struct.groups)
           {
-            _iter39.write(oprot);
+            _iter23.write(oprot);
           }
           oprot.writeSetEnd();
         }
@@ -841,17 +841,17 @@ public class TAlterSentryRoleAddGroupsRequest implements org.apache.thrift.TBase
       oprot.writeString(struct.requestorUserName);
       {
         oprot.writeI32(struct.requestorGroupNames.size());
-        for (String _iter40 : struct.requestorGroupNames)
+        for (String _iter24 : struct.requestorGroupNames)
         {
-          oprot.writeString(_iter40);
+          oprot.writeString(_iter24);
         }
       }
       oprot.writeString(struct.roleName);
       {
         oprot.writeI32(struct.groups.size());
-        for (TSentryGroup _iter41 : struct.groups)
+        for (TSentryGroup _iter25 : struct.groups)
         {
-          _iter41.write(oprot);
+          _iter25.write(oprot);
         }
       }
     }
@@ -864,27 +864,27 @@ public class TAlterSentryRoleAddGroupsRequest implements org.apache.thrift.TBase
       struct.requestorUserName = iprot.readString();
       struct.setRequestorUserNameIsSet(true);
       {
-        org.apache.thrift.protocol.TSet _set42 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
-        struct.requestorGroupNames = new HashSet<String>(2*_set42.size);
-        for (int _i43 = 0; _i43 < _set42.size; ++_i43)
+        org.apache.thrift.protocol.TSet _set26 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
+        struct.requestorGroupNames = new HashSet<String>(2*_set26.size);
+        for (int _i27 = 0; _i27 < _set26.size; ++_i27)
         {
-          String _elem44; // required
-          _elem44 = iprot.readString();
-          struct.requestorGroupNames.add(_elem44);
+          String _elem28; // required
+          _elem28 = iprot.readString();
+          struct.requestorGroupNames.add(_elem28);
         }
       }
       struct.setRequestorGroupNamesIsSet(true);
       struct.roleName = iprot.readString();
       struct.setRoleNameIsSet(true);
       {
-        org.apache.thrift.protocol.TSet _set45 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
-        struct.groups = new HashSet<TSentryGroup>(2*_set45.size);
-        for (int _i46 = 0; _i46 < _set45.size; ++_i46)
+        org.apache.thrift.protocol.TSet _set29 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
+        struct.groups = new HashSet<TSentryGroup>(2*_set29.size);
+        for (int _i30 = 0; _i30 < _set29.size; ++_i30)
         {
-          TSentryGroup _elem47; // required
-          _elem47 = new TSentryGroup();
-          _elem47.read(iprot);
-          struct.groups.add(_elem47);
+          TSentryGroup _elem31; // required
+          _elem31 = new TSentryGroup();
+          _elem31.read(iprot);
+          struct.groups.add(_elem31);
         }
       }
       struct.setGroupsIsSet(true);

http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0fea11ab/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleDeleteGroupsRequest.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleDeleteGroupsRequest.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleDeleteGroupsRequest.java
index b73d25c..c5c13cd 100644
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleDeleteGroupsRequest.java
+++ b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleDeleteGroupsRequest.java
@@ -728,13 +728,13 @@ public class TAlterSentryRoleDeleteGroupsRequest implements org.apache.thrift.TB
           case 3: // REQUESTOR_GROUP_NAMES
             if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
               {
-                org.apache.thrift.protocol.TSet _set48 = iprot.readSetBegin();
-                struct.requestorGroupNames = new HashSet<String>(2*_set48.size);
-                for (int _i49 = 0; _i49 < _set48.size; ++_i49)
+                org.apache.thrift.protocol.TSet _set32 = iprot.readSetBegin();
+                struct.requestorGroupNames = new HashSet<String>(2*_set32.size);
+                for (int _i33 = 0; _i33 < _set32.size; ++_i33)
                 {
-                  String _elem50; // required
-                  _elem50 = iprot.readString();
-                  struct.requestorGroupNames.add(_elem50);
+                  String _elem34; // required
+                  _elem34 = iprot.readString();
+                  struct.requestorGroupNames.add(_elem34);
                 }
                 iprot.readSetEnd();
               }
@@ -754,14 +754,14 @@ public class TAlterSentryRoleDeleteGroupsRequest implements org.apache.thrift.TB
           case 5: // GROUPS
             if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
               {
-                org.apache.thrift.protocol.TSet _set51 = iprot.readSetBegin();
-                struct.groups = new HashSet<TSentryGroup>(2*_set51.size);
-                for (int _i52 = 0; _i52 < _set51.size; ++_i52)
+                org.apache.thrift.protocol.TSet _set35 = iprot.readSetBegin();
+                struct.groups = new HashSet<TSentryGroup>(2*_set35.size);
+                for (int _i36 = 0; _i36 < _set35.size; ++_i36)
                 {
-                  TSentryGroup _elem53; // required
-                  _elem53 = new TSentryGroup();
-                  _elem53.read(iprot);
-                  struct.groups.add(_elem53);
+                  TSentryGroup _elem37; // required
+                  _elem37 = new TSentryGroup();
+                  _elem37.read(iprot);
+                  struct.groups.add(_elem37);
                 }
                 iprot.readSetEnd();
               }
@@ -795,9 +795,9 @@ public class TAlterSentryRoleDeleteGroupsRequest implements org.apache.thrift.TB
         oprot.writeFieldBegin(REQUESTOR_GROUP_NAMES_FIELD_DESC);
         {
           oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, struct.requestorGroupNames.size()));
-          for (String _iter54 : struct.requestorGroupNames)
+          for (String _iter38 : struct.requestorGroupNames)
           {
-            oprot.writeString(_iter54);
+            oprot.writeString(_iter38);
           }
           oprot.writeSetEnd();
         }
@@ -812,9 +812,9 @@ public class TAlterSentryRoleDeleteGroupsRequest implements org.apache.thrift.TB
         oprot.writeFieldBegin(GROUPS_FIELD_DESC);
         {
           oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, struct.groups.size()));
-          for (TSentryGroup _iter55 : struct.groups)
+          for (TSentryGroup _iter39 : struct.groups)
           {
-            _iter55.write(oprot);
+            _iter39.write(oprot);
           }
           oprot.writeSetEnd();
         }
@@ -841,17 +841,17 @@ public class TAlterSentryRoleDeleteGroupsRequest implements org.apache.thrift.TB
       oprot.writeString(struct.requestorUserName);
       {
         oprot.writeI32(struct.requestorGroupNames.size());
-        for (String _iter56 : struct.requestorGroupNames)
+        for (String _iter40 : struct.requestorGroupNames)
         {
-          oprot.writeString(_iter56);
+          oprot.writeString(_iter40);
         }
       }
       oprot.writeString(struct.roleName);
       {
         oprot.writeI32(struct.groups.size());
-        for (TSentryGroup _iter57 : struct.groups)
+        for (TSentryGroup _iter41 : struct.groups)
         {
-          _iter57.write(oprot);
+          _iter41.write(oprot);
         }
       }
     }
@@ -864,27 +864,27 @@ public class TAlterSentryRoleDeleteGroupsRequest implements org.apache.thrift.TB
       struct.requestorUserName = iprot.readString();
       struct.setRequestorUserNameIsSet(true);
       {
-        org.apache.thrift.protocol.TSet _set58 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
-        struct.requestorGroupNames = new HashSet<String>(2*_set58.size);
-        for (int _i59 = 0; _i59 < _set58.size; ++_i59)
+        org.apache.thrift.protocol.TSet _set42 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
+        struct.requestorGroupNames = new HashSet<String>(2*_set42.size);
+        for (int _i43 = 0; _i43 < _set42.size; ++_i43)
         {
-          String _elem60; // required
-          _elem60 = iprot.readString();
-          struct.requestorGroupNames.add(_elem60);
+          String _elem44; // required
+          _elem44 = iprot.readString();
+          struct.requestorGroupNames.add(_elem44);
         }
       }
       struct.setRequestorGroupNamesIsSet(true);
       struct.roleName = iprot.readString();
       struct.setRoleNameIsSet(true);
       {
-        org.apache.thrift.protocol.TSet _set61 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
-        struct.groups = new HashSet<TSentryGroup>(2*_set61.size);
-        for (int _i62 = 0; _i62 < _set61.size; ++_i62)
+        org.apache.thrift.protocol.TSet _set45 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
+        struct.groups = new HashSet<TSentryGroup>(2*_set45.size);
+        for (int _i46 = 0; _i46 < _set45.size; ++_i46)
         {
-          TSentryGroup _elem63; // required
-          _elem63 = new TSentryGroup();
-          _elem63.read(iprot);
-          struct.groups.add(_elem63);
+          TSentryGroup _elem47; // required
+          _elem47 = new TSentryGroup();
+          _elem47.read(iprot);
+          struct.groups.add(_elem47);
         }
       }
       struct.setGroupsIsSet(true);

http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0fea11ab/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleGrantPrivilegeRequest.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleGrantPrivilegeRequest.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleGrantPrivilegeRequest.java
index 550b72d..d934d54 100644
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleGrantPrivilegeRequest.java
+++ b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleGrantPrivilegeRequest.java
@@ -711,13 +711,13 @@ public class TAlterSentryRoleGrantPrivilegeRequest implements org.apache.thrift.
           case 3: // REQUESTOR_GROUP_NAMES
             if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
               {
-                org.apache.thrift.protocol.TSet _set64 = iprot.readSetBegin();
-                struct.requestorGroupNames = new HashSet<String>(2*_set64.size);
-                for (int _i65 = 0; _i65 < _set64.size; ++_i65)
+                org.apache.thrift.protocol.TSet _set48 = iprot.readSetBegin();
+                struct.requestorGroupNames = new HashSet<String>(2*_set48.size);
+                for (int _i49 = 0; _i49 < _set48.size; ++_i49)
                 {
-                  String _elem66; // required
-                  _elem66 = iprot.readString();
-                  struct.requestorGroupNames.add(_elem66);
+                  String _elem50; // required
+                  _elem50 = iprot.readString();
+                  struct.requestorGroupNames.add(_elem50);
                 }
                 iprot.readSetEnd();
               }
@@ -768,9 +768,9 @@ public class TAlterSentryRoleGrantPrivilegeRequest implements org.apache.thrift.
         oprot.writeFieldBegin(REQUESTOR_GROUP_NAMES_FIELD_DESC);
         {
           oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, struct.requestorGroupNames.size()));
-          for (String _iter67 : struct.requestorGroupNames)
+          for (String _iter51 : struct.requestorGroupNames)
           {
-            oprot.writeString(_iter67);
+            oprot.writeString(_iter51);
           }
           oprot.writeSetEnd();
         }
@@ -807,9 +807,9 @@ public class TAlterSentryRoleGrantPrivilegeRequest implements org.apache.thrift.
       oprot.writeString(struct.requestorUserName);
       {
         oprot.writeI32(struct.requestorGroupNames.size());
-        for (String _iter68 : struct.requestorGroupNames)
+        for (String _iter52 : struct.requestorGroupNames)
         {
-          oprot.writeString(_iter68);
+          oprot.writeString(_iter52);
         }
       }
       oprot.writeString(struct.roleName);
@@ -824,13 +824,13 @@ public class TAlterSentryRoleGrantPrivilegeRequest implements org.apache.thrift.
       struct.requestorUserName = iprot.readString();
       struct.setRequestorUserNameIsSet(true);
       {
-        org.apache.thrift.protocol.TSet _set69 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
-        struct.requestorGroupNames = new HashSet<String>(2*_set69.size);
-        for (int _i70 = 0; _i70 < _set69.size; ++_i70)
+        org.apache.thrift.protocol.TSet _set53 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
+        struct.requestorGroupNames = new HashSet<String>(2*_set53.size);
+        for (int _i54 = 0; _i54 < _set53.size; ++_i54)
         {
-          String _elem71; // required
-          _elem71 = iprot.readString();
-          struct.requestorGroupNames.add(_elem71);
+          String _elem55; // required
+          _elem55 = iprot.readString();
+          struct.requestorGroupNames.add(_elem55);
         }
       }
       struct.setRequestorGroupNamesIsSet(true);

http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0fea11ab/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleRevokePrivilegeRequest.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleRevokePrivilegeRequest.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleRevokePrivilegeRequest.java
index 50f1f8e..ae7eaf3 100644
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleRevokePrivilegeRequest.java
+++ b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleRevokePrivilegeRequest.java
@@ -711,13 +711,13 @@ public class TAlterSentryRoleRevokePrivilegeRequest implements org.apache.thrift
           case 3: // REQUESTOR_GROUP_NAMES
             if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
               {
-                org.apache.thrift.protocol.TSet _set72 = iprot.readSetBegin();
-                struct.requestorGroupNames = new HashSet<String>(2*_set72.size);
-                for (int _i73 = 0; _i73 < _set72.size; ++_i73)
+                org.apache.thrift.protocol.TSet _set56 = iprot.readSetBegin();
+                struct.requestorGroupNames = new HashSet<String>(2*_set56.size);
+                for (int _i57 = 0; _i57 < _set56.size; ++_i57)
                 {
-                  String _elem74; // required
-                  _elem74 = iprot.readString();
-                  struct.requestorGroupNames.add(_elem74);
+                  String _elem58; // required
+                  _elem58 = iprot.readString();
+                  struct.requestorGroupNames.add(_elem58);
                 }
                 iprot.readSetEnd();
               }
@@ -768,9 +768,9 @@ public class TAlterSentryRoleRevokePrivilegeRequest implements org.apache.thrift
         oprot.writeFieldBegin(REQUESTOR_GROUP_NAMES_FIELD_DESC);
         {
           oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, struct.requestorGroupNames.size()));
-          for (String _iter75 : struct.requestorGroupNames)
+          for (String _iter59 : struct.requestorGroupNames)
           {
-            oprot.writeString(_iter75);
+            oprot.writeString(_iter59);
           }
           oprot.writeSetEnd();
         }
@@ -807,9 +807,9 @@ public class TAlterSentryRoleRevokePrivilegeRequest implements org.apache.thrift
       oprot.writeString(struct.requestorUserName);
       {
         oprot.writeI32(struct.requestorGroupNames.size());
-        for (String _iter76 : struct.requestorGroupNames)
+        for (String _iter60 : struct.requestorGroupNames)
         {
-          oprot.writeString(_iter76);
+          oprot.writeString(_iter60);
         }
       }
       oprot.writeString(struct.roleName);
@@ -824,13 +824,13 @@ public class TAlterSentryRoleRevokePrivilegeRequest implements org.apache.thrift
       struct.requestorUserName = iprot.readString();
       struct.setRequestorUserNameIsSet(true);
       {
-        org.apache.thrift.protocol.TSet _set77 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
-        struct.requestorGroupNames = new HashSet<String>(2*_set77.size);
-        for (int _i78 = 0; _i78 < _set77.size; ++_i78)
+        org.apache.thrift.protocol.TSet _set61 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
+        struct.requestorGroupNames = new HashSet<String>(2*_set61.size);
+        for (int _i62 = 0; _i62 < _set61.size; ++_i62)
         {
-          String _elem79; // required
-          _elem79 = iprot.readString();
-          struct.requestorGroupNames.add(_elem79);
+          String _elem63; // required
+          _elem63 = iprot.readString();
+          struct.requestorGroupNames.add(_elem63);
         }
       }
       struct.setRequestorGroupNamesIsSet(true);

http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0fea11ab/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryPrivilegesForProviderRequest.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryPrivilegesForProviderRequest.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryPrivilegesForProviderRequest.java
index 4e7dad9..09704ae 100644
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryPrivilegesForProviderRequest.java
+++ b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryPrivilegesForProviderRequest.java
@@ -533,13 +533,13 @@ public class TListSentryPrivilegesForProviderRequest implements org.apache.thrif
           case 2: // GROUPS
             if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
               {
-                org.apache.thrift.protocol.TSet _set88 = iprot.readSetBegin();
-                struct.groups = new HashSet<String>(2*_set88.size);
-                for (int _i89 = 0; _i89 < _set88.size; ++_i89)
+                org.apache.thrift.protocol.TSet _set112 = iprot.readSetBegin();
+                struct.groups = new HashSet<String>(2*_set112.size);
+                for (int _i113 = 0; _i113 < _set112.size; ++_i113)
                 {
-                  String _elem90; // required
-                  _elem90 = iprot.readString();
-                  struct.groups.add(_elem90);
+                  String _elem114; // required
+                  _elem114 = iprot.readString();
+                  struct.groups.add(_elem114);
                 }
                 iprot.readSetEnd();
               }
@@ -577,9 +577,9 @@ public class TListSentryPrivilegesForProviderRequest implements org.apache.thrif
         oprot.writeFieldBegin(GROUPS_FIELD_DESC);
         {
           oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, struct.groups.size()));
-          for (String _iter91 : struct.groups)
+          for (String _iter115 : struct.groups)
           {
-            oprot.writeString(_iter91);
+            oprot.writeString(_iter115);
           }
           oprot.writeSetEnd();
         }
@@ -610,9 +610,9 @@ public class TListSentryPrivilegesForProviderRequest implements org.apache.thrif
       oprot.writeI32(struct.protocol_version);
       {
         oprot.writeI32(struct.groups.size());
-        for (String _iter92 : struct.groups)
+        for (String _iter116 : struct.groups)
         {
-          oprot.writeString(_iter92);
+          oprot.writeString(_iter116);
         }
       }
       struct.roleSet.write(oprot);
@@ -624,13 +624,13 @@ public class TListSentryPrivilegesForProviderRequest implements org.apache.thrif
       struct.protocol_version = iprot.readI32();
       struct.setProtocol_versionIsSet(true);
       {
-        org.apache.thrift.protocol.TSet _set93 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
-        struct.groups = new HashSet<String>(2*_set93.size);
-        for (int _i94 = 0; _i94 < _set93.size; ++_i94)
+        org.apache.thrift.protocol.TSet _set117 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
+        struct.groups = new HashSet<String>(2*_set117.size);
+        for (int _i118 = 0; _i118 < _set117.size; ++_i118)
         {
-          String _elem95; // required
-          _elem95 = iprot.readString();
-          struct.groups.add(_elem95);
+          String _elem119; // required
+          _elem119 = iprot.readString();
+          struct.groups.add(_elem119);
         }
       }
       struct.setGroupsIsSet(true);

http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0fea11ab/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryPrivilegesForProviderResponse.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryPrivilegesForProviderResponse.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryPrivilegesForProviderResponse.java
index 341a016..dff80b6 100644
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryPrivilegesForProviderResponse.java
+++ b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryPrivilegesForProviderResponse.java
@@ -447,13 +447,13 @@ public class TListSentryPrivilegesForProviderResponse implements org.apache.thri
           case 2: // PRIVILEGES
             if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
               {
-                org.apache.thrift.protocol.TSet _set96 = iprot.readSetBegin();
-                struct.privileges = new HashSet<String>(2*_set96.size);
-                for (int _i97 = 0; _i97 < _set96.size; ++_i97)
+                org.apache.thrift.protocol.TSet _set120 = iprot.readSetBegin();
+                struct.privileges = new HashSet<String>(2*_set120.size);
+                for (int _i121 = 0; _i121 < _set120.size; ++_i121)
                 {
-                  String _elem98; // required
-                  _elem98 = iprot.readString();
-                  struct.privileges.add(_elem98);
+                  String _elem122; // required
+                  _elem122 = iprot.readString();
+                  struct.privileges.add(_elem122);
                 }
                 iprot.readSetEnd();
               }
@@ -484,9 +484,9 @@ public class TListSentryPrivilegesForProviderResponse implements org.apache.thri
         oprot.writeFieldBegin(PRIVILEGES_FIELD_DESC);
         {
           oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, struct.privileges.size()));
-          for (String _iter99 : struct.privileges)
+          for (String _iter123 : struct.privileges)
           {
-            oprot.writeString(_iter99);
+            oprot.writeString(_iter123);
           }
           oprot.writeSetEnd();
         }
@@ -512,9 +512,9 @@ public class TListSentryPrivilegesForProviderResponse implements org.apache.thri
       struct.status.write(oprot);
       {
         oprot.writeI32(struct.privileges.size());
-        for (String _iter100 : struct.privileges)
+        for (String _iter124 : struct.privileges)
         {
-          oprot.writeString(_iter100);
+          oprot.writeString(_iter124);
         }
       }
     }
@@ -526,13 +526,13 @@ public class TListSentryPrivilegesForProviderResponse implements org.apache.thri
       struct.status.read(iprot);
       struct.setStatusIsSet(true);
       {
-        org.apache.thrift.protocol.TSet _set101 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
-        struct.privileges = new HashSet<String>(2*_set101.size);
-        for (int _i102 = 0; _i102 < _set101.size; ++_i102)
+        org.apache.thrift.protocol.TSet _set125 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
+        struct.privileges = new HashSet<String>(2*_set125.size);
+        for (int _i126 = 0; _i126 < _set125.size; ++_i126)
         {
-          String _elem103; // required
-          _elem103 = iprot.readString();
-          struct.privileges.add(_elem103);
+          String _elem127; // required
+          _elem127 = iprot.readString();
+          struct.privileges.add(_elem127);
         }
       }
       struct.setPrivilegesIsSet(true);