You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sentry.apache.org by co...@apache.org on 2016/07/21 05:55:21 UTC

[27/51] [partial] sentry git commit: SENTRY-1205: Refactor the code for sentry-provider-db and create sentry-service module(Colin Ma, reviewed by Dapeng Sun)

http://git-wip-us.apache.org/repos/asf/sentry/blob/f1332300/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryPrivilegeMap.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryPrivilegeMap.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryPrivilegeMap.java
deleted file mode 100644
index 9991f3b..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryPrivilegeMap.java
+++ /dev/null
@@ -1,490 +0,0 @@
-/**
- * Autogenerated by Thrift Compiler (0.9.3)
- *
- * 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.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 org.apache.thrift.async.AsyncMethodCallback;
-import org.apache.thrift.server.AbstractNonblockingServer.*;
-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 javax.annotation.Generated;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
-@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2016-05-05")
-public class TSentryPrivilegeMap implements org.apache.thrift.TBase<TSentryPrivilegeMap, TSentryPrivilegeMap._Fields>, java.io.Serializable, Cloneable, Comparable<TSentryPrivilegeMap> {
-  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TSentryPrivilegeMap");
-
-  private static final org.apache.thrift.protocol.TField PRIVILEGE_MAP_FIELD_DESC = new org.apache.thrift.protocol.TField("privilegeMap", org.apache.thrift.protocol.TType.MAP, (short)1);
-
-  private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
-  static {
-    schemes.put(StandardScheme.class, new TSentryPrivilegeMapStandardSchemeFactory());
-    schemes.put(TupleScheme.class, new TSentryPrivilegeMapTupleSchemeFactory());
-  }
-
-  private Map<String,Set<TSentryPrivilege>> privilegeMap; // 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 {
-    PRIVILEGE_MAP((short)1, "privilegeMap");
-
-    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: // PRIVILEGE_MAP
-          return PRIVILEGE_MAP;
-        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.PRIVILEGE_MAP, new org.apache.thrift.meta_data.FieldMetaData("privilegeMap", org.apache.thrift.TFieldRequirementType.REQUIRED, 
-        new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP, 
-            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING), 
-            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(TSentryPrivilegeMap.class, metaDataMap);
-  }
-
-  public TSentryPrivilegeMap() {
-  }
-
-  public TSentryPrivilegeMap(
-    Map<String,Set<TSentryPrivilege>> privilegeMap)
-  {
-    this();
-    this.privilegeMap = privilegeMap;
-  }
-
-  /**
-   * Performs a deep copy on <i>other</i>.
-   */
-  public TSentryPrivilegeMap(TSentryPrivilegeMap other) {
-    if (other.isSetPrivilegeMap()) {
-      Map<String,Set<TSentryPrivilege>> __this__privilegeMap = new HashMap<String,Set<TSentryPrivilege>>(other.privilegeMap.size());
-      for (Map.Entry<String, Set<TSentryPrivilege>> other_element : other.privilegeMap.entrySet()) {
-
-        String other_element_key = other_element.getKey();
-        Set<TSentryPrivilege> other_element_value = other_element.getValue();
-
-        String __this__privilegeMap_copy_key = other_element_key;
-
-        Set<TSentryPrivilege> __this__privilegeMap_copy_value = new HashSet<TSentryPrivilege>(other_element_value.size());
-        for (TSentryPrivilege other_element_value_element : other_element_value) {
-          __this__privilegeMap_copy_value.add(new TSentryPrivilege(other_element_value_element));
-        }
-
-        __this__privilegeMap.put(__this__privilegeMap_copy_key, __this__privilegeMap_copy_value);
-      }
-      this.privilegeMap = __this__privilegeMap;
-    }
-  }
-
-  public TSentryPrivilegeMap deepCopy() {
-    return new TSentryPrivilegeMap(this);
-  }
-
-  @Override
-  public void clear() {
-    this.privilegeMap = null;
-  }
-
-  public int getPrivilegeMapSize() {
-    return (this.privilegeMap == null) ? 0 : this.privilegeMap.size();
-  }
-
-  public void putToPrivilegeMap(String key, Set<TSentryPrivilege> val) {
-    if (this.privilegeMap == null) {
-      this.privilegeMap = new HashMap<String,Set<TSentryPrivilege>>();
-    }
-    this.privilegeMap.put(key, val);
-  }
-
-  public Map<String,Set<TSentryPrivilege>> getPrivilegeMap() {
-    return this.privilegeMap;
-  }
-
-  public void setPrivilegeMap(Map<String,Set<TSentryPrivilege>> privilegeMap) {
-    this.privilegeMap = privilegeMap;
-  }
-
-  public void unsetPrivilegeMap() {
-    this.privilegeMap = null;
-  }
-
-  /** Returns true if field privilegeMap is set (has been assigned a value) and false otherwise */
-  public boolean isSetPrivilegeMap() {
-    return this.privilegeMap != null;
-  }
-
-  public void setPrivilegeMapIsSet(boolean value) {
-    if (!value) {
-      this.privilegeMap = null;
-    }
-  }
-
-  public void setFieldValue(_Fields field, Object value) {
-    switch (field) {
-    case PRIVILEGE_MAP:
-      if (value == null) {
-        unsetPrivilegeMap();
-      } else {
-        setPrivilegeMap((Map<String,Set<TSentryPrivilege>>)value);
-      }
-      break;
-
-    }
-  }
-
-  public Object getFieldValue(_Fields field) {
-    switch (field) {
-    case PRIVILEGE_MAP:
-      return getPrivilegeMap();
-
-    }
-    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 PRIVILEGE_MAP:
-      return isSetPrivilegeMap();
-    }
-    throw new IllegalStateException();
-  }
-
-  @Override
-  public boolean equals(Object that) {
-    if (that == null)
-      return false;
-    if (that instanceof TSentryPrivilegeMap)
-      return this.equals((TSentryPrivilegeMap)that);
-    return false;
-  }
-
-  public boolean equals(TSentryPrivilegeMap that) {
-    if (that == null)
-      return false;
-
-    boolean this_present_privilegeMap = true && this.isSetPrivilegeMap();
-    boolean that_present_privilegeMap = true && that.isSetPrivilegeMap();
-    if (this_present_privilegeMap || that_present_privilegeMap) {
-      if (!(this_present_privilegeMap && that_present_privilegeMap))
-        return false;
-      if (!this.privilegeMap.equals(that.privilegeMap))
-        return false;
-    }
-
-    return true;
-  }
-
-  @Override
-  public int hashCode() {
-    List<Object> list = new ArrayList<Object>();
-
-    boolean present_privilegeMap = true && (isSetPrivilegeMap());
-    list.add(present_privilegeMap);
-    if (present_privilegeMap)
-      list.add(privilegeMap);
-
-    return list.hashCode();
-  }
-
-  @Override
-  public int compareTo(TSentryPrivilegeMap other) {
-    if (!getClass().equals(other.getClass())) {
-      return getClass().getName().compareTo(other.getClass().getName());
-    }
-
-    int lastComparison = 0;
-
-    lastComparison = Boolean.valueOf(isSetPrivilegeMap()).compareTo(other.isSetPrivilegeMap());
-    if (lastComparison != 0) {
-      return lastComparison;
-    }
-    if (isSetPrivilegeMap()) {
-      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.privilegeMap, other.privilegeMap);
-      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("TSentryPrivilegeMap(");
-    boolean first = true;
-
-    sb.append("privilegeMap:");
-    if (this.privilegeMap == null) {
-      sb.append("null");
-    } else {
-      sb.append(this.privilegeMap);
-    }
-    first = false;
-    sb.append(")");
-    return sb.toString();
-  }
-
-  public void validate() throws org.apache.thrift.TException {
-    // check for required fields
-    if (!isSetPrivilegeMap()) {
-      throw new org.apache.thrift.protocol.TProtocolException("Required field 'privilegeMap' 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 {
-      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 TSentryPrivilegeMapStandardSchemeFactory implements SchemeFactory {
-    public TSentryPrivilegeMapStandardScheme getScheme() {
-      return new TSentryPrivilegeMapStandardScheme();
-    }
-  }
-
-  private static class TSentryPrivilegeMapStandardScheme extends StandardScheme<TSentryPrivilegeMap> {
-
-    public void read(org.apache.thrift.protocol.TProtocol iprot, TSentryPrivilegeMap 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: // PRIVILEGE_MAP
-            if (schemeField.type == org.apache.thrift.protocol.TType.MAP) {
-              {
-                org.apache.thrift.protocol.TMap _map112 = iprot.readMapBegin();
-                struct.privilegeMap = new HashMap<String,Set<TSentryPrivilege>>(2*_map112.size);
-                String _key113;
-                Set<TSentryPrivilege> _val114;
-                for (int _i115 = 0; _i115 < _map112.size; ++_i115)
-                {
-                  _key113 = iprot.readString();
-                  {
-                    org.apache.thrift.protocol.TSet _set116 = iprot.readSetBegin();
-                    _val114 = new HashSet<TSentryPrivilege>(2*_set116.size);
-                    TSentryPrivilege _elem117;
-                    for (int _i118 = 0; _i118 < _set116.size; ++_i118)
-                    {
-                      _elem117 = new TSentryPrivilege();
-                      _elem117.read(iprot);
-                      _val114.add(_elem117);
-                    }
-                    iprot.readSetEnd();
-                  }
-                  struct.privilegeMap.put(_key113, _val114);
-                }
-                iprot.readMapEnd();
-              }
-              struct.setPrivilegeMapIsSet(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, TSentryPrivilegeMap struct) throws org.apache.thrift.TException {
-      struct.validate();
-
-      oprot.writeStructBegin(STRUCT_DESC);
-      if (struct.privilegeMap != null) {
-        oprot.writeFieldBegin(PRIVILEGE_MAP_FIELD_DESC);
-        {
-          oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.SET, struct.privilegeMap.size()));
-          for (Map.Entry<String, Set<TSentryPrivilege>> _iter119 : struct.privilegeMap.entrySet())
-          {
-            oprot.writeString(_iter119.getKey());
-            {
-              oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, _iter119.getValue().size()));
-              for (TSentryPrivilege _iter120 : _iter119.getValue())
-              {
-                _iter120.write(oprot);
-              }
-              oprot.writeSetEnd();
-            }
-          }
-          oprot.writeMapEnd();
-        }
-        oprot.writeFieldEnd();
-      }
-      oprot.writeFieldStop();
-      oprot.writeStructEnd();
-    }
-
-  }
-
-  private static class TSentryPrivilegeMapTupleSchemeFactory implements SchemeFactory {
-    public TSentryPrivilegeMapTupleScheme getScheme() {
-      return new TSentryPrivilegeMapTupleScheme();
-    }
-  }
-
-  private static class TSentryPrivilegeMapTupleScheme extends TupleScheme<TSentryPrivilegeMap> {
-
-    @Override
-    public void write(org.apache.thrift.protocol.TProtocol prot, TSentryPrivilegeMap struct) throws org.apache.thrift.TException {
-      TTupleProtocol oprot = (TTupleProtocol) prot;
-      {
-        oprot.writeI32(struct.privilegeMap.size());
-        for (Map.Entry<String, Set<TSentryPrivilege>> _iter121 : struct.privilegeMap.entrySet())
-        {
-          oprot.writeString(_iter121.getKey());
-          {
-            oprot.writeI32(_iter121.getValue().size());
-            for (TSentryPrivilege _iter122 : _iter121.getValue())
-            {
-              _iter122.write(oprot);
-            }
-          }
-        }
-      }
-    }
-
-    @Override
-    public void read(org.apache.thrift.protocol.TProtocol prot, TSentryPrivilegeMap struct) throws org.apache.thrift.TException {
-      TTupleProtocol iprot = (TTupleProtocol) prot;
-      {
-        org.apache.thrift.protocol.TMap _map123 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.SET, iprot.readI32());
-        struct.privilegeMap = new HashMap<String,Set<TSentryPrivilege>>(2*_map123.size);
-        String _key124;
-        Set<TSentryPrivilege> _val125;
-        for (int _i126 = 0; _i126 < _map123.size; ++_i126)
-        {
-          _key124 = iprot.readString();
-          {
-            org.apache.thrift.protocol.TSet _set127 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
-            _val125 = new HashSet<TSentryPrivilege>(2*_set127.size);
-            TSentryPrivilege _elem128;
-            for (int _i129 = 0; _i129 < _set127.size; ++_i129)
-            {
-              _elem128 = new TSentryPrivilege();
-              _elem128.read(iprot);
-              _val125.add(_elem128);
-            }
-          }
-          struct.privilegeMap.put(_key124, _val125);
-        }
-      }
-      struct.setPrivilegeMapIsSet(true);
-    }
-  }
-
-}
-

http://git-wip-us.apache.org/repos/asf/sentry/blob/f1332300/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
deleted file mode 100644
index e60ac24..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryRole.java
+++ /dev/null
@@ -1,645 +0,0 @@
-/**
- * Autogenerated by Thrift Compiler (0.9.3)
- *
- * 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.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 org.apache.thrift.async.AsyncMethodCallback;
-import org.apache.thrift.server.AbstractNonblockingServer.*;
-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 javax.annotation.Generated;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
-@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2016-05-05")
-public class TSentryRole implements org.apache.thrift.TBase<TSentryRole, TSentryRole._Fields>, java.io.Serializable, Cloneable, Comparable<TSentryRole> {
-  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 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>();
-  static {
-    schemes.put(StandardScheme.class, new TSentryRoleStandardSchemeFactory());
-    schemes.put(TupleScheme.class, new TSentryRoleTupleSchemeFactory());
-  }
-
-  private String roleName; // 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"),
-    GROUPS((short)2, "groups"),
-    GRANTOR_PRINCIPAL((short)3, "grantorPrincipal");
-
-    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: // ROLE_NAME
-          return ROLE_NAME;
-        case 2: // GROUPS
-          return GROUPS;
-        case 3: // GRANTOR_PRINCIPAL
-          return GRANTOR_PRINCIPAL;
-        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.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.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, 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);
-    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TSentryRole.class, metaDataMap);
-  }
-
-  public TSentryRole() {
-  }
-
-  public TSentryRole(
-    String roleName,
-    Set<TSentryGroup> groups,
-    String grantorPrincipal)
-  {
-    this();
-    this.roleName = roleName;
-    this.groups = groups;
-    this.grantorPrincipal = grantorPrincipal;
-  }
-
-  /**
-   * Performs a deep copy on <i>other</i>.
-   */
-  public TSentryRole(TSentryRole other) {
-    if (other.isSetRoleName()) {
-      this.roleName = other.roleName;
-    }
-    if (other.isSetGroups()) {
-      Set<TSentryGroup> __this__groups = new HashSet<TSentryGroup>(other.groups.size());
-      for (TSentryGroup other_element : other.groups) {
-        __this__groups.add(new TSentryGroup(other_element));
-      }
-      this.groups = __this__groups;
-    }
-    if (other.isSetGrantorPrincipal()) {
-      this.grantorPrincipal = other.grantorPrincipal;
-    }
-  }
-
-  public TSentryRole deepCopy() {
-    return new TSentryRole(this);
-  }
-
-  @Override
-  public void clear() {
-    this.roleName = null;
-    this.groups = null;
-    this.grantorPrincipal = 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 int getGroupsSize() {
-    return (this.groups == null) ? 0 : this.groups.size();
-  }
-
-  public java.util.Iterator<TSentryGroup> getGroupsIterator() {
-    return (this.groups == null) ? null : this.groups.iterator();
-  }
-
-  public void addToGroups(TSentryGroup elem) {
-    if (this.groups == null) {
-      this.groups = new HashSet<TSentryGroup>();
-    }
-    this.groups.add(elem);
-  }
-
-  public Set<TSentryGroup> getGroups() {
-    return this.groups;
-  }
-
-  public void setGroups(Set<TSentryGroup> groups) {
-    this.groups = groups;
-  }
-
-  public void unsetGroups() {
-    this.groups = 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 setGroupsIsSet(boolean value) {
-    if (!value) {
-      this.groups = null;
-    }
-  }
-
-  public String getGrantorPrincipal() {
-    return this.grantorPrincipal;
-  }
-
-  public void setGrantorPrincipal(String grantorPrincipal) {
-    this.grantorPrincipal = grantorPrincipal;
-  }
-
-  public void unsetGrantorPrincipal() {
-    this.grantorPrincipal = null;
-  }
-
-  /** Returns true if field grantorPrincipal is set (has been assigned a value) and false otherwise */
-  public boolean isSetGrantorPrincipal() {
-    return this.grantorPrincipal != null;
-  }
-
-  public void setGrantorPrincipalIsSet(boolean value) {
-    if (!value) {
-      this.grantorPrincipal = null;
-    }
-  }
-
-  public void setFieldValue(_Fields field, Object value) {
-    switch (field) {
-    case ROLE_NAME:
-      if (value == null) {
-        unsetRoleName();
-      } else {
-        setRoleName((String)value);
-      }
-      break;
-
-    case GROUPS:
-      if (value == null) {
-        unsetGroups();
-      } else {
-        setGroups((Set<TSentryGroup>)value);
-      }
-      break;
-
-    case GRANTOR_PRINCIPAL:
-      if (value == null) {
-        unsetGrantorPrincipal();
-      } else {
-        setGrantorPrincipal((String)value);
-      }
-      break;
-
-    }
-  }
-
-  public Object getFieldValue(_Fields field) {
-    switch (field) {
-    case ROLE_NAME:
-      return getRoleName();
-
-    case GROUPS:
-      return getGroups();
-
-    case GRANTOR_PRINCIPAL:
-      return getGrantorPrincipal();
-
-    }
-    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 ROLE_NAME:
-      return isSetRoleName();
-    case GROUPS:
-      return isSetGroups();
-    case GRANTOR_PRINCIPAL:
-      return isSetGrantorPrincipal();
-    }
-    throw new IllegalStateException();
-  }
-
-  @Override
-  public boolean equals(Object that) {
-    if (that == null)
-      return false;
-    if (that instanceof TSentryRole)
-      return this.equals((TSentryRole)that);
-    return false;
-  }
-
-  public boolean equals(TSentryRole that) {
-    if (that == null)
-      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;
-    }
-
-    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.groups.equals(that.groups))
-        return false;
-    }
-
-    boolean this_present_grantorPrincipal = true && this.isSetGrantorPrincipal();
-    boolean that_present_grantorPrincipal = true && that.isSetGrantorPrincipal();
-    if (this_present_grantorPrincipal || that_present_grantorPrincipal) {
-      if (!(this_present_grantorPrincipal && that_present_grantorPrincipal))
-        return false;
-      if (!this.grantorPrincipal.equals(that.grantorPrincipal))
-        return false;
-    }
-
-    return true;
-  }
-
-  @Override
-  public int hashCode() {
-    List<Object> list = new ArrayList<Object>();
-
-    boolean present_roleName = true && (isSetRoleName());
-    list.add(present_roleName);
-    if (present_roleName)
-      list.add(roleName);
-
-    boolean present_groups = true && (isSetGroups());
-    list.add(present_groups);
-    if (present_groups)
-      list.add(groups);
-
-    boolean present_grantorPrincipal = true && (isSetGrantorPrincipal());
-    list.add(present_grantorPrincipal);
-    if (present_grantorPrincipal)
-      list.add(grantorPrincipal);
-
-    return list.hashCode();
-  }
-
-  @Override
-  public int compareTo(TSentryRole other) {
-    if (!getClass().equals(other.getClass())) {
-      return getClass().getName().compareTo(other.getClass().getName());
-    }
-
-    int lastComparison = 0;
-
-    lastComparison = Boolean.valueOf(isSetRoleName()).compareTo(other.isSetRoleName());
-    if (lastComparison != 0) {
-      return lastComparison;
-    }
-    if (isSetRoleName()) {
-      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.roleName, other.roleName);
-      if (lastComparison != 0) {
-        return lastComparison;
-      }
-    }
-    lastComparison = Boolean.valueOf(isSetGroups()).compareTo(other.isSetGroups());
-    if (lastComparison != 0) {
-      return lastComparison;
-    }
-    if (isSetGroups()) {
-      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.groups, other.groups);
-      if (lastComparison != 0) {
-        return lastComparison;
-      }
-    }
-    lastComparison = Boolean.valueOf(isSetGrantorPrincipal()).compareTo(other.isSetGrantorPrincipal());
-    if (lastComparison != 0) {
-      return lastComparison;
-    }
-    if (isSetGrantorPrincipal()) {
-      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.grantorPrincipal, other.grantorPrincipal);
-      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("TSentryRole(");
-    boolean first = true;
-
-    sb.append("roleName:");
-    if (this.roleName == null) {
-      sb.append("null");
-    } else {
-      sb.append(this.roleName);
-    }
-    first = false;
-    if (!first) sb.append(", ");
-    sb.append("groups:");
-    if (this.groups == null) {
-      sb.append("null");
-    } else {
-      sb.append(this.groups);
-    }
-    first = false;
-    if (!first) sb.append(", ");
-    sb.append("grantorPrincipal:");
-    if (this.grantorPrincipal == null) {
-      sb.append("null");
-    } else {
-      sb.append(this.grantorPrincipal);
-    }
-    first = false;
-    sb.append(")");
-    return sb.toString();
-  }
-
-  public void validate() throws org.apache.thrift.TException {
-    // check for required fields
-    if (!isSetRoleName()) {
-      throw new org.apache.thrift.protocol.TProtocolException("Required field 'roleName' is unset! Struct:" + toString());
-    }
-
-    if (!isSetGroups()) {
-      throw new org.apache.thrift.protocol.TProtocolException("Required field 'groups' is unset! Struct:" + toString());
-    }
-
-    if (!isSetGrantorPrincipal()) {
-      throw new org.apache.thrift.protocol.TProtocolException("Required field 'grantorPrincipal' 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 {
-      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 TSentryRoleStandardSchemeFactory implements SchemeFactory {
-    public TSentryRoleStandardScheme getScheme() {
-      return new TSentryRoleStandardScheme();
-    }
-  }
-
-  private static class TSentryRoleStandardScheme extends StandardScheme<TSentryRole> {
-
-    public void read(org.apache.thrift.protocol.TProtocol iprot, TSentryRole 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: // 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;
-          case 2: // GROUPS
-            if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
-              {
-                org.apache.thrift.protocol.TSet _set56 = iprot.readSetBegin();
-                struct.groups = new HashSet<TSentryGroup>(2*_set56.size);
-                TSentryGroup _elem57;
-                for (int _i58 = 0; _i58 < _set56.size; ++_i58)
-                {
-                  _elem57 = new TSentryGroup();
-                  _elem57.read(iprot);
-                  struct.groups.add(_elem57);
-                }
-                iprot.readSetEnd();
-              }
-              struct.setGroupsIsSet(true);
-            } else { 
-              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
-            }
-            break;
-          case 3: // GRANTOR_PRINCIPAL
-            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
-              struct.grantorPrincipal = iprot.readString();
-              struct.setGrantorPrincipalIsSet(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, TSentryRole struct) throws org.apache.thrift.TException {
-      struct.validate();
-
-      oprot.writeStructBegin(STRUCT_DESC);
-      if (struct.roleName != null) {
-        oprot.writeFieldBegin(ROLE_NAME_FIELD_DESC);
-        oprot.writeString(struct.roleName);
-        oprot.writeFieldEnd();
-      }
-      if (struct.groups != null) {
-        oprot.writeFieldBegin(GROUPS_FIELD_DESC);
-        {
-          oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, struct.groups.size()));
-          for (TSentryGroup _iter59 : struct.groups)
-          {
-            _iter59.write(oprot);
-          }
-          oprot.writeSetEnd();
-        }
-        oprot.writeFieldEnd();
-      }
-      if (struct.grantorPrincipal != null) {
-        oprot.writeFieldBegin(GRANTOR_PRINCIPAL_FIELD_DESC);
-        oprot.writeString(struct.grantorPrincipal);
-        oprot.writeFieldEnd();
-      }
-      oprot.writeFieldStop();
-      oprot.writeStructEnd();
-    }
-
-  }
-
-  private static class TSentryRoleTupleSchemeFactory implements SchemeFactory {
-    public TSentryRoleTupleScheme getScheme() {
-      return new TSentryRoleTupleScheme();
-    }
-  }
-
-  private static class TSentryRoleTupleScheme extends TupleScheme<TSentryRole> {
-
-    @Override
-    public void write(org.apache.thrift.protocol.TProtocol prot, TSentryRole struct) throws org.apache.thrift.TException {
-      TTupleProtocol oprot = (TTupleProtocol) prot;
-      oprot.writeString(struct.roleName);
-      {
-        oprot.writeI32(struct.groups.size());
-        for (TSentryGroup _iter60 : struct.groups)
-        {
-          _iter60.write(oprot);
-        }
-      }
-      oprot.writeString(struct.grantorPrincipal);
-    }
-
-    @Override
-    public void read(org.apache.thrift.protocol.TProtocol prot, TSentryRole struct) throws org.apache.thrift.TException {
-      TTupleProtocol iprot = (TTupleProtocol) prot;
-      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);
-        TSentryGroup _elem62;
-        for (int _i63 = 0; _i63 < _set61.size; ++_i63)
-        {
-          _elem62 = new TSentryGroup();
-          _elem62.read(iprot);
-          struct.groups.add(_elem62);
-        }
-      }
-      struct.setGroupsIsSet(true);
-      struct.grantorPrincipal = iprot.readString();
-      struct.setGrantorPrincipalIsSet(true);
-    }
-  }
-
-}
-

http://git-wip-us.apache.org/repos/asf/sentry/blob/f1332300/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/service/thrift/TSentryResponseStatus.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/service/thrift/TSentryResponseStatus.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/service/thrift/TSentryResponseStatus.java
deleted file mode 100644
index d9a9f86..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/service/thrift/TSentryResponseStatus.java
+++ /dev/null
@@ -1,598 +0,0 @@
-/**
- * Autogenerated by Thrift Compiler (0.9.3)
- *
- * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
- *  @generated
- */
-package org.apache.sentry.service.thrift;
-
-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 org.apache.thrift.async.AsyncMethodCallback;
-import org.apache.thrift.server.AbstractNonblockingServer.*;
-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 javax.annotation.Generated;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
-@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2016-05-05")
-public class TSentryResponseStatus implements org.apache.thrift.TBase<TSentryResponseStatus, TSentryResponseStatus._Fields>, java.io.Serializable, Cloneable, Comparable<TSentryResponseStatus> {
-  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TSentryResponseStatus");
-
-  private static final org.apache.thrift.protocol.TField VALUE_FIELD_DESC = new org.apache.thrift.protocol.TField("value", org.apache.thrift.protocol.TType.I32, (short)1);
-  private static final org.apache.thrift.protocol.TField MESSAGE_FIELD_DESC = new org.apache.thrift.protocol.TField("message", org.apache.thrift.protocol.TType.STRING, (short)2);
-  private static final org.apache.thrift.protocol.TField STACK_FIELD_DESC = new org.apache.thrift.protocol.TField("stack", org.apache.thrift.protocol.TType.STRING, (short)3);
-
-  private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
-  static {
-    schemes.put(StandardScheme.class, new TSentryResponseStatusStandardSchemeFactory());
-    schemes.put(TupleScheme.class, new TSentryResponseStatusTupleSchemeFactory());
-  }
-
-  private int value; // required
-  private String message; // required
-  private String stack; // 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 {
-    VALUE((short)1, "value"),
-    MESSAGE((short)2, "message"),
-    STACK((short)3, "stack");
-
-    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: // VALUE
-          return VALUE;
-        case 2: // MESSAGE
-          return MESSAGE;
-        case 3: // STACK
-          return STACK;
-        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 __VALUE_ISSET_ID = 0;
-  private byte __isset_bitfield = 0;
-  private static final _Fields optionals[] = {_Fields.STACK};
-  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.VALUE, new org.apache.thrift.meta_data.FieldMetaData("value", org.apache.thrift.TFieldRequirementType.REQUIRED, 
-        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
-    tmpMap.put(_Fields.MESSAGE, new org.apache.thrift.meta_data.FieldMetaData("message", org.apache.thrift.TFieldRequirementType.REQUIRED, 
-        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
-    tmpMap.put(_Fields.STACK, new org.apache.thrift.meta_data.FieldMetaData("stack", 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(TSentryResponseStatus.class, metaDataMap);
-  }
-
-  public TSentryResponseStatus() {
-  }
-
-  public TSentryResponseStatus(
-    int value,
-    String message)
-  {
-    this();
-    this.value = value;
-    setValueIsSet(true);
-    this.message = message;
-  }
-
-  /**
-   * Performs a deep copy on <i>other</i>.
-   */
-  public TSentryResponseStatus(TSentryResponseStatus other) {
-    __isset_bitfield = other.__isset_bitfield;
-    this.value = other.value;
-    if (other.isSetMessage()) {
-      this.message = other.message;
-    }
-    if (other.isSetStack()) {
-      this.stack = other.stack;
-    }
-  }
-
-  public TSentryResponseStatus deepCopy() {
-    return new TSentryResponseStatus(this);
-  }
-
-  @Override
-  public void clear() {
-    setValueIsSet(false);
-    this.value = 0;
-    this.message = null;
-    this.stack = null;
-  }
-
-  public int getValue() {
-    return this.value;
-  }
-
-  public void setValue(int value) {
-    this.value = value;
-    setValueIsSet(true);
-  }
-
-  public void unsetValue() {
-    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __VALUE_ISSET_ID);
-  }
-
-  /** Returns true if field value is set (has been assigned a value) and false otherwise */
-  public boolean isSetValue() {
-    return EncodingUtils.testBit(__isset_bitfield, __VALUE_ISSET_ID);
-  }
-
-  public void setValueIsSet(boolean value) {
-    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __VALUE_ISSET_ID, value);
-  }
-
-  public String getMessage() {
-    return this.message;
-  }
-
-  public void setMessage(String message) {
-    this.message = message;
-  }
-
-  public void unsetMessage() {
-    this.message = null;
-  }
-
-  /** Returns true if field message is set (has been assigned a value) and false otherwise */
-  public boolean isSetMessage() {
-    return this.message != null;
-  }
-
-  public void setMessageIsSet(boolean value) {
-    if (!value) {
-      this.message = null;
-    }
-  }
-
-  public String getStack() {
-    return this.stack;
-  }
-
-  public void setStack(String stack) {
-    this.stack = stack;
-  }
-
-  public void unsetStack() {
-    this.stack = null;
-  }
-
-  /** Returns true if field stack is set (has been assigned a value) and false otherwise */
-  public boolean isSetStack() {
-    return this.stack != null;
-  }
-
-  public void setStackIsSet(boolean value) {
-    if (!value) {
-      this.stack = null;
-    }
-  }
-
-  public void setFieldValue(_Fields field, Object value) {
-    switch (field) {
-    case VALUE:
-      if (value == null) {
-        unsetValue();
-      } else {
-        setValue((Integer)value);
-      }
-      break;
-
-    case MESSAGE:
-      if (value == null) {
-        unsetMessage();
-      } else {
-        setMessage((String)value);
-      }
-      break;
-
-    case STACK:
-      if (value == null) {
-        unsetStack();
-      } else {
-        setStack((String)value);
-      }
-      break;
-
-    }
-  }
-
-  public Object getFieldValue(_Fields field) {
-    switch (field) {
-    case VALUE:
-      return getValue();
-
-    case MESSAGE:
-      return getMessage();
-
-    case STACK:
-      return getStack();
-
-    }
-    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 VALUE:
-      return isSetValue();
-    case MESSAGE:
-      return isSetMessage();
-    case STACK:
-      return isSetStack();
-    }
-    throw new IllegalStateException();
-  }
-
-  @Override
-  public boolean equals(Object that) {
-    if (that == null)
-      return false;
-    if (that instanceof TSentryResponseStatus)
-      return this.equals((TSentryResponseStatus)that);
-    return false;
-  }
-
-  public boolean equals(TSentryResponseStatus that) {
-    if (that == null)
-      return false;
-
-    boolean this_present_value = true;
-    boolean that_present_value = true;
-    if (this_present_value || that_present_value) {
-      if (!(this_present_value && that_present_value))
-        return false;
-      if (this.value != that.value)
-        return false;
-    }
-
-    boolean this_present_message = true && this.isSetMessage();
-    boolean that_present_message = true && that.isSetMessage();
-    if (this_present_message || that_present_message) {
-      if (!(this_present_message && that_present_message))
-        return false;
-      if (!this.message.equals(that.message))
-        return false;
-    }
-
-    boolean this_present_stack = true && this.isSetStack();
-    boolean that_present_stack = true && that.isSetStack();
-    if (this_present_stack || that_present_stack) {
-      if (!(this_present_stack && that_present_stack))
-        return false;
-      if (!this.stack.equals(that.stack))
-        return false;
-    }
-
-    return true;
-  }
-
-  @Override
-  public int hashCode() {
-    List<Object> list = new ArrayList<Object>();
-
-    boolean present_value = true;
-    list.add(present_value);
-    if (present_value)
-      list.add(value);
-
-    boolean present_message = true && (isSetMessage());
-    list.add(present_message);
-    if (present_message)
-      list.add(message);
-
-    boolean present_stack = true && (isSetStack());
-    list.add(present_stack);
-    if (present_stack)
-      list.add(stack);
-
-    return list.hashCode();
-  }
-
-  @Override
-  public int compareTo(TSentryResponseStatus other) {
-    if (!getClass().equals(other.getClass())) {
-      return getClass().getName().compareTo(other.getClass().getName());
-    }
-
-    int lastComparison = 0;
-
-    lastComparison = Boolean.valueOf(isSetValue()).compareTo(other.isSetValue());
-    if (lastComparison != 0) {
-      return lastComparison;
-    }
-    if (isSetValue()) {
-      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.value, other.value);
-      if (lastComparison != 0) {
-        return lastComparison;
-      }
-    }
-    lastComparison = Boolean.valueOf(isSetMessage()).compareTo(other.isSetMessage());
-    if (lastComparison != 0) {
-      return lastComparison;
-    }
-    if (isSetMessage()) {
-      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.message, other.message);
-      if (lastComparison != 0) {
-        return lastComparison;
-      }
-    }
-    lastComparison = Boolean.valueOf(isSetStack()).compareTo(other.isSetStack());
-    if (lastComparison != 0) {
-      return lastComparison;
-    }
-    if (isSetStack()) {
-      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.stack, other.stack);
-      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("TSentryResponseStatus(");
-    boolean first = true;
-
-    sb.append("value:");
-    sb.append(this.value);
-    first = false;
-    if (!first) sb.append(", ");
-    sb.append("message:");
-    if (this.message == null) {
-      sb.append("null");
-    } else {
-      sb.append(this.message);
-    }
-    first = false;
-    if (isSetStack()) {
-      if (!first) sb.append(", ");
-      sb.append("stack:");
-      if (this.stack == null) {
-        sb.append("null");
-      } else {
-        sb.append(this.stack);
-      }
-      first = false;
-    }
-    sb.append(")");
-    return sb.toString();
-  }
-
-  public void validate() throws org.apache.thrift.TException {
-    // check for required fields
-    if (!isSetValue()) {
-      throw new org.apache.thrift.protocol.TProtocolException("Required field 'value' is unset! Struct:" + toString());
-    }
-
-    if (!isSetMessage()) {
-      throw new org.apache.thrift.protocol.TProtocolException("Required field 'message' 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 TSentryResponseStatusStandardSchemeFactory implements SchemeFactory {
-    public TSentryResponseStatusStandardScheme getScheme() {
-      return new TSentryResponseStatusStandardScheme();
-    }
-  }
-
-  private static class TSentryResponseStatusStandardScheme extends StandardScheme<TSentryResponseStatus> {
-
-    public void read(org.apache.thrift.protocol.TProtocol iprot, TSentryResponseStatus 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: // VALUE
-            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
-              struct.value = iprot.readI32();
-              struct.setValueIsSet(true);
-            } else { 
-              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
-            }
-            break;
-          case 2: // MESSAGE
-            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
-              struct.message = iprot.readString();
-              struct.setMessageIsSet(true);
-            } else { 
-              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
-            }
-            break;
-          case 3: // STACK
-            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
-              struct.stack = iprot.readString();
-              struct.setStackIsSet(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, TSentryResponseStatus struct) throws org.apache.thrift.TException {
-      struct.validate();
-
-      oprot.writeStructBegin(STRUCT_DESC);
-      oprot.writeFieldBegin(VALUE_FIELD_DESC);
-      oprot.writeI32(struct.value);
-      oprot.writeFieldEnd();
-      if (struct.message != null) {
-        oprot.writeFieldBegin(MESSAGE_FIELD_DESC);
-        oprot.writeString(struct.message);
-        oprot.writeFieldEnd();
-      }
-      if (struct.stack != null) {
-        if (struct.isSetStack()) {
-          oprot.writeFieldBegin(STACK_FIELD_DESC);
-          oprot.writeString(struct.stack);
-          oprot.writeFieldEnd();
-        }
-      }
-      oprot.writeFieldStop();
-      oprot.writeStructEnd();
-    }
-
-  }
-
-  private static class TSentryResponseStatusTupleSchemeFactory implements SchemeFactory {
-    public TSentryResponseStatusTupleScheme getScheme() {
-      return new TSentryResponseStatusTupleScheme();
-    }
-  }
-
-  private static class TSentryResponseStatusTupleScheme extends TupleScheme<TSentryResponseStatus> {
-
-    @Override
-    public void write(org.apache.thrift.protocol.TProtocol prot, TSentryResponseStatus struct) throws org.apache.thrift.TException {
-      TTupleProtocol oprot = (TTupleProtocol) prot;
-      oprot.writeI32(struct.value);
-      oprot.writeString(struct.message);
-      BitSet optionals = new BitSet();
-      if (struct.isSetStack()) {
-        optionals.set(0);
-      }
-      oprot.writeBitSet(optionals, 1);
-      if (struct.isSetStack()) {
-        oprot.writeString(struct.stack);
-      }
-    }
-
-    @Override
-    public void read(org.apache.thrift.protocol.TProtocol prot, TSentryResponseStatus struct) throws org.apache.thrift.TException {
-      TTupleProtocol iprot = (TTupleProtocol) prot;
-      struct.value = iprot.readI32();
-      struct.setValueIsSet(true);
-      struct.message = iprot.readString();
-      struct.setMessageIsSet(true);
-      BitSet incoming = iprot.readBitSet(1);
-      if (incoming.get(0)) {
-        struct.stack = iprot.readString();
-        struct.setStackIsSet(true);
-      }
-    }
-  }
-
-}
-

http://git-wip-us.apache.org/repos/asf/sentry/blob/f1332300/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/service/thrift/sentry_common_serviceConstants.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/service/thrift/sentry_common_serviceConstants.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/service/thrift/sentry_common_serviceConstants.java
deleted file mode 100644
index eb63bc3..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/service/thrift/sentry_common_serviceConstants.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
- * Autogenerated by Thrift Compiler (0.9.3)
- *
- * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
- *  @generated
- */
-package org.apache.sentry.service.thrift;
-
-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 org.apache.thrift.async.AsyncMethodCallback;
-import org.apache.thrift.server.AbstractNonblockingServer.*;
-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 javax.annotation.Generated;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
-public class sentry_common_serviceConstants {
-
-  public static final int TSENTRY_SERVICE_V1 = 1;
-
-  public static final int TSENTRY_SERVICE_V2 = 2;
-
-  public static final int TSENTRY_STATUS_OK = 0;
-
-  public static final int TSENTRY_STATUS_ALREADY_EXISTS = 1;
-
-  public static final int TSENTRY_STATUS_NO_SUCH_OBJECT = 2;
-
-  public static final int TSENTRY_STATUS_RUNTIME_ERROR = 3;
-
-  public static final int TSENTRY_STATUS_INVALID_INPUT = 4;
-
-  public static final int TSENTRY_STATUS_ACCESS_DENIED = 5;
-
-  public static final int TSENTRY_STATUS_THRIFT_VERSION_MISMATCH = 6;
-
-}

http://git-wip-us.apache.org/repos/asf/sentry/blob/f1332300/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/SentryPolicyStorePlugin.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/SentryPolicyStorePlugin.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/SentryPolicyStorePlugin.java
deleted file mode 100644
index 2ff715f..0000000
--- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/SentryPolicyStorePlugin.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.sentry.provider.db;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.sentry.core.common.exception.SentryUserException;
-import org.apache.sentry.provider.db.service.persistent.SentryStore;
-import org.apache.sentry.provider.db.service.thrift.TAlterSentryRoleAddGroupsRequest;
-import org.apache.sentry.provider.db.service.thrift.TAlterSentryRoleDeleteGroupsRequest;
-import org.apache.sentry.provider.db.service.thrift.TAlterSentryRoleGrantPrivilegeRequest;
-import org.apache.sentry.provider.db.service.thrift.TAlterSentryRoleRevokePrivilegeRequest;
-import org.apache.sentry.provider.db.service.thrift.TDropPrivilegesRequest;
-import org.apache.sentry.provider.db.service.thrift.TDropSentryRoleRequest;
-import org.apache.sentry.provider.db.service.thrift.TRenamePrivilegesRequest;
-
-public interface SentryPolicyStorePlugin {
-
-  @SuppressWarnings("serial")
-  class SentryPluginException extends SentryUserException {
-    public SentryPluginException(String msg) {
-      super(msg);
-    }
-    public SentryPluginException(String msg, Throwable t) {
-      super(msg, t);
-    }
-  }
-
-  void initialize(Configuration conf, SentryStore sentryStore) throws SentryPluginException;
-
-  void onAlterSentryRoleAddGroups(TAlterSentryRoleAddGroupsRequest tRequest) throws SentryPluginException;
-
-  void onAlterSentryRoleDeleteGroups(TAlterSentryRoleDeleteGroupsRequest tRequest) throws SentryPluginException;
-
-  void onAlterSentryRoleGrantPrivilege(TAlterSentryRoleGrantPrivilegeRequest tRequest) throws SentryPluginException;
-
-  void onAlterSentryRoleRevokePrivilege(TAlterSentryRoleRevokePrivilegeRequest tRequest) throws SentryPluginException;
-
-  void onDropSentryRole(TDropSentryRoleRequest tRequest) throws SentryPluginException;
-
-  void onRenameSentryPrivilege(TRenamePrivilegesRequest request) throws SentryPluginException;
-
-  void onDropSentryPrivilege(TDropPrivilegesRequest request) throws SentryPluginException;
-
-}

http://git-wip-us.apache.org/repos/asf/sentry/blob/f1332300/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/generic/service/persistent/DelegateSentryStore.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/generic/service/persistent/DelegateSentryStore.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/generic/service/persistent/DelegateSentryStore.java
deleted file mode 100644
index e960dcd..0000000
--- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/generic/service/persistent/DelegateSentryStore.java
+++ /dev/null
@@ -1,542 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sentry.provider.db.generic.service.persistent;
-
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Set;
-
-import javax.jdo.PersistenceManager;
-import javax.jdo.Query;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.sentry.core.common.exception.SentryUserException;
-import org.apache.sentry.core.common.Authorizable;
-import org.apache.sentry.core.common.exception.SentryAccessDeniedException;
-import org.apache.sentry.core.common.exception.SentryAlreadyExistsException;
-import org.apache.sentry.core.common.exception.SentryGrantDeniedException;
-import org.apache.sentry.core.common.exception.SentryInvalidInputException;
-import org.apache.sentry.core.common.exception.SentryNoSuchObjectException;
-import org.apache.sentry.core.common.exception.SentrySiteConfigurationException;
-import org.apache.sentry.provider.db.service.model.MSentryGMPrivilege;
-import org.apache.sentry.provider.db.service.model.MSentryGroup;
-import org.apache.sentry.provider.db.service.model.MSentryRole;
-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.SentryPolicyStoreProcessor;
-import org.apache.sentry.provider.db.service.thrift.TSentryGroup;
-import org.apache.sentry.provider.db.service.thrift.TSentryRole;
-import org.apache.sentry.service.thrift.ServiceConstants.ServerConfig;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Joiner;
-import com.google.common.base.Preconditions;
-import com.google.common.base.Strings;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Sets;
-
-/**
- * The DelegateSentryStore will supports the generic authorizable model. It stores the authorizables
- * into separated column. Take the authorizables:[DATABASE=db1,TABLE=tb1,COLUMN=cl1] for example,
- * The DATABASE,db1,TABLE,tb1,COLUMN and cl1 will be stored into the six columns(resourceName0=db1,resourceType0=DATABASE,
- * resourceName1=tb1,resourceType1=TABLE,
- * resourceName2=cl1,resourceType2=COLUMN ) of generic privilege table
- */
-public class DelegateSentryStore implements SentryStoreLayer {
-  private SentryStore delegate;
-  private Configuration conf;
-  private Set<String> adminGroups;
-  private PrivilegeOperatePersistence privilegeOperator;
-
-  public DelegateSentryStore(Configuration conf) throws SentryNoSuchObjectException,
-      SentryAccessDeniedException, SentrySiteConfigurationException, IOException {
-    this.privilegeOperator = new PrivilegeOperatePersistence(conf);
-    // The generic model doesn't turn on the thread that cleans hive privileges
-    conf.set(ServerConfig.SENTRY_STORE_ORPHANED_PRIVILEGE_REMOVAL,"false");
-    this.conf = conf;
-    //delegated old sentryStore
-    this.delegate = new SentryStore(conf);
-    adminGroups = ImmutableSet.copyOf(toTrimmed(Sets.newHashSet(conf.getStrings(
-        ServerConfig.ADMIN_GROUPS, new String[]{}))));
-  }
-
-  private PersistenceManager openTransaction() {
-    return delegate.openTransaction();
-  }
-
-  private CommitContext commitUpdateTransaction(PersistenceManager pm) {
-    return delegate.commitUpdateTransaction(pm);
-  }
-
-  private void rollbackTransaction(PersistenceManager pm) {
-    delegate.rollbackTransaction(pm);
-  }
-
-  private void commitTransaction(PersistenceManager pm) {
-    delegate.commitTransaction(pm);
-  }
-
-  private MSentryRole getRole(String roleName, PersistenceManager pm) {
-    return delegate.getMSentryRole(pm, roleName);
-  }
-
-  @Override
-  public CommitContext createRole(String component, String role,
-      String requestor) throws SentryAlreadyExistsException {
-    return delegate.createSentryRole(role);
-  }
-
-  /**
-   * The role is global in the generic model, such as the role may be has more than one component
-   * privileges, so delete role will remove all privileges related to it.
-   */
-  @Override
-  public CommitContext dropRole(String component, String role, String requestor)
-      throws SentryNoSuchObjectException {
-    boolean rollbackTransaction = true;
-    PersistenceManager pm = null;
-    String trimmedRole = toTrimmedLower(role);
-    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(trimmedRole);
-      if (sentryRole == null) {
-        throw new SentryNoSuchObjectException("Role: " + trimmedRole + " doesn't exist");
-      } else {
-        pm.retrieve(sentryRole);
-        sentryRole.removeGMPrivileges();
-        sentryRole.removePrivileges();
-        pm.deletePersistent(sentryRole);
-      }
-      CommitContext commit = commitUpdateTransaction(pm);
-      rollbackTransaction = false;
-      return commit;
-    } finally {
-      if (rollbackTransaction) {
-        rollbackTransaction(pm);
-      }
-    }
-  }
-
-  @Override
-  public Set<String> getAllRoleNames() {
-    return delegate.getAllRoleNames();
-  }
-
-  @Override
-  public CommitContext alterRoleAddGroups(String component, String role,
-      Set<String> groups, String requestor) throws SentryNoSuchObjectException {
-    return delegate.alterSentryRoleAddGroups(requestor, role, toTSentryGroups(groups));
-  }
-
-  @Override
-  public CommitContext alterRoleDeleteGroups(String component, String role,
-      Set<String> groups, String requestor) throws SentryNoSuchObjectException {
-  //called to old sentryStore
-    return delegate.alterSentryRoleDeleteGroups(role, toTSentryGroups(groups));
-  }
-
-  @Override
-  public CommitContext alterRoleGrantPrivilege(String component, String role,
-      PrivilegeObject privilege, String grantorPrincipal)
-      throws SentryUserException {
-    String trimmedRole = toTrimmedLower(role);
-    PersistenceManager pm = null;
-    boolean rollbackTransaction = true;
-    try{
-      pm = openTransaction();
-      MSentryRole mRole = getRole(trimmedRole, pm);
-      if (mRole == null) {
-        throw new SentryNoSuchObjectException("Role: " + trimmedRole + " doesn't exist");
-      }
-      /**
-       * check with grant option
-       */
-      grantOptionCheck(privilege, grantorPrincipal, pm);
-
-      privilegeOperator.grantPrivilege(privilege, mRole, pm);
-
-      CommitContext commitContext = delegate.commitUpdateTransaction(pm);
-      rollbackTransaction = false;
-      return commitContext;
-
-    } finally {
-      if (rollbackTransaction) {
-        rollbackTransaction(pm);
-      }
-    }
-  }
-
-  @Override
-  public CommitContext alterRoleRevokePrivilege(String component,
-      String role, PrivilegeObject privilege, String grantorPrincipal)
-      throws SentryUserException {
-    String trimmedRole = toTrimmedLower(role);
-    PersistenceManager pm = null;
-    boolean rollbackTransaction = true;
-    try{
-      pm = openTransaction();
-      MSentryRole mRole = getRole(trimmedRole, pm);
-      if (mRole == null) {
-        throw new SentryNoSuchObjectException("Role: " + trimmedRole + " doesn't exist");
-      }
-      /**
-       * check with grant option
-       */
-      grantOptionCheck(privilege, grantorPrincipal, pm);
-
-      privilegeOperator.revokePrivilege(privilege, mRole, pm);
-
-      CommitContext commitContext = commitUpdateTransaction(pm);
-      rollbackTransaction = false;
-      return commitContext;
-
-    } finally {
-      if (rollbackTransaction) {
-        rollbackTransaction(pm);
-      }
-    }
-  }
-
-  @Override
-  public CommitContext renamePrivilege(String component, String service,
-      List<? extends Authorizable> oldAuthorizables,
-      List<? extends Authorizable> newAuthorizables, String requestor)
-      throws SentryUserException {
-    Preconditions.checkNotNull(component);
-    Preconditions.checkNotNull(service);
-    Preconditions.checkNotNull(oldAuthorizables);
-    Preconditions.checkNotNull(newAuthorizables);
-
-    if (oldAuthorizables.size() != newAuthorizables.size()) {
-      throw new SentryAccessDeniedException(
-          "rename privilege denied: the size of oldAuthorizables must equals the newAuthorizables "
-              + "oldAuthorizables:" + Arrays.toString(oldAuthorizables.toArray()) + " "
-              + "newAuthorizables:" + Arrays.toString(newAuthorizables.toArray()));
-    }
-
-    PersistenceManager pm = null;
-    boolean rollbackTransaction = true;
-    try {
-      pm = openTransaction();
-
-      privilegeOperator.renamePrivilege(toTrimmedLower(component), toTrimmedLower(service),
-          oldAuthorizables, newAuthorizables, requestor, pm);
-
-      CommitContext commitContext = commitUpdateTransaction(pm);
-      rollbackTransaction = false;
-      return commitContext;
-    } finally {
-      if (rollbackTransaction) {
-        rollbackTransaction(pm);
-      }
-    }
-  }
-
-  @Override
-  public CommitContext dropPrivilege(String component,
-      PrivilegeObject privilege, String requestor) throws SentryUserException {
-    Preconditions.checkNotNull(requestor);
-
-    PersistenceManager pm = null;
-    boolean rollbackTransaction = true;
-    try {
-      pm = openTransaction();
-
-      privilegeOperator.dropPrivilege(privilege, pm);
-
-      CommitContext commitContext = commitUpdateTransaction(pm);
-      rollbackTransaction = false;
-      return commitContext;
-    } finally {
-      if (rollbackTransaction) {
-        rollbackTransaction(pm);
-      }
-    }
-  }
-
-  /**
-   * Grant option check
-   * @param component
-   * @param pm
-   * @param privilegeReader
-   * @throws SentryUserException
-   */
-  private void grantOptionCheck(PrivilegeObject requestPrivilege, String grantorPrincipal,PersistenceManager pm)
-      throws SentryUserException {
-
-    if (Strings.isNullOrEmpty(grantorPrincipal)) {
-      throw new SentryInvalidInputException("grantorPrincipal should not be null or empty");
-    }
-
-    Set<String> groups = getRequestorGroups(grantorPrincipal);
-    if (groups == null || groups.isEmpty()) {
-      throw new SentryGrantDeniedException(grantorPrincipal
-          + " has no grant!");
-    }
-    //admin group check
-    if (!Sets.intersection(adminGroups, toTrimmed(groups)).isEmpty()) {
-      return;
-    }
-    //privilege grant option check
-    Set<MSentryRole> mRoles = delegate.getRolesForGroups(pm, groups);
-    if (!privilegeOperator.checkPrivilegeOption(mRoles, requestPrivilege, pm)) {
-      throw new SentryGrantDeniedException(grantorPrincipal
-          + " has no grant!");
-    }
-  }
-
-  @Override
-  public Set<String> getRolesByGroups(String component, Set<String> groups)
-      throws SentryUserException {
-    Set<String> roles = Sets.newHashSet();
-    if (groups == null) {
-      return roles;
-    }
-    for (TSentryRole tSentryRole : delegate.getTSentryRolesByGroupName(groups, true)) {
-      roles.add(tSentryRole.getRoleName());
-    }
-    return roles;
-  }
-
-  @Override
-  public Set<String> getGroupsByRoles(String component, Set<String> roles)
-      throws SentryUserException {
-    Set<String> trimmedRoles = toTrimmedLower(roles);
-    Set<String> groupNames = Sets.newHashSet();
-    if (trimmedRoles.size() == 0) {
-      return groupNames;
-    }
-
-    PersistenceManager pm = null;
-    try{
-      pm = openTransaction();
-      //get groups by roles
-      Query query = pm.newQuery(MSentryGroup.class);
-      StringBuilder filters = new StringBuilder();
-      query.declareVariables("org.apache.sentry.provider.db.service.model.MSentryRole role");
-      List<String> rolesFiler = new LinkedList<String>();
-      for (String role : trimmedRoles) {
-        rolesFiler.add("role.roleName == \"" + role + "\" ");
-      }
-      filters.append("roles.contains(role) " + "&& (" + Joiner.on(" || ").join(rolesFiler) + ")");
-      query.setFilter(filters.toString());
-
-      List<MSentryGroup> groups = (List<MSentryGroup>)query.execute();
-      if (groups == null) {
-        return groupNames;
-      }
-      for (MSentryGroup group : groups) {
-        groupNames.add(group.getGroupName());
-      }
-      return groupNames;
-    } finally {
-      if (pm != null) {
-        commitTransaction(pm);
-      }
-    }
-  }
-
-  @Override
-  public Set<PrivilegeObject> getPrivilegesByRole(String component,
-      Set<String> roles) throws SentryUserException {
-    Preconditions.checkNotNull(roles);
-    Set<PrivilegeObject> privileges = Sets.newHashSet();
-    if (roles.isEmpty()) {
-      return privileges;
-    }
-
-    PersistenceManager pm = null;
-    try {
-      pm = openTransaction();
-      Set<MSentryRole> mRoles = Sets.newHashSet();
-      for (String role : roles) {
-        MSentryRole mRole = getRole(toTrimmedLower(role), pm);
-        if (mRole != null) {
-          mRoles.add(mRole);
-        }
-      }
-      privileges.addAll(privilegeOperator.getPrivilegesByRole(mRoles, pm));
-    } finally {
-      if (pm != null) {
-        commitTransaction(pm);
-      }
-    }
-    return privileges;
-  }
-
-  @Override
-  public Set<PrivilegeObject> getPrivilegesByProvider(String component,
-      String service, Set<String> roles, Set<String> groups,
-      List<? extends Authorizable> authorizables) throws SentryUserException {
-    Preconditions.checkNotNull(component);
-    Preconditions.checkNotNull(service);
-
-    String trimmedComponent = toTrimmedLower(component);
-    String trimmedService = toTrimmedLower(service);
-
-    Set<PrivilegeObject> privileges = Sets.newHashSet();
-    PersistenceManager pm = null;
-    try {
-      pm = openTransaction();
-      //CaseInsensitive roleNames
-      Set<String> trimmedRoles = toTrimmedLower(roles);
-
-      if (groups != null) {
-        trimmedRoles.addAll(delegate.getRoleNamesForGroups(groups));
-      }
-
-      if (trimmedRoles.size() == 0) {
-        return privileges;
-      }
-
-      Set<MSentryRole> mRoles = Sets.newHashSet();
-      for (String role : trimmedRoles) {
-        MSentryRole mRole = getRole(role, pm);
-        if (mRole != null) {
-          mRoles.add(mRole);
-        }
-      }
-      //get the privileges
-      privileges.addAll(privilegeOperator.getPrivilegesByProvider(trimmedComponent, trimmedService, mRoles, authorizables, pm));
-    } finally {
-      if (pm != null) {
-        commitTransaction(pm);
-      }
-    }
-    return privileges;
-  }
-
-  @Override
-  public Set<MSentryGMPrivilege> getPrivilegesByAuthorizable(String component, String service,
-      Set<String> validActiveRoles, List<? extends Authorizable> authorizables)
-      throws SentryUserException {
-
-    Preconditions.checkNotNull(component);
-    Preconditions.checkNotNull(service);
-
-    component = toTrimmedLower(component);
-    service = toTrimmedLower(service);
-
-    Set<MSentryGMPrivilege> privileges = Sets.newHashSet();
-
-    if (validActiveRoles == null || validActiveRoles.isEmpty()) {
-      return privileges;
-    }
-
-    PersistenceManager pm = null;
-    try {
-      pm = openTransaction();
-
-      Set<MSentryRole> mRoles = Sets.newHashSet();
-      for (String role : validActiveRoles) {
-        MSentryRole mRole = getRole(role, pm);
-        if (mRole != null) {
-          mRoles.add(mRole);
-        }
-      }
-
-      //get the privileges
-      Set<MSentryGMPrivilege> mSentryGMPrivileges =  privilegeOperator.getPrivilegesByAuthorizable(component, service, mRoles, authorizables, pm);
-
-      for (MSentryGMPrivilege mSentryGMPrivilege : mSentryGMPrivileges) {
-        /**
-         * force to load all roles related this privilege
-         * avoid the lazy-loading
-         */
-        pm.retrieve(mSentryGMPrivilege);
-        privileges.add(mSentryGMPrivilege);
-      }
-
-    } finally {
-      commitTransaction(pm);
-    }
-    return privileges;
-  }
-
-   @Override
-  public void close() {
-    delegate.stop();
-  }
-
-  private Set<TSentryGroup> toTSentryGroups(Set<String> groups) {
-    Set<TSentryGroup> tSentryGroups = Sets.newHashSet();
-    for (String group : groups) {
-      tSentryGroups.add(new TSentryGroup(group));
-    }
-    return tSentryGroups;
-  }
-
-  private Set<String> toTrimmedLower(Set<String> s) {
-    if (s == null) {
-      return new HashSet<String>();
-    }
-    Set<String> result = Sets.newHashSet();
-    for (String v : s) {
-      result.add(v.trim().toLowerCase());
-    }
-    return result;
-  }
-
-  private Set<String> toTrimmed(Set<String> s) {
-    if (s == null) {
-      return new HashSet<String>();
-    }
-    Set<String> result = Sets.newHashSet();
-    for (String v : s) {
-      result.add(v.trim());
-    }
-    return result;
-  }
-
-  private String toTrimmedLower(String s) {
-    if (s == null) {
-      return "";
-    }
-    return s.trim().toLowerCase();
-  }
-
-  private Set<String> getRequestorGroups(String userName)
-      throws SentryUserException {
-    return SentryPolicyStoreProcessor.getGroupsFromUserName(this.conf, userName);
-  }
-
-  @VisibleForTesting
-  void clearAllTables() {
-    boolean rollbackTransaction = true;
-    PersistenceManager pm = null;
-    try {
-      pm = openTransaction();
-      pm.newQuery(MSentryRole.class).deletePersistentAll();
-      pm.newQuery(MSentryGroup.class).deletePersistentAll();
-      pm.newQuery(MSentryGMPrivilege.class).deletePersistentAll();
-      commitUpdateTransaction(pm);
-      rollbackTransaction = false;
-    } finally {
-      if (rollbackTransaction) {
-        rollbackTransaction(pm);
-      }
-    }
-  }
-}