http://git-wip-us.apache.org/repos/asf/sentry/blob/f5368df5/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/f5368df5/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/f5368df5/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/f5368df5/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/f5368df5/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 3de1f65..7931eb8 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 @@ -143,7 +143,7 @@ public class SentryPolicyStoreProcessor implements SentryPolicyService.Iface { } catch (IllegalArgumentException e) { LOGGER.warn("Metrics reporting not configured correctly, please set " + ServerConfig.SENTRY_REPORTER + - " to: " + ServerConfig.SENTRY_REPORTER_CONSOLE + "/" + ServerConfig.SENTRY_REPORTER_JMX); + " to: " + SentryMetrics.Reporting.CONSOLE.name() + "/" + SentryMetrics.Reporting.JMX.name()); } } } http://git-wip-us.apache.org/repos/asf/sentry/blob/f5368df5/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/ServiceConstants.java ---------------------------------------------------------------------- diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/ServiceConstants.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/ServiceConstants.java deleted file mode 100644 index 32a4044..0000000 --- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/ServiceConstants.java +++ /dev/null @@ -1,261 +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.service.thrift; - -import java.util.HashMap; -import java.util.Map; - -import javax.security.sasl.Sasl; - -import org.apache.sentry.provider.db.service.thrift.SentryMetrics; - -import com.google.common.base.Splitter; -import com.google.common.collect.ImmutableMap; - -public class ServiceConstants { - - private static final ImmutableMap<String, String> SASL_PROPERTIES; - - static { - Map<String, String> saslProps = new HashMap<String, String>(); - saslProps.put(Sasl.SERVER_AUTH, "true"); - saslProps.put(Sasl.QOP, "auth-conf"); - SASL_PROPERTIES = ImmutableMap.copyOf(saslProps); - } - - public static class ConfUtilties { - public static final Splitter CLASS_SPLITTER = Splitter.onPattern("[\\s,]") - .trimResults().omitEmptyStrings(); - } - public static class ServiceArgs { - public static final String CONFIG_FILE_SHORT = "c"; - public static final String CONFIG_FILE_LONG = "conffile"; - } - - public static class ServerConfig { - public static final ImmutableMap<String, String> SASL_PROPERTIES = ServiceConstants.SASL_PROPERTIES; - /** - * This configuration parameter is only meant to be used for testing purposes. - */ - public static final String SECURITY_MODE = "sentry.service.security.mode"; - public static final String SECURITY_MODE_KERBEROS = "kerberos"; - public static final String SECURITY_MODE_NONE = "none"; - public static final String SECURITY_USE_UGI_TRANSPORT = "sentry.service.security.use.ugi"; - public static final String ADMIN_GROUPS = "sentry.service.admin.group"; - public static final String PRINCIPAL = "sentry.service.server.principal"; - public static final String KEY_TAB = "sentry.service.server.keytab"; - public static final String RPC_PORT = "sentry.service.server.rpc-port"; - public static final int RPC_PORT_DEFAULT = 8038; - public static final String RPC_ADDRESS = "sentry.service.server.rpc-address"; - public static final String RPC_ADDRESS_DEFAULT = "0.0.0.0"; //NOPMD - public static final String RPC_MAX_THREADS = "sentry.service.server-max-threads"; - public static final int RPC_MAX_THREADS_DEFAULT = 500; - public static final String RPC_MIN_THREADS = "sentry.service.server-min-threads"; - public static final int RPC_MIN_THREADS_DEFAULT = 10; - public static final String ALLOW_CONNECT = "sentry.service.allow.connect"; - - public static final String SENTRY_POLICY_STORE_PLUGINS = "sentry.policy.store.plugins"; - public static final String SENTRY_POLICY_STORE_PLUGINS_DEFAULT = ""; - - public static final String SENTRY_METASTORE_PLUGINS = "sentry.metastore.plugins"; - public static final String SENTRY_METASTORE_PLUGINS_DEFAULT = ""; - - public static final String PROCESSOR_FACTORIES = "sentry.service.processor.factories"; - public static final String PROCESSOR_FACTORIES_DEFAULT = - "org.apache.sentry.provider.db.service.thrift.SentryPolicyStoreProcessorFactory" + - ",org.apache.sentry.provider.db.generic.service.thrift.SentryGenericPolicyProcessorFactory"; - public static final String SENTRY_STORE_JDBC_URL = "sentry.store.jdbc.url"; - public static final String SENTRY_STORE_JDBC_USER = "sentry.store.jdbc.user"; - public static final String SENTRY_STORE_JDBC_USER_DEFAULT = "Sentry"; - public static final String SENTRY_STORE_JDBC_PASS = "sentry.store.jdbc.password"; - public static final String SENTRY_STORE_JDBC_DRIVER = "sentry.store.jdbc.driver"; - public static final String SENTRY_STORE_JDBC_DRIVER_DEFAULT = "org.apache.derby.jdbc.EmbeddedDriver"; - - public static final String JAVAX_JDO_URL = "javax.jdo.option.ConnectionURL"; - public static final String JAVAX_JDO_USER = "javax.jdo.option.ConnectionUserName"; - public static final String JAVAX_JDO_PASS = "javax.jdo.option.ConnectionPassword"; - public static final String JAVAX_JDO_DRIVER_NAME = "javax.jdo.option.ConnectionDriverName"; - - public static final String SENTRY_DB_PROPERTY_PREFIX = "sentry."; - public static final String SENTRY_JAVAX_JDO_PROPERTY_PREFIX = SENTRY_DB_PROPERTY_PREFIX + "javax.jdo"; - public static final String SENTRY_DATANUCLEUS_PROPERTY_PREFIX = SENTRY_DB_PROPERTY_PREFIX + "datanucleus"; - - public static final String SENTRY_VERIFY_SCHEM_VERSION = "sentry.verify.schema.version"; - public static final String SENTRY_VERIFY_SCHEM_VERSION_DEFAULT = "true"; - - public static final String SENTRY_SERVICE_NAME = "sentry.service.name"; - public static final String SENTRY_SERVICE_NAME_DEFAULT = "Sentry-Service"; - - public static final String SENTRY_STORE_GROUP_MAPPING = "sentry.store.group.mapping"; - public static final String SENTRY_STORE_GROUP_MAPPING_RESOURCE = "sentry.store.group.mapping.resource"; - public static final String SENTRY_STORE_HADOOP_GROUP_MAPPING = "org.apache.sentry.provider.common.HadoopGroupMappingService"; - public static final String SENTRY_STORE_LOCAL_GROUP_MAPPING = "org.apache.sentry.provider.file.LocalGroupMappingService"; - public static final String SENTRY_STORE_GROUP_MAPPING_DEFAULT = SENTRY_STORE_HADOOP_GROUP_MAPPING; - - public static final String SENTRY_STORE_ORPHANED_PRIVILEGE_REMOVAL = "sentry.store.orphaned.privilege.removal"; - public static final String SENTRY_STORE_ORPHANED_PRIVILEGE_REMOVAL_DEFAULT = "false"; - public static final String SENTRY_HA_ENABLED = "sentry.ha.enabled"; - public static final boolean SENTRY_HA_ENABLED_DEFAULT = false; - public static final String SENTRY_HA_ZK_PROPERTY_PREFIX = "sentry.ha.zookeeper."; - public static final String SENTRY_HA_ZOOKEEPER_SECURITY = SENTRY_HA_ZK_PROPERTY_PREFIX + "security"; - public static final boolean SENTRY_HA_ZOOKEEPER_SECURITY_DEFAULT = false; - public static final String SENTRY_HA_ZOOKEEPER_QUORUM = SENTRY_HA_ZK_PROPERTY_PREFIX + "quorum"; - public static final String SENTRY_HA_ZOOKEEPER_QUORUM_DEFAULT = "localhost:2181"; - public static final String SENTRY_HA_ZOOKEEPER_RETRIES_MAX_COUNT = SENTRY_HA_ZK_PROPERTY_PREFIX + "session.retries.max.count"; - public static final int SENTRY_HA_ZOOKEEPER_RETRIES_MAX_COUNT_DEFAULT = 3; - public static final String SENTRY_HA_ZOOKEEPER_SLEEP_BETWEEN_RETRIES_MS = SENTRY_HA_ZK_PROPERTY_PREFIX + "session.sleep.between.retries.ms"; - public static final int SENTRY_HA_ZOOKEEPER_SLEEP_BETWEEN_RETRIES_MS_DEFAULT = 100; - public static final String SENTRY_HA_ZOOKEEPER_NAMESPACE = SENTRY_HA_ZK_PROPERTY_PREFIX + "namespace"; - public static final String SENTRY_HA_ZOOKEEPER_NAMESPACE_DEFAULT = "sentry"; - // principal and keytab for client to be able to connect to secure ZK. Needed for Sentry HA with secure ZK - public static final String SERVER_HA_ZOOKEEPER_CLIENT_PRINCIPAL = "sentry.zookeeper.client.principal"; - public static final String SERVER_HA_ZOOKEEPER_CLIENT_KEYTAB = "sentry.zookeeper.client.keytab"; - public static final String SERVER_HA_ZOOKEEPER_CLIENT_TICKET_CACHE = "sentry.zookeeper.client.ticketcache"; - public static final String SERVER_HA_ZOOKEEPER_CLIENT_TICKET_CACHE_DEFAULT = "false"; - public static final ImmutableMap<String, String> SENTRY_STORE_DEFAULTS = - ImmutableMap.<String, String>builder() - .put("datanucleus.connectionPoolingType", "BoneCP") - .put("datanucleus.validateTables", "false") - .put("datanucleus.validateColumns", "false") - .put("datanucleus.validateConstraints", "false") - .put("datanucleus.storeManagerType", "rdbms") - .put("datanucleus.schema.autoCreateAll", "true") - .put("datanucleus.autoCreateSchema", "false") - .put("datanucleus.fixedDatastore", "true") - .put("datanucleus.autoStartMechanismMode", "checked") - .put("datanucleus.transactionIsolation", "read-committed") - .put("datanucleus.cache.level2", "false") - .put("datanucleus.cache.level2.type", "none") - .put("datanucleus.identifierFactory", "datanucleus1") - .put("datanucleus.rdbms.useLegacyNativeValueStrategy", "true") - .put("datanucleus.plugin.pluginRegistryBundleCheck", "LOG") - .put("javax.jdo.PersistenceManagerFactoryClass", - "org.datanucleus.api.jdo.JDOPersistenceManagerFactory") - .put("javax.jdo.option.DetachAllOnCommit", "true") - .put("javax.jdo.option.NonTransactionalRead", "false") - .put("javax.jdo.option.NonTransactionalWrite", "false") - .put("javax.jdo.option.Multithreaded", "true") - .build(); - - public static final String SENTRY_WEB_ENABLE = "sentry.service.web.enable"; - public static final Boolean SENTRY_WEB_ENABLE_DEFAULT = false; - public static final String SENTRY_WEB_PORT = "sentry.service.web.port"; - public static final int SENTRY_WEB_PORT_DEFAULT = 29000; - public static final String SENTRY_REPORTER = "sentry.service.reporter"; - public static final String SENTRY_REPORTER_JMX = SentryMetrics.Reporting.JMX.name(); //case insensitive - public static final String SENTRY_REPORTER_CONSOLE = SentryMetrics.Reporting.CONSOLE.name();//case insensitive - - // Web SSL - public static final String SENTRY_WEB_USE_SSL = "sentry.web.use.ssl"; - public static final String SENTRY_WEB_SSL_KEYSTORE_PATH = "sentry.web.ssl.keystore.path"; - public static final String SENTRY_WEB_SSL_KEYSTORE_PASSWORD = "sentry.web.ssl.keystore.password"; - public static final String SENTRY_SSL_PROTOCOL_BLACKLIST = "sentry.ssl.protocol.blacklist"; - // Blacklist SSL protocols that are not secure (e.g., POODLE vulnerability) - public static final String[] SENTRY_SSL_PROTOCOL_BLACKLIST_DEFAULT = {"SSLv2", "SSLv2Hello", "SSLv3"}; - - // Web Security - public static final String SENTRY_WEB_SECURITY_PREFIX = "sentry.service.web.authentication"; - public static final String SENTRY_WEB_SECURITY_TYPE = SENTRY_WEB_SECURITY_PREFIX + ".type"; - public static final String SENTRY_WEB_SECURITY_TYPE_NONE = "NONE"; - public static final String SENTRY_WEB_SECURITY_TYPE_KERBEROS = "KERBEROS"; - public static final String SENTRY_WEB_SECURITY_PRINCIPAL = SENTRY_WEB_SECURITY_PREFIX + ".kerberos.principal"; - public static final String SENTRY_WEB_SECURITY_KEYTAB = SENTRY_WEB_SECURITY_PREFIX + ".kerberos.keytab"; - public static final String SENTRY_WEB_SECURITY_ALLOW_CONNECT_USERS = SENTRY_WEB_SECURITY_PREFIX + ".allow.connect.users"; - - // max message size for thrift messages - public static final String SENTRY_POLICY_SERVER_THRIFT_MAX_MESSAGE_SIZE = "sentry.policy.server.thrift.max.message.size"; - public static final long SENTRY_POLICY_SERVER_THRIFT_MAX_MESSAGE_SIZE_DEFAULT = 100 * 1024 * 1024; - - // action factories for external components - public static final String SENTRY_COMPONENT_ACTION_FACTORY_FORMAT = "sentry.%s.action.factory"; - - // Sentry is never a client to other Kerberos Services, it should not be required to renew the TGT - @Deprecated - public static final String SENTRY_KERBEROS_TGT_AUTORENEW = "sentry.service.kerberos.tgt.autorenew"; - @Deprecated - public static final Boolean SENTRY_KERBEROS_TGT_AUTORENEW_DEFAULT = false; - } - - public static class ClientConfig { - public static final ImmutableMap<String, String> SASL_PROPERTIES = ServiceConstants.SASL_PROPERTIES; - public static final String SERVER_RPC_PORT = "sentry.service.client.server.rpc-port"; - public static final int SERVER_RPC_PORT_DEFAULT = ServerConfig.RPC_PORT_DEFAULT; - public static final String SERVER_RPC_ADDRESS = "sentry.service.client.server.rpc-address"; - public static final String SERVER_RPC_CONN_TIMEOUT = "sentry.service.client.server.rpc-connection-timeout"; - public static final int SERVER_RPC_CONN_TIMEOUT_DEFAULT = 200000; - - // HA configuration - public static final String SERVER_HA_ENABLED = "sentry.ha.enabled"; - public static final boolean SERVER_HA_ENABLED_DEFAULT = ServerConfig.SENTRY_HA_ENABLED_DEFAULT; - public static final String SENTRY_HA_ZOOKEEPER_QUORUM = ServerConfig.SENTRY_HA_ZOOKEEPER_QUORUM; - public static final String SERVER_HA_ZOOKEEPER_QUORUM_DEFAULT = ServerConfig.SENTRY_HA_ZOOKEEPER_QUORUM_DEFAULT; - public static final String SENTRY_HA_ZOOKEEPER_NAMESPACE = ServerConfig.SENTRY_HA_ZOOKEEPER_NAMESPACE; - public static final String SERVER_HA_ZOOKEEPER_NAMESPACE_DEFAULT = ServerConfig.SENTRY_HA_ZOOKEEPER_NAMESPACE_DEFAULT; - - // connection pool configuration - public static final String SENTRY_POOL_ENABLED = "sentry.service.client.connection.pool.enabled"; - public static final boolean SENTRY_POOL_ENABLED_DEFAULT = false; - - // commons-pool configuration for pool size - public static final String SENTRY_POOL_MAX_TOTAL = "sentry.service.client.connection.pool.max-total"; - public static final int SENTRY_POOL_MAX_TOTAL_DEFAULT = 8; - public static final String SENTRY_POOL_MAX_IDLE = "sentry.service.client.connection.pool.max-idle"; - public static final int SENTRY_POOL_MAX_IDLE_DEFAULT = 8; - public static final String SENTRY_POOL_MIN_IDLE = "sentry.service.client.connection.pool.min-idle"; - public static final int SENTRY_POOL_MIN_IDLE_DEFAULT = 0; - - // retry num for getting the connection from connection pool - public static final String SENTRY_POOL_RETRY_TOTAL = "sentry.service.client.connection.pool.retry-total"; - public static final int SENTRY_POOL_RETRY_TOTAL_DEFAULT = 3; - - // max message size for thrift messages - public static final String SENTRY_POLICY_CLIENT_THRIFT_MAX_MESSAGE_SIZE = "sentry.policy.client.thrift.max.message.size"; - public static final long SENTRY_POLICY_CLIENT_THRIFT_MAX_MESSAGE_SIZE_DEFAULT = 100 * 1024 * 1024; - - // client retry settings - public static final String RETRY_COUNT_CONF = "sentry.provider.backend.db.retry.count"; - public static final int RETRY_COUNT_DEFAULT = 3; - public static final String RETRY_INTERVAL_SEC_CONF = "sentry.provider.backend.db.retry.interval.seconds"; - public static final int RETRY_INTERVAL_SEC_DEFAULT = 30; - - // provider backend cache settings - public static final String ENABLE_CACHING = "sentry.provider.backend.generic.cache.enabled"; - public static final boolean ENABLE_CACHING_DEFAULT = false; - public static final String CACHE_TTL_MS = "sentry.provider.backend.generic.cache.ttl.ms"; - public static final long CACHING_TTL_MS_DEFAULT = 30000; - public static final String CACHE_UPDATE_FAILURES_BEFORE_PRIV_REVOKE = "sentry.provider.backend.generic.cache.update.failures.count"; - public static final int CACHE_UPDATE_FAILURES_BEFORE_PRIV_REVOKE_DEFAULT = 3; - public static final String PRIVILEGE_CONVERTER = "sentry.provider.backend.generic.privilege.converter"; - } - - /** - * Thrift generates terrible constant class names - */ - public static class ThriftConstants extends org.apache.sentry.service.thrift.sentry_common_serviceConstants { - public static final int TSENTRY_SERVICE_VERSION_CURRENT = TSENTRY_SERVICE_V2; - } - - /* Privilege operation scope */ - public static enum PrivilegeScope { - SERVER, - URI, - DATABASE, - TABLE, - COLUMN - } -} http://git-wip-us.apache.org/repos/asf/sentry/blob/f5368df5/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/Status.java ---------------------------------------------------------------------- diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/Status.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/Status.java deleted file mode 100644 index e9cc411..0000000 --- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/Status.java +++ /dev/null @@ -1,132 +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.service.thrift; - -import java.io.PrintWriter; -import java.io.StringWriter; - -import javax.annotation.Nullable; - -import org.apache.sentry.core.common.exception.SentryUserException; -import org.apache.sentry.core.common.exception.SentryAccessDeniedException; -import org.apache.sentry.core.common.exception.SentryAlreadyExistsException; -import org.apache.sentry.core.common.exception.SentryInvalidInputException; -import org.apache.sentry.core.common.exception.SentryNoSuchObjectException; -import org.apache.sentry.core.common.exception.SentryThriftAPIMismatchException; -import org.apache.sentry.service.thrift.ServiceConstants.ThriftConstants; - -/** - * Simple factory to make returning TSentryStatus objects easy - */ -public enum Status { - OK(ThriftConstants.TSENTRY_STATUS_OK), - ALREADY_EXISTS(ThriftConstants.TSENTRY_STATUS_ALREADY_EXISTS), - NO_SUCH_OBJECT(ThriftConstants.TSENTRY_STATUS_NO_SUCH_OBJECT), - RUNTIME_ERROR(ThriftConstants.TSENTRY_STATUS_RUNTIME_ERROR), - INVALID_INPUT(ThriftConstants.TSENTRY_STATUS_INVALID_INPUT), - ACCESS_DENIED(ThriftConstants.TSENTRY_STATUS_ACCESS_DENIED), - THRIFT_VERSION_MISMATCH(ThriftConstants.TSENTRY_STATUS_THRIFT_VERSION_MISMATCH), - UNKNOWN(-1) - ; - private int code; - private Status(int code) { - this.code = code; - } - public int getCode() { - return code; - } - public static Status fromCode(int code) { - for (Status status : Status.values()) { - if (status.getCode() == code) { - return status; - } - } - return Status.UNKNOWN; - } - public static TSentryResponseStatus OK() { - return Create(Status.OK, ""); - } - public static TSentryResponseStatus AccessDenied(String message, Throwable t) { - return Create(Status.ACCESS_DENIED, message, t); - } - public static TSentryResponseStatus AlreadyExists(String message, Throwable t) { - return Create(Status.ALREADY_EXISTS, message, t); - } - public static TSentryResponseStatus NoSuchObject(String message, Throwable t) { - return Create(Status.NO_SUCH_OBJECT, message, t); - } - public static TSentryResponseStatus RuntimeError(String message, Throwable t) { - return Create(Status.RUNTIME_ERROR, message, t); - } - public static TSentryResponseStatus Create(Status value, String message) { - return Create(value, message, null); - } - public static TSentryResponseStatus InvalidInput(String message, Throwable t) { - return Create(Status.INVALID_INPUT, message, t); - } - public static TSentryResponseStatus THRIFT_VERSION_MISMATCH(String message, Throwable t) { - return Create(Status.THRIFT_VERSION_MISMATCH, message, t); - } - public static TSentryResponseStatus Create(Status value, String message, @Nullable Throwable t) { - TSentryResponseStatus status = new TSentryResponseStatus(); - status.setValue(value.getCode()); - status.setMessage(message); - if (t != null) { - StringWriter stringWriter = new StringWriter(); - PrintWriter printWriter = new PrintWriter(stringWriter); - t.printStackTrace(printWriter); - printWriter.close(); - status.setStack(stringWriter.toString()); - } - return status; - } - public static void throwIfNotOk(TSentryResponseStatus thriftStatus) - throws SentryUserException { - Status status = Status.fromCode(thriftStatus.getValue()); - switch(status) { - case OK: - break; - case ALREADY_EXISTS: - throw new SentryAlreadyExistsException(serverErrorToString(thriftStatus), thriftStatus.getMessage()); - case NO_SUCH_OBJECT: - throw new SentryNoSuchObjectException(serverErrorToString(thriftStatus), thriftStatus.getMessage()); - case RUNTIME_ERROR: - throw new RuntimeException(serverErrorToString(thriftStatus)); - case INVALID_INPUT: - throw new SentryInvalidInputException(serverErrorToString(thriftStatus), thriftStatus.getMessage()); - case ACCESS_DENIED: - throw new SentryAccessDeniedException(serverErrorToString(thriftStatus), thriftStatus.getMessage()); - case THRIFT_VERSION_MISMATCH: - throw new SentryThriftAPIMismatchException(serverErrorToString(thriftStatus), thriftStatus.getMessage()); - case UNKNOWN: - throw new AssertionError(serverErrorToString(thriftStatus)); - default: - throw new AssertionError("Unknown status code: " + status + ". Msg: " + - serverErrorToString(thriftStatus)); - } - } - - private static String serverErrorToString(TSentryResponseStatus thriftStatus) { - String msg = thriftStatus.getMessage(); - String stack = thriftStatus.getStack(); - if (stack == null) { - return msg; - } - return msg + ". Server Stacktrace: " + stack; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/sentry/blob/f5368df5/sentry-provider/sentry-provider-db/src/main/resources/sentry_common_service.thrift ---------------------------------------------------------------------- diff --git a/sentry-provider/sentry-provider-db/src/main/resources/sentry_common_service.thrift b/sentry-provider/sentry-provider-db/src/main/resources/sentry_common_service.thrift deleted file mode 100644 index 65c6934..0000000 --- a/sentry-provider/sentry-provider-db/src/main/resources/sentry_common_service.thrift +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/local/bin/thrift -java - -/** - * 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. - */ - -include "share/fb303/if/fb303.thrift" - -namespace java org.apache.sentry.service.thrift -namespace php sentry.service.thrift -namespace cpp Apache.Sentry.Service.Thrift - -const i32 TSENTRY_SERVICE_V1 = 1; -// Made a backward incompatible change when adding column level privileges. -// We also added generalized model in this version -const i32 TSENTRY_SERVICE_V2 = 2; - -const i32 TSENTRY_STATUS_OK = 0; -const i32 TSENTRY_STATUS_ALREADY_EXISTS = 1; -const i32 TSENTRY_STATUS_NO_SUCH_OBJECT = 2; -const i32 TSENTRY_STATUS_RUNTIME_ERROR = 3; -const i32 TSENTRY_STATUS_INVALID_INPUT = 4; -const i32 TSENTRY_STATUS_ACCESS_DENIED = 5; -const i32 TSENTRY_STATUS_THRIFT_VERSION_MISMATCH = 6; - -struct TSentryResponseStatus { -1: required i32 value, -// message will be set to empty string when status is OK -2: required string message -3: optional string stack -} -
