You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sentry.apache.org by pr...@apache.org on 2014/09/15 23:07:39 UTC
[01/25] git commit: SENTRY-424: Rat check occasionally failing after
derby upgrade (Prasad Mujumdar via Sravya Tirukkovalur)
Repository: incubator-sentry
Updated Branches:
refs/heads/sentry-hdfs-sync 218b1ea8e -> 0eb6645e8
SENTRY-424: Rat check occasionally failing after derby upgrade (Prasad Mujumdar via Sravya Tirukkovalur)
Project: http://git-wip-us.apache.org/repos/asf/incubator-sentry/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-sentry/commit/00a5eba1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-sentry/tree/00a5eba1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-sentry/diff/00a5eba1
Branch: refs/heads/sentry-hdfs-sync
Commit: 00a5eba1f645991d3eb2bf7365057c045f86a25f
Parents: 218b1ea
Author: Sravya Tirukkovalur <sr...@clouera.com>
Authored: Mon Sep 15 10:25:40 2014 -0700
Committer: Sravya Tirukkovalur <sr...@clouera.com>
Committed: Mon Sep 15 10:25:40 2014 -0700
----------------------------------------------------------------------
pom.xml | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/00a5eba1/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 603004f..e172e92 100644
--- a/pom.xml
+++ b/pom.xml
@@ -532,6 +532,7 @@ limitations under the License.
<exclude>**/*.sql</exclude>
<exclude>**/upgrade.*</exclude>
<exclude>**/datanucleus.log</exclude>
+ <exclude>**/metastore_db/</exclude>
</excludes>
</configuration>
</execution>
[05/25] SENTRY-432. HDFS ingration. Initial patch
Posted by pr...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TPathsUpdate.java
----------------------------------------------------------------------
diff --git a/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TPathsUpdate.java b/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TPathsUpdate.java
new file mode 100644
index 0000000..f0bdbc9
--- /dev/null
+++ b/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TPathsUpdate.java
@@ -0,0 +1,748 @@
+/**
+ * Autogenerated by Thrift Compiler (0.9.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+package org.apache.sentry.provider.db.service.thrift;
+
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EnumMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.EnumSet;
+import java.util.Collections;
+import java.util.BitSet;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class TPathsUpdate implements org.apache.thrift.TBase<TPathsUpdate, TPathsUpdate._Fields>, java.io.Serializable, Cloneable {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TPathsUpdate");
+
+ private static final org.apache.thrift.protocol.TField HAS_FULL_IMAGE_FIELD_DESC = new org.apache.thrift.protocol.TField("hasFullImage", org.apache.thrift.protocol.TType.BOOL, (short)1);
+ private static final org.apache.thrift.protocol.TField PATHS_DUMP_FIELD_DESC = new org.apache.thrift.protocol.TField("pathsDump", org.apache.thrift.protocol.TType.STRUCT, (short)2);
+ private static final org.apache.thrift.protocol.TField SEQ_NUM_FIELD_DESC = new org.apache.thrift.protocol.TField("seqNum", org.apache.thrift.protocol.TType.I64, (short)3);
+ private static final org.apache.thrift.protocol.TField PATH_CHANGES_FIELD_DESC = new org.apache.thrift.protocol.TField("pathChanges", org.apache.thrift.protocol.TType.LIST, (short)4);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new TPathsUpdateStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new TPathsUpdateTupleSchemeFactory());
+ }
+
+ private boolean hasFullImage; // required
+ private TPathsDump pathsDump; // optional
+ private long seqNum; // required
+ private List<TPathChanges> pathChanges; // 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 {
+ HAS_FULL_IMAGE((short)1, "hasFullImage"),
+ PATHS_DUMP((short)2, "pathsDump"),
+ SEQ_NUM((short)3, "seqNum"),
+ PATH_CHANGES((short)4, "pathChanges");
+
+ 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: // HAS_FULL_IMAGE
+ return HAS_FULL_IMAGE;
+ case 2: // PATHS_DUMP
+ return PATHS_DUMP;
+ case 3: // SEQ_NUM
+ return SEQ_NUM;
+ case 4: // PATH_CHANGES
+ return PATH_CHANGES;
+ 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 __HASFULLIMAGE_ISSET_ID = 0;
+ private static final int __SEQNUM_ISSET_ID = 1;
+ private byte __isset_bitfield = 0;
+ private _Fields optionals[] = {_Fields.PATHS_DUMP};
+ 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.HAS_FULL_IMAGE, new org.apache.thrift.meta_data.FieldMetaData("hasFullImage", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
+ tmpMap.put(_Fields.PATHS_DUMP, new org.apache.thrift.meta_data.FieldMetaData("pathsDump", org.apache.thrift.TFieldRequirementType.OPTIONAL,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TPathsDump.class)));
+ tmpMap.put(_Fields.SEQ_NUM, new org.apache.thrift.meta_data.FieldMetaData("seqNum", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
+ tmpMap.put(_Fields.PATH_CHANGES, new org.apache.thrift.meta_data.FieldMetaData("pathChanges", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TPathChanges.class))));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TPathsUpdate.class, metaDataMap);
+ }
+
+ public TPathsUpdate() {
+ }
+
+ public TPathsUpdate(
+ boolean hasFullImage,
+ long seqNum,
+ List<TPathChanges> pathChanges)
+ {
+ this();
+ this.hasFullImage = hasFullImage;
+ setHasFullImageIsSet(true);
+ this.seqNum = seqNum;
+ setSeqNumIsSet(true);
+ this.pathChanges = pathChanges;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public TPathsUpdate(TPathsUpdate other) {
+ __isset_bitfield = other.__isset_bitfield;
+ this.hasFullImage = other.hasFullImage;
+ if (other.isSetPathsDump()) {
+ this.pathsDump = new TPathsDump(other.pathsDump);
+ }
+ this.seqNum = other.seqNum;
+ if (other.isSetPathChanges()) {
+ List<TPathChanges> __this__pathChanges = new ArrayList<TPathChanges>();
+ for (TPathChanges other_element : other.pathChanges) {
+ __this__pathChanges.add(new TPathChanges(other_element));
+ }
+ this.pathChanges = __this__pathChanges;
+ }
+ }
+
+ public TPathsUpdate deepCopy() {
+ return new TPathsUpdate(this);
+ }
+
+ @Override
+ public void clear() {
+ setHasFullImageIsSet(false);
+ this.hasFullImage = false;
+ this.pathsDump = null;
+ setSeqNumIsSet(false);
+ this.seqNum = 0;
+ this.pathChanges = null;
+ }
+
+ public boolean isHasFullImage() {
+ return this.hasFullImage;
+ }
+
+ public void setHasFullImage(boolean hasFullImage) {
+ this.hasFullImage = hasFullImage;
+ setHasFullImageIsSet(true);
+ }
+
+ public void unsetHasFullImage() {
+ __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __HASFULLIMAGE_ISSET_ID);
+ }
+
+ /** Returns true if field hasFullImage is set (has been assigned a value) and false otherwise */
+ public boolean isSetHasFullImage() {
+ return EncodingUtils.testBit(__isset_bitfield, __HASFULLIMAGE_ISSET_ID);
+ }
+
+ public void setHasFullImageIsSet(boolean value) {
+ __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __HASFULLIMAGE_ISSET_ID, value);
+ }
+
+ public TPathsDump getPathsDump() {
+ return this.pathsDump;
+ }
+
+ public void setPathsDump(TPathsDump pathsDump) {
+ this.pathsDump = pathsDump;
+ }
+
+ public void unsetPathsDump() {
+ this.pathsDump = null;
+ }
+
+ /** Returns true if field pathsDump is set (has been assigned a value) and false otherwise */
+ public boolean isSetPathsDump() {
+ return this.pathsDump != null;
+ }
+
+ public void setPathsDumpIsSet(boolean value) {
+ if (!value) {
+ this.pathsDump = null;
+ }
+ }
+
+ public long getSeqNum() {
+ return this.seqNum;
+ }
+
+ public void setSeqNum(long seqNum) {
+ this.seqNum = seqNum;
+ setSeqNumIsSet(true);
+ }
+
+ public void unsetSeqNum() {
+ __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __SEQNUM_ISSET_ID);
+ }
+
+ /** Returns true if field seqNum is set (has been assigned a value) and false otherwise */
+ public boolean isSetSeqNum() {
+ return EncodingUtils.testBit(__isset_bitfield, __SEQNUM_ISSET_ID);
+ }
+
+ public void setSeqNumIsSet(boolean value) {
+ __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __SEQNUM_ISSET_ID, value);
+ }
+
+ public int getPathChangesSize() {
+ return (this.pathChanges == null) ? 0 : this.pathChanges.size();
+ }
+
+ public java.util.Iterator<TPathChanges> getPathChangesIterator() {
+ return (this.pathChanges == null) ? null : this.pathChanges.iterator();
+ }
+
+ public void addToPathChanges(TPathChanges elem) {
+ if (this.pathChanges == null) {
+ this.pathChanges = new ArrayList<TPathChanges>();
+ }
+ this.pathChanges.add(elem);
+ }
+
+ public List<TPathChanges> getPathChanges() {
+ return this.pathChanges;
+ }
+
+ public void setPathChanges(List<TPathChanges> pathChanges) {
+ this.pathChanges = pathChanges;
+ }
+
+ public void unsetPathChanges() {
+ this.pathChanges = null;
+ }
+
+ /** Returns true if field pathChanges is set (has been assigned a value) and false otherwise */
+ public boolean isSetPathChanges() {
+ return this.pathChanges != null;
+ }
+
+ public void setPathChangesIsSet(boolean value) {
+ if (!value) {
+ this.pathChanges = null;
+ }
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case HAS_FULL_IMAGE:
+ if (value == null) {
+ unsetHasFullImage();
+ } else {
+ setHasFullImage((Boolean)value);
+ }
+ break;
+
+ case PATHS_DUMP:
+ if (value == null) {
+ unsetPathsDump();
+ } else {
+ setPathsDump((TPathsDump)value);
+ }
+ break;
+
+ case SEQ_NUM:
+ if (value == null) {
+ unsetSeqNum();
+ } else {
+ setSeqNum((Long)value);
+ }
+ break;
+
+ case PATH_CHANGES:
+ if (value == null) {
+ unsetPathChanges();
+ } else {
+ setPathChanges((List<TPathChanges>)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case HAS_FULL_IMAGE:
+ return Boolean.valueOf(isHasFullImage());
+
+ case PATHS_DUMP:
+ return getPathsDump();
+
+ case SEQ_NUM:
+ return Long.valueOf(getSeqNum());
+
+ case PATH_CHANGES:
+ return getPathChanges();
+
+ }
+ 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 HAS_FULL_IMAGE:
+ return isSetHasFullImage();
+ case PATHS_DUMP:
+ return isSetPathsDump();
+ case SEQ_NUM:
+ return isSetSeqNum();
+ case PATH_CHANGES:
+ return isSetPathChanges();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof TPathsUpdate)
+ return this.equals((TPathsUpdate)that);
+ return false;
+ }
+
+ public boolean equals(TPathsUpdate that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_hasFullImage = true;
+ boolean that_present_hasFullImage = true;
+ if (this_present_hasFullImage || that_present_hasFullImage) {
+ if (!(this_present_hasFullImage && that_present_hasFullImage))
+ return false;
+ if (this.hasFullImage != that.hasFullImage)
+ return false;
+ }
+
+ boolean this_present_pathsDump = true && this.isSetPathsDump();
+ boolean that_present_pathsDump = true && that.isSetPathsDump();
+ if (this_present_pathsDump || that_present_pathsDump) {
+ if (!(this_present_pathsDump && that_present_pathsDump))
+ return false;
+ if (!this.pathsDump.equals(that.pathsDump))
+ return false;
+ }
+
+ boolean this_present_seqNum = true;
+ boolean that_present_seqNum = true;
+ if (this_present_seqNum || that_present_seqNum) {
+ if (!(this_present_seqNum && that_present_seqNum))
+ return false;
+ if (this.seqNum != that.seqNum)
+ return false;
+ }
+
+ boolean this_present_pathChanges = true && this.isSetPathChanges();
+ boolean that_present_pathChanges = true && that.isSetPathChanges();
+ if (this_present_pathChanges || that_present_pathChanges) {
+ if (!(this_present_pathChanges && that_present_pathChanges))
+ return false;
+ if (!this.pathChanges.equals(that.pathChanges))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ HashCodeBuilder builder = new HashCodeBuilder();
+
+ boolean present_hasFullImage = true;
+ builder.append(present_hasFullImage);
+ if (present_hasFullImage)
+ builder.append(hasFullImage);
+
+ boolean present_pathsDump = true && (isSetPathsDump());
+ builder.append(present_pathsDump);
+ if (present_pathsDump)
+ builder.append(pathsDump);
+
+ boolean present_seqNum = true;
+ builder.append(present_seqNum);
+ if (present_seqNum)
+ builder.append(seqNum);
+
+ boolean present_pathChanges = true && (isSetPathChanges());
+ builder.append(present_pathChanges);
+ if (present_pathChanges)
+ builder.append(pathChanges);
+
+ return builder.toHashCode();
+ }
+
+ public int compareTo(TPathsUpdate other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+ TPathsUpdate typedOther = (TPathsUpdate)other;
+
+ lastComparison = Boolean.valueOf(isSetHasFullImage()).compareTo(typedOther.isSetHasFullImage());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetHasFullImage()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.hasFullImage, typedOther.hasFullImage);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetPathsDump()).compareTo(typedOther.isSetPathsDump());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetPathsDump()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.pathsDump, typedOther.pathsDump);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetSeqNum()).compareTo(typedOther.isSetSeqNum());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetSeqNum()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.seqNum, typedOther.seqNum);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetPathChanges()).compareTo(typedOther.isSetPathChanges());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetPathChanges()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.pathChanges, typedOther.pathChanges);
+ 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("TPathsUpdate(");
+ boolean first = true;
+
+ sb.append("hasFullImage:");
+ sb.append(this.hasFullImage);
+ first = false;
+ if (isSetPathsDump()) {
+ if (!first) sb.append(", ");
+ sb.append("pathsDump:");
+ if (this.pathsDump == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.pathsDump);
+ }
+ first = false;
+ }
+ if (!first) sb.append(", ");
+ sb.append("seqNum:");
+ sb.append(this.seqNum);
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("pathChanges:");
+ if (this.pathChanges == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.pathChanges);
+ }
+ first = false;
+ sb.append(")");
+ return sb.toString();
+ }
+
+ public void validate() throws org.apache.thrift.TException {
+ // check for required fields
+ if (!isSetHasFullImage()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'hasFullImage' is unset! Struct:" + toString());
+ }
+
+ if (!isSetSeqNum()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'seqNum' is unset! Struct:" + toString());
+ }
+
+ if (!isSetPathChanges()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'pathChanges' is unset! Struct:" + toString());
+ }
+
+ // check for sub-struct validity
+ if (pathsDump != null) {
+ pathsDump.validate();
+ }
+ }
+
+ private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+ try {
+ write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+ try {
+ // 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 TPathsUpdateStandardSchemeFactory implements SchemeFactory {
+ public TPathsUpdateStandardScheme getScheme() {
+ return new TPathsUpdateStandardScheme();
+ }
+ }
+
+ private static class TPathsUpdateStandardScheme extends StandardScheme<TPathsUpdate> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, TPathsUpdate 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: // HAS_FULL_IMAGE
+ if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
+ struct.hasFullImage = iprot.readBool();
+ struct.setHasFullImageIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 2: // PATHS_DUMP
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+ struct.pathsDump = new TPathsDump();
+ struct.pathsDump.read(iprot);
+ struct.setPathsDumpIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 3: // SEQ_NUM
+ if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
+ struct.seqNum = iprot.readI64();
+ struct.setSeqNumIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 4: // PATH_CHANGES
+ if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
+ {
+ org.apache.thrift.protocol.TList _list114 = iprot.readListBegin();
+ struct.pathChanges = new ArrayList<TPathChanges>(_list114.size);
+ for (int _i115 = 0; _i115 < _list114.size; ++_i115)
+ {
+ TPathChanges _elem116; // required
+ _elem116 = new TPathChanges();
+ _elem116.read(iprot);
+ struct.pathChanges.add(_elem116);
+ }
+ iprot.readListEnd();
+ }
+ struct.setPathChangesIsSet(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, TPathsUpdate struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ oprot.writeFieldBegin(HAS_FULL_IMAGE_FIELD_DESC);
+ oprot.writeBool(struct.hasFullImage);
+ oprot.writeFieldEnd();
+ if (struct.pathsDump != null) {
+ if (struct.isSetPathsDump()) {
+ oprot.writeFieldBegin(PATHS_DUMP_FIELD_DESC);
+ struct.pathsDump.write(oprot);
+ oprot.writeFieldEnd();
+ }
+ }
+ oprot.writeFieldBegin(SEQ_NUM_FIELD_DESC);
+ oprot.writeI64(struct.seqNum);
+ oprot.writeFieldEnd();
+ if (struct.pathChanges != null) {
+ oprot.writeFieldBegin(PATH_CHANGES_FIELD_DESC);
+ {
+ oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.pathChanges.size()));
+ for (TPathChanges _iter117 : struct.pathChanges)
+ {
+ _iter117.write(oprot);
+ }
+ oprot.writeListEnd();
+ }
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class TPathsUpdateTupleSchemeFactory implements SchemeFactory {
+ public TPathsUpdateTupleScheme getScheme() {
+ return new TPathsUpdateTupleScheme();
+ }
+ }
+
+ private static class TPathsUpdateTupleScheme extends TupleScheme<TPathsUpdate> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, TPathsUpdate struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ oprot.writeBool(struct.hasFullImage);
+ oprot.writeI64(struct.seqNum);
+ {
+ oprot.writeI32(struct.pathChanges.size());
+ for (TPathChanges _iter118 : struct.pathChanges)
+ {
+ _iter118.write(oprot);
+ }
+ }
+ BitSet optionals = new BitSet();
+ if (struct.isSetPathsDump()) {
+ optionals.set(0);
+ }
+ oprot.writeBitSet(optionals, 1);
+ if (struct.isSetPathsDump()) {
+ struct.pathsDump.write(oprot);
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, TPathsUpdate struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ struct.hasFullImage = iprot.readBool();
+ struct.setHasFullImageIsSet(true);
+ struct.seqNum = iprot.readI64();
+ struct.setSeqNumIsSet(true);
+ {
+ org.apache.thrift.protocol.TList _list119 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
+ struct.pathChanges = new ArrayList<TPathChanges>(_list119.size);
+ for (int _i120 = 0; _i120 < _list119.size; ++_i120)
+ {
+ TPathChanges _elem121; // required
+ _elem121 = new TPathChanges();
+ _elem121.read(iprot);
+ struct.pathChanges.add(_elem121);
+ }
+ }
+ struct.setPathChangesIsSet(true);
+ BitSet incoming = iprot.readBitSet(1);
+ if (incoming.get(0)) {
+ struct.pathsDump = new TPathsDump();
+ struct.pathsDump.read(iprot);
+ struct.setPathsDumpIsSet(true);
+ }
+ }
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TPermissionsUpdate.java
----------------------------------------------------------------------
diff --git a/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TPermissionsUpdate.java b/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TPermissionsUpdate.java
new file mode 100644
index 0000000..968f2b1
--- /dev/null
+++ b/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TPermissionsUpdate.java
@@ -0,0 +1,810 @@
+/**
+ * Autogenerated by Thrift Compiler (0.9.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+package org.apache.sentry.provider.db.service.thrift;
+
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EnumMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.EnumSet;
+import java.util.Collections;
+import java.util.BitSet;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class TPermissionsUpdate implements org.apache.thrift.TBase<TPermissionsUpdate, TPermissionsUpdate._Fields>, java.io.Serializable, Cloneable {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TPermissionsUpdate");
+
+ private static final org.apache.thrift.protocol.TField HASFULL_IMAGE_FIELD_DESC = new org.apache.thrift.protocol.TField("hasfullImage", org.apache.thrift.protocol.TType.BOOL, (short)1);
+ private static final org.apache.thrift.protocol.TField SEQ_NUM_FIELD_DESC = new org.apache.thrift.protocol.TField("seqNum", org.apache.thrift.protocol.TType.I64, (short)2);
+ private static final org.apache.thrift.protocol.TField PRIVILEGE_CHANGES_FIELD_DESC = new org.apache.thrift.protocol.TField("privilegeChanges", org.apache.thrift.protocol.TType.MAP, (short)3);
+ private static final org.apache.thrift.protocol.TField ROLE_CHANGES_FIELD_DESC = new org.apache.thrift.protocol.TField("roleChanges", org.apache.thrift.protocol.TType.MAP, (short)4);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new TPermissionsUpdateStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new TPermissionsUpdateTupleSchemeFactory());
+ }
+
+ private boolean hasfullImage; // required
+ private long seqNum; // required
+ private Map<String,TPrivilegeChanges> privilegeChanges; // required
+ private Map<String,TRoleChanges> roleChanges; // 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 {
+ HASFULL_IMAGE((short)1, "hasfullImage"),
+ SEQ_NUM((short)2, "seqNum"),
+ PRIVILEGE_CHANGES((short)3, "privilegeChanges"),
+ ROLE_CHANGES((short)4, "roleChanges");
+
+ 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: // HASFULL_IMAGE
+ return HASFULL_IMAGE;
+ case 2: // SEQ_NUM
+ return SEQ_NUM;
+ case 3: // PRIVILEGE_CHANGES
+ return PRIVILEGE_CHANGES;
+ case 4: // ROLE_CHANGES
+ return ROLE_CHANGES;
+ 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 __HASFULLIMAGE_ISSET_ID = 0;
+ private static final int __SEQNUM_ISSET_ID = 1;
+ private byte __isset_bitfield = 0;
+ public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+ static {
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+ tmpMap.put(_Fields.HASFULL_IMAGE, new org.apache.thrift.meta_data.FieldMetaData("hasfullImage", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
+ tmpMap.put(_Fields.SEQ_NUM, new org.apache.thrift.meta_data.FieldMetaData("seqNum", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
+ tmpMap.put(_Fields.PRIVILEGE_CHANGES, new org.apache.thrift.meta_data.FieldMetaData("privilegeChanges", 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.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TPrivilegeChanges.class))));
+ tmpMap.put(_Fields.ROLE_CHANGES, new org.apache.thrift.meta_data.FieldMetaData("roleChanges", 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.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TRoleChanges.class))));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TPermissionsUpdate.class, metaDataMap);
+ }
+
+ public TPermissionsUpdate() {
+ }
+
+ public TPermissionsUpdate(
+ boolean hasfullImage,
+ long seqNum,
+ Map<String,TPrivilegeChanges> privilegeChanges,
+ Map<String,TRoleChanges> roleChanges)
+ {
+ this();
+ this.hasfullImage = hasfullImage;
+ setHasfullImageIsSet(true);
+ this.seqNum = seqNum;
+ setSeqNumIsSet(true);
+ this.privilegeChanges = privilegeChanges;
+ this.roleChanges = roleChanges;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public TPermissionsUpdate(TPermissionsUpdate other) {
+ __isset_bitfield = other.__isset_bitfield;
+ this.hasfullImage = other.hasfullImage;
+ this.seqNum = other.seqNum;
+ if (other.isSetPrivilegeChanges()) {
+ Map<String,TPrivilegeChanges> __this__privilegeChanges = new HashMap<String,TPrivilegeChanges>();
+ for (Map.Entry<String, TPrivilegeChanges> other_element : other.privilegeChanges.entrySet()) {
+
+ String other_element_key = other_element.getKey();
+ TPrivilegeChanges other_element_value = other_element.getValue();
+
+ String __this__privilegeChanges_copy_key = other_element_key;
+
+ TPrivilegeChanges __this__privilegeChanges_copy_value = new TPrivilegeChanges(other_element_value);
+
+ __this__privilegeChanges.put(__this__privilegeChanges_copy_key, __this__privilegeChanges_copy_value);
+ }
+ this.privilegeChanges = __this__privilegeChanges;
+ }
+ if (other.isSetRoleChanges()) {
+ Map<String,TRoleChanges> __this__roleChanges = new HashMap<String,TRoleChanges>();
+ for (Map.Entry<String, TRoleChanges> other_element : other.roleChanges.entrySet()) {
+
+ String other_element_key = other_element.getKey();
+ TRoleChanges other_element_value = other_element.getValue();
+
+ String __this__roleChanges_copy_key = other_element_key;
+
+ TRoleChanges __this__roleChanges_copy_value = new TRoleChanges(other_element_value);
+
+ __this__roleChanges.put(__this__roleChanges_copy_key, __this__roleChanges_copy_value);
+ }
+ this.roleChanges = __this__roleChanges;
+ }
+ }
+
+ public TPermissionsUpdate deepCopy() {
+ return new TPermissionsUpdate(this);
+ }
+
+ @Override
+ public void clear() {
+ setHasfullImageIsSet(false);
+ this.hasfullImage = false;
+ setSeqNumIsSet(false);
+ this.seqNum = 0;
+ this.privilegeChanges = null;
+ this.roleChanges = null;
+ }
+
+ public boolean isHasfullImage() {
+ return this.hasfullImage;
+ }
+
+ public void setHasfullImage(boolean hasfullImage) {
+ this.hasfullImage = hasfullImage;
+ setHasfullImageIsSet(true);
+ }
+
+ public void unsetHasfullImage() {
+ __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __HASFULLIMAGE_ISSET_ID);
+ }
+
+ /** Returns true if field hasfullImage is set (has been assigned a value) and false otherwise */
+ public boolean isSetHasfullImage() {
+ return EncodingUtils.testBit(__isset_bitfield, __HASFULLIMAGE_ISSET_ID);
+ }
+
+ public void setHasfullImageIsSet(boolean value) {
+ __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __HASFULLIMAGE_ISSET_ID, value);
+ }
+
+ public long getSeqNum() {
+ return this.seqNum;
+ }
+
+ public void setSeqNum(long seqNum) {
+ this.seqNum = seqNum;
+ setSeqNumIsSet(true);
+ }
+
+ public void unsetSeqNum() {
+ __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __SEQNUM_ISSET_ID);
+ }
+
+ /** Returns true if field seqNum is set (has been assigned a value) and false otherwise */
+ public boolean isSetSeqNum() {
+ return EncodingUtils.testBit(__isset_bitfield, __SEQNUM_ISSET_ID);
+ }
+
+ public void setSeqNumIsSet(boolean value) {
+ __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __SEQNUM_ISSET_ID, value);
+ }
+
+ public int getPrivilegeChangesSize() {
+ return (this.privilegeChanges == null) ? 0 : this.privilegeChanges.size();
+ }
+
+ public void putToPrivilegeChanges(String key, TPrivilegeChanges val) {
+ if (this.privilegeChanges == null) {
+ this.privilegeChanges = new HashMap<String,TPrivilegeChanges>();
+ }
+ this.privilegeChanges.put(key, val);
+ }
+
+ public Map<String,TPrivilegeChanges> getPrivilegeChanges() {
+ return this.privilegeChanges;
+ }
+
+ public void setPrivilegeChanges(Map<String,TPrivilegeChanges> privilegeChanges) {
+ this.privilegeChanges = privilegeChanges;
+ }
+
+ public void unsetPrivilegeChanges() {
+ this.privilegeChanges = null;
+ }
+
+ /** Returns true if field privilegeChanges is set (has been assigned a value) and false otherwise */
+ public boolean isSetPrivilegeChanges() {
+ return this.privilegeChanges != null;
+ }
+
+ public void setPrivilegeChangesIsSet(boolean value) {
+ if (!value) {
+ this.privilegeChanges = null;
+ }
+ }
+
+ public int getRoleChangesSize() {
+ return (this.roleChanges == null) ? 0 : this.roleChanges.size();
+ }
+
+ public void putToRoleChanges(String key, TRoleChanges val) {
+ if (this.roleChanges == null) {
+ this.roleChanges = new HashMap<String,TRoleChanges>();
+ }
+ this.roleChanges.put(key, val);
+ }
+
+ public Map<String,TRoleChanges> getRoleChanges() {
+ return this.roleChanges;
+ }
+
+ public void setRoleChanges(Map<String,TRoleChanges> roleChanges) {
+ this.roleChanges = roleChanges;
+ }
+
+ public void unsetRoleChanges() {
+ this.roleChanges = null;
+ }
+
+ /** Returns true if field roleChanges is set (has been assigned a value) and false otherwise */
+ public boolean isSetRoleChanges() {
+ return this.roleChanges != null;
+ }
+
+ public void setRoleChangesIsSet(boolean value) {
+ if (!value) {
+ this.roleChanges = null;
+ }
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case HASFULL_IMAGE:
+ if (value == null) {
+ unsetHasfullImage();
+ } else {
+ setHasfullImage((Boolean)value);
+ }
+ break;
+
+ case SEQ_NUM:
+ if (value == null) {
+ unsetSeqNum();
+ } else {
+ setSeqNum((Long)value);
+ }
+ break;
+
+ case PRIVILEGE_CHANGES:
+ if (value == null) {
+ unsetPrivilegeChanges();
+ } else {
+ setPrivilegeChanges((Map<String,TPrivilegeChanges>)value);
+ }
+ break;
+
+ case ROLE_CHANGES:
+ if (value == null) {
+ unsetRoleChanges();
+ } else {
+ setRoleChanges((Map<String,TRoleChanges>)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case HASFULL_IMAGE:
+ return Boolean.valueOf(isHasfullImage());
+
+ case SEQ_NUM:
+ return Long.valueOf(getSeqNum());
+
+ case PRIVILEGE_CHANGES:
+ return getPrivilegeChanges();
+
+ case ROLE_CHANGES:
+ return getRoleChanges();
+
+ }
+ 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 HASFULL_IMAGE:
+ return isSetHasfullImage();
+ case SEQ_NUM:
+ return isSetSeqNum();
+ case PRIVILEGE_CHANGES:
+ return isSetPrivilegeChanges();
+ case ROLE_CHANGES:
+ return isSetRoleChanges();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof TPermissionsUpdate)
+ return this.equals((TPermissionsUpdate)that);
+ return false;
+ }
+
+ public boolean equals(TPermissionsUpdate that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_hasfullImage = true;
+ boolean that_present_hasfullImage = true;
+ if (this_present_hasfullImage || that_present_hasfullImage) {
+ if (!(this_present_hasfullImage && that_present_hasfullImage))
+ return false;
+ if (this.hasfullImage != that.hasfullImage)
+ return false;
+ }
+
+ boolean this_present_seqNum = true;
+ boolean that_present_seqNum = true;
+ if (this_present_seqNum || that_present_seqNum) {
+ if (!(this_present_seqNum && that_present_seqNum))
+ return false;
+ if (this.seqNum != that.seqNum)
+ return false;
+ }
+
+ boolean this_present_privilegeChanges = true && this.isSetPrivilegeChanges();
+ boolean that_present_privilegeChanges = true && that.isSetPrivilegeChanges();
+ if (this_present_privilegeChanges || that_present_privilegeChanges) {
+ if (!(this_present_privilegeChanges && that_present_privilegeChanges))
+ return false;
+ if (!this.privilegeChanges.equals(that.privilegeChanges))
+ return false;
+ }
+
+ boolean this_present_roleChanges = true && this.isSetRoleChanges();
+ boolean that_present_roleChanges = true && that.isSetRoleChanges();
+ if (this_present_roleChanges || that_present_roleChanges) {
+ if (!(this_present_roleChanges && that_present_roleChanges))
+ return false;
+ if (!this.roleChanges.equals(that.roleChanges))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ HashCodeBuilder builder = new HashCodeBuilder();
+
+ boolean present_hasfullImage = true;
+ builder.append(present_hasfullImage);
+ if (present_hasfullImage)
+ builder.append(hasfullImage);
+
+ boolean present_seqNum = true;
+ builder.append(present_seqNum);
+ if (present_seqNum)
+ builder.append(seqNum);
+
+ boolean present_privilegeChanges = true && (isSetPrivilegeChanges());
+ builder.append(present_privilegeChanges);
+ if (present_privilegeChanges)
+ builder.append(privilegeChanges);
+
+ boolean present_roleChanges = true && (isSetRoleChanges());
+ builder.append(present_roleChanges);
+ if (present_roleChanges)
+ builder.append(roleChanges);
+
+ return builder.toHashCode();
+ }
+
+ public int compareTo(TPermissionsUpdate other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+ TPermissionsUpdate typedOther = (TPermissionsUpdate)other;
+
+ lastComparison = Boolean.valueOf(isSetHasfullImage()).compareTo(typedOther.isSetHasfullImage());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetHasfullImage()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.hasfullImage, typedOther.hasfullImage);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetSeqNum()).compareTo(typedOther.isSetSeqNum());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetSeqNum()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.seqNum, typedOther.seqNum);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetPrivilegeChanges()).compareTo(typedOther.isSetPrivilegeChanges());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetPrivilegeChanges()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.privilegeChanges, typedOther.privilegeChanges);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetRoleChanges()).compareTo(typedOther.isSetRoleChanges());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetRoleChanges()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.roleChanges, typedOther.roleChanges);
+ 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("TPermissionsUpdate(");
+ boolean first = true;
+
+ sb.append("hasfullImage:");
+ sb.append(this.hasfullImage);
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("seqNum:");
+ sb.append(this.seqNum);
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("privilegeChanges:");
+ if (this.privilegeChanges == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.privilegeChanges);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("roleChanges:");
+ if (this.roleChanges == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.roleChanges);
+ }
+ first = false;
+ sb.append(")");
+ return sb.toString();
+ }
+
+ public void validate() throws org.apache.thrift.TException {
+ // check for required fields
+ if (!isSetHasfullImage()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'hasfullImage' is unset! Struct:" + toString());
+ }
+
+ if (!isSetSeqNum()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'seqNum' is unset! Struct:" + toString());
+ }
+
+ if (!isSetPrivilegeChanges()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'privilegeChanges' is unset! Struct:" + toString());
+ }
+
+ if (!isSetRoleChanges()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'roleChanges' 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 TPermissionsUpdateStandardSchemeFactory implements SchemeFactory {
+ public TPermissionsUpdateStandardScheme getScheme() {
+ return new TPermissionsUpdateStandardScheme();
+ }
+ }
+
+ private static class TPermissionsUpdateStandardScheme extends StandardScheme<TPermissionsUpdate> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, TPermissionsUpdate 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: // HASFULL_IMAGE
+ if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
+ struct.hasfullImage = iprot.readBool();
+ struct.setHasfullImageIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 2: // SEQ_NUM
+ if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
+ struct.seqNum = iprot.readI64();
+ struct.setSeqNumIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 3: // PRIVILEGE_CHANGES
+ if (schemeField.type == org.apache.thrift.protocol.TType.MAP) {
+ {
+ org.apache.thrift.protocol.TMap _map158 = iprot.readMapBegin();
+ struct.privilegeChanges = new HashMap<String,TPrivilegeChanges>(2*_map158.size);
+ for (int _i159 = 0; _i159 < _map158.size; ++_i159)
+ {
+ String _key160; // required
+ TPrivilegeChanges _val161; // required
+ _key160 = iprot.readString();
+ _val161 = new TPrivilegeChanges();
+ _val161.read(iprot);
+ struct.privilegeChanges.put(_key160, _val161);
+ }
+ iprot.readMapEnd();
+ }
+ struct.setPrivilegeChangesIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 4: // ROLE_CHANGES
+ if (schemeField.type == org.apache.thrift.protocol.TType.MAP) {
+ {
+ org.apache.thrift.protocol.TMap _map162 = iprot.readMapBegin();
+ struct.roleChanges = new HashMap<String,TRoleChanges>(2*_map162.size);
+ for (int _i163 = 0; _i163 < _map162.size; ++_i163)
+ {
+ String _key164; // required
+ TRoleChanges _val165; // required
+ _key164 = iprot.readString();
+ _val165 = new TRoleChanges();
+ _val165.read(iprot);
+ struct.roleChanges.put(_key164, _val165);
+ }
+ iprot.readMapEnd();
+ }
+ struct.setRoleChangesIsSet(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, TPermissionsUpdate struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ oprot.writeFieldBegin(HASFULL_IMAGE_FIELD_DESC);
+ oprot.writeBool(struct.hasfullImage);
+ oprot.writeFieldEnd();
+ oprot.writeFieldBegin(SEQ_NUM_FIELD_DESC);
+ oprot.writeI64(struct.seqNum);
+ oprot.writeFieldEnd();
+ if (struct.privilegeChanges != null) {
+ oprot.writeFieldBegin(PRIVILEGE_CHANGES_FIELD_DESC);
+ {
+ oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRUCT, struct.privilegeChanges.size()));
+ for (Map.Entry<String, TPrivilegeChanges> _iter166 : struct.privilegeChanges.entrySet())
+ {
+ oprot.writeString(_iter166.getKey());
+ _iter166.getValue().write(oprot);
+ }
+ oprot.writeMapEnd();
+ }
+ oprot.writeFieldEnd();
+ }
+ if (struct.roleChanges != null) {
+ oprot.writeFieldBegin(ROLE_CHANGES_FIELD_DESC);
+ {
+ oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRUCT, struct.roleChanges.size()));
+ for (Map.Entry<String, TRoleChanges> _iter167 : struct.roleChanges.entrySet())
+ {
+ oprot.writeString(_iter167.getKey());
+ _iter167.getValue().write(oprot);
+ }
+ oprot.writeMapEnd();
+ }
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class TPermissionsUpdateTupleSchemeFactory implements SchemeFactory {
+ public TPermissionsUpdateTupleScheme getScheme() {
+ return new TPermissionsUpdateTupleScheme();
+ }
+ }
+
+ private static class TPermissionsUpdateTupleScheme extends TupleScheme<TPermissionsUpdate> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, TPermissionsUpdate struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ oprot.writeBool(struct.hasfullImage);
+ oprot.writeI64(struct.seqNum);
+ {
+ oprot.writeI32(struct.privilegeChanges.size());
+ for (Map.Entry<String, TPrivilegeChanges> _iter168 : struct.privilegeChanges.entrySet())
+ {
+ oprot.writeString(_iter168.getKey());
+ _iter168.getValue().write(oprot);
+ }
+ }
+ {
+ oprot.writeI32(struct.roleChanges.size());
+ for (Map.Entry<String, TRoleChanges> _iter169 : struct.roleChanges.entrySet())
+ {
+ oprot.writeString(_iter169.getKey());
+ _iter169.getValue().write(oprot);
+ }
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, TPermissionsUpdate struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ struct.hasfullImage = iprot.readBool();
+ struct.setHasfullImageIsSet(true);
+ struct.seqNum = iprot.readI64();
+ struct.setSeqNumIsSet(true);
+ {
+ org.apache.thrift.protocol.TMap _map170 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
+ struct.privilegeChanges = new HashMap<String,TPrivilegeChanges>(2*_map170.size);
+ for (int _i171 = 0; _i171 < _map170.size; ++_i171)
+ {
+ String _key172; // required
+ TPrivilegeChanges _val173; // required
+ _key172 = iprot.readString();
+ _val173 = new TPrivilegeChanges();
+ _val173.read(iprot);
+ struct.privilegeChanges.put(_key172, _val173);
+ }
+ }
+ struct.setPrivilegeChangesIsSet(true);
+ {
+ org.apache.thrift.protocol.TMap _map174 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
+ struct.roleChanges = new HashMap<String,TRoleChanges>(2*_map174.size);
+ for (int _i175 = 0; _i175 < _map174.size; ++_i175)
+ {
+ String _key176; // required
+ TRoleChanges _val177; // required
+ _key176 = iprot.readString();
+ _val177 = new TRoleChanges();
+ _val177.read(iprot);
+ struct.roleChanges.put(_key176, _val177);
+ }
+ }
+ struct.setRoleChangesIsSet(true);
+ }
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TPrivilegeChanges.java
----------------------------------------------------------------------
diff --git a/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TPrivilegeChanges.java b/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TPrivilegeChanges.java
new file mode 100644
index 0000000..3ded631
--- /dev/null
+++ b/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TPrivilegeChanges.java
@@ -0,0 +1,713 @@
+/**
+ * Autogenerated by Thrift Compiler (0.9.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+package org.apache.sentry.provider.db.service.thrift;
+
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EnumMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.EnumSet;
+import java.util.Collections;
+import java.util.BitSet;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class TPrivilegeChanges implements org.apache.thrift.TBase<TPrivilegeChanges, TPrivilegeChanges._Fields>, java.io.Serializable, Cloneable {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TPrivilegeChanges");
+
+ private static final org.apache.thrift.protocol.TField AUTHZ_OBJ_FIELD_DESC = new org.apache.thrift.protocol.TField("authzObj", org.apache.thrift.protocol.TType.STRING, (short)1);
+ private static final org.apache.thrift.protocol.TField ADD_PRIVILEGES_FIELD_DESC = new org.apache.thrift.protocol.TField("addPrivileges", org.apache.thrift.protocol.TType.MAP, (short)2);
+ private static final org.apache.thrift.protocol.TField DEL_PRIVILEGES_FIELD_DESC = new org.apache.thrift.protocol.TField("delPrivileges", org.apache.thrift.protocol.TType.MAP, (short)3);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new TPrivilegeChangesStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new TPrivilegeChangesTupleSchemeFactory());
+ }
+
+ private String authzObj; // required
+ private Map<String,String> addPrivileges; // required
+ private Map<String,String> delPrivileges; // 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 {
+ AUTHZ_OBJ((short)1, "authzObj"),
+ ADD_PRIVILEGES((short)2, "addPrivileges"),
+ DEL_PRIVILEGES((short)3, "delPrivileges");
+
+ 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: // AUTHZ_OBJ
+ return AUTHZ_OBJ;
+ case 2: // ADD_PRIVILEGES
+ return ADD_PRIVILEGES;
+ case 3: // DEL_PRIVILEGES
+ return DEL_PRIVILEGES;
+ default:
+ return null;
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, throwing an exception
+ * if it is not found.
+ */
+ public static _Fields findByThriftIdOrThrow(int fieldId) {
+ _Fields fields = findByThriftId(fieldId);
+ if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+ return fields;
+ }
+
+ /**
+ * Find the _Fields constant that matches name, or null if its not found.
+ */
+ public static _Fields findByName(String name) {
+ return byName.get(name);
+ }
+
+ private final short _thriftId;
+ private final String _fieldName;
+
+ _Fields(short thriftId, String fieldName) {
+ _thriftId = thriftId;
+ _fieldName = fieldName;
+ }
+
+ public short getThriftFieldId() {
+ return _thriftId;
+ }
+
+ public String getFieldName() {
+ return _fieldName;
+ }
+ }
+
+ // isset id assignments
+ public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+ static {
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+ tmpMap.put(_Fields.AUTHZ_OBJ, new org.apache.thrift.meta_data.FieldMetaData("authzObj", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields.ADD_PRIVILEGES, new org.apache.thrift.meta_data.FieldMetaData("addPrivileges", 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.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
+ tmpMap.put(_Fields.DEL_PRIVILEGES, new org.apache.thrift.meta_data.FieldMetaData("delPrivileges", 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.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TPrivilegeChanges.class, metaDataMap);
+ }
+
+ public TPrivilegeChanges() {
+ }
+
+ public TPrivilegeChanges(
+ String authzObj,
+ Map<String,String> addPrivileges,
+ Map<String,String> delPrivileges)
+ {
+ this();
+ this.authzObj = authzObj;
+ this.addPrivileges = addPrivileges;
+ this.delPrivileges = delPrivileges;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public TPrivilegeChanges(TPrivilegeChanges other) {
+ if (other.isSetAuthzObj()) {
+ this.authzObj = other.authzObj;
+ }
+ if (other.isSetAddPrivileges()) {
+ Map<String,String> __this__addPrivileges = new HashMap<String,String>();
+ for (Map.Entry<String, String> other_element : other.addPrivileges.entrySet()) {
+
+ String other_element_key = other_element.getKey();
+ String other_element_value = other_element.getValue();
+
+ String __this__addPrivileges_copy_key = other_element_key;
+
+ String __this__addPrivileges_copy_value = other_element_value;
+
+ __this__addPrivileges.put(__this__addPrivileges_copy_key, __this__addPrivileges_copy_value);
+ }
+ this.addPrivileges = __this__addPrivileges;
+ }
+ if (other.isSetDelPrivileges()) {
+ Map<String,String> __this__delPrivileges = new HashMap<String,String>();
+ for (Map.Entry<String, String> other_element : other.delPrivileges.entrySet()) {
+
+ String other_element_key = other_element.getKey();
+ String other_element_value = other_element.getValue();
+
+ String __this__delPrivileges_copy_key = other_element_key;
+
+ String __this__delPrivileges_copy_value = other_element_value;
+
+ __this__delPrivileges.put(__this__delPrivileges_copy_key, __this__delPrivileges_copy_value);
+ }
+ this.delPrivileges = __this__delPrivileges;
+ }
+ }
+
+ public TPrivilegeChanges deepCopy() {
+ return new TPrivilegeChanges(this);
+ }
+
+ @Override
+ public void clear() {
+ this.authzObj = null;
+ this.addPrivileges = null;
+ this.delPrivileges = null;
+ }
+
+ public String getAuthzObj() {
+ return this.authzObj;
+ }
+
+ public void setAuthzObj(String authzObj) {
+ this.authzObj = authzObj;
+ }
+
+ public void unsetAuthzObj() {
+ this.authzObj = null;
+ }
+
+ /** Returns true if field authzObj is set (has been assigned a value) and false otherwise */
+ public boolean isSetAuthzObj() {
+ return this.authzObj != null;
+ }
+
+ public void setAuthzObjIsSet(boolean value) {
+ if (!value) {
+ this.authzObj = null;
+ }
+ }
+
+ public int getAddPrivilegesSize() {
+ return (this.addPrivileges == null) ? 0 : this.addPrivileges.size();
+ }
+
+ public void putToAddPrivileges(String key, String val) {
+ if (this.addPrivileges == null) {
+ this.addPrivileges = new HashMap<String,String>();
+ }
+ this.addPrivileges.put(key, val);
+ }
+
+ public Map<String,String> getAddPrivileges() {
+ return this.addPrivileges;
+ }
+
+ public void setAddPrivileges(Map<String,String> addPrivileges) {
+ this.addPrivileges = addPrivileges;
+ }
+
+ public void unsetAddPrivileges() {
+ this.addPrivileges = null;
+ }
+
+ /** Returns true if field addPrivileges is set (has been assigned a value) and false otherwise */
+ public boolean isSetAddPrivileges() {
+ return this.addPrivileges != null;
+ }
+
+ public void setAddPrivilegesIsSet(boolean value) {
+ if (!value) {
+ this.addPrivileges = null;
+ }
+ }
+
+ public int getDelPrivilegesSize() {
+ return (this.delPrivileges == null) ? 0 : this.delPrivileges.size();
+ }
+
+ public void putToDelPrivileges(String key, String val) {
+ if (this.delPrivileges == null) {
+ this.delPrivileges = new HashMap<String,String>();
+ }
+ this.delPrivileges.put(key, val);
+ }
+
+ public Map<String,String> getDelPrivileges() {
+ return this.delPrivileges;
+ }
+
+ public void setDelPrivileges(Map<String,String> delPrivileges) {
+ this.delPrivileges = delPrivileges;
+ }
+
+ public void unsetDelPrivileges() {
+ this.delPrivileges = null;
+ }
+
+ /** Returns true if field delPrivileges is set (has been assigned a value) and false otherwise */
+ public boolean isSetDelPrivileges() {
+ return this.delPrivileges != null;
+ }
+
+ public void setDelPrivilegesIsSet(boolean value) {
+ if (!value) {
+ this.delPrivileges = null;
+ }
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case AUTHZ_OBJ:
+ if (value == null) {
+ unsetAuthzObj();
+ } else {
+ setAuthzObj((String)value);
+ }
+ break;
+
+ case ADD_PRIVILEGES:
+ if (value == null) {
+ unsetAddPrivileges();
+ } else {
+ setAddPrivileges((Map<String,String>)value);
+ }
+ break;
+
+ case DEL_PRIVILEGES:
+ if (value == null) {
+ unsetDelPrivileges();
+ } else {
+ setDelPrivileges((Map<String,String>)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case AUTHZ_OBJ:
+ return getAuthzObj();
+
+ case ADD_PRIVILEGES:
+ return getAddPrivileges();
+
+ case DEL_PRIVILEGES:
+ return getDelPrivileges();
+
+ }
+ 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 AUTHZ_OBJ:
+ return isSetAuthzObj();
+ case ADD_PRIVILEGES:
+ return isSetAddPrivileges();
+ case DEL_PRIVILEGES:
+ return isSetDelPrivileges();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof TPrivilegeChanges)
+ return this.equals((TPrivilegeChanges)that);
+ return false;
+ }
+
+ public boolean equals(TPrivilegeChanges that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_authzObj = true && this.isSetAuthzObj();
+ boolean that_present_authzObj = true && that.isSetAuthzObj();
+ if (this_present_authzObj || that_present_authzObj) {
+ if (!(this_present_authzObj && that_present_authzObj))
+ return false;
+ if (!this.authzObj.equals(that.authzObj))
+ return false;
+ }
+
+ boolean this_present_addPrivileges = true && this.isSetAddPrivileges();
+ boolean that_present_addPrivileges = true && that.isSetAddPrivileges();
+ if (this_present_addPrivileges || that_present_addPrivileges) {
+ if (!(this_present_addPrivileges && that_present_addPrivileges))
+ return false;
+ if (!this.addPrivileges.equals(that.addPrivileges))
+ return false;
+ }
+
+ boolean this_present_delPrivileges = true && this.isSetDelPrivileges();
+ boolean that_present_delPrivileges = true && that.isSetDelPrivileges();
+ if (this_present_delPrivileges || that_present_delPrivileges) {
+ if (!(this_present_delPrivileges && that_present_delPrivileges))
+ return false;
+ if (!this.delPrivileges.equals(that.delPrivileges))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ HashCodeBuilder builder = new HashCodeBuilder();
+
+ boolean present_authzObj = true && (isSetAuthzObj());
+ builder.append(present_authzObj);
+ if (present_authzObj)
+ builder.append(authzObj);
+
+ boolean present_addPrivileges = true && (isSetAddPrivileges());
+ builder.append(present_addPrivileges);
+ if (present_addPrivileges)
+ builder.append(addPrivileges);
+
+ boolean present_delPrivileges = true && (isSetDelPrivileges());
+ builder.append(present_delPrivileges);
+ if (present_delPrivileges)
+ builder.append(delPrivileges);
+
+ return builder.toHashCode();
+ }
+
+ public int compareTo(TPrivilegeChanges other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+ TPrivilegeChanges typedOther = (TPrivilegeChanges)other;
+
+ lastComparison = Boolean.valueOf(isSetAuthzObj()).compareTo(typedOther.isSetAuthzObj());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetAuthzObj()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.authzObj, typedOther.authzObj);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetAddPrivileges()).compareTo(typedOther.isSetAddPrivileges());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetAddPrivileges()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.addPrivileges, typedOther.addPrivileges);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetDelPrivileges()).compareTo(typedOther.isSetDelPrivileges());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetDelPrivileges()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delPrivileges, typedOther.delPrivileges);
+ 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("TPrivilegeChanges(");
+ boolean first = true;
+
+ sb.append("authzObj:");
+ if (this.authzObj == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.authzObj);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("addPrivileges:");
+ if (this.addPrivileges == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.addPrivileges);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("delPrivileges:");
+ if (this.delPrivileges == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.delPrivileges);
+ }
+ first = false;
+ sb.append(")");
+ return sb.toString();
+ }
+
+ public void validate() throws org.apache.thrift.TException {
+ // check for required fields
+ if (!isSetAuthzObj()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'authzObj' is unset! Struct:" + toString());
+ }
+
+ if (!isSetAddPrivileges()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'addPrivileges' is unset! Struct:" + toString());
+ }
+
+ if (!isSetDelPrivileges()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'delPrivileges' 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 TPrivilegeChangesStandardSchemeFactory implements SchemeFactory {
+ public TPrivilegeChangesStandardScheme getScheme() {
+ return new TPrivilegeChangesStandardScheme();
+ }
+ }
+
+ private static class TPrivilegeChangesStandardScheme extends StandardScheme<TPrivilegeChanges> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, TPrivilegeChanges 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: // AUTHZ_OBJ
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.authzObj = iprot.readString();
+ struct.setAuthzObjIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 2: // ADD_PRIVILEGES
+ if (schemeField.type == org.apache.thrift.protocol.TType.MAP) {
+ {
+ org.apache.thrift.protocol.TMap _map122 = iprot.readMapBegin();
+ struct.addPrivileges = new HashMap<String,String>(2*_map122.size);
+ for (int _i123 = 0; _i123 < _map122.size; ++_i123)
+ {
+ String _key124; // required
+ String _val125; // required
+ _key124 = iprot.readString();
+ _val125 = iprot.readString();
+ struct.addPrivileges.put(_key124, _val125);
+ }
+ iprot.readMapEnd();
+ }
+ struct.setAddPrivilegesIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 3: // DEL_PRIVILEGES
+ if (schemeField.type == org.apache.thrift.protocol.TType.MAP) {
+ {
+ org.apache.thrift.protocol.TMap _map126 = iprot.readMapBegin();
+ struct.delPrivileges = new HashMap<String,String>(2*_map126.size);
+ for (int _i127 = 0; _i127 < _map126.size; ++_i127)
+ {
+ String _key128; // required
+ String _val129; // required
+ _key128 = iprot.readString();
+ _val129 = iprot.readString();
+ struct.delPrivileges.put(_key128, _val129);
+ }
+ iprot.readMapEnd();
+ }
+ struct.setDelPrivilegesIsSet(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, TPrivilegeChanges struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.authzObj != null) {
+ oprot.writeFieldBegin(AUTHZ_OBJ_FIELD_DESC);
+ oprot.writeString(struct.authzObj);
+ oprot.writeFieldEnd();
+ }
+ if (struct.addPrivileges != null) {
+ oprot.writeFieldBegin(ADD_PRIVILEGES_FIELD_DESC);
+ {
+ oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, struct.addPrivileges.size()));
+ for (Map.Entry<String, String> _iter130 : struct.addPrivileges.entrySet())
+ {
+ oprot.writeString(_iter130.getKey());
+ oprot.writeString(_iter130.getValue());
+ }
+ oprot.writeMapEnd();
+ }
+ oprot.writeFieldEnd();
+ }
+ if (struct.delPrivileges != null) {
+ oprot.writeFieldBegin(DEL_PRIVILEGES_FIELD_DESC);
+ {
+ oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, struct.delPrivileges.size()));
+ for (Map.Entry<String, String> _iter131 : struct.delPrivileges.entrySet())
+ {
+ oprot.writeString(_iter131.getKey());
+ oprot.writeString(_iter131.getValue());
+ }
+ oprot.writeMapEnd();
+ }
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class TPrivilegeChangesTupleSchemeFactory implements SchemeFactory {
+ public TPrivilegeChangesTupleScheme getScheme() {
+ return new TPrivilegeChangesTupleScheme();
+ }
+ }
+
+ private static class TPrivilegeChangesTupleScheme extends TupleScheme<TPrivilegeChanges> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, TPrivilegeChanges struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ oprot.writeString(struct.authzObj);
+ {
+ oprot.writeI32(struct.addPrivileges.size());
+ for (Map.Entry<String, String> _iter132 : struct.addPrivileges.entrySet())
+ {
+ oprot.writeString(_iter132.getKey());
+ oprot.writeString(_iter132.getValue());
+ }
+ }
+ {
+ oprot.writeI32(struct.delPrivileges.size());
+ for (Map.Entry<String, String> _iter133 : struct.delPrivileges.entrySet())
+ {
+ oprot.writeString(_iter133.getKey());
+ oprot.writeString(_iter133.getValue());
+ }
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, TPrivilegeChanges struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ struct.authzObj = iprot.readString();
+ struct.setAuthzObjIsSet(true);
+ {
+ org.apache.thrift.protocol.TMap _map134 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32());
+ struct.addPrivileges = new HashMap<String,String>(2*_map134.size);
+ for (int _i135 = 0; _i135 < _map134.size; ++_i135)
+ {
+ String _key136; // required
+ String _val137; // required
+ _key136 = iprot.readString();
+ _val137 = iprot.readString();
+ struct.addPrivileges.put(_key136, _val137);
+ }
+ }
+ struct.setAddPrivilegesIsSet(true);
+ {
+ org.apache.thrift.protocol.TMap _map138 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32());
+ struct.delPrivileges = new HashMap<String,String>(2*_map138.size);
+ for (int _i139 = 0; _i139 < _map138.size; ++_i139)
+ {
+ String _key140; // required
+ String _val141; // required
+ _key140 = iprot.readString();
+ _val141 = iprot.readString();
+ struct.delPrivileges.put(_key140, _val141);
+ }
+ }
+ struct.setDelPrivilegesIsSet(true);
+ }
+ }
+
+}
+
[20/25] SENTRY-432. HDFS ingration. Initial patch
Posted by pr...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleGrantPrivilegeRequest.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleGrantPrivilegeRequest.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleGrantPrivilegeRequest.java
deleted file mode 100644
index 62b6b31..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleGrantPrivilegeRequest.java
+++ /dev/null
@@ -1,693 +0,0 @@
-/**
- * Autogenerated by Thrift Compiler (0.9.0)
- *
- * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
- * @generated
- */
-package org.apache.sentry.provider.db.service.thrift;
-
-import org.apache.commons.lang.builder.HashCodeBuilder;
-import org.apache.thrift.scheme.IScheme;
-import org.apache.thrift.scheme.SchemeFactory;
-import org.apache.thrift.scheme.StandardScheme;
-
-import org.apache.thrift.scheme.TupleScheme;
-import org.apache.thrift.protocol.TTupleProtocol;
-import org.apache.thrift.protocol.TProtocolException;
-import org.apache.thrift.EncodingUtils;
-import org.apache.thrift.TException;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.EnumMap;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.EnumSet;
-import java.util.Collections;
-import java.util.BitSet;
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class TAlterSentryRoleGrantPrivilegeRequest implements org.apache.thrift.TBase<TAlterSentryRoleGrantPrivilegeRequest, TAlterSentryRoleGrantPrivilegeRequest._Fields>, java.io.Serializable, Cloneable {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TAlterSentryRoleGrantPrivilegeRequest");
-
- private static final org.apache.thrift.protocol.TField PROTOCOL_VERSION_FIELD_DESC = new org.apache.thrift.protocol.TField("protocol_version", org.apache.thrift.protocol.TType.I32, (short)1);
- private static final org.apache.thrift.protocol.TField REQUESTOR_USER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("requestorUserName", org.apache.thrift.protocol.TType.STRING, (short)2);
- private static final org.apache.thrift.protocol.TField ROLE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("roleName", org.apache.thrift.protocol.TType.STRING, (short)3);
- private static final org.apache.thrift.protocol.TField PRIVILEGE_FIELD_DESC = new org.apache.thrift.protocol.TField("privilege", org.apache.thrift.protocol.TType.STRUCT, (short)5);
-
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TAlterSentryRoleGrantPrivilegeRequestStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TAlterSentryRoleGrantPrivilegeRequestTupleSchemeFactory());
- }
-
- private int protocol_version; // required
- private String requestorUserName; // required
- private String roleName; // required
- private TSentryPrivilege privilege; // required
-
- /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
- public enum _Fields implements org.apache.thrift.TFieldIdEnum {
- PROTOCOL_VERSION((short)1, "protocol_version"),
- REQUESTOR_USER_NAME((short)2, "requestorUserName"),
- ROLE_NAME((short)3, "roleName"),
- PRIVILEGE((short)5, "privilege");
-
- private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
-
- static {
- for (_Fields field : EnumSet.allOf(_Fields.class)) {
- byName.put(field.getFieldName(), field);
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, or null if its not found.
- */
- public static _Fields findByThriftId(int fieldId) {
- switch(fieldId) {
- case 1: // PROTOCOL_VERSION
- return PROTOCOL_VERSION;
- case 2: // REQUESTOR_USER_NAME
- return REQUESTOR_USER_NAME;
- case 3: // ROLE_NAME
- return ROLE_NAME;
- case 5: // PRIVILEGE
- return PRIVILEGE;
- default:
- return null;
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, throwing an exception
- * if it is not found.
- */
- public static _Fields findByThriftIdOrThrow(int fieldId) {
- _Fields fields = findByThriftId(fieldId);
- if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
- return fields;
- }
-
- /**
- * Find the _Fields constant that matches name, or null if its not found.
- */
- public static _Fields findByName(String name) {
- return byName.get(name);
- }
-
- private final short _thriftId;
- private final String _fieldName;
-
- _Fields(short thriftId, String fieldName) {
- _thriftId = thriftId;
- _fieldName = fieldName;
- }
-
- public short getThriftFieldId() {
- return _thriftId;
- }
-
- public String getFieldName() {
- return _fieldName;
- }
- }
-
- // isset id assignments
- private static final int __PROTOCOL_VERSION_ISSET_ID = 0;
- private byte __isset_bitfield = 0;
- public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
- static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
- tmpMap.put(_Fields.PROTOCOL_VERSION, new org.apache.thrift.meta_data.FieldMetaData("protocol_version", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
- tmpMap.put(_Fields.REQUESTOR_USER_NAME, new org.apache.thrift.meta_data.FieldMetaData("requestorUserName", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.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.PRIVILEGE, new org.apache.thrift.meta_data.FieldMetaData("privilege", org.apache.thrift.TFieldRequirementType.REQUIRED,
- 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(TAlterSentryRoleGrantPrivilegeRequest.class, metaDataMap);
- }
-
- public TAlterSentryRoleGrantPrivilegeRequest() {
- this.protocol_version = 1;
-
- }
-
- public TAlterSentryRoleGrantPrivilegeRequest(
- int protocol_version,
- String requestorUserName,
- String roleName,
- TSentryPrivilege privilege)
- {
- this();
- this.protocol_version = protocol_version;
- setProtocol_versionIsSet(true);
- this.requestorUserName = requestorUserName;
- this.roleName = roleName;
- this.privilege = privilege;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TAlterSentryRoleGrantPrivilegeRequest(TAlterSentryRoleGrantPrivilegeRequest other) {
- __isset_bitfield = other.__isset_bitfield;
- this.protocol_version = other.protocol_version;
- if (other.isSetRequestorUserName()) {
- this.requestorUserName = other.requestorUserName;
- }
- if (other.isSetRoleName()) {
- this.roleName = other.roleName;
- }
- if (other.isSetPrivilege()) {
- this.privilege = new TSentryPrivilege(other.privilege);
- }
- }
-
- public TAlterSentryRoleGrantPrivilegeRequest deepCopy() {
- return new TAlterSentryRoleGrantPrivilegeRequest(this);
- }
-
- @Override
- public void clear() {
- this.protocol_version = 1;
-
- this.requestorUserName = null;
- this.roleName = null;
- this.privilege = null;
- }
-
- public int getProtocol_version() {
- return this.protocol_version;
- }
-
- public void setProtocol_version(int protocol_version) {
- this.protocol_version = protocol_version;
- setProtocol_versionIsSet(true);
- }
-
- public void unsetProtocol_version() {
- __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __PROTOCOL_VERSION_ISSET_ID);
- }
-
- /** Returns true if field protocol_version is set (has been assigned a value) and false otherwise */
- public boolean isSetProtocol_version() {
- return EncodingUtils.testBit(__isset_bitfield, __PROTOCOL_VERSION_ISSET_ID);
- }
-
- public void setProtocol_versionIsSet(boolean value) {
- __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __PROTOCOL_VERSION_ISSET_ID, value);
- }
-
- public String getRequestorUserName() {
- return this.requestorUserName;
- }
-
- public void setRequestorUserName(String requestorUserName) {
- this.requestorUserName = requestorUserName;
- }
-
- public void unsetRequestorUserName() {
- this.requestorUserName = null;
- }
-
- /** Returns true if field requestorUserName is set (has been assigned a value) and false otherwise */
- public boolean isSetRequestorUserName() {
- return this.requestorUserName != null;
- }
-
- public void setRequestorUserNameIsSet(boolean value) {
- if (!value) {
- this.requestorUserName = null;
- }
- }
-
- public 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 TSentryPrivilege getPrivilege() {
- return this.privilege;
- }
-
- public void setPrivilege(TSentryPrivilege privilege) {
- this.privilege = privilege;
- }
-
- public void unsetPrivilege() {
- this.privilege = null;
- }
-
- /** Returns true if field privilege is set (has been assigned a value) and false otherwise */
- public boolean isSetPrivilege() {
- return this.privilege != null;
- }
-
- public void setPrivilegeIsSet(boolean value) {
- if (!value) {
- this.privilege = null;
- }
- }
-
- public void setFieldValue(_Fields field, Object value) {
- switch (field) {
- case PROTOCOL_VERSION:
- if (value == null) {
- unsetProtocol_version();
- } else {
- setProtocol_version((Integer)value);
- }
- break;
-
- case REQUESTOR_USER_NAME:
- if (value == null) {
- unsetRequestorUserName();
- } else {
- setRequestorUserName((String)value);
- }
- break;
-
- case ROLE_NAME:
- if (value == null) {
- unsetRoleName();
- } else {
- setRoleName((String)value);
- }
- break;
-
- case PRIVILEGE:
- if (value == null) {
- unsetPrivilege();
- } else {
- setPrivilege((TSentryPrivilege)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case PROTOCOL_VERSION:
- return Integer.valueOf(getProtocol_version());
-
- case REQUESTOR_USER_NAME:
- return getRequestorUserName();
-
- case ROLE_NAME:
- return getRoleName();
-
- case PRIVILEGE:
- return getPrivilege();
-
- }
- throw new IllegalStateException();
- }
-
- /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
- public boolean isSet(_Fields field) {
- if (field == null) {
- throw new IllegalArgumentException();
- }
-
- switch (field) {
- case PROTOCOL_VERSION:
- return isSetProtocol_version();
- case REQUESTOR_USER_NAME:
- return isSetRequestorUserName();
- case ROLE_NAME:
- return isSetRoleName();
- case PRIVILEGE:
- return isSetPrivilege();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TAlterSentryRoleGrantPrivilegeRequest)
- return this.equals((TAlterSentryRoleGrantPrivilegeRequest)that);
- return false;
- }
-
- public boolean equals(TAlterSentryRoleGrantPrivilegeRequest that) {
- if (that == null)
- return false;
-
- boolean this_present_protocol_version = true;
- boolean that_present_protocol_version = true;
- if (this_present_protocol_version || that_present_protocol_version) {
- if (!(this_present_protocol_version && that_present_protocol_version))
- return false;
- if (this.protocol_version != that.protocol_version)
- return false;
- }
-
- boolean this_present_requestorUserName = true && this.isSetRequestorUserName();
- boolean that_present_requestorUserName = true && that.isSetRequestorUserName();
- if (this_present_requestorUserName || that_present_requestorUserName) {
- if (!(this_present_requestorUserName && that_present_requestorUserName))
- return false;
- if (!this.requestorUserName.equals(that.requestorUserName))
- return false;
- }
-
- boolean this_present_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_privilege = true && this.isSetPrivilege();
- boolean that_present_privilege = true && that.isSetPrivilege();
- if (this_present_privilege || that_present_privilege) {
- if (!(this_present_privilege && that_present_privilege))
- return false;
- if (!this.privilege.equals(that.privilege))
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode() {
- HashCodeBuilder builder = new HashCodeBuilder();
-
- boolean present_protocol_version = true;
- builder.append(present_protocol_version);
- if (present_protocol_version)
- builder.append(protocol_version);
-
- boolean present_requestorUserName = true && (isSetRequestorUserName());
- builder.append(present_requestorUserName);
- if (present_requestorUserName)
- builder.append(requestorUserName);
-
- boolean present_roleName = true && (isSetRoleName());
- builder.append(present_roleName);
- if (present_roleName)
- builder.append(roleName);
-
- boolean present_privilege = true && (isSetPrivilege());
- builder.append(present_privilege);
- if (present_privilege)
- builder.append(privilege);
-
- return builder.toHashCode();
- }
-
- public int compareTo(TAlterSentryRoleGrantPrivilegeRequest other) {
- if (!getClass().equals(other.getClass())) {
- return getClass().getName().compareTo(other.getClass().getName());
- }
-
- int lastComparison = 0;
- TAlterSentryRoleGrantPrivilegeRequest typedOther = (TAlterSentryRoleGrantPrivilegeRequest)other;
-
- lastComparison = Boolean.valueOf(isSetProtocol_version()).compareTo(typedOther.isSetProtocol_version());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetProtocol_version()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.protocol_version, typedOther.protocol_version);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetRequestorUserName()).compareTo(typedOther.isSetRequestorUserName());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetRequestorUserName()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.requestorUserName, typedOther.requestorUserName);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetRoleName()).compareTo(typedOther.isSetRoleName());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetRoleName()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.roleName, typedOther.roleName);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetPrivilege()).compareTo(typedOther.isSetPrivilege());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetPrivilege()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.privilege, typedOther.privilege);
- 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("TAlterSentryRoleGrantPrivilegeRequest(");
- boolean first = true;
-
- sb.append("protocol_version:");
- sb.append(this.protocol_version);
- first = false;
- if (!first) sb.append(", ");
- sb.append("requestorUserName:");
- if (this.requestorUserName == null) {
- sb.append("null");
- } else {
- sb.append(this.requestorUserName);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("roleName:");
- if (this.roleName == null) {
- sb.append("null");
- } else {
- sb.append(this.roleName);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("privilege:");
- if (this.privilege == null) {
- sb.append("null");
- } else {
- sb.append(this.privilege);
- }
- first = false;
- sb.append(")");
- return sb.toString();
- }
-
- public void validate() throws org.apache.thrift.TException {
- // check for required fields
- if (!isSetProtocol_version()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'protocol_version' is unset! Struct:" + toString());
- }
-
- if (!isSetRequestorUserName()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'requestorUserName' is unset! Struct:" + toString());
- }
-
- if (!isSetRoleName()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'roleName' is unset! Struct:" + toString());
- }
-
- if (!isSetPrivilege()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'privilege' is unset! Struct:" + toString());
- }
-
- // check for sub-struct validity
- if (privilege != null) {
- privilege.validate();
- }
- }
-
- private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
- try {
- write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
- try {
- // 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 TAlterSentryRoleGrantPrivilegeRequestStandardSchemeFactory implements SchemeFactory {
- public TAlterSentryRoleGrantPrivilegeRequestStandardScheme getScheme() {
- return new TAlterSentryRoleGrantPrivilegeRequestStandardScheme();
- }
- }
-
- private static class TAlterSentryRoleGrantPrivilegeRequestStandardScheme extends StandardScheme<TAlterSentryRoleGrantPrivilegeRequest> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TAlterSentryRoleGrantPrivilegeRequest struct) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TField schemeField;
- iprot.readStructBegin();
- while (true)
- {
- schemeField = iprot.readFieldBegin();
- if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
- break;
- }
- switch (schemeField.id) {
- case 1: // PROTOCOL_VERSION
- if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
- struct.protocol_version = iprot.readI32();
- struct.setProtocol_versionIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 2: // REQUESTOR_USER_NAME
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.requestorUserName = iprot.readString();
- struct.setRequestorUserNameIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 3: // 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 5: // PRIVILEGE
- if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
- struct.privilege = new TSentryPrivilege();
- struct.privilege.read(iprot);
- struct.setPrivilegeIsSet(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, TAlterSentryRoleGrantPrivilegeRequest struct) throws org.apache.thrift.TException {
- struct.validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- oprot.writeFieldBegin(PROTOCOL_VERSION_FIELD_DESC);
- oprot.writeI32(struct.protocol_version);
- oprot.writeFieldEnd();
- if (struct.requestorUserName != null) {
- oprot.writeFieldBegin(REQUESTOR_USER_NAME_FIELD_DESC);
- oprot.writeString(struct.requestorUserName);
- oprot.writeFieldEnd();
- }
- if (struct.roleName != null) {
- oprot.writeFieldBegin(ROLE_NAME_FIELD_DESC);
- oprot.writeString(struct.roleName);
- oprot.writeFieldEnd();
- }
- if (struct.privilege != null) {
- oprot.writeFieldBegin(PRIVILEGE_FIELD_DESC);
- struct.privilege.write(oprot);
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TAlterSentryRoleGrantPrivilegeRequestTupleSchemeFactory implements SchemeFactory {
- public TAlterSentryRoleGrantPrivilegeRequestTupleScheme getScheme() {
- return new TAlterSentryRoleGrantPrivilegeRequestTupleScheme();
- }
- }
-
- private static class TAlterSentryRoleGrantPrivilegeRequestTupleScheme extends TupleScheme<TAlterSentryRoleGrantPrivilegeRequest> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleGrantPrivilegeRequest struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- oprot.writeI32(struct.protocol_version);
- oprot.writeString(struct.requestorUserName);
- oprot.writeString(struct.roleName);
- struct.privilege.write(oprot);
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleGrantPrivilegeRequest struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- struct.protocol_version = iprot.readI32();
- struct.setProtocol_versionIsSet(true);
- struct.requestorUserName = iprot.readString();
- struct.setRequestorUserNameIsSet(true);
- struct.roleName = iprot.readString();
- struct.setRoleNameIsSet(true);
- struct.privilege = new TSentryPrivilege();
- struct.privilege.read(iprot);
- struct.setPrivilegeIsSet(true);
- }
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleGrantPrivilegeResponse.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleGrantPrivilegeResponse.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleGrantPrivilegeResponse.java
deleted file mode 100644
index 05e9f95..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleGrantPrivilegeResponse.java
+++ /dev/null
@@ -1,390 +0,0 @@
-/**
- * Autogenerated by Thrift Compiler (0.9.0)
- *
- * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
- * @generated
- */
-package org.apache.sentry.provider.db.service.thrift;
-
-import org.apache.commons.lang.builder.HashCodeBuilder;
-import org.apache.thrift.scheme.IScheme;
-import org.apache.thrift.scheme.SchemeFactory;
-import org.apache.thrift.scheme.StandardScheme;
-
-import org.apache.thrift.scheme.TupleScheme;
-import org.apache.thrift.protocol.TTupleProtocol;
-import org.apache.thrift.protocol.TProtocolException;
-import org.apache.thrift.EncodingUtils;
-import org.apache.thrift.TException;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.EnumMap;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.EnumSet;
-import java.util.Collections;
-import java.util.BitSet;
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class TAlterSentryRoleGrantPrivilegeResponse implements org.apache.thrift.TBase<TAlterSentryRoleGrantPrivilegeResponse, TAlterSentryRoleGrantPrivilegeResponse._Fields>, java.io.Serializable, Cloneable {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TAlterSentryRoleGrantPrivilegeResponse");
-
- private static final org.apache.thrift.protocol.TField STATUS_FIELD_DESC = new org.apache.thrift.protocol.TField("status", org.apache.thrift.protocol.TType.STRUCT, (short)1);
-
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TAlterSentryRoleGrantPrivilegeResponseStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TAlterSentryRoleGrantPrivilegeResponseTupleSchemeFactory());
- }
-
- private org.apache.sentry.service.thrift.TSentryResponseStatus status; // required
-
- /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
- public enum _Fields implements org.apache.thrift.TFieldIdEnum {
- STATUS((short)1, "status");
-
- private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
-
- static {
- for (_Fields field : EnumSet.allOf(_Fields.class)) {
- byName.put(field.getFieldName(), field);
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, or null if its not found.
- */
- public static _Fields findByThriftId(int fieldId) {
- switch(fieldId) {
- case 1: // STATUS
- return STATUS;
- default:
- return null;
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, throwing an exception
- * if it is not found.
- */
- public static _Fields findByThriftIdOrThrow(int fieldId) {
- _Fields fields = findByThriftId(fieldId);
- if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
- return fields;
- }
-
- /**
- * Find the _Fields constant that matches name, or null if its not found.
- */
- public static _Fields findByName(String name) {
- return byName.get(name);
- }
-
- private final short _thriftId;
- private final String _fieldName;
-
- _Fields(short thriftId, String fieldName) {
- _thriftId = thriftId;
- _fieldName = fieldName;
- }
-
- public short getThriftFieldId() {
- return _thriftId;
- }
-
- public String getFieldName() {
- return _fieldName;
- }
- }
-
- // isset id assignments
- public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
- static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
- tmpMap.put(_Fields.STATUS, new org.apache.thrift.meta_data.FieldMetaData("status", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.sentry.service.thrift.TSentryResponseStatus.class)));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TAlterSentryRoleGrantPrivilegeResponse.class, metaDataMap);
- }
-
- public TAlterSentryRoleGrantPrivilegeResponse() {
- }
-
- public TAlterSentryRoleGrantPrivilegeResponse(
- org.apache.sentry.service.thrift.TSentryResponseStatus status)
- {
- this();
- this.status = status;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TAlterSentryRoleGrantPrivilegeResponse(TAlterSentryRoleGrantPrivilegeResponse other) {
- if (other.isSetStatus()) {
- this.status = new org.apache.sentry.service.thrift.TSentryResponseStatus(other.status);
- }
- }
-
- public TAlterSentryRoleGrantPrivilegeResponse deepCopy() {
- return new TAlterSentryRoleGrantPrivilegeResponse(this);
- }
-
- @Override
- public void clear() {
- this.status = null;
- }
-
- public org.apache.sentry.service.thrift.TSentryResponseStatus getStatus() {
- return this.status;
- }
-
- public void setStatus(org.apache.sentry.service.thrift.TSentryResponseStatus status) {
- this.status = status;
- }
-
- public void unsetStatus() {
- this.status = null;
- }
-
- /** Returns true if field status is set (has been assigned a value) and false otherwise */
- public boolean isSetStatus() {
- return this.status != null;
- }
-
- public void setStatusIsSet(boolean value) {
- if (!value) {
- this.status = null;
- }
- }
-
- public void setFieldValue(_Fields field, Object value) {
- switch (field) {
- case STATUS:
- if (value == null) {
- unsetStatus();
- } else {
- setStatus((org.apache.sentry.service.thrift.TSentryResponseStatus)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case STATUS:
- return getStatus();
-
- }
- throw new IllegalStateException();
- }
-
- /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
- public boolean isSet(_Fields field) {
- if (field == null) {
- throw new IllegalArgumentException();
- }
-
- switch (field) {
- case STATUS:
- return isSetStatus();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TAlterSentryRoleGrantPrivilegeResponse)
- return this.equals((TAlterSentryRoleGrantPrivilegeResponse)that);
- return false;
- }
-
- public boolean equals(TAlterSentryRoleGrantPrivilegeResponse that) {
- if (that == null)
- return false;
-
- boolean this_present_status = true && this.isSetStatus();
- boolean that_present_status = true && that.isSetStatus();
- if (this_present_status || that_present_status) {
- if (!(this_present_status && that_present_status))
- return false;
- if (!this.status.equals(that.status))
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode() {
- HashCodeBuilder builder = new HashCodeBuilder();
-
- boolean present_status = true && (isSetStatus());
- builder.append(present_status);
- if (present_status)
- builder.append(status);
-
- return builder.toHashCode();
- }
-
- public int compareTo(TAlterSentryRoleGrantPrivilegeResponse other) {
- if (!getClass().equals(other.getClass())) {
- return getClass().getName().compareTo(other.getClass().getName());
- }
-
- int lastComparison = 0;
- TAlterSentryRoleGrantPrivilegeResponse typedOther = (TAlterSentryRoleGrantPrivilegeResponse)other;
-
- lastComparison = Boolean.valueOf(isSetStatus()).compareTo(typedOther.isSetStatus());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetStatus()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.status, typedOther.status);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- 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("TAlterSentryRoleGrantPrivilegeResponse(");
- boolean first = true;
-
- sb.append("status:");
- if (this.status == null) {
- sb.append("null");
- } else {
- sb.append(this.status);
- }
- first = false;
- sb.append(")");
- return sb.toString();
- }
-
- public void validate() throws org.apache.thrift.TException {
- // check for required fields
- if (!isSetStatus()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'status' is unset! Struct:" + toString());
- }
-
- // check for sub-struct validity
- if (status != null) {
- status.validate();
- }
- }
-
- private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
- try {
- write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
- try {
- read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private static class TAlterSentryRoleGrantPrivilegeResponseStandardSchemeFactory implements SchemeFactory {
- public TAlterSentryRoleGrantPrivilegeResponseStandardScheme getScheme() {
- return new TAlterSentryRoleGrantPrivilegeResponseStandardScheme();
- }
- }
-
- private static class TAlterSentryRoleGrantPrivilegeResponseStandardScheme extends StandardScheme<TAlterSentryRoleGrantPrivilegeResponse> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TAlterSentryRoleGrantPrivilegeResponse struct) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TField schemeField;
- iprot.readStructBegin();
- while (true)
- {
- schemeField = iprot.readFieldBegin();
- if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
- break;
- }
- switch (schemeField.id) {
- case 1: // STATUS
- if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
- struct.status = new org.apache.sentry.service.thrift.TSentryResponseStatus();
- struct.status.read(iprot);
- struct.setStatusIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- 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, TAlterSentryRoleGrantPrivilegeResponse struct) throws org.apache.thrift.TException {
- struct.validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- if (struct.status != null) {
- oprot.writeFieldBegin(STATUS_FIELD_DESC);
- struct.status.write(oprot);
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TAlterSentryRoleGrantPrivilegeResponseTupleSchemeFactory implements SchemeFactory {
- public TAlterSentryRoleGrantPrivilegeResponseTupleScheme getScheme() {
- return new TAlterSentryRoleGrantPrivilegeResponseTupleScheme();
- }
- }
-
- private static class TAlterSentryRoleGrantPrivilegeResponseTupleScheme extends TupleScheme<TAlterSentryRoleGrantPrivilegeResponse> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleGrantPrivilegeResponse struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- struct.status.write(oprot);
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleGrantPrivilegeResponse struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- struct.status = new org.apache.sentry.service.thrift.TSentryResponseStatus();
- struct.status.read(iprot);
- struct.setStatusIsSet(true);
- }
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleRevokePrivilegeRequest.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleRevokePrivilegeRequest.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleRevokePrivilegeRequest.java
deleted file mode 100644
index bbd9536..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleRevokePrivilegeRequest.java
+++ /dev/null
@@ -1,693 +0,0 @@
-/**
- * Autogenerated by Thrift Compiler (0.9.0)
- *
- * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
- * @generated
- */
-package org.apache.sentry.provider.db.service.thrift;
-
-import org.apache.commons.lang.builder.HashCodeBuilder;
-import org.apache.thrift.scheme.IScheme;
-import org.apache.thrift.scheme.SchemeFactory;
-import org.apache.thrift.scheme.StandardScheme;
-
-import org.apache.thrift.scheme.TupleScheme;
-import org.apache.thrift.protocol.TTupleProtocol;
-import org.apache.thrift.protocol.TProtocolException;
-import org.apache.thrift.EncodingUtils;
-import org.apache.thrift.TException;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.EnumMap;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.EnumSet;
-import java.util.Collections;
-import java.util.BitSet;
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class TAlterSentryRoleRevokePrivilegeRequest implements org.apache.thrift.TBase<TAlterSentryRoleRevokePrivilegeRequest, TAlterSentryRoleRevokePrivilegeRequest._Fields>, java.io.Serializable, Cloneable {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TAlterSentryRoleRevokePrivilegeRequest");
-
- private static final org.apache.thrift.protocol.TField PROTOCOL_VERSION_FIELD_DESC = new org.apache.thrift.protocol.TField("protocol_version", org.apache.thrift.protocol.TType.I32, (short)1);
- private static final org.apache.thrift.protocol.TField REQUESTOR_USER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("requestorUserName", org.apache.thrift.protocol.TType.STRING, (short)2);
- private static final org.apache.thrift.protocol.TField ROLE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("roleName", org.apache.thrift.protocol.TType.STRING, (short)3);
- private static final org.apache.thrift.protocol.TField PRIVILEGE_FIELD_DESC = new org.apache.thrift.protocol.TField("privilege", org.apache.thrift.protocol.TType.STRUCT, (short)5);
-
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TAlterSentryRoleRevokePrivilegeRequestStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TAlterSentryRoleRevokePrivilegeRequestTupleSchemeFactory());
- }
-
- private int protocol_version; // required
- private String requestorUserName; // required
- private String roleName; // required
- private TSentryPrivilege privilege; // required
-
- /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
- public enum _Fields implements org.apache.thrift.TFieldIdEnum {
- PROTOCOL_VERSION((short)1, "protocol_version"),
- REQUESTOR_USER_NAME((short)2, "requestorUserName"),
- ROLE_NAME((short)3, "roleName"),
- PRIVILEGE((short)5, "privilege");
-
- private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
-
- static {
- for (_Fields field : EnumSet.allOf(_Fields.class)) {
- byName.put(field.getFieldName(), field);
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, or null if its not found.
- */
- public static _Fields findByThriftId(int fieldId) {
- switch(fieldId) {
- case 1: // PROTOCOL_VERSION
- return PROTOCOL_VERSION;
- case 2: // REQUESTOR_USER_NAME
- return REQUESTOR_USER_NAME;
- case 3: // ROLE_NAME
- return ROLE_NAME;
- case 5: // PRIVILEGE
- return PRIVILEGE;
- default:
- return null;
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, throwing an exception
- * if it is not found.
- */
- public static _Fields findByThriftIdOrThrow(int fieldId) {
- _Fields fields = findByThriftId(fieldId);
- if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
- return fields;
- }
-
- /**
- * Find the _Fields constant that matches name, or null if its not found.
- */
- public static _Fields findByName(String name) {
- return byName.get(name);
- }
-
- private final short _thriftId;
- private final String _fieldName;
-
- _Fields(short thriftId, String fieldName) {
- _thriftId = thriftId;
- _fieldName = fieldName;
- }
-
- public short getThriftFieldId() {
- return _thriftId;
- }
-
- public String getFieldName() {
- return _fieldName;
- }
- }
-
- // isset id assignments
- private static final int __PROTOCOL_VERSION_ISSET_ID = 0;
- private byte __isset_bitfield = 0;
- public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
- static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
- tmpMap.put(_Fields.PROTOCOL_VERSION, new org.apache.thrift.meta_data.FieldMetaData("protocol_version", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
- tmpMap.put(_Fields.REQUESTOR_USER_NAME, new org.apache.thrift.meta_data.FieldMetaData("requestorUserName", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.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.PRIVILEGE, new org.apache.thrift.meta_data.FieldMetaData("privilege", org.apache.thrift.TFieldRequirementType.REQUIRED,
- 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(TAlterSentryRoleRevokePrivilegeRequest.class, metaDataMap);
- }
-
- public TAlterSentryRoleRevokePrivilegeRequest() {
- this.protocol_version = 1;
-
- }
-
- public TAlterSentryRoleRevokePrivilegeRequest(
- int protocol_version,
- String requestorUserName,
- String roleName,
- TSentryPrivilege privilege)
- {
- this();
- this.protocol_version = protocol_version;
- setProtocol_versionIsSet(true);
- this.requestorUserName = requestorUserName;
- this.roleName = roleName;
- this.privilege = privilege;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TAlterSentryRoleRevokePrivilegeRequest(TAlterSentryRoleRevokePrivilegeRequest other) {
- __isset_bitfield = other.__isset_bitfield;
- this.protocol_version = other.protocol_version;
- if (other.isSetRequestorUserName()) {
- this.requestorUserName = other.requestorUserName;
- }
- if (other.isSetRoleName()) {
- this.roleName = other.roleName;
- }
- if (other.isSetPrivilege()) {
- this.privilege = new TSentryPrivilege(other.privilege);
- }
- }
-
- public TAlterSentryRoleRevokePrivilegeRequest deepCopy() {
- return new TAlterSentryRoleRevokePrivilegeRequest(this);
- }
-
- @Override
- public void clear() {
- this.protocol_version = 1;
-
- this.requestorUserName = null;
- this.roleName = null;
- this.privilege = null;
- }
-
- public int getProtocol_version() {
- return this.protocol_version;
- }
-
- public void setProtocol_version(int protocol_version) {
- this.protocol_version = protocol_version;
- setProtocol_versionIsSet(true);
- }
-
- public void unsetProtocol_version() {
- __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __PROTOCOL_VERSION_ISSET_ID);
- }
-
- /** Returns true if field protocol_version is set (has been assigned a value) and false otherwise */
- public boolean isSetProtocol_version() {
- return EncodingUtils.testBit(__isset_bitfield, __PROTOCOL_VERSION_ISSET_ID);
- }
-
- public void setProtocol_versionIsSet(boolean value) {
- __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __PROTOCOL_VERSION_ISSET_ID, value);
- }
-
- public String getRequestorUserName() {
- return this.requestorUserName;
- }
-
- public void setRequestorUserName(String requestorUserName) {
- this.requestorUserName = requestorUserName;
- }
-
- public void unsetRequestorUserName() {
- this.requestorUserName = null;
- }
-
- /** Returns true if field requestorUserName is set (has been assigned a value) and false otherwise */
- public boolean isSetRequestorUserName() {
- return this.requestorUserName != null;
- }
-
- public void setRequestorUserNameIsSet(boolean value) {
- if (!value) {
- this.requestorUserName = null;
- }
- }
-
- public 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 TSentryPrivilege getPrivilege() {
- return this.privilege;
- }
-
- public void setPrivilege(TSentryPrivilege privilege) {
- this.privilege = privilege;
- }
-
- public void unsetPrivilege() {
- this.privilege = null;
- }
-
- /** Returns true if field privilege is set (has been assigned a value) and false otherwise */
- public boolean isSetPrivilege() {
- return this.privilege != null;
- }
-
- public void setPrivilegeIsSet(boolean value) {
- if (!value) {
- this.privilege = null;
- }
- }
-
- public void setFieldValue(_Fields field, Object value) {
- switch (field) {
- case PROTOCOL_VERSION:
- if (value == null) {
- unsetProtocol_version();
- } else {
- setProtocol_version((Integer)value);
- }
- break;
-
- case REQUESTOR_USER_NAME:
- if (value == null) {
- unsetRequestorUserName();
- } else {
- setRequestorUserName((String)value);
- }
- break;
-
- case ROLE_NAME:
- if (value == null) {
- unsetRoleName();
- } else {
- setRoleName((String)value);
- }
- break;
-
- case PRIVILEGE:
- if (value == null) {
- unsetPrivilege();
- } else {
- setPrivilege((TSentryPrivilege)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case PROTOCOL_VERSION:
- return Integer.valueOf(getProtocol_version());
-
- case REQUESTOR_USER_NAME:
- return getRequestorUserName();
-
- case ROLE_NAME:
- return getRoleName();
-
- case PRIVILEGE:
- return getPrivilege();
-
- }
- throw new IllegalStateException();
- }
-
- /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
- public boolean isSet(_Fields field) {
- if (field == null) {
- throw new IllegalArgumentException();
- }
-
- switch (field) {
- case PROTOCOL_VERSION:
- return isSetProtocol_version();
- case REQUESTOR_USER_NAME:
- return isSetRequestorUserName();
- case ROLE_NAME:
- return isSetRoleName();
- case PRIVILEGE:
- return isSetPrivilege();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TAlterSentryRoleRevokePrivilegeRequest)
- return this.equals((TAlterSentryRoleRevokePrivilegeRequest)that);
- return false;
- }
-
- public boolean equals(TAlterSentryRoleRevokePrivilegeRequest that) {
- if (that == null)
- return false;
-
- boolean this_present_protocol_version = true;
- boolean that_present_protocol_version = true;
- if (this_present_protocol_version || that_present_protocol_version) {
- if (!(this_present_protocol_version && that_present_protocol_version))
- return false;
- if (this.protocol_version != that.protocol_version)
- return false;
- }
-
- boolean this_present_requestorUserName = true && this.isSetRequestorUserName();
- boolean that_present_requestorUserName = true && that.isSetRequestorUserName();
- if (this_present_requestorUserName || that_present_requestorUserName) {
- if (!(this_present_requestorUserName && that_present_requestorUserName))
- return false;
- if (!this.requestorUserName.equals(that.requestorUserName))
- return false;
- }
-
- boolean this_present_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_privilege = true && this.isSetPrivilege();
- boolean that_present_privilege = true && that.isSetPrivilege();
- if (this_present_privilege || that_present_privilege) {
- if (!(this_present_privilege && that_present_privilege))
- return false;
- if (!this.privilege.equals(that.privilege))
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode() {
- HashCodeBuilder builder = new HashCodeBuilder();
-
- boolean present_protocol_version = true;
- builder.append(present_protocol_version);
- if (present_protocol_version)
- builder.append(protocol_version);
-
- boolean present_requestorUserName = true && (isSetRequestorUserName());
- builder.append(present_requestorUserName);
- if (present_requestorUserName)
- builder.append(requestorUserName);
-
- boolean present_roleName = true && (isSetRoleName());
- builder.append(present_roleName);
- if (present_roleName)
- builder.append(roleName);
-
- boolean present_privilege = true && (isSetPrivilege());
- builder.append(present_privilege);
- if (present_privilege)
- builder.append(privilege);
-
- return builder.toHashCode();
- }
-
- public int compareTo(TAlterSentryRoleRevokePrivilegeRequest other) {
- if (!getClass().equals(other.getClass())) {
- return getClass().getName().compareTo(other.getClass().getName());
- }
-
- int lastComparison = 0;
- TAlterSentryRoleRevokePrivilegeRequest typedOther = (TAlterSentryRoleRevokePrivilegeRequest)other;
-
- lastComparison = Boolean.valueOf(isSetProtocol_version()).compareTo(typedOther.isSetProtocol_version());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetProtocol_version()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.protocol_version, typedOther.protocol_version);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetRequestorUserName()).compareTo(typedOther.isSetRequestorUserName());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetRequestorUserName()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.requestorUserName, typedOther.requestorUserName);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetRoleName()).compareTo(typedOther.isSetRoleName());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetRoleName()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.roleName, typedOther.roleName);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetPrivilege()).compareTo(typedOther.isSetPrivilege());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetPrivilege()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.privilege, typedOther.privilege);
- 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("TAlterSentryRoleRevokePrivilegeRequest(");
- boolean first = true;
-
- sb.append("protocol_version:");
- sb.append(this.protocol_version);
- first = false;
- if (!first) sb.append(", ");
- sb.append("requestorUserName:");
- if (this.requestorUserName == null) {
- sb.append("null");
- } else {
- sb.append(this.requestorUserName);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("roleName:");
- if (this.roleName == null) {
- sb.append("null");
- } else {
- sb.append(this.roleName);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("privilege:");
- if (this.privilege == null) {
- sb.append("null");
- } else {
- sb.append(this.privilege);
- }
- first = false;
- sb.append(")");
- return sb.toString();
- }
-
- public void validate() throws org.apache.thrift.TException {
- // check for required fields
- if (!isSetProtocol_version()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'protocol_version' is unset! Struct:" + toString());
- }
-
- if (!isSetRequestorUserName()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'requestorUserName' is unset! Struct:" + toString());
- }
-
- if (!isSetRoleName()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'roleName' is unset! Struct:" + toString());
- }
-
- if (!isSetPrivilege()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'privilege' is unset! Struct:" + toString());
- }
-
- // check for sub-struct validity
- if (privilege != null) {
- privilege.validate();
- }
- }
-
- private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
- try {
- write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
- try {
- // 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 TAlterSentryRoleRevokePrivilegeRequestStandardSchemeFactory implements SchemeFactory {
- public TAlterSentryRoleRevokePrivilegeRequestStandardScheme getScheme() {
- return new TAlterSentryRoleRevokePrivilegeRequestStandardScheme();
- }
- }
-
- private static class TAlterSentryRoleRevokePrivilegeRequestStandardScheme extends StandardScheme<TAlterSentryRoleRevokePrivilegeRequest> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TAlterSentryRoleRevokePrivilegeRequest struct) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TField schemeField;
- iprot.readStructBegin();
- while (true)
- {
- schemeField = iprot.readFieldBegin();
- if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
- break;
- }
- switch (schemeField.id) {
- case 1: // PROTOCOL_VERSION
- if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
- struct.protocol_version = iprot.readI32();
- struct.setProtocol_versionIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 2: // REQUESTOR_USER_NAME
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.requestorUserName = iprot.readString();
- struct.setRequestorUserNameIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 3: // 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 5: // PRIVILEGE
- if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
- struct.privilege = new TSentryPrivilege();
- struct.privilege.read(iprot);
- struct.setPrivilegeIsSet(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, TAlterSentryRoleRevokePrivilegeRequest struct) throws org.apache.thrift.TException {
- struct.validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- oprot.writeFieldBegin(PROTOCOL_VERSION_FIELD_DESC);
- oprot.writeI32(struct.protocol_version);
- oprot.writeFieldEnd();
- if (struct.requestorUserName != null) {
- oprot.writeFieldBegin(REQUESTOR_USER_NAME_FIELD_DESC);
- oprot.writeString(struct.requestorUserName);
- oprot.writeFieldEnd();
- }
- if (struct.roleName != null) {
- oprot.writeFieldBegin(ROLE_NAME_FIELD_DESC);
- oprot.writeString(struct.roleName);
- oprot.writeFieldEnd();
- }
- if (struct.privilege != null) {
- oprot.writeFieldBegin(PRIVILEGE_FIELD_DESC);
- struct.privilege.write(oprot);
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TAlterSentryRoleRevokePrivilegeRequestTupleSchemeFactory implements SchemeFactory {
- public TAlterSentryRoleRevokePrivilegeRequestTupleScheme getScheme() {
- return new TAlterSentryRoleRevokePrivilegeRequestTupleScheme();
- }
- }
-
- private static class TAlterSentryRoleRevokePrivilegeRequestTupleScheme extends TupleScheme<TAlterSentryRoleRevokePrivilegeRequest> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleRevokePrivilegeRequest struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- oprot.writeI32(struct.protocol_version);
- oprot.writeString(struct.requestorUserName);
- oprot.writeString(struct.roleName);
- struct.privilege.write(oprot);
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleRevokePrivilegeRequest struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- struct.protocol_version = iprot.readI32();
- struct.setProtocol_versionIsSet(true);
- struct.requestorUserName = iprot.readString();
- struct.setRequestorUserNameIsSet(true);
- struct.roleName = iprot.readString();
- struct.setRoleNameIsSet(true);
- struct.privilege = new TSentryPrivilege();
- struct.privilege.read(iprot);
- struct.setPrivilegeIsSet(true);
- }
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleRevokePrivilegeResponse.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleRevokePrivilegeResponse.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleRevokePrivilegeResponse.java
deleted file mode 100644
index d431e37..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleRevokePrivilegeResponse.java
+++ /dev/null
@@ -1,390 +0,0 @@
-/**
- * Autogenerated by Thrift Compiler (0.9.0)
- *
- * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
- * @generated
- */
-package org.apache.sentry.provider.db.service.thrift;
-
-import org.apache.commons.lang.builder.HashCodeBuilder;
-import org.apache.thrift.scheme.IScheme;
-import org.apache.thrift.scheme.SchemeFactory;
-import org.apache.thrift.scheme.StandardScheme;
-
-import org.apache.thrift.scheme.TupleScheme;
-import org.apache.thrift.protocol.TTupleProtocol;
-import org.apache.thrift.protocol.TProtocolException;
-import org.apache.thrift.EncodingUtils;
-import org.apache.thrift.TException;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.EnumMap;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.EnumSet;
-import java.util.Collections;
-import java.util.BitSet;
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class TAlterSentryRoleRevokePrivilegeResponse implements org.apache.thrift.TBase<TAlterSentryRoleRevokePrivilegeResponse, TAlterSentryRoleRevokePrivilegeResponse._Fields>, java.io.Serializable, Cloneable {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TAlterSentryRoleRevokePrivilegeResponse");
-
- private static final org.apache.thrift.protocol.TField STATUS_FIELD_DESC = new org.apache.thrift.protocol.TField("status", org.apache.thrift.protocol.TType.STRUCT, (short)1);
-
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TAlterSentryRoleRevokePrivilegeResponseStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TAlterSentryRoleRevokePrivilegeResponseTupleSchemeFactory());
- }
-
- private org.apache.sentry.service.thrift.TSentryResponseStatus status; // required
-
- /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
- public enum _Fields implements org.apache.thrift.TFieldIdEnum {
- STATUS((short)1, "status");
-
- private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
-
- static {
- for (_Fields field : EnumSet.allOf(_Fields.class)) {
- byName.put(field.getFieldName(), field);
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, or null if its not found.
- */
- public static _Fields findByThriftId(int fieldId) {
- switch(fieldId) {
- case 1: // STATUS
- return STATUS;
- default:
- return null;
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, throwing an exception
- * if it is not found.
- */
- public static _Fields findByThriftIdOrThrow(int fieldId) {
- _Fields fields = findByThriftId(fieldId);
- if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
- return fields;
- }
-
- /**
- * Find the _Fields constant that matches name, or null if its not found.
- */
- public static _Fields findByName(String name) {
- return byName.get(name);
- }
-
- private final short _thriftId;
- private final String _fieldName;
-
- _Fields(short thriftId, String fieldName) {
- _thriftId = thriftId;
- _fieldName = fieldName;
- }
-
- public short getThriftFieldId() {
- return _thriftId;
- }
-
- public String getFieldName() {
- return _fieldName;
- }
- }
-
- // isset id assignments
- public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
- static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
- tmpMap.put(_Fields.STATUS, new org.apache.thrift.meta_data.FieldMetaData("status", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.sentry.service.thrift.TSentryResponseStatus.class)));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TAlterSentryRoleRevokePrivilegeResponse.class, metaDataMap);
- }
-
- public TAlterSentryRoleRevokePrivilegeResponse() {
- }
-
- public TAlterSentryRoleRevokePrivilegeResponse(
- org.apache.sentry.service.thrift.TSentryResponseStatus status)
- {
- this();
- this.status = status;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TAlterSentryRoleRevokePrivilegeResponse(TAlterSentryRoleRevokePrivilegeResponse other) {
- if (other.isSetStatus()) {
- this.status = new org.apache.sentry.service.thrift.TSentryResponseStatus(other.status);
- }
- }
-
- public TAlterSentryRoleRevokePrivilegeResponse deepCopy() {
- return new TAlterSentryRoleRevokePrivilegeResponse(this);
- }
-
- @Override
- public void clear() {
- this.status = null;
- }
-
- public org.apache.sentry.service.thrift.TSentryResponseStatus getStatus() {
- return this.status;
- }
-
- public void setStatus(org.apache.sentry.service.thrift.TSentryResponseStatus status) {
- this.status = status;
- }
-
- public void unsetStatus() {
- this.status = null;
- }
-
- /** Returns true if field status is set (has been assigned a value) and false otherwise */
- public boolean isSetStatus() {
- return this.status != null;
- }
-
- public void setStatusIsSet(boolean value) {
- if (!value) {
- this.status = null;
- }
- }
-
- public void setFieldValue(_Fields field, Object value) {
- switch (field) {
- case STATUS:
- if (value == null) {
- unsetStatus();
- } else {
- setStatus((org.apache.sentry.service.thrift.TSentryResponseStatus)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case STATUS:
- return getStatus();
-
- }
- throw new IllegalStateException();
- }
-
- /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
- public boolean isSet(_Fields field) {
- if (field == null) {
- throw new IllegalArgumentException();
- }
-
- switch (field) {
- case STATUS:
- return isSetStatus();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TAlterSentryRoleRevokePrivilegeResponse)
- return this.equals((TAlterSentryRoleRevokePrivilegeResponse)that);
- return false;
- }
-
- public boolean equals(TAlterSentryRoleRevokePrivilegeResponse that) {
- if (that == null)
- return false;
-
- boolean this_present_status = true && this.isSetStatus();
- boolean that_present_status = true && that.isSetStatus();
- if (this_present_status || that_present_status) {
- if (!(this_present_status && that_present_status))
- return false;
- if (!this.status.equals(that.status))
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode() {
- HashCodeBuilder builder = new HashCodeBuilder();
-
- boolean present_status = true && (isSetStatus());
- builder.append(present_status);
- if (present_status)
- builder.append(status);
-
- return builder.toHashCode();
- }
-
- public int compareTo(TAlterSentryRoleRevokePrivilegeResponse other) {
- if (!getClass().equals(other.getClass())) {
- return getClass().getName().compareTo(other.getClass().getName());
- }
-
- int lastComparison = 0;
- TAlterSentryRoleRevokePrivilegeResponse typedOther = (TAlterSentryRoleRevokePrivilegeResponse)other;
-
- lastComparison = Boolean.valueOf(isSetStatus()).compareTo(typedOther.isSetStatus());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetStatus()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.status, typedOther.status);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- 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("TAlterSentryRoleRevokePrivilegeResponse(");
- boolean first = true;
-
- sb.append("status:");
- if (this.status == null) {
- sb.append("null");
- } else {
- sb.append(this.status);
- }
- first = false;
- sb.append(")");
- return sb.toString();
- }
-
- public void validate() throws org.apache.thrift.TException {
- // check for required fields
- if (!isSetStatus()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'status' is unset! Struct:" + toString());
- }
-
- // check for sub-struct validity
- if (status != null) {
- status.validate();
- }
- }
-
- private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
- try {
- write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
- try {
- read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private static class TAlterSentryRoleRevokePrivilegeResponseStandardSchemeFactory implements SchemeFactory {
- public TAlterSentryRoleRevokePrivilegeResponseStandardScheme getScheme() {
- return new TAlterSentryRoleRevokePrivilegeResponseStandardScheme();
- }
- }
-
- private static class TAlterSentryRoleRevokePrivilegeResponseStandardScheme extends StandardScheme<TAlterSentryRoleRevokePrivilegeResponse> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TAlterSentryRoleRevokePrivilegeResponse struct) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TField schemeField;
- iprot.readStructBegin();
- while (true)
- {
- schemeField = iprot.readFieldBegin();
- if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
- break;
- }
- switch (schemeField.id) {
- case 1: // STATUS
- if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
- struct.status = new org.apache.sentry.service.thrift.TSentryResponseStatus();
- struct.status.read(iprot);
- struct.setStatusIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- 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, TAlterSentryRoleRevokePrivilegeResponse struct) throws org.apache.thrift.TException {
- struct.validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- if (struct.status != null) {
- oprot.writeFieldBegin(STATUS_FIELD_DESC);
- struct.status.write(oprot);
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TAlterSentryRoleRevokePrivilegeResponseTupleSchemeFactory implements SchemeFactory {
- public TAlterSentryRoleRevokePrivilegeResponseTupleScheme getScheme() {
- return new TAlterSentryRoleRevokePrivilegeResponseTupleScheme();
- }
- }
-
- private static class TAlterSentryRoleRevokePrivilegeResponseTupleScheme extends TupleScheme<TAlterSentryRoleRevokePrivilegeResponse> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleRevokePrivilegeResponse struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- struct.status.write(oprot);
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleRevokePrivilegeResponse struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- struct.status = new org.apache.sentry.service.thrift.TSentryResponseStatus();
- struct.status.read(iprot);
- struct.setStatusIsSet(true);
- }
- }
-
-}
-
[08/25] SENTRY-432. HDFS ingration. Initial patch
Posted by pr...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TDropPrivilegesResponse.java
----------------------------------------------------------------------
diff --git a/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TDropPrivilegesResponse.java b/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TDropPrivilegesResponse.java
new file mode 100644
index 0000000..24f7926
--- /dev/null
+++ b/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TDropPrivilegesResponse.java
@@ -0,0 +1,390 @@
+/**
+ * Autogenerated by Thrift Compiler (0.9.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+package org.apache.sentry.provider.db.service.thrift;
+
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EnumMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.EnumSet;
+import java.util.Collections;
+import java.util.BitSet;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class TDropPrivilegesResponse implements org.apache.thrift.TBase<TDropPrivilegesResponse, TDropPrivilegesResponse._Fields>, java.io.Serializable, Cloneable {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TDropPrivilegesResponse");
+
+ private static final org.apache.thrift.protocol.TField STATUS_FIELD_DESC = new org.apache.thrift.protocol.TField("status", org.apache.thrift.protocol.TType.STRUCT, (short)1);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new TDropPrivilegesResponseStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new TDropPrivilegesResponseTupleSchemeFactory());
+ }
+
+ private org.apache.sentry.service.thrift.TSentryResponseStatus status; // required
+
+ /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+ public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+ STATUS((short)1, "status");
+
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+ static {
+ for (_Fields field : EnumSet.allOf(_Fields.class)) {
+ byName.put(field.getFieldName(), field);
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, or null if its not found.
+ */
+ public static _Fields findByThriftId(int fieldId) {
+ switch(fieldId) {
+ case 1: // STATUS
+ return STATUS;
+ default:
+ return null;
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, throwing an exception
+ * if it is not found.
+ */
+ public static _Fields findByThriftIdOrThrow(int fieldId) {
+ _Fields fields = findByThriftId(fieldId);
+ if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+ return fields;
+ }
+
+ /**
+ * Find the _Fields constant that matches name, or null if its not found.
+ */
+ public static _Fields findByName(String name) {
+ return byName.get(name);
+ }
+
+ private final short _thriftId;
+ private final String _fieldName;
+
+ _Fields(short thriftId, String fieldName) {
+ _thriftId = thriftId;
+ _fieldName = fieldName;
+ }
+
+ public short getThriftFieldId() {
+ return _thriftId;
+ }
+
+ public String getFieldName() {
+ return _fieldName;
+ }
+ }
+
+ // isset id assignments
+ public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+ static {
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+ tmpMap.put(_Fields.STATUS, new org.apache.thrift.meta_data.FieldMetaData("status", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.sentry.service.thrift.TSentryResponseStatus.class)));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TDropPrivilegesResponse.class, metaDataMap);
+ }
+
+ public TDropPrivilegesResponse() {
+ }
+
+ public TDropPrivilegesResponse(
+ org.apache.sentry.service.thrift.TSentryResponseStatus status)
+ {
+ this();
+ this.status = status;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public TDropPrivilegesResponse(TDropPrivilegesResponse other) {
+ if (other.isSetStatus()) {
+ this.status = new org.apache.sentry.service.thrift.TSentryResponseStatus(other.status);
+ }
+ }
+
+ public TDropPrivilegesResponse deepCopy() {
+ return new TDropPrivilegesResponse(this);
+ }
+
+ @Override
+ public void clear() {
+ this.status = null;
+ }
+
+ public org.apache.sentry.service.thrift.TSentryResponseStatus getStatus() {
+ return this.status;
+ }
+
+ public void setStatus(org.apache.sentry.service.thrift.TSentryResponseStatus status) {
+ this.status = status;
+ }
+
+ public void unsetStatus() {
+ this.status = null;
+ }
+
+ /** Returns true if field status is set (has been assigned a value) and false otherwise */
+ public boolean isSetStatus() {
+ return this.status != null;
+ }
+
+ public void setStatusIsSet(boolean value) {
+ if (!value) {
+ this.status = null;
+ }
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case STATUS:
+ if (value == null) {
+ unsetStatus();
+ } else {
+ setStatus((org.apache.sentry.service.thrift.TSentryResponseStatus)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case STATUS:
+ return getStatus();
+
+ }
+ throw new IllegalStateException();
+ }
+
+ /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+ public boolean isSet(_Fields field) {
+ if (field == null) {
+ throw new IllegalArgumentException();
+ }
+
+ switch (field) {
+ case STATUS:
+ return isSetStatus();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof TDropPrivilegesResponse)
+ return this.equals((TDropPrivilegesResponse)that);
+ return false;
+ }
+
+ public boolean equals(TDropPrivilegesResponse that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_status = true && this.isSetStatus();
+ boolean that_present_status = true && that.isSetStatus();
+ if (this_present_status || that_present_status) {
+ if (!(this_present_status && that_present_status))
+ return false;
+ if (!this.status.equals(that.status))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ HashCodeBuilder builder = new HashCodeBuilder();
+
+ boolean present_status = true && (isSetStatus());
+ builder.append(present_status);
+ if (present_status)
+ builder.append(status);
+
+ return builder.toHashCode();
+ }
+
+ public int compareTo(TDropPrivilegesResponse other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+ TDropPrivilegesResponse typedOther = (TDropPrivilegesResponse)other;
+
+ lastComparison = Boolean.valueOf(isSetStatus()).compareTo(typedOther.isSetStatus());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetStatus()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.status, typedOther.status);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ 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("TDropPrivilegesResponse(");
+ boolean first = true;
+
+ sb.append("status:");
+ if (this.status == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.status);
+ }
+ first = false;
+ sb.append(")");
+ return sb.toString();
+ }
+
+ public void validate() throws org.apache.thrift.TException {
+ // check for required fields
+ if (!isSetStatus()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'status' is unset! Struct:" + toString());
+ }
+
+ // check for sub-struct validity
+ if (status != null) {
+ status.validate();
+ }
+ }
+
+ private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+ try {
+ write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+ try {
+ read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private static class TDropPrivilegesResponseStandardSchemeFactory implements SchemeFactory {
+ public TDropPrivilegesResponseStandardScheme getScheme() {
+ return new TDropPrivilegesResponseStandardScheme();
+ }
+ }
+
+ private static class TDropPrivilegesResponseStandardScheme extends StandardScheme<TDropPrivilegesResponse> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, TDropPrivilegesResponse struct) throws org.apache.thrift.TException {
+ org.apache.thrift.protocol.TField schemeField;
+ iprot.readStructBegin();
+ while (true)
+ {
+ schemeField = iprot.readFieldBegin();
+ if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
+ break;
+ }
+ switch (schemeField.id) {
+ case 1: // STATUS
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+ struct.status = new org.apache.sentry.service.thrift.TSentryResponseStatus();
+ struct.status.read(iprot);
+ struct.setStatusIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ 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, TDropPrivilegesResponse struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.status != null) {
+ oprot.writeFieldBegin(STATUS_FIELD_DESC);
+ struct.status.write(oprot);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class TDropPrivilegesResponseTupleSchemeFactory implements SchemeFactory {
+ public TDropPrivilegesResponseTupleScheme getScheme() {
+ return new TDropPrivilegesResponseTupleScheme();
+ }
+ }
+
+ private static class TDropPrivilegesResponseTupleScheme extends TupleScheme<TDropPrivilegesResponse> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, TDropPrivilegesResponse struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ struct.status.write(oprot);
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, TDropPrivilegesResponse struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ struct.status = new org.apache.sentry.service.thrift.TSentryResponseStatus();
+ struct.status.read(iprot);
+ struct.setStatusIsSet(true);
+ }
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TDropSentryRoleRequest.java
----------------------------------------------------------------------
diff --git a/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TDropSentryRoleRequest.java b/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TDropSentryRoleRequest.java
new file mode 100644
index 0000000..e2971ec
--- /dev/null
+++ b/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TDropSentryRoleRequest.java
@@ -0,0 +1,587 @@
+/**
+ * Autogenerated by Thrift Compiler (0.9.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+package org.apache.sentry.provider.db.service.thrift;
+
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EnumMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.EnumSet;
+import java.util.Collections;
+import java.util.BitSet;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class TDropSentryRoleRequest implements org.apache.thrift.TBase<TDropSentryRoleRequest, TDropSentryRoleRequest._Fields>, java.io.Serializable, Cloneable {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TDropSentryRoleRequest");
+
+ private static final org.apache.thrift.protocol.TField PROTOCOL_VERSION_FIELD_DESC = new org.apache.thrift.protocol.TField("protocol_version", org.apache.thrift.protocol.TType.I32, (short)1);
+ private static final org.apache.thrift.protocol.TField REQUESTOR_USER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("requestorUserName", org.apache.thrift.protocol.TType.STRING, (short)2);
+ private static final org.apache.thrift.protocol.TField ROLE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("roleName", 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 TDropSentryRoleRequestStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new TDropSentryRoleRequestTupleSchemeFactory());
+ }
+
+ private int protocol_version; // required
+ private String requestorUserName; // required
+ private String roleName; // required
+
+ /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+ public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+ PROTOCOL_VERSION((short)1, "protocol_version"),
+ REQUESTOR_USER_NAME((short)2, "requestorUserName"),
+ ROLE_NAME((short)3, "roleName");
+
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+ static {
+ for (_Fields field : EnumSet.allOf(_Fields.class)) {
+ byName.put(field.getFieldName(), field);
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, or null if its not found.
+ */
+ public static _Fields findByThriftId(int fieldId) {
+ switch(fieldId) {
+ case 1: // PROTOCOL_VERSION
+ return PROTOCOL_VERSION;
+ case 2: // REQUESTOR_USER_NAME
+ return REQUESTOR_USER_NAME;
+ case 3: // ROLE_NAME
+ return ROLE_NAME;
+ default:
+ return null;
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, throwing an exception
+ * if it is not found.
+ */
+ public static _Fields findByThriftIdOrThrow(int fieldId) {
+ _Fields fields = findByThriftId(fieldId);
+ if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+ return fields;
+ }
+
+ /**
+ * Find the _Fields constant that matches name, or null if its not found.
+ */
+ public static _Fields findByName(String name) {
+ return byName.get(name);
+ }
+
+ private final short _thriftId;
+ private final String _fieldName;
+
+ _Fields(short thriftId, String fieldName) {
+ _thriftId = thriftId;
+ _fieldName = fieldName;
+ }
+
+ public short getThriftFieldId() {
+ return _thriftId;
+ }
+
+ public String getFieldName() {
+ return _fieldName;
+ }
+ }
+
+ // isset id assignments
+ private static final int __PROTOCOL_VERSION_ISSET_ID = 0;
+ private byte __isset_bitfield = 0;
+ public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+ static {
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+ tmpMap.put(_Fields.PROTOCOL_VERSION, new org.apache.thrift.meta_data.FieldMetaData("protocol_version", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
+ tmpMap.put(_Fields.REQUESTOR_USER_NAME, new org.apache.thrift.meta_data.FieldMetaData("requestorUserName", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields.ROLE_NAME, new org.apache.thrift.meta_data.FieldMetaData("roleName", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TDropSentryRoleRequest.class, metaDataMap);
+ }
+
+ public TDropSentryRoleRequest() {
+ this.protocol_version = 1;
+
+ }
+
+ public TDropSentryRoleRequest(
+ int protocol_version,
+ String requestorUserName,
+ String roleName)
+ {
+ this();
+ this.protocol_version = protocol_version;
+ setProtocol_versionIsSet(true);
+ this.requestorUserName = requestorUserName;
+ this.roleName = roleName;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public TDropSentryRoleRequest(TDropSentryRoleRequest other) {
+ __isset_bitfield = other.__isset_bitfield;
+ this.protocol_version = other.protocol_version;
+ if (other.isSetRequestorUserName()) {
+ this.requestorUserName = other.requestorUserName;
+ }
+ if (other.isSetRoleName()) {
+ this.roleName = other.roleName;
+ }
+ }
+
+ public TDropSentryRoleRequest deepCopy() {
+ return new TDropSentryRoleRequest(this);
+ }
+
+ @Override
+ public void clear() {
+ this.protocol_version = 1;
+
+ this.requestorUserName = null;
+ this.roleName = null;
+ }
+
+ public int getProtocol_version() {
+ return this.protocol_version;
+ }
+
+ public void setProtocol_version(int protocol_version) {
+ this.protocol_version = protocol_version;
+ setProtocol_versionIsSet(true);
+ }
+
+ public void unsetProtocol_version() {
+ __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __PROTOCOL_VERSION_ISSET_ID);
+ }
+
+ /** Returns true if field protocol_version is set (has been assigned a value) and false otherwise */
+ public boolean isSetProtocol_version() {
+ return EncodingUtils.testBit(__isset_bitfield, __PROTOCOL_VERSION_ISSET_ID);
+ }
+
+ public void setProtocol_versionIsSet(boolean value) {
+ __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __PROTOCOL_VERSION_ISSET_ID, value);
+ }
+
+ public String getRequestorUserName() {
+ return this.requestorUserName;
+ }
+
+ public void setRequestorUserName(String requestorUserName) {
+ this.requestorUserName = requestorUserName;
+ }
+
+ public void unsetRequestorUserName() {
+ this.requestorUserName = null;
+ }
+
+ /** Returns true if field requestorUserName is set (has been assigned a value) and false otherwise */
+ public boolean isSetRequestorUserName() {
+ return this.requestorUserName != null;
+ }
+
+ public void setRequestorUserNameIsSet(boolean value) {
+ if (!value) {
+ this.requestorUserName = null;
+ }
+ }
+
+ public String getRoleName() {
+ return this.roleName;
+ }
+
+ public void setRoleName(String roleName) {
+ this.roleName = roleName;
+ }
+
+ public void unsetRoleName() {
+ this.roleName = null;
+ }
+
+ /** Returns true if field roleName is set (has been assigned a value) and false otherwise */
+ public boolean isSetRoleName() {
+ return this.roleName != null;
+ }
+
+ public void setRoleNameIsSet(boolean value) {
+ if (!value) {
+ this.roleName = null;
+ }
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case PROTOCOL_VERSION:
+ if (value == null) {
+ unsetProtocol_version();
+ } else {
+ setProtocol_version((Integer)value);
+ }
+ break;
+
+ case REQUESTOR_USER_NAME:
+ if (value == null) {
+ unsetRequestorUserName();
+ } else {
+ setRequestorUserName((String)value);
+ }
+ break;
+
+ case ROLE_NAME:
+ if (value == null) {
+ unsetRoleName();
+ } else {
+ setRoleName((String)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case PROTOCOL_VERSION:
+ return Integer.valueOf(getProtocol_version());
+
+ case REQUESTOR_USER_NAME:
+ return getRequestorUserName();
+
+ case ROLE_NAME:
+ return getRoleName();
+
+ }
+ throw new IllegalStateException();
+ }
+
+ /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+ public boolean isSet(_Fields field) {
+ if (field == null) {
+ throw new IllegalArgumentException();
+ }
+
+ switch (field) {
+ case PROTOCOL_VERSION:
+ return isSetProtocol_version();
+ case REQUESTOR_USER_NAME:
+ return isSetRequestorUserName();
+ case ROLE_NAME:
+ return isSetRoleName();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof TDropSentryRoleRequest)
+ return this.equals((TDropSentryRoleRequest)that);
+ return false;
+ }
+
+ public boolean equals(TDropSentryRoleRequest that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_protocol_version = true;
+ boolean that_present_protocol_version = true;
+ if (this_present_protocol_version || that_present_protocol_version) {
+ if (!(this_present_protocol_version && that_present_protocol_version))
+ return false;
+ if (this.protocol_version != that.protocol_version)
+ return false;
+ }
+
+ boolean this_present_requestorUserName = true && this.isSetRequestorUserName();
+ boolean that_present_requestorUserName = true && that.isSetRequestorUserName();
+ if (this_present_requestorUserName || that_present_requestorUserName) {
+ if (!(this_present_requestorUserName && that_present_requestorUserName))
+ return false;
+ if (!this.requestorUserName.equals(that.requestorUserName))
+ return false;
+ }
+
+ boolean this_present_roleName = true && this.isSetRoleName();
+ boolean that_present_roleName = true && that.isSetRoleName();
+ if (this_present_roleName || that_present_roleName) {
+ if (!(this_present_roleName && that_present_roleName))
+ return false;
+ if (!this.roleName.equals(that.roleName))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ HashCodeBuilder builder = new HashCodeBuilder();
+
+ boolean present_protocol_version = true;
+ builder.append(present_protocol_version);
+ if (present_protocol_version)
+ builder.append(protocol_version);
+
+ boolean present_requestorUserName = true && (isSetRequestorUserName());
+ builder.append(present_requestorUserName);
+ if (present_requestorUserName)
+ builder.append(requestorUserName);
+
+ boolean present_roleName = true && (isSetRoleName());
+ builder.append(present_roleName);
+ if (present_roleName)
+ builder.append(roleName);
+
+ return builder.toHashCode();
+ }
+
+ public int compareTo(TDropSentryRoleRequest other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+ TDropSentryRoleRequest typedOther = (TDropSentryRoleRequest)other;
+
+ lastComparison = Boolean.valueOf(isSetProtocol_version()).compareTo(typedOther.isSetProtocol_version());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetProtocol_version()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.protocol_version, typedOther.protocol_version);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetRequestorUserName()).compareTo(typedOther.isSetRequestorUserName());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetRequestorUserName()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.requestorUserName, typedOther.requestorUserName);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetRoleName()).compareTo(typedOther.isSetRoleName());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetRoleName()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.roleName, typedOther.roleName);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ return 0;
+ }
+
+ public _Fields fieldForId(int fieldId) {
+ return _Fields.findByThriftId(fieldId);
+ }
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
+ schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
+ }
+
+ public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
+ schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder("TDropSentryRoleRequest(");
+ boolean first = true;
+
+ sb.append("protocol_version:");
+ sb.append(this.protocol_version);
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("requestorUserName:");
+ if (this.requestorUserName == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.requestorUserName);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("roleName:");
+ if (this.roleName == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.roleName);
+ }
+ first = false;
+ sb.append(")");
+ return sb.toString();
+ }
+
+ public void validate() throws org.apache.thrift.TException {
+ // check for required fields
+ if (!isSetProtocol_version()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'protocol_version' is unset! Struct:" + toString());
+ }
+
+ if (!isSetRequestorUserName()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'requestorUserName' is unset! Struct:" + toString());
+ }
+
+ if (!isSetRoleName()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'roleName' is unset! Struct:" + toString());
+ }
+
+ // check for sub-struct validity
+ }
+
+ private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+ try {
+ write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+ try {
+ // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
+ __isset_bitfield = 0;
+ read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private static class TDropSentryRoleRequestStandardSchemeFactory implements SchemeFactory {
+ public TDropSentryRoleRequestStandardScheme getScheme() {
+ return new TDropSentryRoleRequestStandardScheme();
+ }
+ }
+
+ private static class TDropSentryRoleRequestStandardScheme extends StandardScheme<TDropSentryRoleRequest> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, TDropSentryRoleRequest struct) throws org.apache.thrift.TException {
+ org.apache.thrift.protocol.TField schemeField;
+ iprot.readStructBegin();
+ while (true)
+ {
+ schemeField = iprot.readFieldBegin();
+ if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
+ break;
+ }
+ switch (schemeField.id) {
+ case 1: // PROTOCOL_VERSION
+ if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
+ struct.protocol_version = iprot.readI32();
+ struct.setProtocol_versionIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 2: // REQUESTOR_USER_NAME
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.requestorUserName = iprot.readString();
+ struct.setRequestorUserNameIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 3: // ROLE_NAME
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.roleName = iprot.readString();
+ struct.setRoleNameIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ default:
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+ struct.validate();
+ }
+
+ public void write(org.apache.thrift.protocol.TProtocol oprot, TDropSentryRoleRequest struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ oprot.writeFieldBegin(PROTOCOL_VERSION_FIELD_DESC);
+ oprot.writeI32(struct.protocol_version);
+ oprot.writeFieldEnd();
+ if (struct.requestorUserName != null) {
+ oprot.writeFieldBegin(REQUESTOR_USER_NAME_FIELD_DESC);
+ oprot.writeString(struct.requestorUserName);
+ oprot.writeFieldEnd();
+ }
+ if (struct.roleName != null) {
+ oprot.writeFieldBegin(ROLE_NAME_FIELD_DESC);
+ oprot.writeString(struct.roleName);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class TDropSentryRoleRequestTupleSchemeFactory implements SchemeFactory {
+ public TDropSentryRoleRequestTupleScheme getScheme() {
+ return new TDropSentryRoleRequestTupleScheme();
+ }
+ }
+
+ private static class TDropSentryRoleRequestTupleScheme extends TupleScheme<TDropSentryRoleRequest> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, TDropSentryRoleRequest struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ oprot.writeI32(struct.protocol_version);
+ oprot.writeString(struct.requestorUserName);
+ oprot.writeString(struct.roleName);
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, TDropSentryRoleRequest struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ struct.protocol_version = iprot.readI32();
+ struct.setProtocol_versionIsSet(true);
+ struct.requestorUserName = iprot.readString();
+ struct.setRequestorUserNameIsSet(true);
+ struct.roleName = iprot.readString();
+ struct.setRoleNameIsSet(true);
+ }
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TDropSentryRoleResponse.java
----------------------------------------------------------------------
diff --git a/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TDropSentryRoleResponse.java b/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TDropSentryRoleResponse.java
new file mode 100644
index 0000000..efcf96d
--- /dev/null
+++ b/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TDropSentryRoleResponse.java
@@ -0,0 +1,390 @@
+/**
+ * Autogenerated by Thrift Compiler (0.9.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+package org.apache.sentry.provider.db.service.thrift;
+
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EnumMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.EnumSet;
+import java.util.Collections;
+import java.util.BitSet;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class TDropSentryRoleResponse implements org.apache.thrift.TBase<TDropSentryRoleResponse, TDropSentryRoleResponse._Fields>, java.io.Serializable, Cloneable {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TDropSentryRoleResponse");
+
+ private static final org.apache.thrift.protocol.TField STATUS_FIELD_DESC = new org.apache.thrift.protocol.TField("status", org.apache.thrift.protocol.TType.STRUCT, (short)1);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new TDropSentryRoleResponseStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new TDropSentryRoleResponseTupleSchemeFactory());
+ }
+
+ private org.apache.sentry.service.thrift.TSentryResponseStatus status; // required
+
+ /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+ public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+ STATUS((short)1, "status");
+
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+ static {
+ for (_Fields field : EnumSet.allOf(_Fields.class)) {
+ byName.put(field.getFieldName(), field);
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, or null if its not found.
+ */
+ public static _Fields findByThriftId(int fieldId) {
+ switch(fieldId) {
+ case 1: // STATUS
+ return STATUS;
+ default:
+ return null;
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, throwing an exception
+ * if it is not found.
+ */
+ public static _Fields findByThriftIdOrThrow(int fieldId) {
+ _Fields fields = findByThriftId(fieldId);
+ if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+ return fields;
+ }
+
+ /**
+ * Find the _Fields constant that matches name, or null if its not found.
+ */
+ public static _Fields findByName(String name) {
+ return byName.get(name);
+ }
+
+ private final short _thriftId;
+ private final String _fieldName;
+
+ _Fields(short thriftId, String fieldName) {
+ _thriftId = thriftId;
+ _fieldName = fieldName;
+ }
+
+ public short getThriftFieldId() {
+ return _thriftId;
+ }
+
+ public String getFieldName() {
+ return _fieldName;
+ }
+ }
+
+ // isset id assignments
+ public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+ static {
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+ tmpMap.put(_Fields.STATUS, new org.apache.thrift.meta_data.FieldMetaData("status", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.sentry.service.thrift.TSentryResponseStatus.class)));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TDropSentryRoleResponse.class, metaDataMap);
+ }
+
+ public TDropSentryRoleResponse() {
+ }
+
+ public TDropSentryRoleResponse(
+ org.apache.sentry.service.thrift.TSentryResponseStatus status)
+ {
+ this();
+ this.status = status;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public TDropSentryRoleResponse(TDropSentryRoleResponse other) {
+ if (other.isSetStatus()) {
+ this.status = new org.apache.sentry.service.thrift.TSentryResponseStatus(other.status);
+ }
+ }
+
+ public TDropSentryRoleResponse deepCopy() {
+ return new TDropSentryRoleResponse(this);
+ }
+
+ @Override
+ public void clear() {
+ this.status = null;
+ }
+
+ public org.apache.sentry.service.thrift.TSentryResponseStatus getStatus() {
+ return this.status;
+ }
+
+ public void setStatus(org.apache.sentry.service.thrift.TSentryResponseStatus status) {
+ this.status = status;
+ }
+
+ public void unsetStatus() {
+ this.status = null;
+ }
+
+ /** Returns true if field status is set (has been assigned a value) and false otherwise */
+ public boolean isSetStatus() {
+ return this.status != null;
+ }
+
+ public void setStatusIsSet(boolean value) {
+ if (!value) {
+ this.status = null;
+ }
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case STATUS:
+ if (value == null) {
+ unsetStatus();
+ } else {
+ setStatus((org.apache.sentry.service.thrift.TSentryResponseStatus)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case STATUS:
+ return getStatus();
+
+ }
+ throw new IllegalStateException();
+ }
+
+ /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+ public boolean isSet(_Fields field) {
+ if (field == null) {
+ throw new IllegalArgumentException();
+ }
+
+ switch (field) {
+ case STATUS:
+ return isSetStatus();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof TDropSentryRoleResponse)
+ return this.equals((TDropSentryRoleResponse)that);
+ return false;
+ }
+
+ public boolean equals(TDropSentryRoleResponse that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_status = true && this.isSetStatus();
+ boolean that_present_status = true && that.isSetStatus();
+ if (this_present_status || that_present_status) {
+ if (!(this_present_status && that_present_status))
+ return false;
+ if (!this.status.equals(that.status))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ HashCodeBuilder builder = new HashCodeBuilder();
+
+ boolean present_status = true && (isSetStatus());
+ builder.append(present_status);
+ if (present_status)
+ builder.append(status);
+
+ return builder.toHashCode();
+ }
+
+ public int compareTo(TDropSentryRoleResponse other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+ TDropSentryRoleResponse typedOther = (TDropSentryRoleResponse)other;
+
+ lastComparison = Boolean.valueOf(isSetStatus()).compareTo(typedOther.isSetStatus());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetStatus()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.status, typedOther.status);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ 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("TDropSentryRoleResponse(");
+ boolean first = true;
+
+ sb.append("status:");
+ if (this.status == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.status);
+ }
+ first = false;
+ sb.append(")");
+ return sb.toString();
+ }
+
+ public void validate() throws org.apache.thrift.TException {
+ // check for required fields
+ if (!isSetStatus()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'status' is unset! Struct:" + toString());
+ }
+
+ // check for sub-struct validity
+ if (status != null) {
+ status.validate();
+ }
+ }
+
+ private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+ try {
+ write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+ try {
+ read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private static class TDropSentryRoleResponseStandardSchemeFactory implements SchemeFactory {
+ public TDropSentryRoleResponseStandardScheme getScheme() {
+ return new TDropSentryRoleResponseStandardScheme();
+ }
+ }
+
+ private static class TDropSentryRoleResponseStandardScheme extends StandardScheme<TDropSentryRoleResponse> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, TDropSentryRoleResponse struct) throws org.apache.thrift.TException {
+ org.apache.thrift.protocol.TField schemeField;
+ iprot.readStructBegin();
+ while (true)
+ {
+ schemeField = iprot.readFieldBegin();
+ if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
+ break;
+ }
+ switch (schemeField.id) {
+ case 1: // STATUS
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+ struct.status = new org.apache.sentry.service.thrift.TSentryResponseStatus();
+ struct.status.read(iprot);
+ struct.setStatusIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ 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, TDropSentryRoleResponse struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.status != null) {
+ oprot.writeFieldBegin(STATUS_FIELD_DESC);
+ struct.status.write(oprot);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class TDropSentryRoleResponseTupleSchemeFactory implements SchemeFactory {
+ public TDropSentryRoleResponseTupleScheme getScheme() {
+ return new TDropSentryRoleResponseTupleScheme();
+ }
+ }
+
+ private static class TDropSentryRoleResponseTupleScheme extends TupleScheme<TDropSentryRoleResponse> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, TDropSentryRoleResponse struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ struct.status.write(oprot);
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, TDropSentryRoleResponse struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ struct.status = new org.apache.sentry.service.thrift.TSentryResponseStatus();
+ struct.status.read(iprot);
+ struct.setStatusIsSet(true);
+ }
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryPrivilegesForProviderRequest.java
----------------------------------------------------------------------
diff --git a/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryPrivilegesForProviderRequest.java b/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryPrivilegesForProviderRequest.java
new file mode 100644
index 0000000..10ab56b
--- /dev/null
+++ b/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryPrivilegesForProviderRequest.java
@@ -0,0 +1,759 @@
+/**
+ * Autogenerated by Thrift Compiler (0.9.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+package org.apache.sentry.provider.db.service.thrift;
+
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EnumMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.EnumSet;
+import java.util.Collections;
+import java.util.BitSet;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class TListSentryPrivilegesForProviderRequest implements org.apache.thrift.TBase<TListSentryPrivilegesForProviderRequest, TListSentryPrivilegesForProviderRequest._Fields>, java.io.Serializable, Cloneable {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TListSentryPrivilegesForProviderRequest");
+
+ private static final org.apache.thrift.protocol.TField PROTOCOL_VERSION_FIELD_DESC = new org.apache.thrift.protocol.TField("protocol_version", org.apache.thrift.protocol.TType.I32, (short)1);
+ private static final org.apache.thrift.protocol.TField 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 ROLE_SET_FIELD_DESC = new org.apache.thrift.protocol.TField("roleSet", org.apache.thrift.protocol.TType.STRUCT, (short)3);
+ private static final org.apache.thrift.protocol.TField AUTHORIZABLE_HIERARCHY_FIELD_DESC = new org.apache.thrift.protocol.TField("authorizableHierarchy", org.apache.thrift.protocol.TType.STRUCT, (short)4);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new TListSentryPrivilegesForProviderRequestStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new TListSentryPrivilegesForProviderRequestTupleSchemeFactory());
+ }
+
+ private int protocol_version; // required
+ private Set<String> groups; // required
+ private TSentryActiveRoleSet roleSet; // required
+ private TSentryAuthorizable authorizableHierarchy; // optional
+
+ /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+ public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+ PROTOCOL_VERSION((short)1, "protocol_version"),
+ GROUPS((short)2, "groups"),
+ ROLE_SET((short)3, "roleSet"),
+ AUTHORIZABLE_HIERARCHY((short)4, "authorizableHierarchy");
+
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+ static {
+ for (_Fields field : EnumSet.allOf(_Fields.class)) {
+ byName.put(field.getFieldName(), field);
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, or null if its not found.
+ */
+ public static _Fields findByThriftId(int fieldId) {
+ switch(fieldId) {
+ case 1: // PROTOCOL_VERSION
+ return PROTOCOL_VERSION;
+ case 2: // GROUPS
+ return GROUPS;
+ case 3: // ROLE_SET
+ return ROLE_SET;
+ case 4: // AUTHORIZABLE_HIERARCHY
+ return AUTHORIZABLE_HIERARCHY;
+ default:
+ return null;
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, throwing an exception
+ * if it is not found.
+ */
+ public static _Fields findByThriftIdOrThrow(int fieldId) {
+ _Fields fields = findByThriftId(fieldId);
+ if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+ return fields;
+ }
+
+ /**
+ * Find the _Fields constant that matches name, or null if its not found.
+ */
+ public static _Fields findByName(String name) {
+ return byName.get(name);
+ }
+
+ private final short _thriftId;
+ private final String _fieldName;
+
+ _Fields(short thriftId, String fieldName) {
+ _thriftId = thriftId;
+ _fieldName = fieldName;
+ }
+
+ public short getThriftFieldId() {
+ return _thriftId;
+ }
+
+ public String getFieldName() {
+ return _fieldName;
+ }
+ }
+
+ // isset id assignments
+ private static final int __PROTOCOL_VERSION_ISSET_ID = 0;
+ private byte __isset_bitfield = 0;
+ private _Fields optionals[] = {_Fields.AUTHORIZABLE_HIERARCHY};
+ public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+ static {
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+ tmpMap.put(_Fields.PROTOCOL_VERSION, new org.apache.thrift.meta_data.FieldMetaData("protocol_version", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
+ tmpMap.put(_Fields.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.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
+ tmpMap.put(_Fields.ROLE_SET, new org.apache.thrift.meta_data.FieldMetaData("roleSet", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TSentryActiveRoleSet.class)));
+ tmpMap.put(_Fields.AUTHORIZABLE_HIERARCHY, new org.apache.thrift.meta_data.FieldMetaData("authorizableHierarchy", org.apache.thrift.TFieldRequirementType.OPTIONAL,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TSentryAuthorizable.class)));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TListSentryPrivilegesForProviderRequest.class, metaDataMap);
+ }
+
+ public TListSentryPrivilegesForProviderRequest() {
+ this.protocol_version = 1;
+
+ }
+
+ public TListSentryPrivilegesForProviderRequest(
+ int protocol_version,
+ Set<String> groups,
+ TSentryActiveRoleSet roleSet)
+ {
+ this();
+ this.protocol_version = protocol_version;
+ setProtocol_versionIsSet(true);
+ this.groups = groups;
+ this.roleSet = roleSet;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public TListSentryPrivilegesForProviderRequest(TListSentryPrivilegesForProviderRequest other) {
+ __isset_bitfield = other.__isset_bitfield;
+ this.protocol_version = other.protocol_version;
+ if (other.isSetGroups()) {
+ Set<String> __this__groups = new HashSet<String>();
+ for (String other_element : other.groups) {
+ __this__groups.add(other_element);
+ }
+ this.groups = __this__groups;
+ }
+ if (other.isSetRoleSet()) {
+ this.roleSet = new TSentryActiveRoleSet(other.roleSet);
+ }
+ if (other.isSetAuthorizableHierarchy()) {
+ this.authorizableHierarchy = new TSentryAuthorizable(other.authorizableHierarchy);
+ }
+ }
+
+ public TListSentryPrivilegesForProviderRequest deepCopy() {
+ return new TListSentryPrivilegesForProviderRequest(this);
+ }
+
+ @Override
+ public void clear() {
+ this.protocol_version = 1;
+
+ this.groups = null;
+ this.roleSet = null;
+ this.authorizableHierarchy = null;
+ }
+
+ public int getProtocol_version() {
+ return this.protocol_version;
+ }
+
+ public void setProtocol_version(int protocol_version) {
+ this.protocol_version = protocol_version;
+ setProtocol_versionIsSet(true);
+ }
+
+ public void unsetProtocol_version() {
+ __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __PROTOCOL_VERSION_ISSET_ID);
+ }
+
+ /** Returns true if field protocol_version is set (has been assigned a value) and false otherwise */
+ public boolean isSetProtocol_version() {
+ return EncodingUtils.testBit(__isset_bitfield, __PROTOCOL_VERSION_ISSET_ID);
+ }
+
+ public void setProtocol_versionIsSet(boolean value) {
+ __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __PROTOCOL_VERSION_ISSET_ID, value);
+ }
+
+ public int getGroupsSize() {
+ return (this.groups == null) ? 0 : this.groups.size();
+ }
+
+ public java.util.Iterator<String> getGroupsIterator() {
+ return (this.groups == null) ? null : this.groups.iterator();
+ }
+
+ public void addToGroups(String elem) {
+ if (this.groups == null) {
+ this.groups = new HashSet<String>();
+ }
+ this.groups.add(elem);
+ }
+
+ public Set<String> getGroups() {
+ return this.groups;
+ }
+
+ public void setGroups(Set<String> 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 TSentryActiveRoleSet getRoleSet() {
+ return this.roleSet;
+ }
+
+ public void setRoleSet(TSentryActiveRoleSet roleSet) {
+ this.roleSet = roleSet;
+ }
+
+ public void unsetRoleSet() {
+ this.roleSet = null;
+ }
+
+ /** Returns true if field roleSet is set (has been assigned a value) and false otherwise */
+ public boolean isSetRoleSet() {
+ return this.roleSet != null;
+ }
+
+ public void setRoleSetIsSet(boolean value) {
+ if (!value) {
+ this.roleSet = null;
+ }
+ }
+
+ public TSentryAuthorizable getAuthorizableHierarchy() {
+ return this.authorizableHierarchy;
+ }
+
+ public void setAuthorizableHierarchy(TSentryAuthorizable authorizableHierarchy) {
+ this.authorizableHierarchy = authorizableHierarchy;
+ }
+
+ public void unsetAuthorizableHierarchy() {
+ this.authorizableHierarchy = null;
+ }
+
+ /** Returns true if field authorizableHierarchy is set (has been assigned a value) and false otherwise */
+ public boolean isSetAuthorizableHierarchy() {
+ return this.authorizableHierarchy != null;
+ }
+
+ public void setAuthorizableHierarchyIsSet(boolean value) {
+ if (!value) {
+ this.authorizableHierarchy = null;
+ }
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case PROTOCOL_VERSION:
+ if (value == null) {
+ unsetProtocol_version();
+ } else {
+ setProtocol_version((Integer)value);
+ }
+ break;
+
+ case GROUPS:
+ if (value == null) {
+ unsetGroups();
+ } else {
+ setGroups((Set<String>)value);
+ }
+ break;
+
+ case ROLE_SET:
+ if (value == null) {
+ unsetRoleSet();
+ } else {
+ setRoleSet((TSentryActiveRoleSet)value);
+ }
+ break;
+
+ case AUTHORIZABLE_HIERARCHY:
+ if (value == null) {
+ unsetAuthorizableHierarchy();
+ } else {
+ setAuthorizableHierarchy((TSentryAuthorizable)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case PROTOCOL_VERSION:
+ return Integer.valueOf(getProtocol_version());
+
+ case GROUPS:
+ return getGroups();
+
+ case ROLE_SET:
+ return getRoleSet();
+
+ case AUTHORIZABLE_HIERARCHY:
+ return getAuthorizableHierarchy();
+
+ }
+ throw new IllegalStateException();
+ }
+
+ /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+ public boolean isSet(_Fields field) {
+ if (field == null) {
+ throw new IllegalArgumentException();
+ }
+
+ switch (field) {
+ case PROTOCOL_VERSION:
+ return isSetProtocol_version();
+ case GROUPS:
+ return isSetGroups();
+ case ROLE_SET:
+ return isSetRoleSet();
+ case AUTHORIZABLE_HIERARCHY:
+ return isSetAuthorizableHierarchy();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof TListSentryPrivilegesForProviderRequest)
+ return this.equals((TListSentryPrivilegesForProviderRequest)that);
+ return false;
+ }
+
+ public boolean equals(TListSentryPrivilegesForProviderRequest that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_protocol_version = true;
+ boolean that_present_protocol_version = true;
+ if (this_present_protocol_version || that_present_protocol_version) {
+ if (!(this_present_protocol_version && that_present_protocol_version))
+ return false;
+ if (this.protocol_version != that.protocol_version)
+ return false;
+ }
+
+ boolean this_present_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_roleSet = true && this.isSetRoleSet();
+ boolean that_present_roleSet = true && that.isSetRoleSet();
+ if (this_present_roleSet || that_present_roleSet) {
+ if (!(this_present_roleSet && that_present_roleSet))
+ return false;
+ if (!this.roleSet.equals(that.roleSet))
+ return false;
+ }
+
+ boolean this_present_authorizableHierarchy = true && this.isSetAuthorizableHierarchy();
+ boolean that_present_authorizableHierarchy = true && that.isSetAuthorizableHierarchy();
+ if (this_present_authorizableHierarchy || that_present_authorizableHierarchy) {
+ if (!(this_present_authorizableHierarchy && that_present_authorizableHierarchy))
+ return false;
+ if (!this.authorizableHierarchy.equals(that.authorizableHierarchy))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ HashCodeBuilder builder = new HashCodeBuilder();
+
+ boolean present_protocol_version = true;
+ builder.append(present_protocol_version);
+ if (present_protocol_version)
+ builder.append(protocol_version);
+
+ boolean present_groups = true && (isSetGroups());
+ builder.append(present_groups);
+ if (present_groups)
+ builder.append(groups);
+
+ boolean present_roleSet = true && (isSetRoleSet());
+ builder.append(present_roleSet);
+ if (present_roleSet)
+ builder.append(roleSet);
+
+ boolean present_authorizableHierarchy = true && (isSetAuthorizableHierarchy());
+ builder.append(present_authorizableHierarchy);
+ if (present_authorizableHierarchy)
+ builder.append(authorizableHierarchy);
+
+ return builder.toHashCode();
+ }
+
+ public int compareTo(TListSentryPrivilegesForProviderRequest other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+ TListSentryPrivilegesForProviderRequest typedOther = (TListSentryPrivilegesForProviderRequest)other;
+
+ lastComparison = Boolean.valueOf(isSetProtocol_version()).compareTo(typedOther.isSetProtocol_version());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetProtocol_version()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.protocol_version, typedOther.protocol_version);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetGroups()).compareTo(typedOther.isSetGroups());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetGroups()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.groups, typedOther.groups);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetRoleSet()).compareTo(typedOther.isSetRoleSet());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetRoleSet()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.roleSet, typedOther.roleSet);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetAuthorizableHierarchy()).compareTo(typedOther.isSetAuthorizableHierarchy());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetAuthorizableHierarchy()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.authorizableHierarchy, typedOther.authorizableHierarchy);
+ 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("TListSentryPrivilegesForProviderRequest(");
+ boolean first = true;
+
+ sb.append("protocol_version:");
+ sb.append(this.protocol_version);
+ 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("roleSet:");
+ if (this.roleSet == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.roleSet);
+ }
+ first = false;
+ if (isSetAuthorizableHierarchy()) {
+ if (!first) sb.append(", ");
+ sb.append("authorizableHierarchy:");
+ if (this.authorizableHierarchy == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.authorizableHierarchy);
+ }
+ first = false;
+ }
+ sb.append(")");
+ return sb.toString();
+ }
+
+ public void validate() throws org.apache.thrift.TException {
+ // check for required fields
+ if (!isSetProtocol_version()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'protocol_version' is unset! Struct:" + toString());
+ }
+
+ if (!isSetGroups()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'groups' is unset! Struct:" + toString());
+ }
+
+ if (!isSetRoleSet()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'roleSet' is unset! Struct:" + toString());
+ }
+
+ // check for sub-struct validity
+ if (roleSet != null) {
+ roleSet.validate();
+ }
+ if (authorizableHierarchy != null) {
+ authorizableHierarchy.validate();
+ }
+ }
+
+ private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+ try {
+ write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+ try {
+ // 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 TListSentryPrivilegesForProviderRequestStandardSchemeFactory implements SchemeFactory {
+ public TListSentryPrivilegesForProviderRequestStandardScheme getScheme() {
+ return new TListSentryPrivilegesForProviderRequestStandardScheme();
+ }
+ }
+
+ private static class TListSentryPrivilegesForProviderRequestStandardScheme extends StandardScheme<TListSentryPrivilegesForProviderRequest> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, TListSentryPrivilegesForProviderRequest struct) throws org.apache.thrift.TException {
+ org.apache.thrift.protocol.TField schemeField;
+ iprot.readStructBegin();
+ while (true)
+ {
+ schemeField = iprot.readFieldBegin();
+ if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
+ break;
+ }
+ switch (schemeField.id) {
+ case 1: // PROTOCOL_VERSION
+ if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
+ struct.protocol_version = iprot.readI32();
+ struct.setProtocol_versionIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 2: // GROUPS
+ if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
+ {
+ org.apache.thrift.protocol.TSet _set48 = iprot.readSetBegin();
+ struct.groups = new HashSet<String>(2*_set48.size);
+ for (int _i49 = 0; _i49 < _set48.size; ++_i49)
+ {
+ String _elem50; // required
+ _elem50 = iprot.readString();
+ struct.groups.add(_elem50);
+ }
+ iprot.readSetEnd();
+ }
+ struct.setGroupsIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 3: // ROLE_SET
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+ struct.roleSet = new TSentryActiveRoleSet();
+ struct.roleSet.read(iprot);
+ struct.setRoleSetIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 4: // AUTHORIZABLE_HIERARCHY
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+ struct.authorizableHierarchy = new TSentryAuthorizable();
+ struct.authorizableHierarchy.read(iprot);
+ struct.setAuthorizableHierarchyIsSet(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, TListSentryPrivilegesForProviderRequest struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ oprot.writeFieldBegin(PROTOCOL_VERSION_FIELD_DESC);
+ oprot.writeI32(struct.protocol_version);
+ oprot.writeFieldEnd();
+ if (struct.groups != null) {
+ oprot.writeFieldBegin(GROUPS_FIELD_DESC);
+ {
+ oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, struct.groups.size()));
+ for (String _iter51 : struct.groups)
+ {
+ oprot.writeString(_iter51);
+ }
+ oprot.writeSetEnd();
+ }
+ oprot.writeFieldEnd();
+ }
+ if (struct.roleSet != null) {
+ oprot.writeFieldBegin(ROLE_SET_FIELD_DESC);
+ struct.roleSet.write(oprot);
+ oprot.writeFieldEnd();
+ }
+ if (struct.authorizableHierarchy != null) {
+ if (struct.isSetAuthorizableHierarchy()) {
+ oprot.writeFieldBegin(AUTHORIZABLE_HIERARCHY_FIELD_DESC);
+ struct.authorizableHierarchy.write(oprot);
+ oprot.writeFieldEnd();
+ }
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class TListSentryPrivilegesForProviderRequestTupleSchemeFactory implements SchemeFactory {
+ public TListSentryPrivilegesForProviderRequestTupleScheme getScheme() {
+ return new TListSentryPrivilegesForProviderRequestTupleScheme();
+ }
+ }
+
+ private static class TListSentryPrivilegesForProviderRequestTupleScheme extends TupleScheme<TListSentryPrivilegesForProviderRequest> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, TListSentryPrivilegesForProviderRequest struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ oprot.writeI32(struct.protocol_version);
+ {
+ oprot.writeI32(struct.groups.size());
+ for (String _iter52 : struct.groups)
+ {
+ oprot.writeString(_iter52);
+ }
+ }
+ struct.roleSet.write(oprot);
+ BitSet optionals = new BitSet();
+ if (struct.isSetAuthorizableHierarchy()) {
+ optionals.set(0);
+ }
+ oprot.writeBitSet(optionals, 1);
+ if (struct.isSetAuthorizableHierarchy()) {
+ struct.authorizableHierarchy.write(oprot);
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, TListSentryPrivilegesForProviderRequest struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ struct.protocol_version = iprot.readI32();
+ struct.setProtocol_versionIsSet(true);
+ {
+ org.apache.thrift.protocol.TSet _set53 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
+ struct.groups = new HashSet<String>(2*_set53.size);
+ for (int _i54 = 0; _i54 < _set53.size; ++_i54)
+ {
+ String _elem55; // required
+ _elem55 = iprot.readString();
+ struct.groups.add(_elem55);
+ }
+ }
+ struct.setGroupsIsSet(true);
+ struct.roleSet = new TSentryActiveRoleSet();
+ struct.roleSet.read(iprot);
+ struct.setRoleSetIsSet(true);
+ BitSet incoming = iprot.readBitSet(1);
+ if (incoming.get(0)) {
+ struct.authorizableHierarchy = new TSentryAuthorizable();
+ struct.authorizableHierarchy.read(iprot);
+ struct.setAuthorizableHierarchyIsSet(true);
+ }
+ }
+ }
+
+}
+
[19/25] SENTRY-432. HDFS ingration. Initial patch
Posted by pr...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TCreateSentryRoleRequest.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TCreateSentryRoleRequest.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TCreateSentryRoleRequest.java
deleted file mode 100644
index fc7c5dd..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TCreateSentryRoleRequest.java
+++ /dev/null
@@ -1,587 +0,0 @@
-/**
- * Autogenerated by Thrift Compiler (0.9.0)
- *
- * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
- * @generated
- */
-package org.apache.sentry.provider.db.service.thrift;
-
-import org.apache.commons.lang.builder.HashCodeBuilder;
-import org.apache.thrift.scheme.IScheme;
-import org.apache.thrift.scheme.SchemeFactory;
-import org.apache.thrift.scheme.StandardScheme;
-
-import org.apache.thrift.scheme.TupleScheme;
-import org.apache.thrift.protocol.TTupleProtocol;
-import org.apache.thrift.protocol.TProtocolException;
-import org.apache.thrift.EncodingUtils;
-import org.apache.thrift.TException;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.EnumMap;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.EnumSet;
-import java.util.Collections;
-import java.util.BitSet;
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class TCreateSentryRoleRequest implements org.apache.thrift.TBase<TCreateSentryRoleRequest, TCreateSentryRoleRequest._Fields>, java.io.Serializable, Cloneable {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TCreateSentryRoleRequest");
-
- private static final org.apache.thrift.protocol.TField PROTOCOL_VERSION_FIELD_DESC = new org.apache.thrift.protocol.TField("protocol_version", org.apache.thrift.protocol.TType.I32, (short)1);
- private static final org.apache.thrift.protocol.TField REQUESTOR_USER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("requestorUserName", org.apache.thrift.protocol.TType.STRING, (short)2);
- private static final org.apache.thrift.protocol.TField ROLE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("roleName", 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 TCreateSentryRoleRequestStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TCreateSentryRoleRequestTupleSchemeFactory());
- }
-
- private int protocol_version; // required
- private String requestorUserName; // required
- private String roleName; // required
-
- /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
- public enum _Fields implements org.apache.thrift.TFieldIdEnum {
- PROTOCOL_VERSION((short)1, "protocol_version"),
- REQUESTOR_USER_NAME((short)2, "requestorUserName"),
- ROLE_NAME((short)3, "roleName");
-
- private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
-
- static {
- for (_Fields field : EnumSet.allOf(_Fields.class)) {
- byName.put(field.getFieldName(), field);
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, or null if its not found.
- */
- public static _Fields findByThriftId(int fieldId) {
- switch(fieldId) {
- case 1: // PROTOCOL_VERSION
- return PROTOCOL_VERSION;
- case 2: // REQUESTOR_USER_NAME
- return REQUESTOR_USER_NAME;
- case 3: // ROLE_NAME
- return ROLE_NAME;
- default:
- return null;
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, throwing an exception
- * if it is not found.
- */
- public static _Fields findByThriftIdOrThrow(int fieldId) {
- _Fields fields = findByThriftId(fieldId);
- if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
- return fields;
- }
-
- /**
- * Find the _Fields constant that matches name, or null if its not found.
- */
- public static _Fields findByName(String name) {
- return byName.get(name);
- }
-
- private final short _thriftId;
- private final String _fieldName;
-
- _Fields(short thriftId, String fieldName) {
- _thriftId = thriftId;
- _fieldName = fieldName;
- }
-
- public short getThriftFieldId() {
- return _thriftId;
- }
-
- public String getFieldName() {
- return _fieldName;
- }
- }
-
- // isset id assignments
- private static final int __PROTOCOL_VERSION_ISSET_ID = 0;
- private byte __isset_bitfield = 0;
- public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
- static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
- tmpMap.put(_Fields.PROTOCOL_VERSION, new org.apache.thrift.meta_data.FieldMetaData("protocol_version", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
- tmpMap.put(_Fields.REQUESTOR_USER_NAME, new org.apache.thrift.meta_data.FieldMetaData("requestorUserName", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.ROLE_NAME, new org.apache.thrift.meta_data.FieldMetaData("roleName", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TCreateSentryRoleRequest.class, metaDataMap);
- }
-
- public TCreateSentryRoleRequest() {
- this.protocol_version = 1;
-
- }
-
- public TCreateSentryRoleRequest(
- int protocol_version,
- String requestorUserName,
- String roleName)
- {
- this();
- this.protocol_version = protocol_version;
- setProtocol_versionIsSet(true);
- this.requestorUserName = requestorUserName;
- this.roleName = roleName;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TCreateSentryRoleRequest(TCreateSentryRoleRequest other) {
- __isset_bitfield = other.__isset_bitfield;
- this.protocol_version = other.protocol_version;
- if (other.isSetRequestorUserName()) {
- this.requestorUserName = other.requestorUserName;
- }
- if (other.isSetRoleName()) {
- this.roleName = other.roleName;
- }
- }
-
- public TCreateSentryRoleRequest deepCopy() {
- return new TCreateSentryRoleRequest(this);
- }
-
- @Override
- public void clear() {
- this.protocol_version = 1;
-
- this.requestorUserName = null;
- this.roleName = null;
- }
-
- public int getProtocol_version() {
- return this.protocol_version;
- }
-
- public void setProtocol_version(int protocol_version) {
- this.protocol_version = protocol_version;
- setProtocol_versionIsSet(true);
- }
-
- public void unsetProtocol_version() {
- __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __PROTOCOL_VERSION_ISSET_ID);
- }
-
- /** Returns true if field protocol_version is set (has been assigned a value) and false otherwise */
- public boolean isSetProtocol_version() {
- return EncodingUtils.testBit(__isset_bitfield, __PROTOCOL_VERSION_ISSET_ID);
- }
-
- public void setProtocol_versionIsSet(boolean value) {
- __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __PROTOCOL_VERSION_ISSET_ID, value);
- }
-
- public String getRequestorUserName() {
- return this.requestorUserName;
- }
-
- public void setRequestorUserName(String requestorUserName) {
- this.requestorUserName = requestorUserName;
- }
-
- public void unsetRequestorUserName() {
- this.requestorUserName = null;
- }
-
- /** Returns true if field requestorUserName is set (has been assigned a value) and false otherwise */
- public boolean isSetRequestorUserName() {
- return this.requestorUserName != null;
- }
-
- public void setRequestorUserNameIsSet(boolean value) {
- if (!value) {
- this.requestorUserName = null;
- }
- }
-
- public String getRoleName() {
- return this.roleName;
- }
-
- public void setRoleName(String roleName) {
- this.roleName = roleName;
- }
-
- public void unsetRoleName() {
- this.roleName = null;
- }
-
- /** Returns true if field roleName is set (has been assigned a value) and false otherwise */
- public boolean isSetRoleName() {
- return this.roleName != null;
- }
-
- public void setRoleNameIsSet(boolean value) {
- if (!value) {
- this.roleName = null;
- }
- }
-
- public void setFieldValue(_Fields field, Object value) {
- switch (field) {
- case PROTOCOL_VERSION:
- if (value == null) {
- unsetProtocol_version();
- } else {
- setProtocol_version((Integer)value);
- }
- break;
-
- case REQUESTOR_USER_NAME:
- if (value == null) {
- unsetRequestorUserName();
- } else {
- setRequestorUserName((String)value);
- }
- break;
-
- case ROLE_NAME:
- if (value == null) {
- unsetRoleName();
- } else {
- setRoleName((String)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case PROTOCOL_VERSION:
- return Integer.valueOf(getProtocol_version());
-
- case REQUESTOR_USER_NAME:
- return getRequestorUserName();
-
- case ROLE_NAME:
- return getRoleName();
-
- }
- throw new IllegalStateException();
- }
-
- /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
- public boolean isSet(_Fields field) {
- if (field == null) {
- throw new IllegalArgumentException();
- }
-
- switch (field) {
- case PROTOCOL_VERSION:
- return isSetProtocol_version();
- case REQUESTOR_USER_NAME:
- return isSetRequestorUserName();
- case ROLE_NAME:
- return isSetRoleName();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TCreateSentryRoleRequest)
- return this.equals((TCreateSentryRoleRequest)that);
- return false;
- }
-
- public boolean equals(TCreateSentryRoleRequest that) {
- if (that == null)
- return false;
-
- boolean this_present_protocol_version = true;
- boolean that_present_protocol_version = true;
- if (this_present_protocol_version || that_present_protocol_version) {
- if (!(this_present_protocol_version && that_present_protocol_version))
- return false;
- if (this.protocol_version != that.protocol_version)
- return false;
- }
-
- boolean this_present_requestorUserName = true && this.isSetRequestorUserName();
- boolean that_present_requestorUserName = true && that.isSetRequestorUserName();
- if (this_present_requestorUserName || that_present_requestorUserName) {
- if (!(this_present_requestorUserName && that_present_requestorUserName))
- return false;
- if (!this.requestorUserName.equals(that.requestorUserName))
- return false;
- }
-
- boolean this_present_roleName = true && this.isSetRoleName();
- boolean that_present_roleName = true && that.isSetRoleName();
- if (this_present_roleName || that_present_roleName) {
- if (!(this_present_roleName && that_present_roleName))
- return false;
- if (!this.roleName.equals(that.roleName))
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode() {
- HashCodeBuilder builder = new HashCodeBuilder();
-
- boolean present_protocol_version = true;
- builder.append(present_protocol_version);
- if (present_protocol_version)
- builder.append(protocol_version);
-
- boolean present_requestorUserName = true && (isSetRequestorUserName());
- builder.append(present_requestorUserName);
- if (present_requestorUserName)
- builder.append(requestorUserName);
-
- boolean present_roleName = true && (isSetRoleName());
- builder.append(present_roleName);
- if (present_roleName)
- builder.append(roleName);
-
- return builder.toHashCode();
- }
-
- public int compareTo(TCreateSentryRoleRequest other) {
- if (!getClass().equals(other.getClass())) {
- return getClass().getName().compareTo(other.getClass().getName());
- }
-
- int lastComparison = 0;
- TCreateSentryRoleRequest typedOther = (TCreateSentryRoleRequest)other;
-
- lastComparison = Boolean.valueOf(isSetProtocol_version()).compareTo(typedOther.isSetProtocol_version());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetProtocol_version()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.protocol_version, typedOther.protocol_version);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetRequestorUserName()).compareTo(typedOther.isSetRequestorUserName());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetRequestorUserName()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.requestorUserName, typedOther.requestorUserName);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetRoleName()).compareTo(typedOther.isSetRoleName());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetRoleName()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.roleName, typedOther.roleName);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- return 0;
- }
-
- public _Fields fieldForId(int fieldId) {
- return _Fields.findByThriftId(fieldId);
- }
-
- public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
- schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
- }
-
- public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
- schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
- }
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder("TCreateSentryRoleRequest(");
- boolean first = true;
-
- sb.append("protocol_version:");
- sb.append(this.protocol_version);
- first = false;
- if (!first) sb.append(", ");
- sb.append("requestorUserName:");
- if (this.requestorUserName == null) {
- sb.append("null");
- } else {
- sb.append(this.requestorUserName);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("roleName:");
- if (this.roleName == null) {
- sb.append("null");
- } else {
- sb.append(this.roleName);
- }
- first = false;
- sb.append(")");
- return sb.toString();
- }
-
- public void validate() throws org.apache.thrift.TException {
- // check for required fields
- if (!isSetProtocol_version()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'protocol_version' is unset! Struct:" + toString());
- }
-
- if (!isSetRequestorUserName()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'requestorUserName' is unset! Struct:" + toString());
- }
-
- if (!isSetRoleName()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'roleName' is unset! Struct:" + toString());
- }
-
- // check for sub-struct validity
- }
-
- private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
- try {
- write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
- try {
- // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
- __isset_bitfield = 0;
- read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private static class TCreateSentryRoleRequestStandardSchemeFactory implements SchemeFactory {
- public TCreateSentryRoleRequestStandardScheme getScheme() {
- return new TCreateSentryRoleRequestStandardScheme();
- }
- }
-
- private static class TCreateSentryRoleRequestStandardScheme extends StandardScheme<TCreateSentryRoleRequest> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TCreateSentryRoleRequest struct) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TField schemeField;
- iprot.readStructBegin();
- while (true)
- {
- schemeField = iprot.readFieldBegin();
- if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
- break;
- }
- switch (schemeField.id) {
- case 1: // PROTOCOL_VERSION
- if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
- struct.protocol_version = iprot.readI32();
- struct.setProtocol_versionIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 2: // REQUESTOR_USER_NAME
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.requestorUserName = iprot.readString();
- struct.setRequestorUserNameIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 3: // ROLE_NAME
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.roleName = iprot.readString();
- struct.setRoleNameIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- default:
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- iprot.readFieldEnd();
- }
- iprot.readStructEnd();
- struct.validate();
- }
-
- public void write(org.apache.thrift.protocol.TProtocol oprot, TCreateSentryRoleRequest struct) throws org.apache.thrift.TException {
- struct.validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- oprot.writeFieldBegin(PROTOCOL_VERSION_FIELD_DESC);
- oprot.writeI32(struct.protocol_version);
- oprot.writeFieldEnd();
- if (struct.requestorUserName != null) {
- oprot.writeFieldBegin(REQUESTOR_USER_NAME_FIELD_DESC);
- oprot.writeString(struct.requestorUserName);
- oprot.writeFieldEnd();
- }
- if (struct.roleName != null) {
- oprot.writeFieldBegin(ROLE_NAME_FIELD_DESC);
- oprot.writeString(struct.roleName);
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TCreateSentryRoleRequestTupleSchemeFactory implements SchemeFactory {
- public TCreateSentryRoleRequestTupleScheme getScheme() {
- return new TCreateSentryRoleRequestTupleScheme();
- }
- }
-
- private static class TCreateSentryRoleRequestTupleScheme extends TupleScheme<TCreateSentryRoleRequest> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, TCreateSentryRoleRequest struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- oprot.writeI32(struct.protocol_version);
- oprot.writeString(struct.requestorUserName);
- oprot.writeString(struct.roleName);
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TCreateSentryRoleRequest struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- struct.protocol_version = iprot.readI32();
- struct.setProtocol_versionIsSet(true);
- struct.requestorUserName = iprot.readString();
- struct.setRequestorUserNameIsSet(true);
- struct.roleName = iprot.readString();
- struct.setRoleNameIsSet(true);
- }
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TCreateSentryRoleResponse.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TCreateSentryRoleResponse.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TCreateSentryRoleResponse.java
deleted file mode 100644
index fcb3f41..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TCreateSentryRoleResponse.java
+++ /dev/null
@@ -1,390 +0,0 @@
-/**
- * Autogenerated by Thrift Compiler (0.9.0)
- *
- * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
- * @generated
- */
-package org.apache.sentry.provider.db.service.thrift;
-
-import org.apache.commons.lang.builder.HashCodeBuilder;
-import org.apache.thrift.scheme.IScheme;
-import org.apache.thrift.scheme.SchemeFactory;
-import org.apache.thrift.scheme.StandardScheme;
-
-import org.apache.thrift.scheme.TupleScheme;
-import org.apache.thrift.protocol.TTupleProtocol;
-import org.apache.thrift.protocol.TProtocolException;
-import org.apache.thrift.EncodingUtils;
-import org.apache.thrift.TException;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.EnumMap;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.EnumSet;
-import java.util.Collections;
-import java.util.BitSet;
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class TCreateSentryRoleResponse implements org.apache.thrift.TBase<TCreateSentryRoleResponse, TCreateSentryRoleResponse._Fields>, java.io.Serializable, Cloneable {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TCreateSentryRoleResponse");
-
- private static final org.apache.thrift.protocol.TField STATUS_FIELD_DESC = new org.apache.thrift.protocol.TField("status", org.apache.thrift.protocol.TType.STRUCT, (short)1);
-
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TCreateSentryRoleResponseStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TCreateSentryRoleResponseTupleSchemeFactory());
- }
-
- private org.apache.sentry.service.thrift.TSentryResponseStatus status; // required
-
- /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
- public enum _Fields implements org.apache.thrift.TFieldIdEnum {
- STATUS((short)1, "status");
-
- private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
-
- static {
- for (_Fields field : EnumSet.allOf(_Fields.class)) {
- byName.put(field.getFieldName(), field);
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, or null if its not found.
- */
- public static _Fields findByThriftId(int fieldId) {
- switch(fieldId) {
- case 1: // STATUS
- return STATUS;
- default:
- return null;
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, throwing an exception
- * if it is not found.
- */
- public static _Fields findByThriftIdOrThrow(int fieldId) {
- _Fields fields = findByThriftId(fieldId);
- if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
- return fields;
- }
-
- /**
- * Find the _Fields constant that matches name, or null if its not found.
- */
- public static _Fields findByName(String name) {
- return byName.get(name);
- }
-
- private final short _thriftId;
- private final String _fieldName;
-
- _Fields(short thriftId, String fieldName) {
- _thriftId = thriftId;
- _fieldName = fieldName;
- }
-
- public short getThriftFieldId() {
- return _thriftId;
- }
-
- public String getFieldName() {
- return _fieldName;
- }
- }
-
- // isset id assignments
- public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
- static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
- tmpMap.put(_Fields.STATUS, new org.apache.thrift.meta_data.FieldMetaData("status", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.sentry.service.thrift.TSentryResponseStatus.class)));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TCreateSentryRoleResponse.class, metaDataMap);
- }
-
- public TCreateSentryRoleResponse() {
- }
-
- public TCreateSentryRoleResponse(
- org.apache.sentry.service.thrift.TSentryResponseStatus status)
- {
- this();
- this.status = status;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TCreateSentryRoleResponse(TCreateSentryRoleResponse other) {
- if (other.isSetStatus()) {
- this.status = new org.apache.sentry.service.thrift.TSentryResponseStatus(other.status);
- }
- }
-
- public TCreateSentryRoleResponse deepCopy() {
- return new TCreateSentryRoleResponse(this);
- }
-
- @Override
- public void clear() {
- this.status = null;
- }
-
- public org.apache.sentry.service.thrift.TSentryResponseStatus getStatus() {
- return this.status;
- }
-
- public void setStatus(org.apache.sentry.service.thrift.TSentryResponseStatus status) {
- this.status = status;
- }
-
- public void unsetStatus() {
- this.status = null;
- }
-
- /** Returns true if field status is set (has been assigned a value) and false otherwise */
- public boolean isSetStatus() {
- return this.status != null;
- }
-
- public void setStatusIsSet(boolean value) {
- if (!value) {
- this.status = null;
- }
- }
-
- public void setFieldValue(_Fields field, Object value) {
- switch (field) {
- case STATUS:
- if (value == null) {
- unsetStatus();
- } else {
- setStatus((org.apache.sentry.service.thrift.TSentryResponseStatus)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case STATUS:
- return getStatus();
-
- }
- throw new IllegalStateException();
- }
-
- /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
- public boolean isSet(_Fields field) {
- if (field == null) {
- throw new IllegalArgumentException();
- }
-
- switch (field) {
- case STATUS:
- return isSetStatus();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TCreateSentryRoleResponse)
- return this.equals((TCreateSentryRoleResponse)that);
- return false;
- }
-
- public boolean equals(TCreateSentryRoleResponse that) {
- if (that == null)
- return false;
-
- boolean this_present_status = true && this.isSetStatus();
- boolean that_present_status = true && that.isSetStatus();
- if (this_present_status || that_present_status) {
- if (!(this_present_status && that_present_status))
- return false;
- if (!this.status.equals(that.status))
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode() {
- HashCodeBuilder builder = new HashCodeBuilder();
-
- boolean present_status = true && (isSetStatus());
- builder.append(present_status);
- if (present_status)
- builder.append(status);
-
- return builder.toHashCode();
- }
-
- public int compareTo(TCreateSentryRoleResponse other) {
- if (!getClass().equals(other.getClass())) {
- return getClass().getName().compareTo(other.getClass().getName());
- }
-
- int lastComparison = 0;
- TCreateSentryRoleResponse typedOther = (TCreateSentryRoleResponse)other;
-
- lastComparison = Boolean.valueOf(isSetStatus()).compareTo(typedOther.isSetStatus());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetStatus()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.status, typedOther.status);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- 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("TCreateSentryRoleResponse(");
- boolean first = true;
-
- sb.append("status:");
- if (this.status == null) {
- sb.append("null");
- } else {
- sb.append(this.status);
- }
- first = false;
- sb.append(")");
- return sb.toString();
- }
-
- public void validate() throws org.apache.thrift.TException {
- // check for required fields
- if (!isSetStatus()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'status' is unset! Struct:" + toString());
- }
-
- // check for sub-struct validity
- if (status != null) {
- status.validate();
- }
- }
-
- private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
- try {
- write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
- try {
- read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private static class TCreateSentryRoleResponseStandardSchemeFactory implements SchemeFactory {
- public TCreateSentryRoleResponseStandardScheme getScheme() {
- return new TCreateSentryRoleResponseStandardScheme();
- }
- }
-
- private static class TCreateSentryRoleResponseStandardScheme extends StandardScheme<TCreateSentryRoleResponse> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TCreateSentryRoleResponse struct) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TField schemeField;
- iprot.readStructBegin();
- while (true)
- {
- schemeField = iprot.readFieldBegin();
- if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
- break;
- }
- switch (schemeField.id) {
- case 1: // STATUS
- if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
- struct.status = new org.apache.sentry.service.thrift.TSentryResponseStatus();
- struct.status.read(iprot);
- struct.setStatusIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- 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, TCreateSentryRoleResponse struct) throws org.apache.thrift.TException {
- struct.validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- if (struct.status != null) {
- oprot.writeFieldBegin(STATUS_FIELD_DESC);
- struct.status.write(oprot);
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TCreateSentryRoleResponseTupleSchemeFactory implements SchemeFactory {
- public TCreateSentryRoleResponseTupleScheme getScheme() {
- return new TCreateSentryRoleResponseTupleScheme();
- }
- }
-
- private static class TCreateSentryRoleResponseTupleScheme extends TupleScheme<TCreateSentryRoleResponse> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, TCreateSentryRoleResponse struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- struct.status.write(oprot);
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TCreateSentryRoleResponse struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- struct.status = new org.apache.sentry.service.thrift.TSentryResponseStatus();
- struct.status.read(iprot);
- struct.setStatusIsSet(true);
- }
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TDropPrivilegesRequest.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TDropPrivilegesRequest.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TDropPrivilegesRequest.java
deleted file mode 100644
index 3df9235..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TDropPrivilegesRequest.java
+++ /dev/null
@@ -1,592 +0,0 @@
-/**
- * Autogenerated by Thrift Compiler (0.9.0)
- *
- * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
- * @generated
- */
-package org.apache.sentry.provider.db.service.thrift;
-
-import org.apache.commons.lang.builder.HashCodeBuilder;
-import org.apache.thrift.scheme.IScheme;
-import org.apache.thrift.scheme.SchemeFactory;
-import org.apache.thrift.scheme.StandardScheme;
-
-import org.apache.thrift.scheme.TupleScheme;
-import org.apache.thrift.protocol.TTupleProtocol;
-import org.apache.thrift.protocol.TProtocolException;
-import org.apache.thrift.EncodingUtils;
-import org.apache.thrift.TException;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.EnumMap;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.EnumSet;
-import java.util.Collections;
-import java.util.BitSet;
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class TDropPrivilegesRequest implements org.apache.thrift.TBase<TDropPrivilegesRequest, TDropPrivilegesRequest._Fields>, java.io.Serializable, Cloneable {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TDropPrivilegesRequest");
-
- private static final org.apache.thrift.protocol.TField PROTOCOL_VERSION_FIELD_DESC = new org.apache.thrift.protocol.TField("protocol_version", org.apache.thrift.protocol.TType.I32, (short)1);
- private static final org.apache.thrift.protocol.TField REQUESTOR_USER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("requestorUserName", org.apache.thrift.protocol.TType.STRING, (short)2);
- private static final org.apache.thrift.protocol.TField AUTHORIZABLE_FIELD_DESC = new org.apache.thrift.protocol.TField("authorizable", org.apache.thrift.protocol.TType.STRUCT, (short)3);
-
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TDropPrivilegesRequestStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TDropPrivilegesRequestTupleSchemeFactory());
- }
-
- private int protocol_version; // required
- private String requestorUserName; // required
- private TSentryAuthorizable authorizable; // required
-
- /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
- public enum _Fields implements org.apache.thrift.TFieldIdEnum {
- PROTOCOL_VERSION((short)1, "protocol_version"),
- REQUESTOR_USER_NAME((short)2, "requestorUserName"),
- AUTHORIZABLE((short)3, "authorizable");
-
- private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
-
- static {
- for (_Fields field : EnumSet.allOf(_Fields.class)) {
- byName.put(field.getFieldName(), field);
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, or null if its not found.
- */
- public static _Fields findByThriftId(int fieldId) {
- switch(fieldId) {
- case 1: // PROTOCOL_VERSION
- return PROTOCOL_VERSION;
- case 2: // REQUESTOR_USER_NAME
- return REQUESTOR_USER_NAME;
- case 3: // AUTHORIZABLE
- return AUTHORIZABLE;
- default:
- return null;
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, throwing an exception
- * if it is not found.
- */
- public static _Fields findByThriftIdOrThrow(int fieldId) {
- _Fields fields = findByThriftId(fieldId);
- if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
- return fields;
- }
-
- /**
- * Find the _Fields constant that matches name, or null if its not found.
- */
- public static _Fields findByName(String name) {
- return byName.get(name);
- }
-
- private final short _thriftId;
- private final String _fieldName;
-
- _Fields(short thriftId, String fieldName) {
- _thriftId = thriftId;
- _fieldName = fieldName;
- }
-
- public short getThriftFieldId() {
- return _thriftId;
- }
-
- public String getFieldName() {
- return _fieldName;
- }
- }
-
- // isset id assignments
- private static final int __PROTOCOL_VERSION_ISSET_ID = 0;
- private byte __isset_bitfield = 0;
- public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
- static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
- tmpMap.put(_Fields.PROTOCOL_VERSION, new org.apache.thrift.meta_data.FieldMetaData("protocol_version", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
- tmpMap.put(_Fields.REQUESTOR_USER_NAME, new org.apache.thrift.meta_data.FieldMetaData("requestorUserName", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.AUTHORIZABLE, new org.apache.thrift.meta_data.FieldMetaData("authorizable", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TSentryAuthorizable.class)));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TDropPrivilegesRequest.class, metaDataMap);
- }
-
- public TDropPrivilegesRequest() {
- this.protocol_version = 1;
-
- }
-
- public TDropPrivilegesRequest(
- int protocol_version,
- String requestorUserName,
- TSentryAuthorizable authorizable)
- {
- this();
- this.protocol_version = protocol_version;
- setProtocol_versionIsSet(true);
- this.requestorUserName = requestorUserName;
- this.authorizable = authorizable;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TDropPrivilegesRequest(TDropPrivilegesRequest other) {
- __isset_bitfield = other.__isset_bitfield;
- this.protocol_version = other.protocol_version;
- if (other.isSetRequestorUserName()) {
- this.requestorUserName = other.requestorUserName;
- }
- if (other.isSetAuthorizable()) {
- this.authorizable = new TSentryAuthorizable(other.authorizable);
- }
- }
-
- public TDropPrivilegesRequest deepCopy() {
- return new TDropPrivilegesRequest(this);
- }
-
- @Override
- public void clear() {
- this.protocol_version = 1;
-
- this.requestorUserName = null;
- this.authorizable = null;
- }
-
- public int getProtocol_version() {
- return this.protocol_version;
- }
-
- public void setProtocol_version(int protocol_version) {
- this.protocol_version = protocol_version;
- setProtocol_versionIsSet(true);
- }
-
- public void unsetProtocol_version() {
- __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __PROTOCOL_VERSION_ISSET_ID);
- }
-
- /** Returns true if field protocol_version is set (has been assigned a value) and false otherwise */
- public boolean isSetProtocol_version() {
- return EncodingUtils.testBit(__isset_bitfield, __PROTOCOL_VERSION_ISSET_ID);
- }
-
- public void setProtocol_versionIsSet(boolean value) {
- __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __PROTOCOL_VERSION_ISSET_ID, value);
- }
-
- public String getRequestorUserName() {
- return this.requestorUserName;
- }
-
- public void setRequestorUserName(String requestorUserName) {
- this.requestorUserName = requestorUserName;
- }
-
- public void unsetRequestorUserName() {
- this.requestorUserName = null;
- }
-
- /** Returns true if field requestorUserName is set (has been assigned a value) and false otherwise */
- public boolean isSetRequestorUserName() {
- return this.requestorUserName != null;
- }
-
- public void setRequestorUserNameIsSet(boolean value) {
- if (!value) {
- this.requestorUserName = null;
- }
- }
-
- public TSentryAuthorizable getAuthorizable() {
- return this.authorizable;
- }
-
- public void setAuthorizable(TSentryAuthorizable authorizable) {
- this.authorizable = authorizable;
- }
-
- public void unsetAuthorizable() {
- this.authorizable = null;
- }
-
- /** Returns true if field authorizable is set (has been assigned a value) and false otherwise */
- public boolean isSetAuthorizable() {
- return this.authorizable != null;
- }
-
- public void setAuthorizableIsSet(boolean value) {
- if (!value) {
- this.authorizable = null;
- }
- }
-
- public void setFieldValue(_Fields field, Object value) {
- switch (field) {
- case PROTOCOL_VERSION:
- if (value == null) {
- unsetProtocol_version();
- } else {
- setProtocol_version((Integer)value);
- }
- break;
-
- case REQUESTOR_USER_NAME:
- if (value == null) {
- unsetRequestorUserName();
- } else {
- setRequestorUserName((String)value);
- }
- break;
-
- case AUTHORIZABLE:
- if (value == null) {
- unsetAuthorizable();
- } else {
- setAuthorizable((TSentryAuthorizable)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case PROTOCOL_VERSION:
- return Integer.valueOf(getProtocol_version());
-
- case REQUESTOR_USER_NAME:
- return getRequestorUserName();
-
- case AUTHORIZABLE:
- return getAuthorizable();
-
- }
- throw new IllegalStateException();
- }
-
- /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
- public boolean isSet(_Fields field) {
- if (field == null) {
- throw new IllegalArgumentException();
- }
-
- switch (field) {
- case PROTOCOL_VERSION:
- return isSetProtocol_version();
- case REQUESTOR_USER_NAME:
- return isSetRequestorUserName();
- case AUTHORIZABLE:
- return isSetAuthorizable();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TDropPrivilegesRequest)
- return this.equals((TDropPrivilegesRequest)that);
- return false;
- }
-
- public boolean equals(TDropPrivilegesRequest that) {
- if (that == null)
- return false;
-
- boolean this_present_protocol_version = true;
- boolean that_present_protocol_version = true;
- if (this_present_protocol_version || that_present_protocol_version) {
- if (!(this_present_protocol_version && that_present_protocol_version))
- return false;
- if (this.protocol_version != that.protocol_version)
- return false;
- }
-
- boolean this_present_requestorUserName = true && this.isSetRequestorUserName();
- boolean that_present_requestorUserName = true && that.isSetRequestorUserName();
- if (this_present_requestorUserName || that_present_requestorUserName) {
- if (!(this_present_requestorUserName && that_present_requestorUserName))
- return false;
- if (!this.requestorUserName.equals(that.requestorUserName))
- return false;
- }
-
- boolean this_present_authorizable = true && this.isSetAuthorizable();
- boolean that_present_authorizable = true && that.isSetAuthorizable();
- if (this_present_authorizable || that_present_authorizable) {
- if (!(this_present_authorizable && that_present_authorizable))
- return false;
- if (!this.authorizable.equals(that.authorizable))
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode() {
- HashCodeBuilder builder = new HashCodeBuilder();
-
- boolean present_protocol_version = true;
- builder.append(present_protocol_version);
- if (present_protocol_version)
- builder.append(protocol_version);
-
- boolean present_requestorUserName = true && (isSetRequestorUserName());
- builder.append(present_requestorUserName);
- if (present_requestorUserName)
- builder.append(requestorUserName);
-
- boolean present_authorizable = true && (isSetAuthorizable());
- builder.append(present_authorizable);
- if (present_authorizable)
- builder.append(authorizable);
-
- return builder.toHashCode();
- }
-
- public int compareTo(TDropPrivilegesRequest other) {
- if (!getClass().equals(other.getClass())) {
- return getClass().getName().compareTo(other.getClass().getName());
- }
-
- int lastComparison = 0;
- TDropPrivilegesRequest typedOther = (TDropPrivilegesRequest)other;
-
- lastComparison = Boolean.valueOf(isSetProtocol_version()).compareTo(typedOther.isSetProtocol_version());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetProtocol_version()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.protocol_version, typedOther.protocol_version);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetRequestorUserName()).compareTo(typedOther.isSetRequestorUserName());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetRequestorUserName()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.requestorUserName, typedOther.requestorUserName);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetAuthorizable()).compareTo(typedOther.isSetAuthorizable());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetAuthorizable()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.authorizable, typedOther.authorizable);
- 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("TDropPrivilegesRequest(");
- boolean first = true;
-
- sb.append("protocol_version:");
- sb.append(this.protocol_version);
- first = false;
- if (!first) sb.append(", ");
- sb.append("requestorUserName:");
- if (this.requestorUserName == null) {
- sb.append("null");
- } else {
- sb.append(this.requestorUserName);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("authorizable:");
- if (this.authorizable == null) {
- sb.append("null");
- } else {
- sb.append(this.authorizable);
- }
- first = false;
- sb.append(")");
- return sb.toString();
- }
-
- public void validate() throws org.apache.thrift.TException {
- // check for required fields
- if (!isSetProtocol_version()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'protocol_version' is unset! Struct:" + toString());
- }
-
- if (!isSetRequestorUserName()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'requestorUserName' is unset! Struct:" + toString());
- }
-
- if (!isSetAuthorizable()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'authorizable' is unset! Struct:" + toString());
- }
-
- // check for sub-struct validity
- if (authorizable != null) {
- authorizable.validate();
- }
- }
-
- private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
- try {
- write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
- try {
- // 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 TDropPrivilegesRequestStandardSchemeFactory implements SchemeFactory {
- public TDropPrivilegesRequestStandardScheme getScheme() {
- return new TDropPrivilegesRequestStandardScheme();
- }
- }
-
- private static class TDropPrivilegesRequestStandardScheme extends StandardScheme<TDropPrivilegesRequest> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TDropPrivilegesRequest struct) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TField schemeField;
- iprot.readStructBegin();
- while (true)
- {
- schemeField = iprot.readFieldBegin();
- if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
- break;
- }
- switch (schemeField.id) {
- case 1: // PROTOCOL_VERSION
- if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
- struct.protocol_version = iprot.readI32();
- struct.setProtocol_versionIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 2: // REQUESTOR_USER_NAME
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.requestorUserName = iprot.readString();
- struct.setRequestorUserNameIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 3: // AUTHORIZABLE
- if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
- struct.authorizable = new TSentryAuthorizable();
- struct.authorizable.read(iprot);
- struct.setAuthorizableIsSet(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, TDropPrivilegesRequest struct) throws org.apache.thrift.TException {
- struct.validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- oprot.writeFieldBegin(PROTOCOL_VERSION_FIELD_DESC);
- oprot.writeI32(struct.protocol_version);
- oprot.writeFieldEnd();
- if (struct.requestorUserName != null) {
- oprot.writeFieldBegin(REQUESTOR_USER_NAME_FIELD_DESC);
- oprot.writeString(struct.requestorUserName);
- oprot.writeFieldEnd();
- }
- if (struct.authorizable != null) {
- oprot.writeFieldBegin(AUTHORIZABLE_FIELD_DESC);
- struct.authorizable.write(oprot);
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TDropPrivilegesRequestTupleSchemeFactory implements SchemeFactory {
- public TDropPrivilegesRequestTupleScheme getScheme() {
- return new TDropPrivilegesRequestTupleScheme();
- }
- }
-
- private static class TDropPrivilegesRequestTupleScheme extends TupleScheme<TDropPrivilegesRequest> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, TDropPrivilegesRequest struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- oprot.writeI32(struct.protocol_version);
- oprot.writeString(struct.requestorUserName);
- struct.authorizable.write(oprot);
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TDropPrivilegesRequest struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- struct.protocol_version = iprot.readI32();
- struct.setProtocol_versionIsSet(true);
- struct.requestorUserName = iprot.readString();
- struct.setRequestorUserNameIsSet(true);
- struct.authorizable = new TSentryAuthorizable();
- struct.authorizable.read(iprot);
- struct.setAuthorizableIsSet(true);
- }
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TDropPrivilegesResponse.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TDropPrivilegesResponse.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TDropPrivilegesResponse.java
deleted file mode 100644
index 24f7926..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TDropPrivilegesResponse.java
+++ /dev/null
@@ -1,390 +0,0 @@
-/**
- * Autogenerated by Thrift Compiler (0.9.0)
- *
- * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
- * @generated
- */
-package org.apache.sentry.provider.db.service.thrift;
-
-import org.apache.commons.lang.builder.HashCodeBuilder;
-import org.apache.thrift.scheme.IScheme;
-import org.apache.thrift.scheme.SchemeFactory;
-import org.apache.thrift.scheme.StandardScheme;
-
-import org.apache.thrift.scheme.TupleScheme;
-import org.apache.thrift.protocol.TTupleProtocol;
-import org.apache.thrift.protocol.TProtocolException;
-import org.apache.thrift.EncodingUtils;
-import org.apache.thrift.TException;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.EnumMap;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.EnumSet;
-import java.util.Collections;
-import java.util.BitSet;
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class TDropPrivilegesResponse implements org.apache.thrift.TBase<TDropPrivilegesResponse, TDropPrivilegesResponse._Fields>, java.io.Serializable, Cloneable {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TDropPrivilegesResponse");
-
- private static final org.apache.thrift.protocol.TField STATUS_FIELD_DESC = new org.apache.thrift.protocol.TField("status", org.apache.thrift.protocol.TType.STRUCT, (short)1);
-
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TDropPrivilegesResponseStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TDropPrivilegesResponseTupleSchemeFactory());
- }
-
- private org.apache.sentry.service.thrift.TSentryResponseStatus status; // required
-
- /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
- public enum _Fields implements org.apache.thrift.TFieldIdEnum {
- STATUS((short)1, "status");
-
- private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
-
- static {
- for (_Fields field : EnumSet.allOf(_Fields.class)) {
- byName.put(field.getFieldName(), field);
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, or null if its not found.
- */
- public static _Fields findByThriftId(int fieldId) {
- switch(fieldId) {
- case 1: // STATUS
- return STATUS;
- default:
- return null;
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, throwing an exception
- * if it is not found.
- */
- public static _Fields findByThriftIdOrThrow(int fieldId) {
- _Fields fields = findByThriftId(fieldId);
- if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
- return fields;
- }
-
- /**
- * Find the _Fields constant that matches name, or null if its not found.
- */
- public static _Fields findByName(String name) {
- return byName.get(name);
- }
-
- private final short _thriftId;
- private final String _fieldName;
-
- _Fields(short thriftId, String fieldName) {
- _thriftId = thriftId;
- _fieldName = fieldName;
- }
-
- public short getThriftFieldId() {
- return _thriftId;
- }
-
- public String getFieldName() {
- return _fieldName;
- }
- }
-
- // isset id assignments
- public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
- static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
- tmpMap.put(_Fields.STATUS, new org.apache.thrift.meta_data.FieldMetaData("status", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.sentry.service.thrift.TSentryResponseStatus.class)));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TDropPrivilegesResponse.class, metaDataMap);
- }
-
- public TDropPrivilegesResponse() {
- }
-
- public TDropPrivilegesResponse(
- org.apache.sentry.service.thrift.TSentryResponseStatus status)
- {
- this();
- this.status = status;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TDropPrivilegesResponse(TDropPrivilegesResponse other) {
- if (other.isSetStatus()) {
- this.status = new org.apache.sentry.service.thrift.TSentryResponseStatus(other.status);
- }
- }
-
- public TDropPrivilegesResponse deepCopy() {
- return new TDropPrivilegesResponse(this);
- }
-
- @Override
- public void clear() {
- this.status = null;
- }
-
- public org.apache.sentry.service.thrift.TSentryResponseStatus getStatus() {
- return this.status;
- }
-
- public void setStatus(org.apache.sentry.service.thrift.TSentryResponseStatus status) {
- this.status = status;
- }
-
- public void unsetStatus() {
- this.status = null;
- }
-
- /** Returns true if field status is set (has been assigned a value) and false otherwise */
- public boolean isSetStatus() {
- return this.status != null;
- }
-
- public void setStatusIsSet(boolean value) {
- if (!value) {
- this.status = null;
- }
- }
-
- public void setFieldValue(_Fields field, Object value) {
- switch (field) {
- case STATUS:
- if (value == null) {
- unsetStatus();
- } else {
- setStatus((org.apache.sentry.service.thrift.TSentryResponseStatus)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case STATUS:
- return getStatus();
-
- }
- throw new IllegalStateException();
- }
-
- /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
- public boolean isSet(_Fields field) {
- if (field == null) {
- throw new IllegalArgumentException();
- }
-
- switch (field) {
- case STATUS:
- return isSetStatus();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TDropPrivilegesResponse)
- return this.equals((TDropPrivilegesResponse)that);
- return false;
- }
-
- public boolean equals(TDropPrivilegesResponse that) {
- if (that == null)
- return false;
-
- boolean this_present_status = true && this.isSetStatus();
- boolean that_present_status = true && that.isSetStatus();
- if (this_present_status || that_present_status) {
- if (!(this_present_status && that_present_status))
- return false;
- if (!this.status.equals(that.status))
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode() {
- HashCodeBuilder builder = new HashCodeBuilder();
-
- boolean present_status = true && (isSetStatus());
- builder.append(present_status);
- if (present_status)
- builder.append(status);
-
- return builder.toHashCode();
- }
-
- public int compareTo(TDropPrivilegesResponse other) {
- if (!getClass().equals(other.getClass())) {
- return getClass().getName().compareTo(other.getClass().getName());
- }
-
- int lastComparison = 0;
- TDropPrivilegesResponse typedOther = (TDropPrivilegesResponse)other;
-
- lastComparison = Boolean.valueOf(isSetStatus()).compareTo(typedOther.isSetStatus());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetStatus()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.status, typedOther.status);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- 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("TDropPrivilegesResponse(");
- boolean first = true;
-
- sb.append("status:");
- if (this.status == null) {
- sb.append("null");
- } else {
- sb.append(this.status);
- }
- first = false;
- sb.append(")");
- return sb.toString();
- }
-
- public void validate() throws org.apache.thrift.TException {
- // check for required fields
- if (!isSetStatus()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'status' is unset! Struct:" + toString());
- }
-
- // check for sub-struct validity
- if (status != null) {
- status.validate();
- }
- }
-
- private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
- try {
- write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
- try {
- read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private static class TDropPrivilegesResponseStandardSchemeFactory implements SchemeFactory {
- public TDropPrivilegesResponseStandardScheme getScheme() {
- return new TDropPrivilegesResponseStandardScheme();
- }
- }
-
- private static class TDropPrivilegesResponseStandardScheme extends StandardScheme<TDropPrivilegesResponse> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TDropPrivilegesResponse struct) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TField schemeField;
- iprot.readStructBegin();
- while (true)
- {
- schemeField = iprot.readFieldBegin();
- if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
- break;
- }
- switch (schemeField.id) {
- case 1: // STATUS
- if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
- struct.status = new org.apache.sentry.service.thrift.TSentryResponseStatus();
- struct.status.read(iprot);
- struct.setStatusIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- 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, TDropPrivilegesResponse struct) throws org.apache.thrift.TException {
- struct.validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- if (struct.status != null) {
- oprot.writeFieldBegin(STATUS_FIELD_DESC);
- struct.status.write(oprot);
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TDropPrivilegesResponseTupleSchemeFactory implements SchemeFactory {
- public TDropPrivilegesResponseTupleScheme getScheme() {
- return new TDropPrivilegesResponseTupleScheme();
- }
- }
-
- private static class TDropPrivilegesResponseTupleScheme extends TupleScheme<TDropPrivilegesResponse> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, TDropPrivilegesResponse struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- struct.status.write(oprot);
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TDropPrivilegesResponse struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- struct.status = new org.apache.sentry.service.thrift.TSentryResponseStatus();
- struct.status.read(iprot);
- struct.setStatusIsSet(true);
- }
- }
-
-}
-
[07/25] SENTRY-432. HDFS ingration. Initial patch
Posted by pr...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryPrivilegesForProviderResponse.java
----------------------------------------------------------------------
diff --git a/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryPrivilegesForProviderResponse.java b/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryPrivilegesForProviderResponse.java
new file mode 100644
index 0000000..4c571c2
--- /dev/null
+++ b/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryPrivilegesForProviderResponse.java
@@ -0,0 +1,543 @@
+/**
+ * Autogenerated by Thrift Compiler (0.9.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+package org.apache.sentry.provider.db.service.thrift;
+
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EnumMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.EnumSet;
+import java.util.Collections;
+import java.util.BitSet;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class TListSentryPrivilegesForProviderResponse implements org.apache.thrift.TBase<TListSentryPrivilegesForProviderResponse, TListSentryPrivilegesForProviderResponse._Fields>, java.io.Serializable, Cloneable {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TListSentryPrivilegesForProviderResponse");
+
+ private static final org.apache.thrift.protocol.TField STATUS_FIELD_DESC = new org.apache.thrift.protocol.TField("status", org.apache.thrift.protocol.TType.STRUCT, (short)1);
+ private static final org.apache.thrift.protocol.TField PRIVILEGES_FIELD_DESC = new org.apache.thrift.protocol.TField("privileges", org.apache.thrift.protocol.TType.SET, (short)2);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new TListSentryPrivilegesForProviderResponseStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new TListSentryPrivilegesForProviderResponseTupleSchemeFactory());
+ }
+
+ private org.apache.sentry.service.thrift.TSentryResponseStatus status; // required
+ private Set<String> privileges; // required
+
+ /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+ public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+ STATUS((short)1, "status"),
+ PRIVILEGES((short)2, "privileges");
+
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+ static {
+ for (_Fields field : EnumSet.allOf(_Fields.class)) {
+ byName.put(field.getFieldName(), field);
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, or null if its not found.
+ */
+ public static _Fields findByThriftId(int fieldId) {
+ switch(fieldId) {
+ case 1: // STATUS
+ return STATUS;
+ case 2: // PRIVILEGES
+ return PRIVILEGES;
+ default:
+ return null;
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, throwing an exception
+ * if it is not found.
+ */
+ public static _Fields findByThriftIdOrThrow(int fieldId) {
+ _Fields fields = findByThriftId(fieldId);
+ if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+ return fields;
+ }
+
+ /**
+ * Find the _Fields constant that matches name, or null if its not found.
+ */
+ public static _Fields findByName(String name) {
+ return byName.get(name);
+ }
+
+ private final short _thriftId;
+ private final String _fieldName;
+
+ _Fields(short thriftId, String fieldName) {
+ _thriftId = thriftId;
+ _fieldName = fieldName;
+ }
+
+ public short getThriftFieldId() {
+ return _thriftId;
+ }
+
+ public String getFieldName() {
+ return _fieldName;
+ }
+ }
+
+ // isset id assignments
+ public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+ static {
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+ tmpMap.put(_Fields.STATUS, new org.apache.thrift.meta_data.FieldMetaData("status", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.sentry.service.thrift.TSentryResponseStatus.class)));
+ tmpMap.put(_Fields.PRIVILEGES, new org.apache.thrift.meta_data.FieldMetaData("privileges", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TListSentryPrivilegesForProviderResponse.class, metaDataMap);
+ }
+
+ public TListSentryPrivilegesForProviderResponse() {
+ }
+
+ public TListSentryPrivilegesForProviderResponse(
+ org.apache.sentry.service.thrift.TSentryResponseStatus status,
+ Set<String> privileges)
+ {
+ this();
+ this.status = status;
+ this.privileges = privileges;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public TListSentryPrivilegesForProviderResponse(TListSentryPrivilegesForProviderResponse other) {
+ if (other.isSetStatus()) {
+ this.status = new org.apache.sentry.service.thrift.TSentryResponseStatus(other.status);
+ }
+ if (other.isSetPrivileges()) {
+ Set<String> __this__privileges = new HashSet<String>();
+ for (String other_element : other.privileges) {
+ __this__privileges.add(other_element);
+ }
+ this.privileges = __this__privileges;
+ }
+ }
+
+ public TListSentryPrivilegesForProviderResponse deepCopy() {
+ return new TListSentryPrivilegesForProviderResponse(this);
+ }
+
+ @Override
+ public void clear() {
+ this.status = null;
+ this.privileges = null;
+ }
+
+ public org.apache.sentry.service.thrift.TSentryResponseStatus getStatus() {
+ return this.status;
+ }
+
+ public void setStatus(org.apache.sentry.service.thrift.TSentryResponseStatus status) {
+ this.status = status;
+ }
+
+ public void unsetStatus() {
+ this.status = null;
+ }
+
+ /** Returns true if field status is set (has been assigned a value) and false otherwise */
+ public boolean isSetStatus() {
+ return this.status != null;
+ }
+
+ public void setStatusIsSet(boolean value) {
+ if (!value) {
+ this.status = null;
+ }
+ }
+
+ public int getPrivilegesSize() {
+ return (this.privileges == null) ? 0 : this.privileges.size();
+ }
+
+ public java.util.Iterator<String> getPrivilegesIterator() {
+ return (this.privileges == null) ? null : this.privileges.iterator();
+ }
+
+ public void addToPrivileges(String elem) {
+ if (this.privileges == null) {
+ this.privileges = new HashSet<String>();
+ }
+ this.privileges.add(elem);
+ }
+
+ public Set<String> getPrivileges() {
+ return this.privileges;
+ }
+
+ public void setPrivileges(Set<String> privileges) {
+ this.privileges = privileges;
+ }
+
+ public void unsetPrivileges() {
+ this.privileges = null;
+ }
+
+ /** Returns true if field privileges is set (has been assigned a value) and false otherwise */
+ public boolean isSetPrivileges() {
+ return this.privileges != null;
+ }
+
+ public void setPrivilegesIsSet(boolean value) {
+ if (!value) {
+ this.privileges = null;
+ }
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case STATUS:
+ if (value == null) {
+ unsetStatus();
+ } else {
+ setStatus((org.apache.sentry.service.thrift.TSentryResponseStatus)value);
+ }
+ break;
+
+ case PRIVILEGES:
+ if (value == null) {
+ unsetPrivileges();
+ } else {
+ setPrivileges((Set<String>)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case STATUS:
+ return getStatus();
+
+ case PRIVILEGES:
+ return getPrivileges();
+
+ }
+ throw new IllegalStateException();
+ }
+
+ /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+ public boolean isSet(_Fields field) {
+ if (field == null) {
+ throw new IllegalArgumentException();
+ }
+
+ switch (field) {
+ case STATUS:
+ return isSetStatus();
+ case PRIVILEGES:
+ return isSetPrivileges();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof TListSentryPrivilegesForProviderResponse)
+ return this.equals((TListSentryPrivilegesForProviderResponse)that);
+ return false;
+ }
+
+ public boolean equals(TListSentryPrivilegesForProviderResponse that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_status = true && this.isSetStatus();
+ boolean that_present_status = true && that.isSetStatus();
+ if (this_present_status || that_present_status) {
+ if (!(this_present_status && that_present_status))
+ return false;
+ if (!this.status.equals(that.status))
+ return false;
+ }
+
+ boolean this_present_privileges = true && this.isSetPrivileges();
+ boolean that_present_privileges = true && that.isSetPrivileges();
+ if (this_present_privileges || that_present_privileges) {
+ if (!(this_present_privileges && that_present_privileges))
+ return false;
+ if (!this.privileges.equals(that.privileges))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ HashCodeBuilder builder = new HashCodeBuilder();
+
+ boolean present_status = true && (isSetStatus());
+ builder.append(present_status);
+ if (present_status)
+ builder.append(status);
+
+ boolean present_privileges = true && (isSetPrivileges());
+ builder.append(present_privileges);
+ if (present_privileges)
+ builder.append(privileges);
+
+ return builder.toHashCode();
+ }
+
+ public int compareTo(TListSentryPrivilegesForProviderResponse other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+ TListSentryPrivilegesForProviderResponse typedOther = (TListSentryPrivilegesForProviderResponse)other;
+
+ lastComparison = Boolean.valueOf(isSetStatus()).compareTo(typedOther.isSetStatus());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetStatus()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.status, typedOther.status);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetPrivileges()).compareTo(typedOther.isSetPrivileges());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetPrivileges()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.privileges, typedOther.privileges);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ return 0;
+ }
+
+ public _Fields fieldForId(int fieldId) {
+ return _Fields.findByThriftId(fieldId);
+ }
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
+ schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
+ }
+
+ public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
+ schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder("TListSentryPrivilegesForProviderResponse(");
+ boolean first = true;
+
+ sb.append("status:");
+ if (this.status == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.status);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("privileges:");
+ if (this.privileges == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.privileges);
+ }
+ first = false;
+ sb.append(")");
+ return sb.toString();
+ }
+
+ public void validate() throws org.apache.thrift.TException {
+ // check for required fields
+ if (!isSetStatus()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'status' is unset! Struct:" + toString());
+ }
+
+ if (!isSetPrivileges()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'privileges' is unset! Struct:" + toString());
+ }
+
+ // check for sub-struct validity
+ if (status != null) {
+ status.validate();
+ }
+ }
+
+ private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+ try {
+ write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+ try {
+ read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private static class TListSentryPrivilegesForProviderResponseStandardSchemeFactory implements SchemeFactory {
+ public TListSentryPrivilegesForProviderResponseStandardScheme getScheme() {
+ return new TListSentryPrivilegesForProviderResponseStandardScheme();
+ }
+ }
+
+ private static class TListSentryPrivilegesForProviderResponseStandardScheme extends StandardScheme<TListSentryPrivilegesForProviderResponse> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, TListSentryPrivilegesForProviderResponse struct) throws org.apache.thrift.TException {
+ org.apache.thrift.protocol.TField schemeField;
+ iprot.readStructBegin();
+ while (true)
+ {
+ schemeField = iprot.readFieldBegin();
+ if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
+ break;
+ }
+ switch (schemeField.id) {
+ case 1: // STATUS
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+ struct.status = new org.apache.sentry.service.thrift.TSentryResponseStatus();
+ struct.status.read(iprot);
+ struct.setStatusIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 2: // PRIVILEGES
+ if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
+ {
+ org.apache.thrift.protocol.TSet _set56 = iprot.readSetBegin();
+ struct.privileges = new HashSet<String>(2*_set56.size);
+ for (int _i57 = 0; _i57 < _set56.size; ++_i57)
+ {
+ String _elem58; // required
+ _elem58 = iprot.readString();
+ struct.privileges.add(_elem58);
+ }
+ iprot.readSetEnd();
+ }
+ struct.setPrivilegesIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ default:
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+ struct.validate();
+ }
+
+ public void write(org.apache.thrift.protocol.TProtocol oprot, TListSentryPrivilegesForProviderResponse struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.status != null) {
+ oprot.writeFieldBegin(STATUS_FIELD_DESC);
+ struct.status.write(oprot);
+ oprot.writeFieldEnd();
+ }
+ if (struct.privileges != null) {
+ oprot.writeFieldBegin(PRIVILEGES_FIELD_DESC);
+ {
+ oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, struct.privileges.size()));
+ for (String _iter59 : struct.privileges)
+ {
+ oprot.writeString(_iter59);
+ }
+ oprot.writeSetEnd();
+ }
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class TListSentryPrivilegesForProviderResponseTupleSchemeFactory implements SchemeFactory {
+ public TListSentryPrivilegesForProviderResponseTupleScheme getScheme() {
+ return new TListSentryPrivilegesForProviderResponseTupleScheme();
+ }
+ }
+
+ private static class TListSentryPrivilegesForProviderResponseTupleScheme extends TupleScheme<TListSentryPrivilegesForProviderResponse> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, TListSentryPrivilegesForProviderResponse struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ struct.status.write(oprot);
+ {
+ oprot.writeI32(struct.privileges.size());
+ for (String _iter60 : struct.privileges)
+ {
+ oprot.writeString(_iter60);
+ }
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, TListSentryPrivilegesForProviderResponse struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ struct.status = new org.apache.sentry.service.thrift.TSentryResponseStatus();
+ struct.status.read(iprot);
+ struct.setStatusIsSet(true);
+ {
+ org.apache.thrift.protocol.TSet _set61 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
+ struct.privileges = new HashSet<String>(2*_set61.size);
+ for (int _i62 = 0; _i62 < _set61.size; ++_i62)
+ {
+ String _elem63; // required
+ _elem63 = iprot.readString();
+ struct.privileges.add(_elem63);
+ }
+ }
+ struct.setPrivilegesIsSet(true);
+ }
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryPrivilegesRequest.java
----------------------------------------------------------------------
diff --git a/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryPrivilegesRequest.java b/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryPrivilegesRequest.java
new file mode 100644
index 0000000..393ff91
--- /dev/null
+++ b/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryPrivilegesRequest.java
@@ -0,0 +1,702 @@
+/**
+ * Autogenerated by Thrift Compiler (0.9.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+package org.apache.sentry.provider.db.service.thrift;
+
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EnumMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.EnumSet;
+import java.util.Collections;
+import java.util.BitSet;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class TListSentryPrivilegesRequest implements org.apache.thrift.TBase<TListSentryPrivilegesRequest, TListSentryPrivilegesRequest._Fields>, java.io.Serializable, Cloneable {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TListSentryPrivilegesRequest");
+
+ private static final org.apache.thrift.protocol.TField PROTOCOL_VERSION_FIELD_DESC = new org.apache.thrift.protocol.TField("protocol_version", org.apache.thrift.protocol.TType.I32, (short)1);
+ private static final org.apache.thrift.protocol.TField REQUESTOR_USER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("requestorUserName", org.apache.thrift.protocol.TType.STRING, (short)2);
+ private static final org.apache.thrift.protocol.TField ROLE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("roleName", org.apache.thrift.protocol.TType.STRING, (short)4);
+ private static final org.apache.thrift.protocol.TField AUTHORIZABLE_HIERARCHY_FIELD_DESC = new org.apache.thrift.protocol.TField("authorizableHierarchy", org.apache.thrift.protocol.TType.STRUCT, (short)5);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new TListSentryPrivilegesRequestStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new TListSentryPrivilegesRequestTupleSchemeFactory());
+ }
+
+ private int protocol_version; // required
+ private String requestorUserName; // required
+ private String roleName; // required
+ private TSentryAuthorizable authorizableHierarchy; // optional
+
+ /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+ public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+ PROTOCOL_VERSION((short)1, "protocol_version"),
+ REQUESTOR_USER_NAME((short)2, "requestorUserName"),
+ ROLE_NAME((short)4, "roleName"),
+ AUTHORIZABLE_HIERARCHY((short)5, "authorizableHierarchy");
+
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+ static {
+ for (_Fields field : EnumSet.allOf(_Fields.class)) {
+ byName.put(field.getFieldName(), field);
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, or null if its not found.
+ */
+ public static _Fields findByThriftId(int fieldId) {
+ switch(fieldId) {
+ case 1: // PROTOCOL_VERSION
+ return PROTOCOL_VERSION;
+ case 2: // REQUESTOR_USER_NAME
+ return REQUESTOR_USER_NAME;
+ case 4: // ROLE_NAME
+ return ROLE_NAME;
+ case 5: // AUTHORIZABLE_HIERARCHY
+ return AUTHORIZABLE_HIERARCHY;
+ default:
+ return null;
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, throwing an exception
+ * if it is not found.
+ */
+ public static _Fields findByThriftIdOrThrow(int fieldId) {
+ _Fields fields = findByThriftId(fieldId);
+ if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+ return fields;
+ }
+
+ /**
+ * Find the _Fields constant that matches name, or null if its not found.
+ */
+ public static _Fields findByName(String name) {
+ return byName.get(name);
+ }
+
+ private final short _thriftId;
+ private final String _fieldName;
+
+ _Fields(short thriftId, String fieldName) {
+ _thriftId = thriftId;
+ _fieldName = fieldName;
+ }
+
+ public short getThriftFieldId() {
+ return _thriftId;
+ }
+
+ public String getFieldName() {
+ return _fieldName;
+ }
+ }
+
+ // isset id assignments
+ private static final int __PROTOCOL_VERSION_ISSET_ID = 0;
+ private byte __isset_bitfield = 0;
+ private _Fields optionals[] = {_Fields.AUTHORIZABLE_HIERARCHY};
+ public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+ static {
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+ tmpMap.put(_Fields.PROTOCOL_VERSION, new org.apache.thrift.meta_data.FieldMetaData("protocol_version", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
+ tmpMap.put(_Fields.REQUESTOR_USER_NAME, new org.apache.thrift.meta_data.FieldMetaData("requestorUserName", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields.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.AUTHORIZABLE_HIERARCHY, new org.apache.thrift.meta_data.FieldMetaData("authorizableHierarchy", org.apache.thrift.TFieldRequirementType.OPTIONAL,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TSentryAuthorizable.class)));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TListSentryPrivilegesRequest.class, metaDataMap);
+ }
+
+ public TListSentryPrivilegesRequest() {
+ this.protocol_version = 1;
+
+ }
+
+ public TListSentryPrivilegesRequest(
+ int protocol_version,
+ String requestorUserName,
+ String roleName)
+ {
+ this();
+ this.protocol_version = protocol_version;
+ setProtocol_versionIsSet(true);
+ this.requestorUserName = requestorUserName;
+ this.roleName = roleName;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public TListSentryPrivilegesRequest(TListSentryPrivilegesRequest other) {
+ __isset_bitfield = other.__isset_bitfield;
+ this.protocol_version = other.protocol_version;
+ if (other.isSetRequestorUserName()) {
+ this.requestorUserName = other.requestorUserName;
+ }
+ if (other.isSetRoleName()) {
+ this.roleName = other.roleName;
+ }
+ if (other.isSetAuthorizableHierarchy()) {
+ this.authorizableHierarchy = new TSentryAuthorizable(other.authorizableHierarchy);
+ }
+ }
+
+ public TListSentryPrivilegesRequest deepCopy() {
+ return new TListSentryPrivilegesRequest(this);
+ }
+
+ @Override
+ public void clear() {
+ this.protocol_version = 1;
+
+ this.requestorUserName = null;
+ this.roleName = null;
+ this.authorizableHierarchy = null;
+ }
+
+ public int getProtocol_version() {
+ return this.protocol_version;
+ }
+
+ public void setProtocol_version(int protocol_version) {
+ this.protocol_version = protocol_version;
+ setProtocol_versionIsSet(true);
+ }
+
+ public void unsetProtocol_version() {
+ __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __PROTOCOL_VERSION_ISSET_ID);
+ }
+
+ /** Returns true if field protocol_version is set (has been assigned a value) and false otherwise */
+ public boolean isSetProtocol_version() {
+ return EncodingUtils.testBit(__isset_bitfield, __PROTOCOL_VERSION_ISSET_ID);
+ }
+
+ public void setProtocol_versionIsSet(boolean value) {
+ __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __PROTOCOL_VERSION_ISSET_ID, value);
+ }
+
+ public String getRequestorUserName() {
+ return this.requestorUserName;
+ }
+
+ public void setRequestorUserName(String requestorUserName) {
+ this.requestorUserName = requestorUserName;
+ }
+
+ public void unsetRequestorUserName() {
+ this.requestorUserName = null;
+ }
+
+ /** Returns true if field requestorUserName is set (has been assigned a value) and false otherwise */
+ public boolean isSetRequestorUserName() {
+ return this.requestorUserName != null;
+ }
+
+ public void setRequestorUserNameIsSet(boolean value) {
+ if (!value) {
+ this.requestorUserName = null;
+ }
+ }
+
+ public 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 TSentryAuthorizable getAuthorizableHierarchy() {
+ return this.authorizableHierarchy;
+ }
+
+ public void setAuthorizableHierarchy(TSentryAuthorizable authorizableHierarchy) {
+ this.authorizableHierarchy = authorizableHierarchy;
+ }
+
+ public void unsetAuthorizableHierarchy() {
+ this.authorizableHierarchy = null;
+ }
+
+ /** Returns true if field authorizableHierarchy is set (has been assigned a value) and false otherwise */
+ public boolean isSetAuthorizableHierarchy() {
+ return this.authorizableHierarchy != null;
+ }
+
+ public void setAuthorizableHierarchyIsSet(boolean value) {
+ if (!value) {
+ this.authorizableHierarchy = null;
+ }
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case PROTOCOL_VERSION:
+ if (value == null) {
+ unsetProtocol_version();
+ } else {
+ setProtocol_version((Integer)value);
+ }
+ break;
+
+ case REQUESTOR_USER_NAME:
+ if (value == null) {
+ unsetRequestorUserName();
+ } else {
+ setRequestorUserName((String)value);
+ }
+ break;
+
+ case ROLE_NAME:
+ if (value == null) {
+ unsetRoleName();
+ } else {
+ setRoleName((String)value);
+ }
+ break;
+
+ case AUTHORIZABLE_HIERARCHY:
+ if (value == null) {
+ unsetAuthorizableHierarchy();
+ } else {
+ setAuthorizableHierarchy((TSentryAuthorizable)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case PROTOCOL_VERSION:
+ return Integer.valueOf(getProtocol_version());
+
+ case REQUESTOR_USER_NAME:
+ return getRequestorUserName();
+
+ case ROLE_NAME:
+ return getRoleName();
+
+ case AUTHORIZABLE_HIERARCHY:
+ return getAuthorizableHierarchy();
+
+ }
+ throw new IllegalStateException();
+ }
+
+ /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+ public boolean isSet(_Fields field) {
+ if (field == null) {
+ throw new IllegalArgumentException();
+ }
+
+ switch (field) {
+ case PROTOCOL_VERSION:
+ return isSetProtocol_version();
+ case REQUESTOR_USER_NAME:
+ return isSetRequestorUserName();
+ case ROLE_NAME:
+ return isSetRoleName();
+ case AUTHORIZABLE_HIERARCHY:
+ return isSetAuthorizableHierarchy();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof TListSentryPrivilegesRequest)
+ return this.equals((TListSentryPrivilegesRequest)that);
+ return false;
+ }
+
+ public boolean equals(TListSentryPrivilegesRequest that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_protocol_version = true;
+ boolean that_present_protocol_version = true;
+ if (this_present_protocol_version || that_present_protocol_version) {
+ if (!(this_present_protocol_version && that_present_protocol_version))
+ return false;
+ if (this.protocol_version != that.protocol_version)
+ return false;
+ }
+
+ boolean this_present_requestorUserName = true && this.isSetRequestorUserName();
+ boolean that_present_requestorUserName = true && that.isSetRequestorUserName();
+ if (this_present_requestorUserName || that_present_requestorUserName) {
+ if (!(this_present_requestorUserName && that_present_requestorUserName))
+ return false;
+ if (!this.requestorUserName.equals(that.requestorUserName))
+ return false;
+ }
+
+ boolean this_present_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_authorizableHierarchy = true && this.isSetAuthorizableHierarchy();
+ boolean that_present_authorizableHierarchy = true && that.isSetAuthorizableHierarchy();
+ if (this_present_authorizableHierarchy || that_present_authorizableHierarchy) {
+ if (!(this_present_authorizableHierarchy && that_present_authorizableHierarchy))
+ return false;
+ if (!this.authorizableHierarchy.equals(that.authorizableHierarchy))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ HashCodeBuilder builder = new HashCodeBuilder();
+
+ boolean present_protocol_version = true;
+ builder.append(present_protocol_version);
+ if (present_protocol_version)
+ builder.append(protocol_version);
+
+ boolean present_requestorUserName = true && (isSetRequestorUserName());
+ builder.append(present_requestorUserName);
+ if (present_requestorUserName)
+ builder.append(requestorUserName);
+
+ boolean present_roleName = true && (isSetRoleName());
+ builder.append(present_roleName);
+ if (present_roleName)
+ builder.append(roleName);
+
+ boolean present_authorizableHierarchy = true && (isSetAuthorizableHierarchy());
+ builder.append(present_authorizableHierarchy);
+ if (present_authorizableHierarchy)
+ builder.append(authorizableHierarchy);
+
+ return builder.toHashCode();
+ }
+
+ public int compareTo(TListSentryPrivilegesRequest other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+ TListSentryPrivilegesRequest typedOther = (TListSentryPrivilegesRequest)other;
+
+ lastComparison = Boolean.valueOf(isSetProtocol_version()).compareTo(typedOther.isSetProtocol_version());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetProtocol_version()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.protocol_version, typedOther.protocol_version);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetRequestorUserName()).compareTo(typedOther.isSetRequestorUserName());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetRequestorUserName()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.requestorUserName, typedOther.requestorUserName);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetRoleName()).compareTo(typedOther.isSetRoleName());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetRoleName()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.roleName, typedOther.roleName);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetAuthorizableHierarchy()).compareTo(typedOther.isSetAuthorizableHierarchy());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetAuthorizableHierarchy()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.authorizableHierarchy, typedOther.authorizableHierarchy);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ return 0;
+ }
+
+ public _Fields fieldForId(int fieldId) {
+ return _Fields.findByThriftId(fieldId);
+ }
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
+ schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
+ }
+
+ public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
+ schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder("TListSentryPrivilegesRequest(");
+ boolean first = true;
+
+ sb.append("protocol_version:");
+ sb.append(this.protocol_version);
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("requestorUserName:");
+ if (this.requestorUserName == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.requestorUserName);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("roleName:");
+ if (this.roleName == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.roleName);
+ }
+ first = false;
+ if (isSetAuthorizableHierarchy()) {
+ if (!first) sb.append(", ");
+ sb.append("authorizableHierarchy:");
+ if (this.authorizableHierarchy == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.authorizableHierarchy);
+ }
+ first = false;
+ }
+ sb.append(")");
+ return sb.toString();
+ }
+
+ public void validate() throws org.apache.thrift.TException {
+ // check for required fields
+ if (!isSetProtocol_version()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'protocol_version' is unset! Struct:" + toString());
+ }
+
+ if (!isSetRequestorUserName()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'requestorUserName' is unset! Struct:" + toString());
+ }
+
+ if (!isSetRoleName()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'roleName' is unset! Struct:" + toString());
+ }
+
+ // check for sub-struct validity
+ if (authorizableHierarchy != null) {
+ authorizableHierarchy.validate();
+ }
+ }
+
+ private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+ try {
+ write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+ try {
+ // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
+ __isset_bitfield = 0;
+ read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private static class TListSentryPrivilegesRequestStandardSchemeFactory implements SchemeFactory {
+ public TListSentryPrivilegesRequestStandardScheme getScheme() {
+ return new TListSentryPrivilegesRequestStandardScheme();
+ }
+ }
+
+ private static class TListSentryPrivilegesRequestStandardScheme extends StandardScheme<TListSentryPrivilegesRequest> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, TListSentryPrivilegesRequest struct) throws org.apache.thrift.TException {
+ org.apache.thrift.protocol.TField schemeField;
+ iprot.readStructBegin();
+ while (true)
+ {
+ schemeField = iprot.readFieldBegin();
+ if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
+ break;
+ }
+ switch (schemeField.id) {
+ case 1: // PROTOCOL_VERSION
+ if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
+ struct.protocol_version = iprot.readI32();
+ struct.setProtocol_versionIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 2: // REQUESTOR_USER_NAME
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.requestorUserName = iprot.readString();
+ struct.setRequestorUserNameIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 4: // ROLE_NAME
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.roleName = iprot.readString();
+ struct.setRoleNameIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 5: // AUTHORIZABLE_HIERARCHY
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+ struct.authorizableHierarchy = new TSentryAuthorizable();
+ struct.authorizableHierarchy.read(iprot);
+ struct.setAuthorizableHierarchyIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ default:
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+ struct.validate();
+ }
+
+ public void write(org.apache.thrift.protocol.TProtocol oprot, TListSentryPrivilegesRequest struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ oprot.writeFieldBegin(PROTOCOL_VERSION_FIELD_DESC);
+ oprot.writeI32(struct.protocol_version);
+ oprot.writeFieldEnd();
+ if (struct.requestorUserName != null) {
+ oprot.writeFieldBegin(REQUESTOR_USER_NAME_FIELD_DESC);
+ oprot.writeString(struct.requestorUserName);
+ oprot.writeFieldEnd();
+ }
+ if (struct.roleName != null) {
+ oprot.writeFieldBegin(ROLE_NAME_FIELD_DESC);
+ oprot.writeString(struct.roleName);
+ oprot.writeFieldEnd();
+ }
+ if (struct.authorizableHierarchy != null) {
+ if (struct.isSetAuthorizableHierarchy()) {
+ oprot.writeFieldBegin(AUTHORIZABLE_HIERARCHY_FIELD_DESC);
+ struct.authorizableHierarchy.write(oprot);
+ oprot.writeFieldEnd();
+ }
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class TListSentryPrivilegesRequestTupleSchemeFactory implements SchemeFactory {
+ public TListSentryPrivilegesRequestTupleScheme getScheme() {
+ return new TListSentryPrivilegesRequestTupleScheme();
+ }
+ }
+
+ private static class TListSentryPrivilegesRequestTupleScheme extends TupleScheme<TListSentryPrivilegesRequest> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, TListSentryPrivilegesRequest struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ oprot.writeI32(struct.protocol_version);
+ oprot.writeString(struct.requestorUserName);
+ oprot.writeString(struct.roleName);
+ BitSet optionals = new BitSet();
+ if (struct.isSetAuthorizableHierarchy()) {
+ optionals.set(0);
+ }
+ oprot.writeBitSet(optionals, 1);
+ if (struct.isSetAuthorizableHierarchy()) {
+ struct.authorizableHierarchy.write(oprot);
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, TListSentryPrivilegesRequest struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ struct.protocol_version = iprot.readI32();
+ struct.setProtocol_versionIsSet(true);
+ struct.requestorUserName = iprot.readString();
+ struct.setRequestorUserNameIsSet(true);
+ struct.roleName = iprot.readString();
+ struct.setRoleNameIsSet(true);
+ BitSet incoming = iprot.readBitSet(1);
+ if (incoming.get(0)) {
+ struct.authorizableHierarchy = new TSentryAuthorizable();
+ struct.authorizableHierarchy.read(iprot);
+ struct.setAuthorizableHierarchyIsSet(true);
+ }
+ }
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryPrivilegesResponse.java
----------------------------------------------------------------------
diff --git a/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryPrivilegesResponse.java b/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryPrivilegesResponse.java
new file mode 100644
index 0000000..d34205a
--- /dev/null
+++ b/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryPrivilegesResponse.java
@@ -0,0 +1,554 @@
+/**
+ * Autogenerated by Thrift Compiler (0.9.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+package org.apache.sentry.provider.db.service.thrift;
+
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EnumMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.EnumSet;
+import java.util.Collections;
+import java.util.BitSet;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class TListSentryPrivilegesResponse implements org.apache.thrift.TBase<TListSentryPrivilegesResponse, TListSentryPrivilegesResponse._Fields>, java.io.Serializable, Cloneable {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TListSentryPrivilegesResponse");
+
+ private static final org.apache.thrift.protocol.TField STATUS_FIELD_DESC = new org.apache.thrift.protocol.TField("status", org.apache.thrift.protocol.TType.STRUCT, (short)1);
+ private static final org.apache.thrift.protocol.TField PRIVILEGES_FIELD_DESC = new org.apache.thrift.protocol.TField("privileges", org.apache.thrift.protocol.TType.SET, (short)2);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new TListSentryPrivilegesResponseStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new TListSentryPrivilegesResponseTupleSchemeFactory());
+ }
+
+ private org.apache.sentry.service.thrift.TSentryResponseStatus status; // required
+ private Set<TSentryPrivilege> privileges; // 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 {
+ STATUS((short)1, "status"),
+ PRIVILEGES((short)2, "privileges");
+
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+ static {
+ for (_Fields field : EnumSet.allOf(_Fields.class)) {
+ byName.put(field.getFieldName(), field);
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, or null if its not found.
+ */
+ public static _Fields findByThriftId(int fieldId) {
+ switch(fieldId) {
+ case 1: // STATUS
+ return STATUS;
+ case 2: // PRIVILEGES
+ return PRIVILEGES;
+ default:
+ return null;
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, throwing an exception
+ * if it is not found.
+ */
+ public static _Fields findByThriftIdOrThrow(int fieldId) {
+ _Fields fields = findByThriftId(fieldId);
+ if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+ return fields;
+ }
+
+ /**
+ * Find the _Fields constant that matches name, or null if its not found.
+ */
+ public static _Fields findByName(String name) {
+ return byName.get(name);
+ }
+
+ private final short _thriftId;
+ private final String _fieldName;
+
+ _Fields(short thriftId, String fieldName) {
+ _thriftId = thriftId;
+ _fieldName = fieldName;
+ }
+
+ public short getThriftFieldId() {
+ return _thriftId;
+ }
+
+ public String getFieldName() {
+ return _fieldName;
+ }
+ }
+
+ // isset id assignments
+ private _Fields optionals[] = {_Fields.PRIVILEGES};
+ public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+ static {
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+ tmpMap.put(_Fields.STATUS, new org.apache.thrift.meta_data.FieldMetaData("status", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.sentry.service.thrift.TSentryResponseStatus.class)));
+ tmpMap.put(_Fields.PRIVILEGES, new org.apache.thrift.meta_data.FieldMetaData("privileges", org.apache.thrift.TFieldRequirementType.OPTIONAL,
+ new org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TSentryPrivilege.class))));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TListSentryPrivilegesResponse.class, metaDataMap);
+ }
+
+ public TListSentryPrivilegesResponse() {
+ }
+
+ public TListSentryPrivilegesResponse(
+ org.apache.sentry.service.thrift.TSentryResponseStatus status)
+ {
+ this();
+ this.status = status;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public TListSentryPrivilegesResponse(TListSentryPrivilegesResponse other) {
+ if (other.isSetStatus()) {
+ this.status = new org.apache.sentry.service.thrift.TSentryResponseStatus(other.status);
+ }
+ if (other.isSetPrivileges()) {
+ Set<TSentryPrivilege> __this__privileges = new HashSet<TSentryPrivilege>();
+ for (TSentryPrivilege other_element : other.privileges) {
+ __this__privileges.add(new TSentryPrivilege(other_element));
+ }
+ this.privileges = __this__privileges;
+ }
+ }
+
+ public TListSentryPrivilegesResponse deepCopy() {
+ return new TListSentryPrivilegesResponse(this);
+ }
+
+ @Override
+ public void clear() {
+ this.status = null;
+ this.privileges = null;
+ }
+
+ public org.apache.sentry.service.thrift.TSentryResponseStatus getStatus() {
+ return this.status;
+ }
+
+ public void setStatus(org.apache.sentry.service.thrift.TSentryResponseStatus status) {
+ this.status = status;
+ }
+
+ public void unsetStatus() {
+ this.status = null;
+ }
+
+ /** Returns true if field status is set (has been assigned a value) and false otherwise */
+ public boolean isSetStatus() {
+ return this.status != null;
+ }
+
+ public void setStatusIsSet(boolean value) {
+ if (!value) {
+ this.status = null;
+ }
+ }
+
+ public int getPrivilegesSize() {
+ return (this.privileges == null) ? 0 : this.privileges.size();
+ }
+
+ public java.util.Iterator<TSentryPrivilege> getPrivilegesIterator() {
+ return (this.privileges == null) ? null : this.privileges.iterator();
+ }
+
+ public void addToPrivileges(TSentryPrivilege elem) {
+ if (this.privileges == null) {
+ this.privileges = new HashSet<TSentryPrivilege>();
+ }
+ this.privileges.add(elem);
+ }
+
+ public Set<TSentryPrivilege> getPrivileges() {
+ return this.privileges;
+ }
+
+ public void setPrivileges(Set<TSentryPrivilege> privileges) {
+ this.privileges = privileges;
+ }
+
+ public void unsetPrivileges() {
+ this.privileges = null;
+ }
+
+ /** Returns true if field privileges is set (has been assigned a value) and false otherwise */
+ public boolean isSetPrivileges() {
+ return this.privileges != null;
+ }
+
+ public void setPrivilegesIsSet(boolean value) {
+ if (!value) {
+ this.privileges = null;
+ }
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case STATUS:
+ if (value == null) {
+ unsetStatus();
+ } else {
+ setStatus((org.apache.sentry.service.thrift.TSentryResponseStatus)value);
+ }
+ break;
+
+ case PRIVILEGES:
+ if (value == null) {
+ unsetPrivileges();
+ } else {
+ setPrivileges((Set<TSentryPrivilege>)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case STATUS:
+ return getStatus();
+
+ case PRIVILEGES:
+ return getPrivileges();
+
+ }
+ throw new IllegalStateException();
+ }
+
+ /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+ public boolean isSet(_Fields field) {
+ if (field == null) {
+ throw new IllegalArgumentException();
+ }
+
+ switch (field) {
+ case STATUS:
+ return isSetStatus();
+ case PRIVILEGES:
+ return isSetPrivileges();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof TListSentryPrivilegesResponse)
+ return this.equals((TListSentryPrivilegesResponse)that);
+ return false;
+ }
+
+ public boolean equals(TListSentryPrivilegesResponse that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_status = true && this.isSetStatus();
+ boolean that_present_status = true && that.isSetStatus();
+ if (this_present_status || that_present_status) {
+ if (!(this_present_status && that_present_status))
+ return false;
+ if (!this.status.equals(that.status))
+ return false;
+ }
+
+ boolean this_present_privileges = true && this.isSetPrivileges();
+ boolean that_present_privileges = true && that.isSetPrivileges();
+ if (this_present_privileges || that_present_privileges) {
+ if (!(this_present_privileges && that_present_privileges))
+ return false;
+ if (!this.privileges.equals(that.privileges))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ HashCodeBuilder builder = new HashCodeBuilder();
+
+ boolean present_status = true && (isSetStatus());
+ builder.append(present_status);
+ if (present_status)
+ builder.append(status);
+
+ boolean present_privileges = true && (isSetPrivileges());
+ builder.append(present_privileges);
+ if (present_privileges)
+ builder.append(privileges);
+
+ return builder.toHashCode();
+ }
+
+ public int compareTo(TListSentryPrivilegesResponse other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+ TListSentryPrivilegesResponse typedOther = (TListSentryPrivilegesResponse)other;
+
+ lastComparison = Boolean.valueOf(isSetStatus()).compareTo(typedOther.isSetStatus());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetStatus()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.status, typedOther.status);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetPrivileges()).compareTo(typedOther.isSetPrivileges());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetPrivileges()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.privileges, typedOther.privileges);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ return 0;
+ }
+
+ public _Fields fieldForId(int fieldId) {
+ return _Fields.findByThriftId(fieldId);
+ }
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
+ schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
+ }
+
+ public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
+ schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder("TListSentryPrivilegesResponse(");
+ boolean first = true;
+
+ sb.append("status:");
+ if (this.status == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.status);
+ }
+ first = false;
+ if (isSetPrivileges()) {
+ if (!first) sb.append(", ");
+ sb.append("privileges:");
+ if (this.privileges == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.privileges);
+ }
+ first = false;
+ }
+ sb.append(")");
+ return sb.toString();
+ }
+
+ public void validate() throws org.apache.thrift.TException {
+ // check for required fields
+ if (!isSetStatus()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'status' is unset! Struct:" + toString());
+ }
+
+ // check for sub-struct validity
+ if (status != null) {
+ status.validate();
+ }
+ }
+
+ private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+ try {
+ write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+ try {
+ read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private static class TListSentryPrivilegesResponseStandardSchemeFactory implements SchemeFactory {
+ public TListSentryPrivilegesResponseStandardScheme getScheme() {
+ return new TListSentryPrivilegesResponseStandardScheme();
+ }
+ }
+
+ private static class TListSentryPrivilegesResponseStandardScheme extends StandardScheme<TListSentryPrivilegesResponse> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, TListSentryPrivilegesResponse struct) throws org.apache.thrift.TException {
+ org.apache.thrift.protocol.TField schemeField;
+ iprot.readStructBegin();
+ while (true)
+ {
+ schemeField = iprot.readFieldBegin();
+ if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
+ break;
+ }
+ switch (schemeField.id) {
+ case 1: // STATUS
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+ struct.status = new org.apache.sentry.service.thrift.TSentryResponseStatus();
+ struct.status.read(iprot);
+ struct.setStatusIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 2: // PRIVILEGES
+ if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
+ {
+ org.apache.thrift.protocol.TSet _set32 = iprot.readSetBegin();
+ struct.privileges = new HashSet<TSentryPrivilege>(2*_set32.size);
+ for (int _i33 = 0; _i33 < _set32.size; ++_i33)
+ {
+ TSentryPrivilege _elem34; // required
+ _elem34 = new TSentryPrivilege();
+ _elem34.read(iprot);
+ struct.privileges.add(_elem34);
+ }
+ iprot.readSetEnd();
+ }
+ struct.setPrivilegesIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ default:
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+ struct.validate();
+ }
+
+ public void write(org.apache.thrift.protocol.TProtocol oprot, TListSentryPrivilegesResponse struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.status != null) {
+ oprot.writeFieldBegin(STATUS_FIELD_DESC);
+ struct.status.write(oprot);
+ oprot.writeFieldEnd();
+ }
+ if (struct.privileges != null) {
+ if (struct.isSetPrivileges()) {
+ oprot.writeFieldBegin(PRIVILEGES_FIELD_DESC);
+ {
+ oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, struct.privileges.size()));
+ for (TSentryPrivilege _iter35 : struct.privileges)
+ {
+ _iter35.write(oprot);
+ }
+ oprot.writeSetEnd();
+ }
+ oprot.writeFieldEnd();
+ }
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class TListSentryPrivilegesResponseTupleSchemeFactory implements SchemeFactory {
+ public TListSentryPrivilegesResponseTupleScheme getScheme() {
+ return new TListSentryPrivilegesResponseTupleScheme();
+ }
+ }
+
+ private static class TListSentryPrivilegesResponseTupleScheme extends TupleScheme<TListSentryPrivilegesResponse> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, TListSentryPrivilegesResponse struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ struct.status.write(oprot);
+ BitSet optionals = new BitSet();
+ if (struct.isSetPrivileges()) {
+ optionals.set(0);
+ }
+ oprot.writeBitSet(optionals, 1);
+ if (struct.isSetPrivileges()) {
+ {
+ oprot.writeI32(struct.privileges.size());
+ for (TSentryPrivilege _iter36 : struct.privileges)
+ {
+ _iter36.write(oprot);
+ }
+ }
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, TListSentryPrivilegesResponse struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ struct.status = new org.apache.sentry.service.thrift.TSentryResponseStatus();
+ struct.status.read(iprot);
+ struct.setStatusIsSet(true);
+ BitSet incoming = iprot.readBitSet(1);
+ if (incoming.get(0)) {
+ {
+ org.apache.thrift.protocol.TSet _set37 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
+ struct.privileges = new HashSet<TSentryPrivilege>(2*_set37.size);
+ for (int _i38 = 0; _i38 < _set37.size; ++_i38)
+ {
+ TSentryPrivilege _elem39; // required
+ _elem39 = new TSentryPrivilege();
+ _elem39.read(iprot);
+ struct.privileges.add(_elem39);
+ }
+ }
+ struct.setPrivilegesIsSet(true);
+ }
+ }
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryRolesRequest.java
----------------------------------------------------------------------
diff --git a/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryRolesRequest.java b/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryRolesRequest.java
new file mode 100644
index 0000000..4eec1ed
--- /dev/null
+++ b/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryRolesRequest.java
@@ -0,0 +1,596 @@
+/**
+ * Autogenerated by Thrift Compiler (0.9.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+package org.apache.sentry.provider.db.service.thrift;
+
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EnumMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.EnumSet;
+import java.util.Collections;
+import java.util.BitSet;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class TListSentryRolesRequest implements org.apache.thrift.TBase<TListSentryRolesRequest, TListSentryRolesRequest._Fields>, java.io.Serializable, Cloneable {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TListSentryRolesRequest");
+
+ private static final org.apache.thrift.protocol.TField PROTOCOL_VERSION_FIELD_DESC = new org.apache.thrift.protocol.TField("protocol_version", org.apache.thrift.protocol.TType.I32, (short)1);
+ private static final org.apache.thrift.protocol.TField REQUESTOR_USER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("requestorUserName", org.apache.thrift.protocol.TType.STRING, (short)2);
+ private static final org.apache.thrift.protocol.TField GROUP_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("groupName", 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 TListSentryRolesRequestStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new TListSentryRolesRequestTupleSchemeFactory());
+ }
+
+ private int protocol_version; // required
+ private String requestorUserName; // required
+ private String groupName; // optional
+
+ /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+ public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+ PROTOCOL_VERSION((short)1, "protocol_version"),
+ REQUESTOR_USER_NAME((short)2, "requestorUserName"),
+ GROUP_NAME((short)3, "groupName");
+
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+ static {
+ for (_Fields field : EnumSet.allOf(_Fields.class)) {
+ byName.put(field.getFieldName(), field);
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, or null if its not found.
+ */
+ public static _Fields findByThriftId(int fieldId) {
+ switch(fieldId) {
+ case 1: // PROTOCOL_VERSION
+ return PROTOCOL_VERSION;
+ case 2: // REQUESTOR_USER_NAME
+ return REQUESTOR_USER_NAME;
+ case 3: // GROUP_NAME
+ return GROUP_NAME;
+ default:
+ return null;
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, throwing an exception
+ * if it is not found.
+ */
+ public static _Fields findByThriftIdOrThrow(int fieldId) {
+ _Fields fields = findByThriftId(fieldId);
+ if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+ return fields;
+ }
+
+ /**
+ * Find the _Fields constant that matches name, or null if its not found.
+ */
+ public static _Fields findByName(String name) {
+ return byName.get(name);
+ }
+
+ private final short _thriftId;
+ private final String _fieldName;
+
+ _Fields(short thriftId, String fieldName) {
+ _thriftId = thriftId;
+ _fieldName = fieldName;
+ }
+
+ public short getThriftFieldId() {
+ return _thriftId;
+ }
+
+ public String getFieldName() {
+ return _fieldName;
+ }
+ }
+
+ // isset id assignments
+ private static final int __PROTOCOL_VERSION_ISSET_ID = 0;
+ private byte __isset_bitfield = 0;
+ private _Fields optionals[] = {_Fields.GROUP_NAME};
+ public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+ static {
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+ tmpMap.put(_Fields.PROTOCOL_VERSION, new org.apache.thrift.meta_data.FieldMetaData("protocol_version", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
+ tmpMap.put(_Fields.REQUESTOR_USER_NAME, new org.apache.thrift.meta_data.FieldMetaData("requestorUserName", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields.GROUP_NAME, new org.apache.thrift.meta_data.FieldMetaData("groupName", org.apache.thrift.TFieldRequirementType.OPTIONAL,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TListSentryRolesRequest.class, metaDataMap);
+ }
+
+ public TListSentryRolesRequest() {
+ this.protocol_version = 1;
+
+ }
+
+ public TListSentryRolesRequest(
+ int protocol_version,
+ String requestorUserName)
+ {
+ this();
+ this.protocol_version = protocol_version;
+ setProtocol_versionIsSet(true);
+ this.requestorUserName = requestorUserName;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public TListSentryRolesRequest(TListSentryRolesRequest other) {
+ __isset_bitfield = other.__isset_bitfield;
+ this.protocol_version = other.protocol_version;
+ if (other.isSetRequestorUserName()) {
+ this.requestorUserName = other.requestorUserName;
+ }
+ if (other.isSetGroupName()) {
+ this.groupName = other.groupName;
+ }
+ }
+
+ public TListSentryRolesRequest deepCopy() {
+ return new TListSentryRolesRequest(this);
+ }
+
+ @Override
+ public void clear() {
+ this.protocol_version = 1;
+
+ this.requestorUserName = null;
+ this.groupName = null;
+ }
+
+ public int getProtocol_version() {
+ return this.protocol_version;
+ }
+
+ public void setProtocol_version(int protocol_version) {
+ this.protocol_version = protocol_version;
+ setProtocol_versionIsSet(true);
+ }
+
+ public void unsetProtocol_version() {
+ __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __PROTOCOL_VERSION_ISSET_ID);
+ }
+
+ /** Returns true if field protocol_version is set (has been assigned a value) and false otherwise */
+ public boolean isSetProtocol_version() {
+ return EncodingUtils.testBit(__isset_bitfield, __PROTOCOL_VERSION_ISSET_ID);
+ }
+
+ public void setProtocol_versionIsSet(boolean value) {
+ __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __PROTOCOL_VERSION_ISSET_ID, value);
+ }
+
+ public String getRequestorUserName() {
+ return this.requestorUserName;
+ }
+
+ public void setRequestorUserName(String requestorUserName) {
+ this.requestorUserName = requestorUserName;
+ }
+
+ public void unsetRequestorUserName() {
+ this.requestorUserName = null;
+ }
+
+ /** Returns true if field requestorUserName is set (has been assigned a value) and false otherwise */
+ public boolean isSetRequestorUserName() {
+ return this.requestorUserName != null;
+ }
+
+ public void setRequestorUserNameIsSet(boolean value) {
+ if (!value) {
+ this.requestorUserName = null;
+ }
+ }
+
+ public String getGroupName() {
+ return this.groupName;
+ }
+
+ public void setGroupName(String groupName) {
+ this.groupName = groupName;
+ }
+
+ public void unsetGroupName() {
+ this.groupName = null;
+ }
+
+ /** Returns true if field groupName is set (has been assigned a value) and false otherwise */
+ public boolean isSetGroupName() {
+ return this.groupName != null;
+ }
+
+ public void setGroupNameIsSet(boolean value) {
+ if (!value) {
+ this.groupName = null;
+ }
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case PROTOCOL_VERSION:
+ if (value == null) {
+ unsetProtocol_version();
+ } else {
+ setProtocol_version((Integer)value);
+ }
+ break;
+
+ case REQUESTOR_USER_NAME:
+ if (value == null) {
+ unsetRequestorUserName();
+ } else {
+ setRequestorUserName((String)value);
+ }
+ break;
+
+ case GROUP_NAME:
+ if (value == null) {
+ unsetGroupName();
+ } else {
+ setGroupName((String)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case PROTOCOL_VERSION:
+ return Integer.valueOf(getProtocol_version());
+
+ case REQUESTOR_USER_NAME:
+ return getRequestorUserName();
+
+ case GROUP_NAME:
+ return getGroupName();
+
+ }
+ throw new IllegalStateException();
+ }
+
+ /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+ public boolean isSet(_Fields field) {
+ if (field == null) {
+ throw new IllegalArgumentException();
+ }
+
+ switch (field) {
+ case PROTOCOL_VERSION:
+ return isSetProtocol_version();
+ case REQUESTOR_USER_NAME:
+ return isSetRequestorUserName();
+ case GROUP_NAME:
+ return isSetGroupName();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof TListSentryRolesRequest)
+ return this.equals((TListSentryRolesRequest)that);
+ return false;
+ }
+
+ public boolean equals(TListSentryRolesRequest that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_protocol_version = true;
+ boolean that_present_protocol_version = true;
+ if (this_present_protocol_version || that_present_protocol_version) {
+ if (!(this_present_protocol_version && that_present_protocol_version))
+ return false;
+ if (this.protocol_version != that.protocol_version)
+ return false;
+ }
+
+ boolean this_present_requestorUserName = true && this.isSetRequestorUserName();
+ boolean that_present_requestorUserName = true && that.isSetRequestorUserName();
+ if (this_present_requestorUserName || that_present_requestorUserName) {
+ if (!(this_present_requestorUserName && that_present_requestorUserName))
+ return false;
+ if (!this.requestorUserName.equals(that.requestorUserName))
+ return false;
+ }
+
+ boolean this_present_groupName = true && this.isSetGroupName();
+ boolean that_present_groupName = true && that.isSetGroupName();
+ if (this_present_groupName || that_present_groupName) {
+ if (!(this_present_groupName && that_present_groupName))
+ return false;
+ if (!this.groupName.equals(that.groupName))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ HashCodeBuilder builder = new HashCodeBuilder();
+
+ boolean present_protocol_version = true;
+ builder.append(present_protocol_version);
+ if (present_protocol_version)
+ builder.append(protocol_version);
+
+ boolean present_requestorUserName = true && (isSetRequestorUserName());
+ builder.append(present_requestorUserName);
+ if (present_requestorUserName)
+ builder.append(requestorUserName);
+
+ boolean present_groupName = true && (isSetGroupName());
+ builder.append(present_groupName);
+ if (present_groupName)
+ builder.append(groupName);
+
+ return builder.toHashCode();
+ }
+
+ public int compareTo(TListSentryRolesRequest other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+ TListSentryRolesRequest typedOther = (TListSentryRolesRequest)other;
+
+ lastComparison = Boolean.valueOf(isSetProtocol_version()).compareTo(typedOther.isSetProtocol_version());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetProtocol_version()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.protocol_version, typedOther.protocol_version);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetRequestorUserName()).compareTo(typedOther.isSetRequestorUserName());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetRequestorUserName()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.requestorUserName, typedOther.requestorUserName);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetGroupName()).compareTo(typedOther.isSetGroupName());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetGroupName()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.groupName, typedOther.groupName);
+ 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("TListSentryRolesRequest(");
+ boolean first = true;
+
+ sb.append("protocol_version:");
+ sb.append(this.protocol_version);
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("requestorUserName:");
+ if (this.requestorUserName == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.requestorUserName);
+ }
+ first = false;
+ if (isSetGroupName()) {
+ if (!first) sb.append(", ");
+ sb.append("groupName:");
+ if (this.groupName == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.groupName);
+ }
+ first = false;
+ }
+ sb.append(")");
+ return sb.toString();
+ }
+
+ public void validate() throws org.apache.thrift.TException {
+ // check for required fields
+ if (!isSetProtocol_version()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'protocol_version' is unset! Struct:" + toString());
+ }
+
+ if (!isSetRequestorUserName()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'requestorUserName' is unset! Struct:" + toString());
+ }
+
+ // 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 TListSentryRolesRequestStandardSchemeFactory implements SchemeFactory {
+ public TListSentryRolesRequestStandardScheme getScheme() {
+ return new TListSentryRolesRequestStandardScheme();
+ }
+ }
+
+ private static class TListSentryRolesRequestStandardScheme extends StandardScheme<TListSentryRolesRequest> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, TListSentryRolesRequest struct) throws org.apache.thrift.TException {
+ org.apache.thrift.protocol.TField schemeField;
+ iprot.readStructBegin();
+ while (true)
+ {
+ schemeField = iprot.readFieldBegin();
+ if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
+ break;
+ }
+ switch (schemeField.id) {
+ case 1: // PROTOCOL_VERSION
+ if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
+ struct.protocol_version = iprot.readI32();
+ struct.setProtocol_versionIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 2: // REQUESTOR_USER_NAME
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.requestorUserName = iprot.readString();
+ struct.setRequestorUserNameIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 3: // GROUP_NAME
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.groupName = iprot.readString();
+ struct.setGroupNameIsSet(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, TListSentryRolesRequest struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ oprot.writeFieldBegin(PROTOCOL_VERSION_FIELD_DESC);
+ oprot.writeI32(struct.protocol_version);
+ oprot.writeFieldEnd();
+ if (struct.requestorUserName != null) {
+ oprot.writeFieldBegin(REQUESTOR_USER_NAME_FIELD_DESC);
+ oprot.writeString(struct.requestorUserName);
+ oprot.writeFieldEnd();
+ }
+ if (struct.groupName != null) {
+ if (struct.isSetGroupName()) {
+ oprot.writeFieldBegin(GROUP_NAME_FIELD_DESC);
+ oprot.writeString(struct.groupName);
+ oprot.writeFieldEnd();
+ }
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class TListSentryRolesRequestTupleSchemeFactory implements SchemeFactory {
+ public TListSentryRolesRequestTupleScheme getScheme() {
+ return new TListSentryRolesRequestTupleScheme();
+ }
+ }
+
+ private static class TListSentryRolesRequestTupleScheme extends TupleScheme<TListSentryRolesRequest> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, TListSentryRolesRequest struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ oprot.writeI32(struct.protocol_version);
+ oprot.writeString(struct.requestorUserName);
+ BitSet optionals = new BitSet();
+ if (struct.isSetGroupName()) {
+ optionals.set(0);
+ }
+ oprot.writeBitSet(optionals, 1);
+ if (struct.isSetGroupName()) {
+ oprot.writeString(struct.groupName);
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, TListSentryRolesRequest struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ struct.protocol_version = iprot.readI32();
+ struct.setProtocol_versionIsSet(true);
+ struct.requestorUserName = iprot.readString();
+ struct.setRequestorUserNameIsSet(true);
+ BitSet incoming = iprot.readBitSet(1);
+ if (incoming.get(0)) {
+ struct.groupName = iprot.readString();
+ struct.setGroupNameIsSet(true);
+ }
+ }
+ }
+
+}
+
[11/25] SENTRY-432. HDFS ingration. Initial patch
Posted by pr...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleAddGroupsRequest.java
----------------------------------------------------------------------
diff --git a/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleAddGroupsRequest.java b/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleAddGroupsRequest.java
new file mode 100644
index 0000000..21efbd0
--- /dev/null
+++ b/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleAddGroupsRequest.java
@@ -0,0 +1,742 @@
+/**
+ * Autogenerated by Thrift Compiler (0.9.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+package org.apache.sentry.provider.db.service.thrift;
+
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EnumMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.EnumSet;
+import java.util.Collections;
+import java.util.BitSet;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class TAlterSentryRoleAddGroupsRequest implements org.apache.thrift.TBase<TAlterSentryRoleAddGroupsRequest, TAlterSentryRoleAddGroupsRequest._Fields>, java.io.Serializable, Cloneable {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TAlterSentryRoleAddGroupsRequest");
+
+ private static final org.apache.thrift.protocol.TField PROTOCOL_VERSION_FIELD_DESC = new org.apache.thrift.protocol.TField("protocol_version", org.apache.thrift.protocol.TType.I32, (short)1);
+ private static final org.apache.thrift.protocol.TField REQUESTOR_USER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("requestorUserName", org.apache.thrift.protocol.TType.STRING, (short)2);
+ private static final org.apache.thrift.protocol.TField ROLE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("roleName", org.apache.thrift.protocol.TType.STRING, (short)3);
+ 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)5);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new TAlterSentryRoleAddGroupsRequestStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new TAlterSentryRoleAddGroupsRequestTupleSchemeFactory());
+ }
+
+ private int protocol_version; // required
+ private String requestorUserName; // required
+ private String roleName; // required
+ private Set<TSentryGroup> groups; // required
+
+ /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+ public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+ PROTOCOL_VERSION((short)1, "protocol_version"),
+ REQUESTOR_USER_NAME((short)2, "requestorUserName"),
+ ROLE_NAME((short)3, "roleName"),
+ GROUPS((short)5, "groups");
+
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+ static {
+ for (_Fields field : EnumSet.allOf(_Fields.class)) {
+ byName.put(field.getFieldName(), field);
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, or null if its not found.
+ */
+ public static _Fields findByThriftId(int fieldId) {
+ switch(fieldId) {
+ case 1: // PROTOCOL_VERSION
+ return PROTOCOL_VERSION;
+ case 2: // REQUESTOR_USER_NAME
+ return REQUESTOR_USER_NAME;
+ case 3: // ROLE_NAME
+ return ROLE_NAME;
+ case 5: // GROUPS
+ return GROUPS;
+ default:
+ return null;
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, throwing an exception
+ * if it is not found.
+ */
+ public static _Fields findByThriftIdOrThrow(int fieldId) {
+ _Fields fields = findByThriftId(fieldId);
+ if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+ return fields;
+ }
+
+ /**
+ * Find the _Fields constant that matches name, or null if its not found.
+ */
+ public static _Fields findByName(String name) {
+ return byName.get(name);
+ }
+
+ private final short _thriftId;
+ private final String _fieldName;
+
+ _Fields(short thriftId, String fieldName) {
+ _thriftId = thriftId;
+ _fieldName = fieldName;
+ }
+
+ public short getThriftFieldId() {
+ return _thriftId;
+ }
+
+ public String getFieldName() {
+ return _fieldName;
+ }
+ }
+
+ // isset id assignments
+ private static final int __PROTOCOL_VERSION_ISSET_ID = 0;
+ private byte __isset_bitfield = 0;
+ public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+ static {
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+ tmpMap.put(_Fields.PROTOCOL_VERSION, new org.apache.thrift.meta_data.FieldMetaData("protocol_version", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
+ tmpMap.put(_Fields.REQUESTOR_USER_NAME, new org.apache.thrift.meta_data.FieldMetaData("requestorUserName", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields.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))));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TAlterSentryRoleAddGroupsRequest.class, metaDataMap);
+ }
+
+ public TAlterSentryRoleAddGroupsRequest() {
+ this.protocol_version = 1;
+
+ }
+
+ public TAlterSentryRoleAddGroupsRequest(
+ int protocol_version,
+ String requestorUserName,
+ String roleName,
+ Set<TSentryGroup> groups)
+ {
+ this();
+ this.protocol_version = protocol_version;
+ setProtocol_versionIsSet(true);
+ this.requestorUserName = requestorUserName;
+ this.roleName = roleName;
+ this.groups = groups;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public TAlterSentryRoleAddGroupsRequest(TAlterSentryRoleAddGroupsRequest other) {
+ __isset_bitfield = other.__isset_bitfield;
+ this.protocol_version = other.protocol_version;
+ if (other.isSetRequestorUserName()) {
+ this.requestorUserName = other.requestorUserName;
+ }
+ if (other.isSetRoleName()) {
+ this.roleName = other.roleName;
+ }
+ if (other.isSetGroups()) {
+ Set<TSentryGroup> __this__groups = new HashSet<TSentryGroup>();
+ for (TSentryGroup other_element : other.groups) {
+ __this__groups.add(new TSentryGroup(other_element));
+ }
+ this.groups = __this__groups;
+ }
+ }
+
+ public TAlterSentryRoleAddGroupsRequest deepCopy() {
+ return new TAlterSentryRoleAddGroupsRequest(this);
+ }
+
+ @Override
+ public void clear() {
+ this.protocol_version = 1;
+
+ this.requestorUserName = null;
+ this.roleName = null;
+ this.groups = null;
+ }
+
+ public int getProtocol_version() {
+ return this.protocol_version;
+ }
+
+ public void setProtocol_version(int protocol_version) {
+ this.protocol_version = protocol_version;
+ setProtocol_versionIsSet(true);
+ }
+
+ public void unsetProtocol_version() {
+ __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __PROTOCOL_VERSION_ISSET_ID);
+ }
+
+ /** Returns true if field protocol_version is set (has been assigned a value) and false otherwise */
+ public boolean isSetProtocol_version() {
+ return EncodingUtils.testBit(__isset_bitfield, __PROTOCOL_VERSION_ISSET_ID);
+ }
+
+ public void setProtocol_versionIsSet(boolean value) {
+ __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __PROTOCOL_VERSION_ISSET_ID, value);
+ }
+
+ public String getRequestorUserName() {
+ return this.requestorUserName;
+ }
+
+ public void setRequestorUserName(String requestorUserName) {
+ this.requestorUserName = requestorUserName;
+ }
+
+ public void unsetRequestorUserName() {
+ this.requestorUserName = null;
+ }
+
+ /** Returns true if field requestorUserName is set (has been assigned a value) and false otherwise */
+ public boolean isSetRequestorUserName() {
+ return this.requestorUserName != null;
+ }
+
+ public void setRequestorUserNameIsSet(boolean value) {
+ if (!value) {
+ this.requestorUserName = null;
+ }
+ }
+
+ public 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 void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case PROTOCOL_VERSION:
+ if (value == null) {
+ unsetProtocol_version();
+ } else {
+ setProtocol_version((Integer)value);
+ }
+ break;
+
+ case REQUESTOR_USER_NAME:
+ if (value == null) {
+ unsetRequestorUserName();
+ } else {
+ setRequestorUserName((String)value);
+ }
+ break;
+
+ case ROLE_NAME:
+ if (value == null) {
+ unsetRoleName();
+ } else {
+ setRoleName((String)value);
+ }
+ break;
+
+ case GROUPS:
+ if (value == null) {
+ unsetGroups();
+ } else {
+ setGroups((Set<TSentryGroup>)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case PROTOCOL_VERSION:
+ return Integer.valueOf(getProtocol_version());
+
+ case REQUESTOR_USER_NAME:
+ return getRequestorUserName();
+
+ case ROLE_NAME:
+ return getRoleName();
+
+ case GROUPS:
+ return getGroups();
+
+ }
+ throw new IllegalStateException();
+ }
+
+ /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+ public boolean isSet(_Fields field) {
+ if (field == null) {
+ throw new IllegalArgumentException();
+ }
+
+ switch (field) {
+ case PROTOCOL_VERSION:
+ return isSetProtocol_version();
+ case REQUESTOR_USER_NAME:
+ return isSetRequestorUserName();
+ case ROLE_NAME:
+ return isSetRoleName();
+ case GROUPS:
+ return isSetGroups();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof TAlterSentryRoleAddGroupsRequest)
+ return this.equals((TAlterSentryRoleAddGroupsRequest)that);
+ return false;
+ }
+
+ public boolean equals(TAlterSentryRoleAddGroupsRequest that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_protocol_version = true;
+ boolean that_present_protocol_version = true;
+ if (this_present_protocol_version || that_present_protocol_version) {
+ if (!(this_present_protocol_version && that_present_protocol_version))
+ return false;
+ if (this.protocol_version != that.protocol_version)
+ return false;
+ }
+
+ boolean this_present_requestorUserName = true && this.isSetRequestorUserName();
+ boolean that_present_requestorUserName = true && that.isSetRequestorUserName();
+ if (this_present_requestorUserName || that_present_requestorUserName) {
+ if (!(this_present_requestorUserName && that_present_requestorUserName))
+ return false;
+ if (!this.requestorUserName.equals(that.requestorUserName))
+ return false;
+ }
+
+ boolean this_present_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;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ HashCodeBuilder builder = new HashCodeBuilder();
+
+ boolean present_protocol_version = true;
+ builder.append(present_protocol_version);
+ if (present_protocol_version)
+ builder.append(protocol_version);
+
+ boolean present_requestorUserName = true && (isSetRequestorUserName());
+ builder.append(present_requestorUserName);
+ if (present_requestorUserName)
+ builder.append(requestorUserName);
+
+ boolean present_roleName = true && (isSetRoleName());
+ builder.append(present_roleName);
+ if (present_roleName)
+ builder.append(roleName);
+
+ boolean present_groups = true && (isSetGroups());
+ builder.append(present_groups);
+ if (present_groups)
+ builder.append(groups);
+
+ return builder.toHashCode();
+ }
+
+ public int compareTo(TAlterSentryRoleAddGroupsRequest other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+ TAlterSentryRoleAddGroupsRequest typedOther = (TAlterSentryRoleAddGroupsRequest)other;
+
+ lastComparison = Boolean.valueOf(isSetProtocol_version()).compareTo(typedOther.isSetProtocol_version());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetProtocol_version()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.protocol_version, typedOther.protocol_version);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetRequestorUserName()).compareTo(typedOther.isSetRequestorUserName());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetRequestorUserName()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.requestorUserName, typedOther.requestorUserName);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetRoleName()).compareTo(typedOther.isSetRoleName());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetRoleName()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.roleName, typedOther.roleName);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetGroups()).compareTo(typedOther.isSetGroups());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetGroups()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.groups, typedOther.groups);
+ 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("TAlterSentryRoleAddGroupsRequest(");
+ boolean first = true;
+
+ sb.append("protocol_version:");
+ sb.append(this.protocol_version);
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("requestorUserName:");
+ if (this.requestorUserName == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.requestorUserName);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("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;
+ sb.append(")");
+ return sb.toString();
+ }
+
+ public void validate() throws org.apache.thrift.TException {
+ // check for required fields
+ if (!isSetProtocol_version()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'protocol_version' is unset! Struct:" + toString());
+ }
+
+ if (!isSetRequestorUserName()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'requestorUserName' is unset! Struct:" + toString());
+ }
+
+ if (!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());
+ }
+
+ // 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 TAlterSentryRoleAddGroupsRequestStandardSchemeFactory implements SchemeFactory {
+ public TAlterSentryRoleAddGroupsRequestStandardScheme getScheme() {
+ return new TAlterSentryRoleAddGroupsRequestStandardScheme();
+ }
+ }
+
+ private static class TAlterSentryRoleAddGroupsRequestStandardScheme extends StandardScheme<TAlterSentryRoleAddGroupsRequest> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, TAlterSentryRoleAddGroupsRequest struct) throws org.apache.thrift.TException {
+ org.apache.thrift.protocol.TField schemeField;
+ iprot.readStructBegin();
+ while (true)
+ {
+ schemeField = iprot.readFieldBegin();
+ if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
+ break;
+ }
+ switch (schemeField.id) {
+ case 1: // PROTOCOL_VERSION
+ if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
+ struct.protocol_version = iprot.readI32();
+ struct.setProtocol_versionIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 2: // REQUESTOR_USER_NAME
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.requestorUserName = iprot.readString();
+ struct.setRequestorUserNameIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 3: // 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 5: // GROUPS
+ if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
+ {
+ org.apache.thrift.protocol.TSet _set0 = iprot.readSetBegin();
+ struct.groups = new HashSet<TSentryGroup>(2*_set0.size);
+ for (int _i1 = 0; _i1 < _set0.size; ++_i1)
+ {
+ TSentryGroup _elem2; // required
+ _elem2 = new TSentryGroup();
+ _elem2.read(iprot);
+ struct.groups.add(_elem2);
+ }
+ iprot.readSetEnd();
+ }
+ struct.setGroupsIsSet(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, TAlterSentryRoleAddGroupsRequest struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ oprot.writeFieldBegin(PROTOCOL_VERSION_FIELD_DESC);
+ oprot.writeI32(struct.protocol_version);
+ oprot.writeFieldEnd();
+ if (struct.requestorUserName != null) {
+ oprot.writeFieldBegin(REQUESTOR_USER_NAME_FIELD_DESC);
+ oprot.writeString(struct.requestorUserName);
+ oprot.writeFieldEnd();
+ }
+ if (struct.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 _iter3 : struct.groups)
+ {
+ _iter3.write(oprot);
+ }
+ oprot.writeSetEnd();
+ }
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class TAlterSentryRoleAddGroupsRequestTupleSchemeFactory implements SchemeFactory {
+ public TAlterSentryRoleAddGroupsRequestTupleScheme getScheme() {
+ return new TAlterSentryRoleAddGroupsRequestTupleScheme();
+ }
+ }
+
+ private static class TAlterSentryRoleAddGroupsRequestTupleScheme extends TupleScheme<TAlterSentryRoleAddGroupsRequest> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleAddGroupsRequest struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ oprot.writeI32(struct.protocol_version);
+ oprot.writeString(struct.requestorUserName);
+ oprot.writeString(struct.roleName);
+ {
+ oprot.writeI32(struct.groups.size());
+ for (TSentryGroup _iter4 : struct.groups)
+ {
+ _iter4.write(oprot);
+ }
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleAddGroupsRequest struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ struct.protocol_version = iprot.readI32();
+ struct.setProtocol_versionIsSet(true);
+ struct.requestorUserName = iprot.readString();
+ struct.setRequestorUserNameIsSet(true);
+ struct.roleName = iprot.readString();
+ struct.setRoleNameIsSet(true);
+ {
+ org.apache.thrift.protocol.TSet _set5 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
+ struct.groups = new HashSet<TSentryGroup>(2*_set5.size);
+ for (int _i6 = 0; _i6 < _set5.size; ++_i6)
+ {
+ TSentryGroup _elem7; // required
+ _elem7 = new TSentryGroup();
+ _elem7.read(iprot);
+ struct.groups.add(_elem7);
+ }
+ }
+ struct.setGroupsIsSet(true);
+ }
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleAddGroupsResponse.java
----------------------------------------------------------------------
diff --git a/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleAddGroupsResponse.java b/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleAddGroupsResponse.java
new file mode 100644
index 0000000..15b014e
--- /dev/null
+++ b/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleAddGroupsResponse.java
@@ -0,0 +1,390 @@
+/**
+ * Autogenerated by Thrift Compiler (0.9.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+package org.apache.sentry.provider.db.service.thrift;
+
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EnumMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.EnumSet;
+import java.util.Collections;
+import java.util.BitSet;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class TAlterSentryRoleAddGroupsResponse implements org.apache.thrift.TBase<TAlterSentryRoleAddGroupsResponse, TAlterSentryRoleAddGroupsResponse._Fields>, java.io.Serializable, Cloneable {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TAlterSentryRoleAddGroupsResponse");
+
+ private static final org.apache.thrift.protocol.TField STATUS_FIELD_DESC = new org.apache.thrift.protocol.TField("status", org.apache.thrift.protocol.TType.STRUCT, (short)1);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new TAlterSentryRoleAddGroupsResponseStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new TAlterSentryRoleAddGroupsResponseTupleSchemeFactory());
+ }
+
+ private org.apache.sentry.service.thrift.TSentryResponseStatus status; // required
+
+ /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+ public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+ STATUS((short)1, "status");
+
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+ static {
+ for (_Fields field : EnumSet.allOf(_Fields.class)) {
+ byName.put(field.getFieldName(), field);
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, or null if its not found.
+ */
+ public static _Fields findByThriftId(int fieldId) {
+ switch(fieldId) {
+ case 1: // STATUS
+ return STATUS;
+ default:
+ return null;
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, throwing an exception
+ * if it is not found.
+ */
+ public static _Fields findByThriftIdOrThrow(int fieldId) {
+ _Fields fields = findByThriftId(fieldId);
+ if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+ return fields;
+ }
+
+ /**
+ * Find the _Fields constant that matches name, or null if its not found.
+ */
+ public static _Fields findByName(String name) {
+ return byName.get(name);
+ }
+
+ private final short _thriftId;
+ private final String _fieldName;
+
+ _Fields(short thriftId, String fieldName) {
+ _thriftId = thriftId;
+ _fieldName = fieldName;
+ }
+
+ public short getThriftFieldId() {
+ return _thriftId;
+ }
+
+ public String getFieldName() {
+ return _fieldName;
+ }
+ }
+
+ // isset id assignments
+ public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+ static {
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+ tmpMap.put(_Fields.STATUS, new org.apache.thrift.meta_data.FieldMetaData("status", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.sentry.service.thrift.TSentryResponseStatus.class)));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TAlterSentryRoleAddGroupsResponse.class, metaDataMap);
+ }
+
+ public TAlterSentryRoleAddGroupsResponse() {
+ }
+
+ public TAlterSentryRoleAddGroupsResponse(
+ org.apache.sentry.service.thrift.TSentryResponseStatus status)
+ {
+ this();
+ this.status = status;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public TAlterSentryRoleAddGroupsResponse(TAlterSentryRoleAddGroupsResponse other) {
+ if (other.isSetStatus()) {
+ this.status = new org.apache.sentry.service.thrift.TSentryResponseStatus(other.status);
+ }
+ }
+
+ public TAlterSentryRoleAddGroupsResponse deepCopy() {
+ return new TAlterSentryRoleAddGroupsResponse(this);
+ }
+
+ @Override
+ public void clear() {
+ this.status = null;
+ }
+
+ public org.apache.sentry.service.thrift.TSentryResponseStatus getStatus() {
+ return this.status;
+ }
+
+ public void setStatus(org.apache.sentry.service.thrift.TSentryResponseStatus status) {
+ this.status = status;
+ }
+
+ public void unsetStatus() {
+ this.status = null;
+ }
+
+ /** Returns true if field status is set (has been assigned a value) and false otherwise */
+ public boolean isSetStatus() {
+ return this.status != null;
+ }
+
+ public void setStatusIsSet(boolean value) {
+ if (!value) {
+ this.status = null;
+ }
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case STATUS:
+ if (value == null) {
+ unsetStatus();
+ } else {
+ setStatus((org.apache.sentry.service.thrift.TSentryResponseStatus)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case STATUS:
+ return getStatus();
+
+ }
+ throw new IllegalStateException();
+ }
+
+ /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+ public boolean isSet(_Fields field) {
+ if (field == null) {
+ throw new IllegalArgumentException();
+ }
+
+ switch (field) {
+ case STATUS:
+ return isSetStatus();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof TAlterSentryRoleAddGroupsResponse)
+ return this.equals((TAlterSentryRoleAddGroupsResponse)that);
+ return false;
+ }
+
+ public boolean equals(TAlterSentryRoleAddGroupsResponse that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_status = true && this.isSetStatus();
+ boolean that_present_status = true && that.isSetStatus();
+ if (this_present_status || that_present_status) {
+ if (!(this_present_status && that_present_status))
+ return false;
+ if (!this.status.equals(that.status))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ HashCodeBuilder builder = new HashCodeBuilder();
+
+ boolean present_status = true && (isSetStatus());
+ builder.append(present_status);
+ if (present_status)
+ builder.append(status);
+
+ return builder.toHashCode();
+ }
+
+ public int compareTo(TAlterSentryRoleAddGroupsResponse other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+ TAlterSentryRoleAddGroupsResponse typedOther = (TAlterSentryRoleAddGroupsResponse)other;
+
+ lastComparison = Boolean.valueOf(isSetStatus()).compareTo(typedOther.isSetStatus());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetStatus()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.status, typedOther.status);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ 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("TAlterSentryRoleAddGroupsResponse(");
+ boolean first = true;
+
+ sb.append("status:");
+ if (this.status == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.status);
+ }
+ first = false;
+ sb.append(")");
+ return sb.toString();
+ }
+
+ public void validate() throws org.apache.thrift.TException {
+ // check for required fields
+ if (!isSetStatus()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'status' is unset! Struct:" + toString());
+ }
+
+ // check for sub-struct validity
+ if (status != null) {
+ status.validate();
+ }
+ }
+
+ private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+ try {
+ write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+ try {
+ read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private static class TAlterSentryRoleAddGroupsResponseStandardSchemeFactory implements SchemeFactory {
+ public TAlterSentryRoleAddGroupsResponseStandardScheme getScheme() {
+ return new TAlterSentryRoleAddGroupsResponseStandardScheme();
+ }
+ }
+
+ private static class TAlterSentryRoleAddGroupsResponseStandardScheme extends StandardScheme<TAlterSentryRoleAddGroupsResponse> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, TAlterSentryRoleAddGroupsResponse struct) throws org.apache.thrift.TException {
+ org.apache.thrift.protocol.TField schemeField;
+ iprot.readStructBegin();
+ while (true)
+ {
+ schemeField = iprot.readFieldBegin();
+ if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
+ break;
+ }
+ switch (schemeField.id) {
+ case 1: // STATUS
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+ struct.status = new org.apache.sentry.service.thrift.TSentryResponseStatus();
+ struct.status.read(iprot);
+ struct.setStatusIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ 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, TAlterSentryRoleAddGroupsResponse struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.status != null) {
+ oprot.writeFieldBegin(STATUS_FIELD_DESC);
+ struct.status.write(oprot);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class TAlterSentryRoleAddGroupsResponseTupleSchemeFactory implements SchemeFactory {
+ public TAlterSentryRoleAddGroupsResponseTupleScheme getScheme() {
+ return new TAlterSentryRoleAddGroupsResponseTupleScheme();
+ }
+ }
+
+ private static class TAlterSentryRoleAddGroupsResponseTupleScheme extends TupleScheme<TAlterSentryRoleAddGroupsResponse> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleAddGroupsResponse struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ struct.status.write(oprot);
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleAddGroupsResponse struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ struct.status = new org.apache.sentry.service.thrift.TSentryResponseStatus();
+ struct.status.read(iprot);
+ struct.setStatusIsSet(true);
+ }
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleDeleteGroupsRequest.java
----------------------------------------------------------------------
diff --git a/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleDeleteGroupsRequest.java b/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleDeleteGroupsRequest.java
new file mode 100644
index 0000000..58e9870
--- /dev/null
+++ b/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleDeleteGroupsRequest.java
@@ -0,0 +1,742 @@
+/**
+ * Autogenerated by Thrift Compiler (0.9.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+package org.apache.sentry.provider.db.service.thrift;
+
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EnumMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.EnumSet;
+import java.util.Collections;
+import java.util.BitSet;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class TAlterSentryRoleDeleteGroupsRequest implements org.apache.thrift.TBase<TAlterSentryRoleDeleteGroupsRequest, TAlterSentryRoleDeleteGroupsRequest._Fields>, java.io.Serializable, Cloneable {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TAlterSentryRoleDeleteGroupsRequest");
+
+ private static final org.apache.thrift.protocol.TField PROTOCOL_VERSION_FIELD_DESC = new org.apache.thrift.protocol.TField("protocol_version", org.apache.thrift.protocol.TType.I32, (short)1);
+ private static final org.apache.thrift.protocol.TField REQUESTOR_USER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("requestorUserName", org.apache.thrift.protocol.TType.STRING, (short)2);
+ private static final org.apache.thrift.protocol.TField ROLE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("roleName", org.apache.thrift.protocol.TType.STRING, (short)3);
+ 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)5);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new TAlterSentryRoleDeleteGroupsRequestStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new TAlterSentryRoleDeleteGroupsRequestTupleSchemeFactory());
+ }
+
+ private int protocol_version; // required
+ private String requestorUserName; // required
+ private String roleName; // required
+ private Set<TSentryGroup> groups; // required
+
+ /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+ public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+ PROTOCOL_VERSION((short)1, "protocol_version"),
+ REQUESTOR_USER_NAME((short)2, "requestorUserName"),
+ ROLE_NAME((short)3, "roleName"),
+ GROUPS((short)5, "groups");
+
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+ static {
+ for (_Fields field : EnumSet.allOf(_Fields.class)) {
+ byName.put(field.getFieldName(), field);
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, or null if its not found.
+ */
+ public static _Fields findByThriftId(int fieldId) {
+ switch(fieldId) {
+ case 1: // PROTOCOL_VERSION
+ return PROTOCOL_VERSION;
+ case 2: // REQUESTOR_USER_NAME
+ return REQUESTOR_USER_NAME;
+ case 3: // ROLE_NAME
+ return ROLE_NAME;
+ case 5: // GROUPS
+ return GROUPS;
+ default:
+ return null;
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, throwing an exception
+ * if it is not found.
+ */
+ public static _Fields findByThriftIdOrThrow(int fieldId) {
+ _Fields fields = findByThriftId(fieldId);
+ if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+ return fields;
+ }
+
+ /**
+ * Find the _Fields constant that matches name, or null if its not found.
+ */
+ public static _Fields findByName(String name) {
+ return byName.get(name);
+ }
+
+ private final short _thriftId;
+ private final String _fieldName;
+
+ _Fields(short thriftId, String fieldName) {
+ _thriftId = thriftId;
+ _fieldName = fieldName;
+ }
+
+ public short getThriftFieldId() {
+ return _thriftId;
+ }
+
+ public String getFieldName() {
+ return _fieldName;
+ }
+ }
+
+ // isset id assignments
+ private static final int __PROTOCOL_VERSION_ISSET_ID = 0;
+ private byte __isset_bitfield = 0;
+ public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+ static {
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+ tmpMap.put(_Fields.PROTOCOL_VERSION, new org.apache.thrift.meta_data.FieldMetaData("protocol_version", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
+ tmpMap.put(_Fields.REQUESTOR_USER_NAME, new org.apache.thrift.meta_data.FieldMetaData("requestorUserName", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields.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))));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TAlterSentryRoleDeleteGroupsRequest.class, metaDataMap);
+ }
+
+ public TAlterSentryRoleDeleteGroupsRequest() {
+ this.protocol_version = 1;
+
+ }
+
+ public TAlterSentryRoleDeleteGroupsRequest(
+ int protocol_version,
+ String requestorUserName,
+ String roleName,
+ Set<TSentryGroup> groups)
+ {
+ this();
+ this.protocol_version = protocol_version;
+ setProtocol_versionIsSet(true);
+ this.requestorUserName = requestorUserName;
+ this.roleName = roleName;
+ this.groups = groups;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public TAlterSentryRoleDeleteGroupsRequest(TAlterSentryRoleDeleteGroupsRequest other) {
+ __isset_bitfield = other.__isset_bitfield;
+ this.protocol_version = other.protocol_version;
+ if (other.isSetRequestorUserName()) {
+ this.requestorUserName = other.requestorUserName;
+ }
+ if (other.isSetRoleName()) {
+ this.roleName = other.roleName;
+ }
+ if (other.isSetGroups()) {
+ Set<TSentryGroup> __this__groups = new HashSet<TSentryGroup>();
+ for (TSentryGroup other_element : other.groups) {
+ __this__groups.add(new TSentryGroup(other_element));
+ }
+ this.groups = __this__groups;
+ }
+ }
+
+ public TAlterSentryRoleDeleteGroupsRequest deepCopy() {
+ return new TAlterSentryRoleDeleteGroupsRequest(this);
+ }
+
+ @Override
+ public void clear() {
+ this.protocol_version = 1;
+
+ this.requestorUserName = null;
+ this.roleName = null;
+ this.groups = null;
+ }
+
+ public int getProtocol_version() {
+ return this.protocol_version;
+ }
+
+ public void setProtocol_version(int protocol_version) {
+ this.protocol_version = protocol_version;
+ setProtocol_versionIsSet(true);
+ }
+
+ public void unsetProtocol_version() {
+ __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __PROTOCOL_VERSION_ISSET_ID);
+ }
+
+ /** Returns true if field protocol_version is set (has been assigned a value) and false otherwise */
+ public boolean isSetProtocol_version() {
+ return EncodingUtils.testBit(__isset_bitfield, __PROTOCOL_VERSION_ISSET_ID);
+ }
+
+ public void setProtocol_versionIsSet(boolean value) {
+ __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __PROTOCOL_VERSION_ISSET_ID, value);
+ }
+
+ public String getRequestorUserName() {
+ return this.requestorUserName;
+ }
+
+ public void setRequestorUserName(String requestorUserName) {
+ this.requestorUserName = requestorUserName;
+ }
+
+ public void unsetRequestorUserName() {
+ this.requestorUserName = null;
+ }
+
+ /** Returns true if field requestorUserName is set (has been assigned a value) and false otherwise */
+ public boolean isSetRequestorUserName() {
+ return this.requestorUserName != null;
+ }
+
+ public void setRequestorUserNameIsSet(boolean value) {
+ if (!value) {
+ this.requestorUserName = null;
+ }
+ }
+
+ public 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 void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case PROTOCOL_VERSION:
+ if (value == null) {
+ unsetProtocol_version();
+ } else {
+ setProtocol_version((Integer)value);
+ }
+ break;
+
+ case REQUESTOR_USER_NAME:
+ if (value == null) {
+ unsetRequestorUserName();
+ } else {
+ setRequestorUserName((String)value);
+ }
+ break;
+
+ case ROLE_NAME:
+ if (value == null) {
+ unsetRoleName();
+ } else {
+ setRoleName((String)value);
+ }
+ break;
+
+ case GROUPS:
+ if (value == null) {
+ unsetGroups();
+ } else {
+ setGroups((Set<TSentryGroup>)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case PROTOCOL_VERSION:
+ return Integer.valueOf(getProtocol_version());
+
+ case REQUESTOR_USER_NAME:
+ return getRequestorUserName();
+
+ case ROLE_NAME:
+ return getRoleName();
+
+ case GROUPS:
+ return getGroups();
+
+ }
+ throw new IllegalStateException();
+ }
+
+ /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+ public boolean isSet(_Fields field) {
+ if (field == null) {
+ throw new IllegalArgumentException();
+ }
+
+ switch (field) {
+ case PROTOCOL_VERSION:
+ return isSetProtocol_version();
+ case REQUESTOR_USER_NAME:
+ return isSetRequestorUserName();
+ case ROLE_NAME:
+ return isSetRoleName();
+ case GROUPS:
+ return isSetGroups();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof TAlterSentryRoleDeleteGroupsRequest)
+ return this.equals((TAlterSentryRoleDeleteGroupsRequest)that);
+ return false;
+ }
+
+ public boolean equals(TAlterSentryRoleDeleteGroupsRequest that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_protocol_version = true;
+ boolean that_present_protocol_version = true;
+ if (this_present_protocol_version || that_present_protocol_version) {
+ if (!(this_present_protocol_version && that_present_protocol_version))
+ return false;
+ if (this.protocol_version != that.protocol_version)
+ return false;
+ }
+
+ boolean this_present_requestorUserName = true && this.isSetRequestorUserName();
+ boolean that_present_requestorUserName = true && that.isSetRequestorUserName();
+ if (this_present_requestorUserName || that_present_requestorUserName) {
+ if (!(this_present_requestorUserName && that_present_requestorUserName))
+ return false;
+ if (!this.requestorUserName.equals(that.requestorUserName))
+ return false;
+ }
+
+ boolean this_present_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;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ HashCodeBuilder builder = new HashCodeBuilder();
+
+ boolean present_protocol_version = true;
+ builder.append(present_protocol_version);
+ if (present_protocol_version)
+ builder.append(protocol_version);
+
+ boolean present_requestorUserName = true && (isSetRequestorUserName());
+ builder.append(present_requestorUserName);
+ if (present_requestorUserName)
+ builder.append(requestorUserName);
+
+ boolean present_roleName = true && (isSetRoleName());
+ builder.append(present_roleName);
+ if (present_roleName)
+ builder.append(roleName);
+
+ boolean present_groups = true && (isSetGroups());
+ builder.append(present_groups);
+ if (present_groups)
+ builder.append(groups);
+
+ return builder.toHashCode();
+ }
+
+ public int compareTo(TAlterSentryRoleDeleteGroupsRequest other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+ TAlterSentryRoleDeleteGroupsRequest typedOther = (TAlterSentryRoleDeleteGroupsRequest)other;
+
+ lastComparison = Boolean.valueOf(isSetProtocol_version()).compareTo(typedOther.isSetProtocol_version());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetProtocol_version()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.protocol_version, typedOther.protocol_version);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetRequestorUserName()).compareTo(typedOther.isSetRequestorUserName());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetRequestorUserName()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.requestorUserName, typedOther.requestorUserName);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetRoleName()).compareTo(typedOther.isSetRoleName());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetRoleName()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.roleName, typedOther.roleName);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetGroups()).compareTo(typedOther.isSetGroups());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetGroups()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.groups, typedOther.groups);
+ 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("TAlterSentryRoleDeleteGroupsRequest(");
+ boolean first = true;
+
+ sb.append("protocol_version:");
+ sb.append(this.protocol_version);
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("requestorUserName:");
+ if (this.requestorUserName == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.requestorUserName);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("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;
+ sb.append(")");
+ return sb.toString();
+ }
+
+ public void validate() throws org.apache.thrift.TException {
+ // check for required fields
+ if (!isSetProtocol_version()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'protocol_version' is unset! Struct:" + toString());
+ }
+
+ if (!isSetRequestorUserName()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'requestorUserName' is unset! Struct:" + toString());
+ }
+
+ if (!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());
+ }
+
+ // 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 TAlterSentryRoleDeleteGroupsRequestStandardSchemeFactory implements SchemeFactory {
+ public TAlterSentryRoleDeleteGroupsRequestStandardScheme getScheme() {
+ return new TAlterSentryRoleDeleteGroupsRequestStandardScheme();
+ }
+ }
+
+ private static class TAlterSentryRoleDeleteGroupsRequestStandardScheme extends StandardScheme<TAlterSentryRoleDeleteGroupsRequest> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, TAlterSentryRoleDeleteGroupsRequest struct) throws org.apache.thrift.TException {
+ org.apache.thrift.protocol.TField schemeField;
+ iprot.readStructBegin();
+ while (true)
+ {
+ schemeField = iprot.readFieldBegin();
+ if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
+ break;
+ }
+ switch (schemeField.id) {
+ case 1: // PROTOCOL_VERSION
+ if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
+ struct.protocol_version = iprot.readI32();
+ struct.setProtocol_versionIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 2: // REQUESTOR_USER_NAME
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.requestorUserName = iprot.readString();
+ struct.setRequestorUserNameIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 3: // 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 5: // GROUPS
+ if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
+ {
+ org.apache.thrift.protocol.TSet _set8 = iprot.readSetBegin();
+ struct.groups = new HashSet<TSentryGroup>(2*_set8.size);
+ for (int _i9 = 0; _i9 < _set8.size; ++_i9)
+ {
+ TSentryGroup _elem10; // required
+ _elem10 = new TSentryGroup();
+ _elem10.read(iprot);
+ struct.groups.add(_elem10);
+ }
+ iprot.readSetEnd();
+ }
+ struct.setGroupsIsSet(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, TAlterSentryRoleDeleteGroupsRequest struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ oprot.writeFieldBegin(PROTOCOL_VERSION_FIELD_DESC);
+ oprot.writeI32(struct.protocol_version);
+ oprot.writeFieldEnd();
+ if (struct.requestorUserName != null) {
+ oprot.writeFieldBegin(REQUESTOR_USER_NAME_FIELD_DESC);
+ oprot.writeString(struct.requestorUserName);
+ oprot.writeFieldEnd();
+ }
+ if (struct.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 _iter11 : struct.groups)
+ {
+ _iter11.write(oprot);
+ }
+ oprot.writeSetEnd();
+ }
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class TAlterSentryRoleDeleteGroupsRequestTupleSchemeFactory implements SchemeFactory {
+ public TAlterSentryRoleDeleteGroupsRequestTupleScheme getScheme() {
+ return new TAlterSentryRoleDeleteGroupsRequestTupleScheme();
+ }
+ }
+
+ private static class TAlterSentryRoleDeleteGroupsRequestTupleScheme extends TupleScheme<TAlterSentryRoleDeleteGroupsRequest> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleDeleteGroupsRequest struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ oprot.writeI32(struct.protocol_version);
+ oprot.writeString(struct.requestorUserName);
+ oprot.writeString(struct.roleName);
+ {
+ oprot.writeI32(struct.groups.size());
+ for (TSentryGroup _iter12 : struct.groups)
+ {
+ _iter12.write(oprot);
+ }
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleDeleteGroupsRequest struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ struct.protocol_version = iprot.readI32();
+ struct.setProtocol_versionIsSet(true);
+ struct.requestorUserName = iprot.readString();
+ struct.setRequestorUserNameIsSet(true);
+ struct.roleName = iprot.readString();
+ struct.setRoleNameIsSet(true);
+ {
+ org.apache.thrift.protocol.TSet _set13 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
+ struct.groups = new HashSet<TSentryGroup>(2*_set13.size);
+ for (int _i14 = 0; _i14 < _set13.size; ++_i14)
+ {
+ TSentryGroup _elem15; // required
+ _elem15 = new TSentryGroup();
+ _elem15.read(iprot);
+ struct.groups.add(_elem15);
+ }
+ }
+ struct.setGroupsIsSet(true);
+ }
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleDeleteGroupsResponse.java
----------------------------------------------------------------------
diff --git a/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleDeleteGroupsResponse.java b/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleDeleteGroupsResponse.java
new file mode 100644
index 0000000..0efa544
--- /dev/null
+++ b/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleDeleteGroupsResponse.java
@@ -0,0 +1,390 @@
+/**
+ * Autogenerated by Thrift Compiler (0.9.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+package org.apache.sentry.provider.db.service.thrift;
+
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EnumMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.EnumSet;
+import java.util.Collections;
+import java.util.BitSet;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class TAlterSentryRoleDeleteGroupsResponse implements org.apache.thrift.TBase<TAlterSentryRoleDeleteGroupsResponse, TAlterSentryRoleDeleteGroupsResponse._Fields>, java.io.Serializable, Cloneable {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TAlterSentryRoleDeleteGroupsResponse");
+
+ private static final org.apache.thrift.protocol.TField STATUS_FIELD_DESC = new org.apache.thrift.protocol.TField("status", org.apache.thrift.protocol.TType.STRUCT, (short)1);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new TAlterSentryRoleDeleteGroupsResponseStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new TAlterSentryRoleDeleteGroupsResponseTupleSchemeFactory());
+ }
+
+ private org.apache.sentry.service.thrift.TSentryResponseStatus status; // required
+
+ /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+ public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+ STATUS((short)1, "status");
+
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+ static {
+ for (_Fields field : EnumSet.allOf(_Fields.class)) {
+ byName.put(field.getFieldName(), field);
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, or null if its not found.
+ */
+ public static _Fields findByThriftId(int fieldId) {
+ switch(fieldId) {
+ case 1: // STATUS
+ return STATUS;
+ default:
+ return null;
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, throwing an exception
+ * if it is not found.
+ */
+ public static _Fields findByThriftIdOrThrow(int fieldId) {
+ _Fields fields = findByThriftId(fieldId);
+ if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+ return fields;
+ }
+
+ /**
+ * Find the _Fields constant that matches name, or null if its not found.
+ */
+ public static _Fields findByName(String name) {
+ return byName.get(name);
+ }
+
+ private final short _thriftId;
+ private final String _fieldName;
+
+ _Fields(short thriftId, String fieldName) {
+ _thriftId = thriftId;
+ _fieldName = fieldName;
+ }
+
+ public short getThriftFieldId() {
+ return _thriftId;
+ }
+
+ public String getFieldName() {
+ return _fieldName;
+ }
+ }
+
+ // isset id assignments
+ public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+ static {
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+ tmpMap.put(_Fields.STATUS, new org.apache.thrift.meta_data.FieldMetaData("status", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.sentry.service.thrift.TSentryResponseStatus.class)));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TAlterSentryRoleDeleteGroupsResponse.class, metaDataMap);
+ }
+
+ public TAlterSentryRoleDeleteGroupsResponse() {
+ }
+
+ public TAlterSentryRoleDeleteGroupsResponse(
+ org.apache.sentry.service.thrift.TSentryResponseStatus status)
+ {
+ this();
+ this.status = status;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public TAlterSentryRoleDeleteGroupsResponse(TAlterSentryRoleDeleteGroupsResponse other) {
+ if (other.isSetStatus()) {
+ this.status = new org.apache.sentry.service.thrift.TSentryResponseStatus(other.status);
+ }
+ }
+
+ public TAlterSentryRoleDeleteGroupsResponse deepCopy() {
+ return new TAlterSentryRoleDeleteGroupsResponse(this);
+ }
+
+ @Override
+ public void clear() {
+ this.status = null;
+ }
+
+ public org.apache.sentry.service.thrift.TSentryResponseStatus getStatus() {
+ return this.status;
+ }
+
+ public void setStatus(org.apache.sentry.service.thrift.TSentryResponseStatus status) {
+ this.status = status;
+ }
+
+ public void unsetStatus() {
+ this.status = null;
+ }
+
+ /** Returns true if field status is set (has been assigned a value) and false otherwise */
+ public boolean isSetStatus() {
+ return this.status != null;
+ }
+
+ public void setStatusIsSet(boolean value) {
+ if (!value) {
+ this.status = null;
+ }
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case STATUS:
+ if (value == null) {
+ unsetStatus();
+ } else {
+ setStatus((org.apache.sentry.service.thrift.TSentryResponseStatus)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case STATUS:
+ return getStatus();
+
+ }
+ throw new IllegalStateException();
+ }
+
+ /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+ public boolean isSet(_Fields field) {
+ if (field == null) {
+ throw new IllegalArgumentException();
+ }
+
+ switch (field) {
+ case STATUS:
+ return isSetStatus();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof TAlterSentryRoleDeleteGroupsResponse)
+ return this.equals((TAlterSentryRoleDeleteGroupsResponse)that);
+ return false;
+ }
+
+ public boolean equals(TAlterSentryRoleDeleteGroupsResponse that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_status = true && this.isSetStatus();
+ boolean that_present_status = true && that.isSetStatus();
+ if (this_present_status || that_present_status) {
+ if (!(this_present_status && that_present_status))
+ return false;
+ if (!this.status.equals(that.status))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ HashCodeBuilder builder = new HashCodeBuilder();
+
+ boolean present_status = true && (isSetStatus());
+ builder.append(present_status);
+ if (present_status)
+ builder.append(status);
+
+ return builder.toHashCode();
+ }
+
+ public int compareTo(TAlterSentryRoleDeleteGroupsResponse other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+ TAlterSentryRoleDeleteGroupsResponse typedOther = (TAlterSentryRoleDeleteGroupsResponse)other;
+
+ lastComparison = Boolean.valueOf(isSetStatus()).compareTo(typedOther.isSetStatus());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetStatus()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.status, typedOther.status);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ 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("TAlterSentryRoleDeleteGroupsResponse(");
+ boolean first = true;
+
+ sb.append("status:");
+ if (this.status == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.status);
+ }
+ first = false;
+ sb.append(")");
+ return sb.toString();
+ }
+
+ public void validate() throws org.apache.thrift.TException {
+ // check for required fields
+ if (!isSetStatus()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'status' is unset! Struct:" + toString());
+ }
+
+ // check for sub-struct validity
+ if (status != null) {
+ status.validate();
+ }
+ }
+
+ private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+ try {
+ write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+ try {
+ read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private static class TAlterSentryRoleDeleteGroupsResponseStandardSchemeFactory implements SchemeFactory {
+ public TAlterSentryRoleDeleteGroupsResponseStandardScheme getScheme() {
+ return new TAlterSentryRoleDeleteGroupsResponseStandardScheme();
+ }
+ }
+
+ private static class TAlterSentryRoleDeleteGroupsResponseStandardScheme extends StandardScheme<TAlterSentryRoleDeleteGroupsResponse> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, TAlterSentryRoleDeleteGroupsResponse struct) throws org.apache.thrift.TException {
+ org.apache.thrift.protocol.TField schemeField;
+ iprot.readStructBegin();
+ while (true)
+ {
+ schemeField = iprot.readFieldBegin();
+ if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
+ break;
+ }
+ switch (schemeField.id) {
+ case 1: // STATUS
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+ struct.status = new org.apache.sentry.service.thrift.TSentryResponseStatus();
+ struct.status.read(iprot);
+ struct.setStatusIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ 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, TAlterSentryRoleDeleteGroupsResponse struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.status != null) {
+ oprot.writeFieldBegin(STATUS_FIELD_DESC);
+ struct.status.write(oprot);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class TAlterSentryRoleDeleteGroupsResponseTupleSchemeFactory implements SchemeFactory {
+ public TAlterSentryRoleDeleteGroupsResponseTupleScheme getScheme() {
+ return new TAlterSentryRoleDeleteGroupsResponseTupleScheme();
+ }
+ }
+
+ private static class TAlterSentryRoleDeleteGroupsResponseTupleScheme extends TupleScheme<TAlterSentryRoleDeleteGroupsResponse> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleDeleteGroupsResponse struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ struct.status.write(oprot);
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleDeleteGroupsResponse struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ struct.status = new org.apache.sentry.service.thrift.TSentryResponseStatus();
+ struct.status.read(iprot);
+ struct.setStatusIsSet(true);
+ }
+ }
+
+}
+
[24/25] SENTRY-432. HDFS ingration. Initial patch
Posted by pr...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-hdfs-int/src/test/java/org/apache/sentry/hdfs/TestSentryAuthorizationProvider.java
----------------------------------------------------------------------
diff --git a/sentry-hdfs-int/src/test/java/org/apache/sentry/hdfs/TestSentryAuthorizationProvider.java b/sentry-hdfs-int/src/test/java/org/apache/sentry/hdfs/TestSentryAuthorizationProvider.java
new file mode 100644
index 0000000..67919fa
--- /dev/null
+++ b/sentry-hdfs-int/src/test/java/org/apache/sentry/hdfs/TestSentryAuthorizationProvider.java
@@ -0,0 +1,163 @@
+/**
+ * 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.hdfs;
+
+import java.io.IOException;
+import java.security.PrivilegedExceptionAction;
+import java.util.ArrayList;
+import java.util.LinkedHashSet;
+import java.util.List;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FileStatus;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.fs.permission.AclEntry;
+import org.apache.hadoop.fs.permission.AclEntryScope;
+import org.apache.hadoop.fs.permission.AclEntryType;
+import org.apache.hadoop.fs.permission.FsAction;
+import org.apache.hadoop.fs.permission.FsPermission;
+import org.apache.hadoop.hdfs.DFSConfigKeys;
+import org.apache.hadoop.hdfs.HdfsConfiguration;
+import org.apache.hadoop.hdfs.MiniDFSCluster;
+import org.apache.hadoop.hdfs.server.namenode.EditLogFileOutputStream;
+import org.apache.hadoop.security.UserGroupInformation;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+
+public class TestSentryAuthorizationProvider {
+ private MiniDFSCluster miniDFS;
+ private UserGroupInformation admin;
+
+ @Before
+ public void setUp() throws Exception {
+ admin = UserGroupInformation.createUserForTesting(
+ System.getProperty("user.name"), new String[] { "supergroup" });
+ admin.doAs(new PrivilegedExceptionAction<Void>() {
+ @Override
+ public Void run() throws Exception {
+ System.setProperty(MiniDFSCluster.PROP_TEST_BUILD_DATA, "target/test/data");
+ Configuration conf = new HdfsConfiguration();
+ conf.set(DFSConfigKeys.DFS_NAMENODE_AUTHORIZATION_PROVIDER_KEY,
+ MockSentryAuthorizationProvider.class.getName());
+ conf.setBoolean(DFSConfigKeys.DFS_NAMENODE_ACLS_ENABLED_KEY, true);
+ EditLogFileOutputStream.setShouldSkipFsyncForTesting(true);
+ miniDFS = new MiniDFSCluster.Builder(conf).build();
+ return null;
+ }
+ });
+ }
+
+ @After
+ public void cleanUp() throws IOException {
+ if (miniDFS != null) {
+ miniDFS.shutdown();
+ }
+ }
+
+ @Test
+ public void testProvider() throws Exception {
+ admin.doAs(new PrivilegedExceptionAction<Void>() {
+ @Override
+ public Void run() throws Exception {
+ String sysUser = UserGroupInformation.getCurrentUser().getShortUserName();
+ FileSystem fs = FileSystem.get(miniDFS.getConfiguration(0));
+
+ List<AclEntry> baseAclList = new ArrayList<AclEntry>();
+ AclEntry.Builder builder = new AclEntry.Builder();
+ baseAclList.add(builder.setType(AclEntryType.USER)
+ .setScope(AclEntryScope.ACCESS).build());
+ baseAclList.add(builder.setType(AclEntryType.GROUP)
+ .setScope(AclEntryScope.ACCESS).build());
+ baseAclList.add(builder.setType(AclEntryType.OTHER)
+ .setScope(AclEntryScope.ACCESS).build());
+ Path path1 = new Path("/user/authz/obj/xxx");
+ fs.mkdirs(path1);
+ fs.setAcl(path1, baseAclList);
+
+ fs.mkdirs(new Path("/user/authz/xxx"));
+ fs.mkdirs(new Path("/user/xxx"));
+
+ // root
+ Path path = new Path("/");
+ Assert.assertEquals(sysUser, fs.getFileStatus(path).getOwner());
+ Assert.assertEquals("supergroup", fs.getFileStatus(path).getGroup());
+ Assert.assertEquals(new FsPermission((short) 0755), fs.getFileStatus(path).getPermission());
+ Assert.assertTrue(fs.getAclStatus(path).getEntries().isEmpty());
+
+ // dir before prefixes
+ path = new Path("/user");
+ Assert.assertEquals(sysUser, fs.getFileStatus(path).getOwner());
+ Assert.assertEquals("supergroup", fs.getFileStatus(path).getGroup());
+ Assert.assertEquals(new FsPermission((short) 0755), fs.getFileStatus(path).getPermission());
+ Assert.assertTrue(fs.getAclStatus(path).getEntries().isEmpty());
+
+ // prefix dir
+ path = new Path("/user/authz");
+ Assert.assertEquals(sysUser, fs.getFileStatus(path).getOwner());
+ Assert.assertEquals("supergroup", fs.getFileStatus(path).getGroup());
+ Assert.assertEquals(new FsPermission((short) 0755), fs.getFileStatus(path).getPermission());
+ Assert.assertTrue(fs.getAclStatus(path).getEntries().isEmpty());
+
+ // dir inside of prefix, no obj
+ path = new Path("/user/authz/xxx");
+ FileStatus status = fs.getFileStatus(path);
+ Assert.assertEquals(sysUser, status.getOwner());
+ Assert.assertEquals("supergroup", status.getGroup());
+ Assert.assertEquals(new FsPermission((short) 0755), status.getPermission());
+ Assert.assertTrue(fs.getAclStatus(path).getEntries().isEmpty());
+
+ // dir inside of prefix, obj
+ path = new Path("/user/authz/obj");
+ Assert.assertEquals("hive", fs.getFileStatus(path).getOwner());
+ Assert.assertEquals("hive", fs.getFileStatus(path).getGroup());
+ Assert.assertEquals(new FsPermission((short) 0770), fs.getFileStatus(path).getPermission());
+ Assert.assertFalse(fs.getAclStatus(path).getEntries().isEmpty());
+
+ List<AclEntry> acls = new ArrayList<AclEntry>();
+ acls.add(new AclEntry.Builder().setName(sysUser).setType(AclEntryType.USER).setScope(AclEntryScope.ACCESS).setPermission(FsAction.ALL).build());
+ acls.add(new AclEntry.Builder().setName("supergroup").setType(AclEntryType.GROUP).setScope(AclEntryScope.ACCESS).setPermission(FsAction.READ_EXECUTE).build());
+ acls.add(new AclEntry.Builder().setName(null).setType(AclEntryType.OTHER).setScope(AclEntryScope.ACCESS).setPermission(FsAction.READ_EXECUTE).build());
+ acls.add(new AclEntry.Builder().setName("user-authz").setType(AclEntryType.USER).setScope(AclEntryScope.ACCESS).setPermission(FsAction.ALL).build());
+ Assert.assertEquals(new LinkedHashSet<AclEntry>(acls), new LinkedHashSet<AclEntry>(fs.getAclStatus(path).getEntries()));
+
+ // dir inside of prefix, inside of obj
+ path = new Path("/user/authz/obj/xxx");
+ Assert.assertEquals("hive", fs.getFileStatus(path).getOwner());
+ Assert.assertEquals("hive", fs.getFileStatus(path).getGroup());
+ Assert.assertEquals(new FsPermission((short) 0770), fs.getFileStatus(path).getPermission());
+ Assert.assertFalse(fs.getAclStatus(path).getEntries().isEmpty());
+
+ Path path2 = new Path("/user/authz/obj/path2");
+ fs.mkdirs(path2);
+ fs.setAcl(path2, baseAclList);
+
+ // dir outside of prefix
+ path = new Path("/user/xxx");
+ Assert.assertEquals(sysUser, fs.getFileStatus(path).getOwner());
+ Assert.assertEquals("supergroup", fs.getFileStatus(path).getGroup());
+ Assert.assertEquals(new FsPermission((short) 0755), fs.getFileStatus(path).getPermission());
+ Assert.assertTrue(fs.getAclStatus(path).getEntries().isEmpty());
+ return null;
+ }
+ });
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-hdfs-int/src/test/resources/hdfs-sentry.xml
----------------------------------------------------------------------
diff --git a/sentry-hdfs-int/src/test/resources/hdfs-sentry.xml b/sentry-hdfs-int/src/test/resources/hdfs-sentry.xml
new file mode 100644
index 0000000..511bfdd
--- /dev/null
+++ b/sentry-hdfs-int/src/test/resources/hdfs-sentry.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
+<!--
+ 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.
+-->
+
+<configuration>
+ <property>
+ <name>sentry.hdfs-plugin.path-prefixes</name>
+ <value>/user/hive/dw</value>
+ </property>
+ <property>
+ <name>sentry.hdfs-plugin.sentry-uri</name>
+ <value>thrift://localhost:1234</value>
+ </property>
+ <property>
+ <name>sentry.hdfs-plugin.stale-threshold.ms</name>
+ <value>-1</value>
+ </property>
+</configuration>
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-hdfs/pom.xml
----------------------------------------------------------------------
diff --git a/sentry-hdfs/pom.xml b/sentry-hdfs/pom.xml
new file mode 100644
index 0000000..5114c18
--- /dev/null
+++ b/sentry-hdfs/pom.xml
@@ -0,0 +1,66 @@
+<?xml version="1.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.
+-->
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.sentry</groupId>
+ <artifactId>sentry</artifactId>
+ <version>1.5.0-incubating-SNAPSHOT</version>
+ <relativePath>..</relativePath>
+ </parent>
+
+ <artifactId>sentry-hdfs</artifactId>
+ <name>Sentry HDFS Integration</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.hadoop</groupId>
+ <artifactId>hadoop-minicluster</artifactId>
+ <version>2.5.0</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.sentry</groupId>
+ <artifactId>sentry-service-client</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hive</groupId>
+ <artifactId>hive-metastore</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hadoop</groupId>
+ <artifactId>hadoop-common</artifactId>
+ <version>2.5.0</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+</project>
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-hdfs/src/main/java/org/apache/sentry/hdfs/AuthzPaths.java
----------------------------------------------------------------------
diff --git a/sentry-hdfs/src/main/java/org/apache/sentry/hdfs/AuthzPaths.java b/sentry-hdfs/src/main/java/org/apache/sentry/hdfs/AuthzPaths.java
new file mode 100644
index 0000000..9ea50c7
--- /dev/null
+++ b/sentry-hdfs/src/main/java/org/apache/sentry/hdfs/AuthzPaths.java
@@ -0,0 +1,30 @@
+/**
+ * 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.hdfs;
+
+public interface AuthzPaths {
+
+ public boolean isUnderPrefix(String[] pathElements);
+
+ public String findAuthzObject(String[] pathElements);
+
+ public String findAuthzObjectExactMatch(String[] pathElements);
+
+ public AuthzPathsDumper<? extends AuthzPaths> getPathsDump();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-hdfs/src/main/java/org/apache/sentry/hdfs/AuthzPathsDumper.java
----------------------------------------------------------------------
diff --git a/sentry-hdfs/src/main/java/org/apache/sentry/hdfs/AuthzPathsDumper.java b/sentry-hdfs/src/main/java/org/apache/sentry/hdfs/AuthzPathsDumper.java
new file mode 100644
index 0000000..924d3b4
--- /dev/null
+++ b/sentry-hdfs/src/main/java/org/apache/sentry/hdfs/AuthzPathsDumper.java
@@ -0,0 +1,28 @@
+/**
+ * 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.hdfs;
+
+import org.apache.sentry.provider.db.service.thrift.TPathsDump;
+
+public interface AuthzPathsDumper<K extends AuthzPaths> {
+
+ public TPathsDump createPathsDump();
+
+ public K initializeFromDump(TPathsDump pathsDump);
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-hdfs/src/main/java/org/apache/sentry/hdfs/AuthzPermissions.java
----------------------------------------------------------------------
diff --git a/sentry-hdfs/src/main/java/org/apache/sentry/hdfs/AuthzPermissions.java b/sentry-hdfs/src/main/java/org/apache/sentry/hdfs/AuthzPermissions.java
new file mode 100644
index 0000000..1631ae5
--- /dev/null
+++ b/sentry-hdfs/src/main/java/org/apache/sentry/hdfs/AuthzPermissions.java
@@ -0,0 +1,28 @@
+/**
+ * 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.hdfs;
+
+import org.apache.hadoop.fs.permission.AclEntry;
+
+import java.util.List;
+
+public interface AuthzPermissions {
+
+ public List<AclEntry> getAcls(String authzObj);
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-hdfs/src/main/java/org/apache/sentry/hdfs/ExtendedMetastoreClient.java
----------------------------------------------------------------------
diff --git a/sentry-hdfs/src/main/java/org/apache/sentry/hdfs/ExtendedMetastoreClient.java b/sentry-hdfs/src/main/java/org/apache/sentry/hdfs/ExtendedMetastoreClient.java
new file mode 100644
index 0000000..c0358f4
--- /dev/null
+++ b/sentry-hdfs/src/main/java/org/apache/sentry/hdfs/ExtendedMetastoreClient.java
@@ -0,0 +1,104 @@
+/*
+ * 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.hdfs;
+
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.apache.hadoop.hive.conf.HiveConf;
+import org.apache.hadoop.hive.metastore.HiveMetaStoreClient;
+import org.apache.hadoop.hive.metastore.api.Database;
+import org.apache.hadoop.hive.metastore.api.MetaException;
+import org.apache.hadoop.hive.metastore.api.Partition;
+import org.apache.hadoop.hive.metastore.api.Table;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class ExtendedMetastoreClient implements MetastoreClient {
+
+ private static Logger LOG = LoggerFactory.getLogger(ExtendedMetastoreClient.class);
+
+ private HiveMetaStoreClient client;
+ private final HiveConf hiveConf;
+ public ExtendedMetastoreClient(HiveConf hiveConf) {
+ this.hiveConf = hiveConf;
+ }
+
+ @Override
+ public List<Database> getAllDatabases() {
+ List<Database> retList = new ArrayList<Database>();
+ HiveMetaStoreClient client = getClient();
+ if (client != null) {
+ try {
+ for (String dbName : client.getAllDatabases()) {
+ retList.add(client.getDatabase(dbName));
+ }
+ } catch (Exception e) {
+ LOG.error("Could not get All Databases !!", e);
+ }
+ }
+ return retList;
+ }
+
+ @Override
+ public List<Table> getAllTablesOfDatabase(Database db) {
+ List<Table> retList = new ArrayList<Table>();
+ HiveMetaStoreClient client = getClient();
+ if (client != null) {
+ try {
+ for (String tblName : client.getAllTables(db.getName())) {
+ retList.add(client.getTable(db.getName(), tblName));
+ }
+ } catch (Exception e) {
+ LOG.error(String.format(
+ "Could not get Tables for '%s' !!", db.getName()), e);
+ }
+ }
+ return retList;
+ }
+
+ @Override
+ public List<Partition> listAllPartitions(Database db, Table tbl) {
+ HiveMetaStoreClient client = getClient();
+ if (client != null) {
+ try {
+ return client.listPartitions(db.getName(), tbl.getTableName(), Short.MAX_VALUE);
+ } catch (Exception e) {
+ LOG.error(String.format(
+ "Could not get partitions for '%s'.'%s' !!", db.getName(),
+ tbl.getTableName()), e);
+ }
+ }
+ return new LinkedList<Partition>();
+ }
+
+ private HiveMetaStoreClient getClient() {
+ if (client == null) {
+ try {
+ client = new HiveMetaStoreClient(hiveConf);
+ return client;
+ } catch (MetaException e) {
+ client = null;
+ LOG.error("Could not create metastore client !!", e);
+ return null;
+ }
+ } else {
+ return client;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-hdfs/src/main/java/org/apache/sentry/hdfs/HMSPaths.java
----------------------------------------------------------------------
diff --git a/sentry-hdfs/src/main/java/org/apache/sentry/hdfs/HMSPaths.java b/sentry-hdfs/src/main/java/org/apache/sentry/hdfs/HMSPaths.java
new file mode 100644
index 0000000..e445634
--- /dev/null
+++ b/sentry-hdfs/src/main/java/org/apache/sentry/hdfs/HMSPaths.java
@@ -0,0 +1,467 @@
+/**
+ * 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.hdfs;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.hadoop.fs.Path;
+
+import com.google.common.annotations.VisibleForTesting;
+import com.google.common.base.Preconditions;
+import com.google.common.collect.Lists;
+
+public class HMSPaths implements AuthzPaths {
+
+ @VisibleForTesting
+ static List<String> getPathElements(String path) {
+ path = path.trim();
+ if (path.charAt(0) != Path.SEPARATOR_CHAR) {
+ throw new IllegalArgumentException("It must be an absolute path: " +
+ path);
+ }
+ List<String> list = new ArrayList<String>(32);
+ int idx = 0;
+ int found = path.indexOf(Path.SEPARATOR_CHAR, idx);
+ while (found > -1) {
+ if (found > idx) {
+ list.add(path.substring(idx, found));
+ }
+ idx = found + 1;
+ found = path.indexOf(Path.SEPARATOR_CHAR, idx);
+ }
+ if (idx < path.length()) {
+ list.add(path.substring(idx));
+ }
+ return list;
+ }
+
+ @VisibleForTesting
+ static List<List<String>> gePathsElements(List<String> paths) {
+ List<List<String>> pathsElements = new ArrayList<List<String>>(paths.size());
+ for (String path : paths) {
+ pathsElements.add(getPathElements(path));
+ }
+ return pathsElements;
+ }
+
+ @VisibleForTesting
+ enum EntryType {
+ DIR(true),
+ PREFIX(false),
+ AUTHZ_OBJECT(false);
+
+ private boolean removeIfDangling;
+
+ private EntryType(boolean removeIfDangling) {
+ this.removeIfDangling = removeIfDangling;
+ }
+
+ public boolean isRemoveIfDangling() {
+ return removeIfDangling;
+ }
+
+ public byte getByte() {
+ return (byte)toString().charAt(0);
+ }
+
+ public static EntryType fromByte(byte b) {
+ switch (b) {
+ case ((byte)'D'):
+ return DIR;
+ case ((byte)'P'):
+ return PREFIX;
+ case ((byte)'A'):
+ return AUTHZ_OBJECT;
+ default:
+ return null;
+ }
+ }
+ }
+
+ @VisibleForTesting
+ static class Entry {
+ private Entry parent;
+ private EntryType type;
+ private final String pathElement;
+ private String authzObj;
+ private final Map<String, Entry> children;
+
+ Entry(Entry parent, String pathElement, EntryType type,
+ String authzObj) {
+ this.parent = parent;
+ this.type = type;
+ this.pathElement = pathElement;
+ this.authzObj = authzObj;
+ children = new HashMap<String, Entry>();
+ }
+
+ private void setAuthzObj(String authzObj) {
+ this.authzObj = authzObj;
+ }
+
+ private void setType(EntryType type) {
+ this.type = type;
+ }
+
+ protected void removeParent() {
+ parent = null;
+ }
+
+ public String toString() {
+ return String.format("Entry[fullPath: %s, type: %s, authObject: %s]",
+ getFullPath(), type, authzObj);
+ }
+
+ private Entry createChild(List<String> pathElements, EntryType type,
+ String authzObj) {
+ Entry entryParent = this;
+ for (int i = 0; i < pathElements.size() - 1; i++) {
+ String pathElement = pathElements.get(i);
+ Entry child = entryParent.getChildren().get(pathElement);
+ if (child == null) {
+ child = new Entry(entryParent, pathElement, EntryType.DIR, null);
+ entryParent.getChildren().put(pathElement, child);
+ }
+ entryParent = child;
+ }
+ String lastPathElement = pathElements.get(pathElements.size() - 1);
+ Entry child = entryParent.getChildren().get(lastPathElement);
+ if (child == null) {
+ child = new Entry(entryParent, lastPathElement, type, authzObj);
+ entryParent.getChildren().put(lastPathElement, child);
+ } else if (type == EntryType.AUTHZ_OBJECT &&
+ child.getType() == EntryType.DIR) {
+ // if the entry already existed as dir, we change it to be a authz obj
+ child.setAuthzObj(authzObj);
+ child.setType(EntryType.AUTHZ_OBJECT);
+ }
+ return child;
+ }
+
+ public static Entry createRoot(boolean asPrefix) {
+ return new Entry(null, "/", (asPrefix)
+ ? EntryType.PREFIX : EntryType.DIR, null);
+ }
+
+ private String toPath(List<String> arr) {
+ StringBuilder sb = new StringBuilder();
+ for (String s : arr) {
+ sb.append(Path.SEPARATOR).append(s);
+ }
+ return sb.toString();
+ }
+
+ public Entry createPrefix(List<String> pathElements) {
+ Entry prefix = findPrefixEntry(pathElements);
+ if (prefix != null) {
+ throw new IllegalArgumentException(String.format(
+ "Cannot add prefix '%s' under an existing prefix '%s'",
+ toPath(pathElements), prefix.getFullPath()));
+ }
+ return createChild(pathElements, EntryType.PREFIX, null);
+ }
+
+ public Entry createAuthzObjPath(List<String> pathElements, String authzObj) {
+ Entry entry = null;
+ Entry prefix = findPrefixEntry(pathElements);
+ if (prefix != null) {
+ // we only create the entry if is under a prefix, else we ignore it
+ entry = createChild(pathElements, EntryType.AUTHZ_OBJECT, authzObj);
+ }
+ return entry;
+ }
+
+ public void delete() {
+ if (getParent() != null) {
+ if (getChildren().isEmpty()) {
+ getParent().getChildren().remove(getPathElement());
+ getParent().deleteIfDangling();
+ parent = null;
+ } else {
+ // if the entry was for an authz object and has children, we
+ // change it to be a dir entry.
+ if (getType() == EntryType.AUTHZ_OBJECT) {
+ setType(EntryType.DIR);
+ setAuthzObj(null);
+ }
+ }
+ }
+ }
+
+ private void deleteIfDangling() {
+ if (getChildren().isEmpty() && getType().isRemoveIfDangling()) {
+ delete();
+ }
+ }
+
+ public Entry getParent() {
+ return parent;
+ }
+
+ public EntryType getType() {
+ return type;
+ }
+
+ public String getPathElement() {
+ return pathElement;
+ }
+
+ public String getAuthzObj() {
+ return authzObj;
+ }
+
+ @SuppressWarnings("unchecked")
+ public Map<String, Entry> getChildren() {
+ return children;
+ }
+
+ public Entry findPrefixEntry(List<String> pathElements) {
+ Preconditions.checkArgument(pathElements != null,
+ "pathElements cannot be NULL");
+ return (getType() == EntryType.PREFIX)
+ ? this : findPrefixEntry(pathElements, 0);
+ }
+
+ private Entry findPrefixEntry(List<String> pathElements, int index) {
+ Entry prefixEntry = null;
+ if (index == pathElements.size()) {
+ prefixEntry = null;
+ } else {
+ Entry child = getChildren().get(pathElements.get(index));
+ if (child != null) {
+ if (child.getType() == EntryType.PREFIX) {
+ prefixEntry = child;
+ } else {
+ prefixEntry = child.findPrefixEntry(pathElements, index + 1);
+ }
+ }
+ }
+ return prefixEntry;
+ }
+
+ public Entry find(String[] pathElements, boolean isPartialMatchOk) {
+ Preconditions.checkArgument(
+ pathElements != null && pathElements.length > 0,
+ "pathElements cannot be NULL or empty");
+ return find(pathElements, 0, isPartialMatchOk, null);
+ }
+
+ private Entry find(String[] pathElements, int index,
+ boolean isPartialMatchOk, Entry lastAuthObj) {
+ Entry found = null;
+ if (index == pathElements.length) {
+ if (isPartialMatchOk && (getType() == EntryType.AUTHZ_OBJECT)) {
+ found = this;
+ }
+ } else {
+ Entry child = getChildren().get(pathElements[index]);
+ if (child != null) {
+ if (index == pathElements.length - 1) {
+ found = (child.getType() == EntryType.AUTHZ_OBJECT) ? child : lastAuthObj;
+ } else {
+ found = child.find(pathElements, index + 1, isPartialMatchOk,
+ (child.getType() == EntryType.AUTHZ_OBJECT) ? child : lastAuthObj);
+ }
+ } else {
+ if (isPartialMatchOk) {
+ found = lastAuthObj;
+ }
+ }
+ }
+ return found;
+ }
+
+ public String getFullPath() {
+ String path = getFullPath(this, new StringBuilder()).toString();
+ if (path.isEmpty()) {
+ path = Path.SEPARATOR;
+ }
+ return path;
+ }
+
+ private StringBuilder getFullPath(Entry entry, StringBuilder sb) {
+ if (entry.getParent() != null) {
+ getFullPath(entry.getParent(), sb).append(Path.SEPARATOR).append(
+ entry.getPathElement());
+ }
+ return sb;
+ }
+
+ }
+
+ private volatile Entry root;
+ private Map<String, Set<Entry>> authzObjToPath;
+
+ public HMSPaths(String[] pathPrefixes) {
+ boolean rootPrefix = false;
+ for (String pathPrefix : pathPrefixes) {
+ rootPrefix = rootPrefix || pathPrefix.equals(Path.SEPARATOR);
+ }
+ if (rootPrefix && pathPrefixes.length > 1) {
+ throw new IllegalArgumentException(
+ "Root is a path prefix, there cannot be other path prefixes");
+ }
+ root = Entry.createRoot(rootPrefix);
+ if (!rootPrefix) {
+ for (String pathPrefix : pathPrefixes) {
+ root.createPrefix(getPathElements(pathPrefix));
+ }
+ }
+ authzObjToPath = new HashMap<String, Set<Entry>>();
+ }
+
+ HMSPaths() {
+ authzObjToPath = new HashMap<String, Set<Entry>>();
+ }
+
+ void _addAuthzObject(String authzObj, List<String> authzObjPaths) {
+ addAuthzObject(authzObj, gePathsElements(authzObjPaths));
+ }
+
+ void addAuthzObject(String authzObj, List<List<String>> authzObjPathElements) {
+ Set<Entry> previousEntries = authzObjToPath.get(authzObj);
+ Set<Entry> newEntries = new HashSet<Entry>(authzObjPathElements.size());
+ for (List<String> pathElements : authzObjPathElements) {
+ Entry e = root.createAuthzObjPath(pathElements, authzObj);
+ if (e != null) {
+ newEntries.add(e);
+ } else {
+ // LOG WARN IGNORING PATH, no prefix
+ }
+ }
+ authzObjToPath.put(authzObj, newEntries);
+ if (previousEntries != null) {
+ previousEntries.removeAll(newEntries);
+ if (!previousEntries.isEmpty()) {
+ for (Entry entry : previousEntries) {
+ entry.delete();
+ }
+ }
+ }
+ }
+
+ void addPathsToAuthzObject(String authzObj,
+ List<List<String>> authzObjPathElements, boolean createNew) {
+ Set<Entry> entries = authzObjToPath.get(authzObj);
+ if (entries != null) {
+ Set<Entry> newEntries = new HashSet<Entry>(authzObjPathElements.size());
+ for (List<String> pathElements : authzObjPathElements) {
+ Entry e = root.createAuthzObjPath(pathElements, authzObj);
+ if (e != null) {
+ newEntries.add(e);
+ } else {
+ // LOG WARN IGNORING PATH, no prefix
+ }
+ }
+ entries.addAll(newEntries);
+ } else {
+ if (createNew) {
+ addAuthzObject(authzObj, authzObjPathElements);
+ }
+ // LOG WARN object does not exist
+ }
+ }
+
+ void _addPathsToAuthzObject(String authzObj, List<String> authzObjPaths) {
+ addPathsToAuthzObject(authzObj, gePathsElements(authzObjPaths), false);
+ }
+
+ void addPathsToAuthzObject(String authzObj, List<List<String>> authzObjPaths) {
+ addPathsToAuthzObject(authzObj, authzObjPaths, false);
+ }
+
+ void deletePathsFromAuthzObject(String authzObj,
+ List<List<String>> authzObjPathElements) {
+ Set<Entry> entries = authzObjToPath.get(authzObj);
+ if (entries != null) {
+ Set<Entry> toDelEntries = new HashSet<Entry>(authzObjPathElements.size());
+ for (List<String> pathElements : authzObjPathElements) {
+ Entry entry = root.find(
+ pathElements.toArray(new String[pathElements.size()]), false);
+ if (entry != null) {
+ entry.delete();
+ toDelEntries.add(entry);
+ } else {
+ // LOG WARN IGNORING PATH, it was not in registered
+ }
+ }
+ entries.removeAll(toDelEntries);
+ } else {
+ // LOG WARN object does not exist
+ }
+ }
+
+ void deleteAuthzObject(String authzObj) {
+ Set<Entry> entries = authzObjToPath.remove(authzObj);
+ if (entries != null) {
+ for (Entry entry : entries) {
+ entry.delete();
+ }
+ }
+ }
+
+ @Override
+ public String findAuthzObject(String[] pathElements) {
+ return findAuthzObject(pathElements, true);
+ }
+
+ @Override
+ public String findAuthzObjectExactMatch(String[] pathElements) {
+ return findAuthzObject(pathElements, false);
+ }
+
+ public String findAuthzObject(String[] pathElements, boolean isPartialOk) {
+ // Handle '/'
+ if ((pathElements == null)||(pathElements.length == 0)) return null;
+ String authzObj = null;
+ Entry entry = root.find(pathElements, isPartialOk);
+ if (entry != null) {
+ authzObj = entry.getAuthzObj();
+ }
+ return authzObj;
+ }
+
+ @Override
+ public boolean isUnderPrefix(String[] pathElements) {
+ return root.findPrefixEntry(Lists.newArrayList(pathElements)) != null;
+ }
+
+ // Used by the serializer
+ Entry getRootEntry() {
+ return root;
+ }
+
+ void setRootEntry(Entry root) {
+ this.root = root;
+ }
+
+ void setAuthzObjToPathMapping(Map<String, Set<Entry>> mapping) {
+ authzObjToPath = mapping;
+ }
+
+ @Override
+ public HMSPathsSerDe getPathsDump() {
+ return new HMSPathsSerDe(this);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-hdfs/src/main/java/org/apache/sentry/hdfs/HMSPathsSerDe.java
----------------------------------------------------------------------
diff --git a/sentry-hdfs/src/main/java/org/apache/sentry/hdfs/HMSPathsSerDe.java b/sentry-hdfs/src/main/java/org/apache/sentry/hdfs/HMSPathsSerDe.java
new file mode 100644
index 0000000..7a25d29
--- /dev/null
+++ b/sentry-hdfs/src/main/java/org/apache/sentry/hdfs/HMSPathsSerDe.java
@@ -0,0 +1,113 @@
+/**
+ * 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.hdfs;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.IdentityHashMap;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.apache.sentry.hdfs.HMSPaths.Entry;
+import org.apache.sentry.hdfs.HMSPaths.EntryType;
+import org.apache.sentry.provider.db.service.thrift.TPathsDump;
+import org.apache.sentry.provider.db.service.thrift.TPathEntry;
+
+public class HMSPathsSerDe implements AuthzPathsDumper<HMSPaths> {
+
+ private final HMSPaths hmsPaths;
+
+ static class Tuple {
+ final TPathEntry entry;
+ final int id;
+ Tuple(TPathEntry entry, int id) {
+ this.entry = entry;
+ this.id = id;
+ }
+ }
+
+ public HMSPathsSerDe(HMSPaths hmsPaths) {
+ this.hmsPaths = hmsPaths;
+ }
+
+ @Override
+ public TPathsDump createPathsDump() {
+ AtomicInteger counter = new AtomicInteger(0);
+ Map<Integer, TPathEntry> idMap = new HashMap<Integer, TPathEntry>();
+ Tuple tRootTuple =
+ createTPathEntry(hmsPaths.getRootEntry(), counter, idMap);
+ idMap.put(tRootTuple.id, tRootTuple.entry);
+ cloneToTPathEntry(hmsPaths.getRootEntry(), tRootTuple.entry, counter, idMap);
+ return new TPathsDump(tRootTuple.id, idMap);
+ }
+
+ private void cloneToTPathEntry(Entry parent, TPathEntry tParent,
+ AtomicInteger counter, Map<Integer, TPathEntry> idMap) {
+ for (Entry child : parent.getChildren().values()) {
+ Tuple childTuple = createTPathEntry(child, counter, idMap);
+ tParent.getChildren().add(childTuple.id);
+ cloneToTPathEntry(child, childTuple.entry, counter, idMap);
+ }
+ }
+
+ private Tuple createTPathEntry(Entry entry, AtomicInteger idCounter,
+ Map<Integer, TPathEntry> idMap) {
+ int myId = idCounter.incrementAndGet();
+ TPathEntry tEntry = new TPathEntry(entry.getType().getByte(),
+ entry.getPathElement(), new HashSet<Integer>());
+ if (entry.getAuthzObj() != null) {
+ tEntry.setAuthzObj(entry.getAuthzObj());
+ }
+ idMap.put(myId, tEntry);
+ return new Tuple(tEntry, myId);
+ }
+
+ @Override
+ public HMSPaths initializeFromDump(TPathsDump pathDump) {
+ HMSPaths hmsPaths = new HMSPaths();
+ TPathEntry tRootEntry = pathDump.getNodeMap().get(pathDump.getRootId());
+ Entry rootEntry = new Entry(null, tRootEntry.getPathElement(),
+ EntryType.fromByte(tRootEntry.getType()), tRootEntry.getAuthzObj());
+ Map<String, Set<Entry>> authzObjToPath = new HashMap<String, Set<Entry>>();
+ cloneToEntry(tRootEntry, rootEntry, pathDump.getNodeMap(), authzObjToPath);
+ hmsPaths.setRootEntry(rootEntry);
+ hmsPaths.setAuthzObjToPathMapping(authzObjToPath);
+ return hmsPaths;
+ }
+
+ private void cloneToEntry(TPathEntry tParent, Entry parent,
+ Map<Integer, TPathEntry> idMap, Map<String, Set<Entry>> authzObjToPath) {
+ for (Integer id : tParent.getChildren()) {
+ TPathEntry tChild = idMap.get(id);
+ Entry child = new Entry(parent, tChild.getPathElement(),
+ EntryType.fromByte(tChild.getType()), tChild.getAuthzObj());
+ if (child.getAuthzObj() != null) {
+ Set<Entry> paths = authzObjToPath.get(child.getAuthzObj());
+ if (paths == null) {
+ paths = new HashSet<Entry>();
+ authzObjToPath.put(child.getAuthzObj(), paths);
+ }
+ paths.add(child);
+ }
+ parent.getChildren().put(child.getPathElement(), child);
+ cloneToEntry(tChild, child, idMap, authzObjToPath);
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-hdfs/src/main/java/org/apache/sentry/hdfs/MetastoreClient.java
----------------------------------------------------------------------
diff --git a/sentry-hdfs/src/main/java/org/apache/sentry/hdfs/MetastoreClient.java b/sentry-hdfs/src/main/java/org/apache/sentry/hdfs/MetastoreClient.java
new file mode 100644
index 0000000..3b64756
--- /dev/null
+++ b/sentry-hdfs/src/main/java/org/apache/sentry/hdfs/MetastoreClient.java
@@ -0,0 +1,34 @@
+/**
+ * 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.hdfs;
+
+import java.util.List;
+
+import org.apache.hadoop.hive.metastore.api.Database;
+import org.apache.hadoop.hive.metastore.api.Partition;
+import org.apache.hadoop.hive.metastore.api.Table;
+
+public interface MetastoreClient {
+
+ public List<Database> getAllDatabases();
+
+ public List<Table> getAllTablesOfDatabase(Database db);
+
+ public List<Partition> listAllPartitions(Database db, Table tbl);
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-hdfs/src/main/java/org/apache/sentry/hdfs/PathsUpdate.java
----------------------------------------------------------------------
diff --git a/sentry-hdfs/src/main/java/org/apache/sentry/hdfs/PathsUpdate.java b/sentry-hdfs/src/main/java/org/apache/sentry/hdfs/PathsUpdate.java
new file mode 100644
index 0000000..faa28f1
--- /dev/null
+++ b/sentry-hdfs/src/main/java/org/apache/sentry/hdfs/PathsUpdate.java
@@ -0,0 +1,84 @@
+/**
+ * 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.hdfs;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.apache.sentry.provider.db.service.thrift.TPathChanges;
+import org.apache.sentry.provider.db.service.thrift.TPathsUpdate;
+
+import com.google.common.collect.Lists;
+
+public class PathsUpdate implements Updateable.Update {
+
+ public static String ALL_PATHS = "__ALL_PATHS__";
+
+ private final TPathsUpdate tPathsUpdate;
+
+ public PathsUpdate(TPathsUpdate tPathsUpdate) {
+ this.tPathsUpdate = tPathsUpdate;
+ }
+
+ public PathsUpdate(long seqNum, boolean hasFullImage) {
+ tPathsUpdate = new TPathsUpdate(hasFullImage, seqNum,
+ new LinkedList<TPathChanges>());
+ }
+
+ @Override
+ public boolean hasFullImage() {
+ return tPathsUpdate.isHasFullImage();
+ }
+ public TPathChanges newPathChange(String authzObject) {
+ TPathChanges pathChanges = new TPathChanges(authzObject,
+ new LinkedList<List<String>>(), new LinkedList<List<String>>());
+ tPathsUpdate.addToPathChanges(pathChanges);
+ return pathChanges;
+ }
+ public List<TPathChanges> getPathChanges() {
+ return tPathsUpdate.getPathChanges();
+ }
+
+ @Override
+ public long getSeqNum() {
+ return tPathsUpdate.getSeqNum();
+ }
+
+ @Override
+ public void setSeqNum(long seqNum) {
+ tPathsUpdate.setSeqNum(seqNum);
+ }
+
+ public TPathsUpdate getThriftObject() {
+ return tPathsUpdate;
+ }
+
+
+
+ public static List<String> cleanPath(String path) {
+ try {
+ return Lists.newArrayList(new URI(path).getPath().split("^/")[1]
+ .split("/"));
+ } catch (URISyntaxException e) {
+ throw new RuntimeException("Incomprehensible path [" + path + "]");
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-hdfs/src/main/java/org/apache/sentry/hdfs/PermissionsUpdate.java
----------------------------------------------------------------------
diff --git a/sentry-hdfs/src/main/java/org/apache/sentry/hdfs/PermissionsUpdate.java b/sentry-hdfs/src/main/java/org/apache/sentry/hdfs/PermissionsUpdate.java
new file mode 100644
index 0000000..d9a6592
--- /dev/null
+++ b/sentry-hdfs/src/main/java/org/apache/sentry/hdfs/PermissionsUpdate.java
@@ -0,0 +1,93 @@
+/**
+ * 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.hdfs;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.LinkedList;
+
+import org.apache.sentry.provider.db.service.thrift.TPermissionsUpdate;
+import org.apache.sentry.provider.db.service.thrift.TPrivilegeChanges;
+import org.apache.sentry.provider.db.service.thrift.TRoleChanges;
+
+public class PermissionsUpdate implements Updateable.Update {
+
+ public static String ALL_AUTHZ_OBJ = "__ALL_AUTHZ_OBJ__";
+ public static String ALL_PRIVS = "__ALL_PRIVS__";
+ public static String ALL_ROLES = "__ALL_ROLES__";
+ public static String ALL_GROUPS = "__ALL_GROUPS__";
+
+ private final TPermissionsUpdate tPermUpdate;
+
+ public PermissionsUpdate(TPermissionsUpdate tPermUpdate) {
+ this.tPermUpdate = tPermUpdate;
+ }
+
+ public PermissionsUpdate(long seqNum, boolean hasFullImage) {
+ this.tPermUpdate = new TPermissionsUpdate(hasFullImage, seqNum,
+ new HashMap<String, TPrivilegeChanges>(),
+ new HashMap<String, TRoleChanges>());
+ }
+
+ @Override
+ public long getSeqNum() {
+ return tPermUpdate.getSeqNum();
+ }
+
+ @Override
+ public void setSeqNum(long seqNum) {
+ tPermUpdate.setSeqNum(seqNum);
+ }
+
+ @Override
+ public boolean hasFullImage() {
+ return tPermUpdate.isHasfullImage();
+ }
+
+ public TPrivilegeChanges addPrivilegeUpdate(String authzObj) {
+ if (tPermUpdate.getPrivilegeChanges().containsKey(authzObj)) {
+ return tPermUpdate.getPrivilegeChanges().get(authzObj);
+ }
+ TPrivilegeChanges privUpdate = new TPrivilegeChanges(authzObj,
+ new HashMap<String, String>(), new HashMap<String, String>());
+ tPermUpdate.getPrivilegeChanges().put(authzObj, privUpdate);
+ return privUpdate;
+ }
+
+ public TRoleChanges addRoleUpdate(String role) {
+ if (tPermUpdate.getRoleChanges().containsKey(role)) {
+ return tPermUpdate.getRoleChanges().get(role);
+ }
+ TRoleChanges roleUpdate = new TRoleChanges(role, new LinkedList<String>(),
+ new LinkedList<String>());
+ tPermUpdate.getRoleChanges().put(role, roleUpdate);
+ return roleUpdate;
+ }
+
+ public Collection<TRoleChanges> getRoleUpdates() {
+ return tPermUpdate.getRoleChanges().values();
+ }
+
+ public Collection<TPrivilegeChanges> getPrivilegeUpdates() {
+ return tPermUpdate.getPrivilegeChanges().values();
+ }
+
+ public TPermissionsUpdate getThriftObject() {
+ return tPermUpdate;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-hdfs/src/main/java/org/apache/sentry/hdfs/Updateable.java
----------------------------------------------------------------------
diff --git a/sentry-hdfs/src/main/java/org/apache/sentry/hdfs/Updateable.java b/sentry-hdfs/src/main/java/org/apache/sentry/hdfs/Updateable.java
new file mode 100644
index 0000000..1649ffc
--- /dev/null
+++ b/sentry-hdfs/src/main/java/org/apache/sentry/hdfs/Updateable.java
@@ -0,0 +1,61 @@
+/**
+ * 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.hdfs;
+
+import java.util.concurrent.locks.ReadWriteLock;
+
+public interface Updateable<K extends Updateable.Update> {
+
+ public interface Update {
+
+ boolean hasFullImage();
+
+ long getSeqNum();
+
+ void setSeqNum(long seqNum);
+
+ }
+
+ /**
+ * Apply multiple partial updates in order
+ * @param update
+ * @param lock External Lock.
+ * @return
+ */
+ public void updatePartial(Iterable<K> update, ReadWriteLock lock);
+
+ /**
+ * This returns a new object with the full update applied
+ * @param update
+ * @return
+ */
+ public Updateable<K> updateFull(K update);
+
+ /**
+ * Return sequence number of Last Update
+ */
+ public long getLastUpdatedSeqNum();
+
+ /**
+ * Create and Full image update of the local data structure
+ * @param currSeqNum
+ * @return
+ */
+ public K createFullImageUpdate(long currSeqNum);
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-hdfs/src/main/java/org/apache/sentry/hdfs/UpdateableAuthzPaths.java
----------------------------------------------------------------------
diff --git a/sentry-hdfs/src/main/java/org/apache/sentry/hdfs/UpdateableAuthzPaths.java b/sentry-hdfs/src/main/java/org/apache/sentry/hdfs/UpdateableAuthzPaths.java
new file mode 100644
index 0000000..8680d5d
--- /dev/null
+++ b/sentry-hdfs/src/main/java/org/apache/sentry/hdfs/UpdateableAuthzPaths.java
@@ -0,0 +1,130 @@
+/**
+ * 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.hdfs;
+
+import java.util.List;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.concurrent.locks.ReadWriteLock;
+
+import org.apache.sentry.provider.db.service.thrift.TPathChanges;
+import org.apache.sentry.provider.db.service.thrift.TPathsDump;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class UpdateableAuthzPaths implements AuthzPaths, Updateable<PathsUpdate> {
+ private volatile HMSPaths paths;
+ private final AtomicLong seqNum = new AtomicLong(0);
+
+ private static Logger LOG = LoggerFactory.getLogger(UpdateableAuthzPaths.class);
+
+ public UpdateableAuthzPaths(String[] pathPrefixes) {
+ this.paths = new HMSPaths(pathPrefixes);
+ }
+
+ UpdateableAuthzPaths(HMSPaths paths) {
+ this.paths = paths;
+ }
+
+ @Override
+ public boolean isUnderPrefix(String[] pathElements) {
+ return paths.isUnderPrefix(pathElements);
+ }
+
+ @Override
+ public String findAuthzObject(String[] pathElements) {
+ return paths.findAuthzObject(pathElements);
+ }
+
+ @Override
+ public String findAuthzObjectExactMatch(String[] pathElements) {
+ return paths.findAuthzObjectExactMatch(pathElements);
+ }
+
+ @Override
+ public UpdateableAuthzPaths updateFull(PathsUpdate update) {
+ UpdateableAuthzPaths other = getPathsDump().initializeFromDump(
+ update.getThriftObject().getPathsDump());
+ other.seqNum.set(update.getSeqNum());
+ return other;
+ }
+
+ @Override
+ public void updatePartial(Iterable<PathsUpdate> updates, ReadWriteLock lock) {
+ lock.writeLock().lock();
+ try {
+ int counter = 0;
+ for (PathsUpdate update : updates) {
+ applyPartialUpdate(update);
+ if (++counter > 99) {
+ counter = 0;
+ lock.writeLock().unlock();
+ lock.writeLock().lock();
+ }
+ seqNum.set(update.getSeqNum());
+ LOG.warn("##### Updated paths seq Num [" + seqNum.get() + "]");
+ }
+ } finally {
+ lock.writeLock().unlock();
+ }
+ }
+
+ private void applyPartialUpdate(PathsUpdate update) {
+ for (TPathChanges pathChanges : update.getPathChanges()) {
+ paths.addPathsToAuthzObject(pathChanges.getAuthzObj(), pathChanges
+ .getAddPaths(), true);
+ List<List<String>> delPaths = pathChanges.getDelPaths();
+ if ((delPaths.size() == 1) && (delPaths.get(0).size() == 1)
+ && (delPaths.get(0).get(0).equals(PathsUpdate.ALL_PATHS))) {
+ // Remove all paths.. eg. drop table
+ paths.deleteAuthzObject(pathChanges.getAuthzObj());
+ } else {
+ paths.deletePathsFromAuthzObject(pathChanges.getAuthzObj(), pathChanges
+ .getDelPaths());
+ }
+ }
+ }
+
+ @Override
+ public long getLastUpdatedSeqNum() {
+ return seqNum.get();
+ }
+
+ @Override
+ public PathsUpdate createFullImageUpdate(long currSeqNum) {
+ PathsUpdate pathsUpdate = new PathsUpdate(currSeqNum, true);
+ pathsUpdate.getThriftObject().setPathsDump(getPathsDump().createPathsDump());
+ return pathsUpdate;
+ }
+
+ @Override
+ public AuthzPathsDumper<UpdateableAuthzPaths> getPathsDump() {
+ return new AuthzPathsDumper<UpdateableAuthzPaths>() {
+
+ @Override
+ public TPathsDump createPathsDump() {
+ return UpdateableAuthzPaths.this.paths.getPathsDump().createPathsDump();
+ }
+
+ @Override
+ public UpdateableAuthzPaths initializeFromDump(TPathsDump pathsDump) {
+ return new UpdateableAuthzPaths(new HMSPaths().getPathsDump().initializeFromDump(
+ pathsDump));
+ }
+ };
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-hdfs/src/test/java/org/apache/sentry/hdfs/DummyAdapter.java
----------------------------------------------------------------------
diff --git a/sentry-hdfs/src/test/java/org/apache/sentry/hdfs/DummyAdapter.java b/sentry-hdfs/src/test/java/org/apache/sentry/hdfs/DummyAdapter.java
new file mode 100644
index 0000000..24c63a5
--- /dev/null
+++ b/sentry-hdfs/src/test/java/org/apache/sentry/hdfs/DummyAdapter.java
@@ -0,0 +1,39 @@
+/**
+ * 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.hdfs;
+
+//import org.apache.sentry.provider.db.service.thrift.UpdateForwarder;
+
+public class DummyAdapter {
+//public class DummyAdapter<K extends UpdateForwarder.Update> {
+//
+// private final UpdateForwarder<K> destCache;
+// private final UpdateForwarder<K> srcCache;
+//
+// public DummyAdapter(UpdateForwarder<K> destCache, UpdateForwarder<K> srcCache) {
+// super();
+// this.destCache = destCache;
+// this.srcCache = srcCache;
+// }
+//
+// public void getDestToPullUpdatesFromSrc() {
+// for (K update : srcCache.getAllUpdatesFrom(destCache.getLastCommitted() + 1)) {
+// destCache.handleUpdateNotification(update);
+// }
+// }
+}
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-hdfs/src/test/java/org/apache/sentry/hdfs/DummyAuthzSource.java
----------------------------------------------------------------------
diff --git a/sentry-hdfs/src/test/java/org/apache/sentry/hdfs/DummyAuthzSource.java b/sentry-hdfs/src/test/java/org/apache/sentry/hdfs/DummyAuthzSource.java
new file mode 100644
index 0000000..57299c8
--- /dev/null
+++ b/sentry-hdfs/src/test/java/org/apache/sentry/hdfs/DummyAuthzSource.java
@@ -0,0 +1,60 @@
+/**
+ * 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.hdfs;
+
+//import org.apache.sentry.hdfs.old.AuthzPermCache.AuthzSource;
+//import org.apache.sentry.hdfs.old.AuthzPermCache.PrivilegeInfo;
+//import org.apache.sentry.hdfs.old.AuthzPermCache.RoleInfo;
+
+public class DummyAuthzSource {
+//public class DummyAuthzSource implements AuthzSource{
+//
+// public Map<String, PrivilegeInfo> privs = new HashMap<String, PrivilegeInfo>();
+// public Map<String, RoleInfo> roles = new HashMap<String, RoleInfo>();
+//
+// @Override
+// public PrivilegeInfo loadPrivilege(String authzObj) throws Exception {
+// return privs.get(authzObj);
+// }
+//
+// @Override
+// public RoleInfo loadGroupsForRole(String group) throws Exception {
+// return roles.get(group);
+// }
+//
+// @Override
+// public PermissionsUpdate createFullImage(long seqNum) {
+// PermissionsUpdate retVal = new PermissionsUpdate(seqNum, true);
+// for (Map.Entry<String, PrivilegeInfo> pE : privs.entrySet()) {
+// PrivilegeChanges pUpdate = retVal.addPrivilegeUpdate(pE.getKey());
+// PrivilegeInfo pInfo = pE.getValue();
+// for (Map.Entry<String, FsAction> ent : pInfo.roleToPermission.entrySet()) {
+// pUpdate.addPrivilege(ent.getKey(), ent.getValue().SYMBOL);
+// }
+// }
+// for (Map.Entry<String, RoleInfo> rE : roles.entrySet()) {
+// RoleChanges rUpdate = retVal.addRoleUpdate(rE.getKey());
+// RoleInfo rInfo = rE.getValue();
+// for (String role : rInfo.groups) {
+// rUpdate.addGroup(role);
+// }
+// }
+// return retVal;
+// }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-hdfs/src/test/java/org/apache/sentry/hdfs/DummyHMSClient.java
----------------------------------------------------------------------
diff --git a/sentry-hdfs/src/test/java/org/apache/sentry/hdfs/DummyHMSClient.java b/sentry-hdfs/src/test/java/org/apache/sentry/hdfs/DummyHMSClient.java
new file mode 100644
index 0000000..3f66c87
--- /dev/null
+++ b/sentry-hdfs/src/test/java/org/apache/sentry/hdfs/DummyHMSClient.java
@@ -0,0 +1,79 @@
+/**
+ * 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.hdfs;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+
+import org.apache.hadoop.hive.metastore.api.Database;
+import org.apache.hadoop.hive.metastore.api.Partition;
+import org.apache.hadoop.hive.metastore.api.StorageDescriptor;
+import org.apache.hadoop.hive.metastore.api.Table;
+import org.apache.sentry.hdfs.MetastoreClient;
+
+public class DummyHMSClient implements MetastoreClient {
+
+ private HashMap<Database, HashMap<Table, HashSet<Partition>>> hmsData =
+ new HashMap<Database, HashMap<Table, HashSet<Partition>>>();
+
+ @Override
+ public List<Database> getAllDatabases() {
+ return new ArrayList<Database>(hmsData.keySet());
+ }
+
+ @Override
+ public List<Table> getAllTablesOfDatabase(Database db) {
+ if (hmsData.containsKey(db)) {
+ return new ArrayList<Table>(hmsData.get(db).keySet());
+ }
+ return new ArrayList<Table>();
+ }
+
+ @Override
+ public List<Partition> listAllPartitions(Database db, Table tbl) {
+ if (hmsData.containsKey(db)) {
+ if (hmsData.get(db).containsKey(tbl)) {
+ return new ArrayList<Partition>(hmsData.get(db).get(tbl));
+ }
+ }
+ return new ArrayList<Partition>();
+ }
+
+ public Database addDb(String dbName, String location) {
+ Database db = new Database(dbName, null, location, null);
+ hmsData.put(db, new HashMap<Table, HashSet<Partition>>());
+ return db;
+ }
+
+ public Table addTable(Database db, String tblName, String location) {
+ Table tbl =
+ new Table(tblName, db.getName(), null, 0, 0, 0,
+ new StorageDescriptor(null, location, null, null, false, 0, null, null, null, null),
+ null, null, null, null, null);
+ hmsData.get(db).put(tbl, new HashSet<Partition>());
+ return tbl;
+ }
+
+ public void addPartition(Database db, Table tbl, String partitionPath) {
+ Partition part = new Partition(null, db.getName(), tbl.getTableName(), 0, 0,
+ new StorageDescriptor(null, partitionPath, null, null, false, 0, null, null, null, null), null);
+ hmsData.get(db).get(tbl).add(part);
+ }
+}
[10/25] SENTRY-432. HDFS ingration. Initial patch
Posted by pr...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleGrantPrivilegeRequest.java
----------------------------------------------------------------------
diff --git a/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleGrantPrivilegeRequest.java b/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleGrantPrivilegeRequest.java
new file mode 100644
index 0000000..62b6b31
--- /dev/null
+++ b/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleGrantPrivilegeRequest.java
@@ -0,0 +1,693 @@
+/**
+ * Autogenerated by Thrift Compiler (0.9.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+package org.apache.sentry.provider.db.service.thrift;
+
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EnumMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.EnumSet;
+import java.util.Collections;
+import java.util.BitSet;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class TAlterSentryRoleGrantPrivilegeRequest implements org.apache.thrift.TBase<TAlterSentryRoleGrantPrivilegeRequest, TAlterSentryRoleGrantPrivilegeRequest._Fields>, java.io.Serializable, Cloneable {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TAlterSentryRoleGrantPrivilegeRequest");
+
+ private static final org.apache.thrift.protocol.TField PROTOCOL_VERSION_FIELD_DESC = new org.apache.thrift.protocol.TField("protocol_version", org.apache.thrift.protocol.TType.I32, (short)1);
+ private static final org.apache.thrift.protocol.TField REQUESTOR_USER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("requestorUserName", org.apache.thrift.protocol.TType.STRING, (short)2);
+ private static final org.apache.thrift.protocol.TField ROLE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("roleName", org.apache.thrift.protocol.TType.STRING, (short)3);
+ private static final org.apache.thrift.protocol.TField PRIVILEGE_FIELD_DESC = new org.apache.thrift.protocol.TField("privilege", org.apache.thrift.protocol.TType.STRUCT, (short)5);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new TAlterSentryRoleGrantPrivilegeRequestStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new TAlterSentryRoleGrantPrivilegeRequestTupleSchemeFactory());
+ }
+
+ private int protocol_version; // required
+ private String requestorUserName; // required
+ private String roleName; // required
+ private TSentryPrivilege privilege; // required
+
+ /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+ public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+ PROTOCOL_VERSION((short)1, "protocol_version"),
+ REQUESTOR_USER_NAME((short)2, "requestorUserName"),
+ ROLE_NAME((short)3, "roleName"),
+ PRIVILEGE((short)5, "privilege");
+
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+ static {
+ for (_Fields field : EnumSet.allOf(_Fields.class)) {
+ byName.put(field.getFieldName(), field);
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, or null if its not found.
+ */
+ public static _Fields findByThriftId(int fieldId) {
+ switch(fieldId) {
+ case 1: // PROTOCOL_VERSION
+ return PROTOCOL_VERSION;
+ case 2: // REQUESTOR_USER_NAME
+ return REQUESTOR_USER_NAME;
+ case 3: // ROLE_NAME
+ return ROLE_NAME;
+ case 5: // PRIVILEGE
+ return PRIVILEGE;
+ default:
+ return null;
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, throwing an exception
+ * if it is not found.
+ */
+ public static _Fields findByThriftIdOrThrow(int fieldId) {
+ _Fields fields = findByThriftId(fieldId);
+ if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+ return fields;
+ }
+
+ /**
+ * Find the _Fields constant that matches name, or null if its not found.
+ */
+ public static _Fields findByName(String name) {
+ return byName.get(name);
+ }
+
+ private final short _thriftId;
+ private final String _fieldName;
+
+ _Fields(short thriftId, String fieldName) {
+ _thriftId = thriftId;
+ _fieldName = fieldName;
+ }
+
+ public short getThriftFieldId() {
+ return _thriftId;
+ }
+
+ public String getFieldName() {
+ return _fieldName;
+ }
+ }
+
+ // isset id assignments
+ private static final int __PROTOCOL_VERSION_ISSET_ID = 0;
+ private byte __isset_bitfield = 0;
+ public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+ static {
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+ tmpMap.put(_Fields.PROTOCOL_VERSION, new org.apache.thrift.meta_data.FieldMetaData("protocol_version", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
+ tmpMap.put(_Fields.REQUESTOR_USER_NAME, new org.apache.thrift.meta_data.FieldMetaData("requestorUserName", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields.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.PRIVILEGE, new org.apache.thrift.meta_data.FieldMetaData("privilege", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ 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(TAlterSentryRoleGrantPrivilegeRequest.class, metaDataMap);
+ }
+
+ public TAlterSentryRoleGrantPrivilegeRequest() {
+ this.protocol_version = 1;
+
+ }
+
+ public TAlterSentryRoleGrantPrivilegeRequest(
+ int protocol_version,
+ String requestorUserName,
+ String roleName,
+ TSentryPrivilege privilege)
+ {
+ this();
+ this.protocol_version = protocol_version;
+ setProtocol_versionIsSet(true);
+ this.requestorUserName = requestorUserName;
+ this.roleName = roleName;
+ this.privilege = privilege;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public TAlterSentryRoleGrantPrivilegeRequest(TAlterSentryRoleGrantPrivilegeRequest other) {
+ __isset_bitfield = other.__isset_bitfield;
+ this.protocol_version = other.protocol_version;
+ if (other.isSetRequestorUserName()) {
+ this.requestorUserName = other.requestorUserName;
+ }
+ if (other.isSetRoleName()) {
+ this.roleName = other.roleName;
+ }
+ if (other.isSetPrivilege()) {
+ this.privilege = new TSentryPrivilege(other.privilege);
+ }
+ }
+
+ public TAlterSentryRoleGrantPrivilegeRequest deepCopy() {
+ return new TAlterSentryRoleGrantPrivilegeRequest(this);
+ }
+
+ @Override
+ public void clear() {
+ this.protocol_version = 1;
+
+ this.requestorUserName = null;
+ this.roleName = null;
+ this.privilege = null;
+ }
+
+ public int getProtocol_version() {
+ return this.protocol_version;
+ }
+
+ public void setProtocol_version(int protocol_version) {
+ this.protocol_version = protocol_version;
+ setProtocol_versionIsSet(true);
+ }
+
+ public void unsetProtocol_version() {
+ __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __PROTOCOL_VERSION_ISSET_ID);
+ }
+
+ /** Returns true if field protocol_version is set (has been assigned a value) and false otherwise */
+ public boolean isSetProtocol_version() {
+ return EncodingUtils.testBit(__isset_bitfield, __PROTOCOL_VERSION_ISSET_ID);
+ }
+
+ public void setProtocol_versionIsSet(boolean value) {
+ __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __PROTOCOL_VERSION_ISSET_ID, value);
+ }
+
+ public String getRequestorUserName() {
+ return this.requestorUserName;
+ }
+
+ public void setRequestorUserName(String requestorUserName) {
+ this.requestorUserName = requestorUserName;
+ }
+
+ public void unsetRequestorUserName() {
+ this.requestorUserName = null;
+ }
+
+ /** Returns true if field requestorUserName is set (has been assigned a value) and false otherwise */
+ public boolean isSetRequestorUserName() {
+ return this.requestorUserName != null;
+ }
+
+ public void setRequestorUserNameIsSet(boolean value) {
+ if (!value) {
+ this.requestorUserName = null;
+ }
+ }
+
+ public 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 TSentryPrivilege getPrivilege() {
+ return this.privilege;
+ }
+
+ public void setPrivilege(TSentryPrivilege privilege) {
+ this.privilege = privilege;
+ }
+
+ public void unsetPrivilege() {
+ this.privilege = null;
+ }
+
+ /** Returns true if field privilege is set (has been assigned a value) and false otherwise */
+ public boolean isSetPrivilege() {
+ return this.privilege != null;
+ }
+
+ public void setPrivilegeIsSet(boolean value) {
+ if (!value) {
+ this.privilege = null;
+ }
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case PROTOCOL_VERSION:
+ if (value == null) {
+ unsetProtocol_version();
+ } else {
+ setProtocol_version((Integer)value);
+ }
+ break;
+
+ case REQUESTOR_USER_NAME:
+ if (value == null) {
+ unsetRequestorUserName();
+ } else {
+ setRequestorUserName((String)value);
+ }
+ break;
+
+ case ROLE_NAME:
+ if (value == null) {
+ unsetRoleName();
+ } else {
+ setRoleName((String)value);
+ }
+ break;
+
+ case PRIVILEGE:
+ if (value == null) {
+ unsetPrivilege();
+ } else {
+ setPrivilege((TSentryPrivilege)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case PROTOCOL_VERSION:
+ return Integer.valueOf(getProtocol_version());
+
+ case REQUESTOR_USER_NAME:
+ return getRequestorUserName();
+
+ case ROLE_NAME:
+ return getRoleName();
+
+ case PRIVILEGE:
+ return getPrivilege();
+
+ }
+ throw new IllegalStateException();
+ }
+
+ /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+ public boolean isSet(_Fields field) {
+ if (field == null) {
+ throw new IllegalArgumentException();
+ }
+
+ switch (field) {
+ case PROTOCOL_VERSION:
+ return isSetProtocol_version();
+ case REQUESTOR_USER_NAME:
+ return isSetRequestorUserName();
+ case ROLE_NAME:
+ return isSetRoleName();
+ case PRIVILEGE:
+ return isSetPrivilege();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof TAlterSentryRoleGrantPrivilegeRequest)
+ return this.equals((TAlterSentryRoleGrantPrivilegeRequest)that);
+ return false;
+ }
+
+ public boolean equals(TAlterSentryRoleGrantPrivilegeRequest that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_protocol_version = true;
+ boolean that_present_protocol_version = true;
+ if (this_present_protocol_version || that_present_protocol_version) {
+ if (!(this_present_protocol_version && that_present_protocol_version))
+ return false;
+ if (this.protocol_version != that.protocol_version)
+ return false;
+ }
+
+ boolean this_present_requestorUserName = true && this.isSetRequestorUserName();
+ boolean that_present_requestorUserName = true && that.isSetRequestorUserName();
+ if (this_present_requestorUserName || that_present_requestorUserName) {
+ if (!(this_present_requestorUserName && that_present_requestorUserName))
+ return false;
+ if (!this.requestorUserName.equals(that.requestorUserName))
+ return false;
+ }
+
+ boolean this_present_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_privilege = true && this.isSetPrivilege();
+ boolean that_present_privilege = true && that.isSetPrivilege();
+ if (this_present_privilege || that_present_privilege) {
+ if (!(this_present_privilege && that_present_privilege))
+ return false;
+ if (!this.privilege.equals(that.privilege))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ HashCodeBuilder builder = new HashCodeBuilder();
+
+ boolean present_protocol_version = true;
+ builder.append(present_protocol_version);
+ if (present_protocol_version)
+ builder.append(protocol_version);
+
+ boolean present_requestorUserName = true && (isSetRequestorUserName());
+ builder.append(present_requestorUserName);
+ if (present_requestorUserName)
+ builder.append(requestorUserName);
+
+ boolean present_roleName = true && (isSetRoleName());
+ builder.append(present_roleName);
+ if (present_roleName)
+ builder.append(roleName);
+
+ boolean present_privilege = true && (isSetPrivilege());
+ builder.append(present_privilege);
+ if (present_privilege)
+ builder.append(privilege);
+
+ return builder.toHashCode();
+ }
+
+ public int compareTo(TAlterSentryRoleGrantPrivilegeRequest other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+ TAlterSentryRoleGrantPrivilegeRequest typedOther = (TAlterSentryRoleGrantPrivilegeRequest)other;
+
+ lastComparison = Boolean.valueOf(isSetProtocol_version()).compareTo(typedOther.isSetProtocol_version());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetProtocol_version()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.protocol_version, typedOther.protocol_version);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetRequestorUserName()).compareTo(typedOther.isSetRequestorUserName());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetRequestorUserName()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.requestorUserName, typedOther.requestorUserName);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetRoleName()).compareTo(typedOther.isSetRoleName());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetRoleName()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.roleName, typedOther.roleName);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetPrivilege()).compareTo(typedOther.isSetPrivilege());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetPrivilege()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.privilege, typedOther.privilege);
+ 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("TAlterSentryRoleGrantPrivilegeRequest(");
+ boolean first = true;
+
+ sb.append("protocol_version:");
+ sb.append(this.protocol_version);
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("requestorUserName:");
+ if (this.requestorUserName == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.requestorUserName);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("roleName:");
+ if (this.roleName == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.roleName);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("privilege:");
+ if (this.privilege == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.privilege);
+ }
+ first = false;
+ sb.append(")");
+ return sb.toString();
+ }
+
+ public void validate() throws org.apache.thrift.TException {
+ // check for required fields
+ if (!isSetProtocol_version()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'protocol_version' is unset! Struct:" + toString());
+ }
+
+ if (!isSetRequestorUserName()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'requestorUserName' is unset! Struct:" + toString());
+ }
+
+ if (!isSetRoleName()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'roleName' is unset! Struct:" + toString());
+ }
+
+ if (!isSetPrivilege()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'privilege' is unset! Struct:" + toString());
+ }
+
+ // check for sub-struct validity
+ if (privilege != null) {
+ privilege.validate();
+ }
+ }
+
+ private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+ try {
+ write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+ try {
+ // 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 TAlterSentryRoleGrantPrivilegeRequestStandardSchemeFactory implements SchemeFactory {
+ public TAlterSentryRoleGrantPrivilegeRequestStandardScheme getScheme() {
+ return new TAlterSentryRoleGrantPrivilegeRequestStandardScheme();
+ }
+ }
+
+ private static class TAlterSentryRoleGrantPrivilegeRequestStandardScheme extends StandardScheme<TAlterSentryRoleGrantPrivilegeRequest> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, TAlterSentryRoleGrantPrivilegeRequest struct) throws org.apache.thrift.TException {
+ org.apache.thrift.protocol.TField schemeField;
+ iprot.readStructBegin();
+ while (true)
+ {
+ schemeField = iprot.readFieldBegin();
+ if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
+ break;
+ }
+ switch (schemeField.id) {
+ case 1: // PROTOCOL_VERSION
+ if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
+ struct.protocol_version = iprot.readI32();
+ struct.setProtocol_versionIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 2: // REQUESTOR_USER_NAME
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.requestorUserName = iprot.readString();
+ struct.setRequestorUserNameIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 3: // 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 5: // PRIVILEGE
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+ struct.privilege = new TSentryPrivilege();
+ struct.privilege.read(iprot);
+ struct.setPrivilegeIsSet(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, TAlterSentryRoleGrantPrivilegeRequest struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ oprot.writeFieldBegin(PROTOCOL_VERSION_FIELD_DESC);
+ oprot.writeI32(struct.protocol_version);
+ oprot.writeFieldEnd();
+ if (struct.requestorUserName != null) {
+ oprot.writeFieldBegin(REQUESTOR_USER_NAME_FIELD_DESC);
+ oprot.writeString(struct.requestorUserName);
+ oprot.writeFieldEnd();
+ }
+ if (struct.roleName != null) {
+ oprot.writeFieldBegin(ROLE_NAME_FIELD_DESC);
+ oprot.writeString(struct.roleName);
+ oprot.writeFieldEnd();
+ }
+ if (struct.privilege != null) {
+ oprot.writeFieldBegin(PRIVILEGE_FIELD_DESC);
+ struct.privilege.write(oprot);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class TAlterSentryRoleGrantPrivilegeRequestTupleSchemeFactory implements SchemeFactory {
+ public TAlterSentryRoleGrantPrivilegeRequestTupleScheme getScheme() {
+ return new TAlterSentryRoleGrantPrivilegeRequestTupleScheme();
+ }
+ }
+
+ private static class TAlterSentryRoleGrantPrivilegeRequestTupleScheme extends TupleScheme<TAlterSentryRoleGrantPrivilegeRequest> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleGrantPrivilegeRequest struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ oprot.writeI32(struct.protocol_version);
+ oprot.writeString(struct.requestorUserName);
+ oprot.writeString(struct.roleName);
+ struct.privilege.write(oprot);
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleGrantPrivilegeRequest struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ struct.protocol_version = iprot.readI32();
+ struct.setProtocol_versionIsSet(true);
+ struct.requestorUserName = iprot.readString();
+ struct.setRequestorUserNameIsSet(true);
+ struct.roleName = iprot.readString();
+ struct.setRoleNameIsSet(true);
+ struct.privilege = new TSentryPrivilege();
+ struct.privilege.read(iprot);
+ struct.setPrivilegeIsSet(true);
+ }
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleGrantPrivilegeResponse.java
----------------------------------------------------------------------
diff --git a/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleGrantPrivilegeResponse.java b/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleGrantPrivilegeResponse.java
new file mode 100644
index 0000000..05e9f95
--- /dev/null
+++ b/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleGrantPrivilegeResponse.java
@@ -0,0 +1,390 @@
+/**
+ * Autogenerated by Thrift Compiler (0.9.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+package org.apache.sentry.provider.db.service.thrift;
+
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EnumMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.EnumSet;
+import java.util.Collections;
+import java.util.BitSet;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class TAlterSentryRoleGrantPrivilegeResponse implements org.apache.thrift.TBase<TAlterSentryRoleGrantPrivilegeResponse, TAlterSentryRoleGrantPrivilegeResponse._Fields>, java.io.Serializable, Cloneable {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TAlterSentryRoleGrantPrivilegeResponse");
+
+ private static final org.apache.thrift.protocol.TField STATUS_FIELD_DESC = new org.apache.thrift.protocol.TField("status", org.apache.thrift.protocol.TType.STRUCT, (short)1);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new TAlterSentryRoleGrantPrivilegeResponseStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new TAlterSentryRoleGrantPrivilegeResponseTupleSchemeFactory());
+ }
+
+ private org.apache.sentry.service.thrift.TSentryResponseStatus status; // required
+
+ /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+ public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+ STATUS((short)1, "status");
+
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+ static {
+ for (_Fields field : EnumSet.allOf(_Fields.class)) {
+ byName.put(field.getFieldName(), field);
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, or null if its not found.
+ */
+ public static _Fields findByThriftId(int fieldId) {
+ switch(fieldId) {
+ case 1: // STATUS
+ return STATUS;
+ default:
+ return null;
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, throwing an exception
+ * if it is not found.
+ */
+ public static _Fields findByThriftIdOrThrow(int fieldId) {
+ _Fields fields = findByThriftId(fieldId);
+ if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+ return fields;
+ }
+
+ /**
+ * Find the _Fields constant that matches name, or null if its not found.
+ */
+ public static _Fields findByName(String name) {
+ return byName.get(name);
+ }
+
+ private final short _thriftId;
+ private final String _fieldName;
+
+ _Fields(short thriftId, String fieldName) {
+ _thriftId = thriftId;
+ _fieldName = fieldName;
+ }
+
+ public short getThriftFieldId() {
+ return _thriftId;
+ }
+
+ public String getFieldName() {
+ return _fieldName;
+ }
+ }
+
+ // isset id assignments
+ public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+ static {
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+ tmpMap.put(_Fields.STATUS, new org.apache.thrift.meta_data.FieldMetaData("status", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.sentry.service.thrift.TSentryResponseStatus.class)));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TAlterSentryRoleGrantPrivilegeResponse.class, metaDataMap);
+ }
+
+ public TAlterSentryRoleGrantPrivilegeResponse() {
+ }
+
+ public TAlterSentryRoleGrantPrivilegeResponse(
+ org.apache.sentry.service.thrift.TSentryResponseStatus status)
+ {
+ this();
+ this.status = status;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public TAlterSentryRoleGrantPrivilegeResponse(TAlterSentryRoleGrantPrivilegeResponse other) {
+ if (other.isSetStatus()) {
+ this.status = new org.apache.sentry.service.thrift.TSentryResponseStatus(other.status);
+ }
+ }
+
+ public TAlterSentryRoleGrantPrivilegeResponse deepCopy() {
+ return new TAlterSentryRoleGrantPrivilegeResponse(this);
+ }
+
+ @Override
+ public void clear() {
+ this.status = null;
+ }
+
+ public org.apache.sentry.service.thrift.TSentryResponseStatus getStatus() {
+ return this.status;
+ }
+
+ public void setStatus(org.apache.sentry.service.thrift.TSentryResponseStatus status) {
+ this.status = status;
+ }
+
+ public void unsetStatus() {
+ this.status = null;
+ }
+
+ /** Returns true if field status is set (has been assigned a value) and false otherwise */
+ public boolean isSetStatus() {
+ return this.status != null;
+ }
+
+ public void setStatusIsSet(boolean value) {
+ if (!value) {
+ this.status = null;
+ }
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case STATUS:
+ if (value == null) {
+ unsetStatus();
+ } else {
+ setStatus((org.apache.sentry.service.thrift.TSentryResponseStatus)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case STATUS:
+ return getStatus();
+
+ }
+ throw new IllegalStateException();
+ }
+
+ /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+ public boolean isSet(_Fields field) {
+ if (field == null) {
+ throw new IllegalArgumentException();
+ }
+
+ switch (field) {
+ case STATUS:
+ return isSetStatus();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof TAlterSentryRoleGrantPrivilegeResponse)
+ return this.equals((TAlterSentryRoleGrantPrivilegeResponse)that);
+ return false;
+ }
+
+ public boolean equals(TAlterSentryRoleGrantPrivilegeResponse that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_status = true && this.isSetStatus();
+ boolean that_present_status = true && that.isSetStatus();
+ if (this_present_status || that_present_status) {
+ if (!(this_present_status && that_present_status))
+ return false;
+ if (!this.status.equals(that.status))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ HashCodeBuilder builder = new HashCodeBuilder();
+
+ boolean present_status = true && (isSetStatus());
+ builder.append(present_status);
+ if (present_status)
+ builder.append(status);
+
+ return builder.toHashCode();
+ }
+
+ public int compareTo(TAlterSentryRoleGrantPrivilegeResponse other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+ TAlterSentryRoleGrantPrivilegeResponse typedOther = (TAlterSentryRoleGrantPrivilegeResponse)other;
+
+ lastComparison = Boolean.valueOf(isSetStatus()).compareTo(typedOther.isSetStatus());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetStatus()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.status, typedOther.status);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ 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("TAlterSentryRoleGrantPrivilegeResponse(");
+ boolean first = true;
+
+ sb.append("status:");
+ if (this.status == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.status);
+ }
+ first = false;
+ sb.append(")");
+ return sb.toString();
+ }
+
+ public void validate() throws org.apache.thrift.TException {
+ // check for required fields
+ if (!isSetStatus()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'status' is unset! Struct:" + toString());
+ }
+
+ // check for sub-struct validity
+ if (status != null) {
+ status.validate();
+ }
+ }
+
+ private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+ try {
+ write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+ try {
+ read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private static class TAlterSentryRoleGrantPrivilegeResponseStandardSchemeFactory implements SchemeFactory {
+ public TAlterSentryRoleGrantPrivilegeResponseStandardScheme getScheme() {
+ return new TAlterSentryRoleGrantPrivilegeResponseStandardScheme();
+ }
+ }
+
+ private static class TAlterSentryRoleGrantPrivilegeResponseStandardScheme extends StandardScheme<TAlterSentryRoleGrantPrivilegeResponse> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, TAlterSentryRoleGrantPrivilegeResponse struct) throws org.apache.thrift.TException {
+ org.apache.thrift.protocol.TField schemeField;
+ iprot.readStructBegin();
+ while (true)
+ {
+ schemeField = iprot.readFieldBegin();
+ if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
+ break;
+ }
+ switch (schemeField.id) {
+ case 1: // STATUS
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+ struct.status = new org.apache.sentry.service.thrift.TSentryResponseStatus();
+ struct.status.read(iprot);
+ struct.setStatusIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ 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, TAlterSentryRoleGrantPrivilegeResponse struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.status != null) {
+ oprot.writeFieldBegin(STATUS_FIELD_DESC);
+ struct.status.write(oprot);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class TAlterSentryRoleGrantPrivilegeResponseTupleSchemeFactory implements SchemeFactory {
+ public TAlterSentryRoleGrantPrivilegeResponseTupleScheme getScheme() {
+ return new TAlterSentryRoleGrantPrivilegeResponseTupleScheme();
+ }
+ }
+
+ private static class TAlterSentryRoleGrantPrivilegeResponseTupleScheme extends TupleScheme<TAlterSentryRoleGrantPrivilegeResponse> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleGrantPrivilegeResponse struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ struct.status.write(oprot);
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleGrantPrivilegeResponse struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ struct.status = new org.apache.sentry.service.thrift.TSentryResponseStatus();
+ struct.status.read(iprot);
+ struct.setStatusIsSet(true);
+ }
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleRevokePrivilegeRequest.java
----------------------------------------------------------------------
diff --git a/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleRevokePrivilegeRequest.java b/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleRevokePrivilegeRequest.java
new file mode 100644
index 0000000..bbd9536
--- /dev/null
+++ b/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleRevokePrivilegeRequest.java
@@ -0,0 +1,693 @@
+/**
+ * Autogenerated by Thrift Compiler (0.9.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+package org.apache.sentry.provider.db.service.thrift;
+
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EnumMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.EnumSet;
+import java.util.Collections;
+import java.util.BitSet;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class TAlterSentryRoleRevokePrivilegeRequest implements org.apache.thrift.TBase<TAlterSentryRoleRevokePrivilegeRequest, TAlterSentryRoleRevokePrivilegeRequest._Fields>, java.io.Serializable, Cloneable {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TAlterSentryRoleRevokePrivilegeRequest");
+
+ private static final org.apache.thrift.protocol.TField PROTOCOL_VERSION_FIELD_DESC = new org.apache.thrift.protocol.TField("protocol_version", org.apache.thrift.protocol.TType.I32, (short)1);
+ private static final org.apache.thrift.protocol.TField REQUESTOR_USER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("requestorUserName", org.apache.thrift.protocol.TType.STRING, (short)2);
+ private static final org.apache.thrift.protocol.TField ROLE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("roleName", org.apache.thrift.protocol.TType.STRING, (short)3);
+ private static final org.apache.thrift.protocol.TField PRIVILEGE_FIELD_DESC = new org.apache.thrift.protocol.TField("privilege", org.apache.thrift.protocol.TType.STRUCT, (short)5);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new TAlterSentryRoleRevokePrivilegeRequestStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new TAlterSentryRoleRevokePrivilegeRequestTupleSchemeFactory());
+ }
+
+ private int protocol_version; // required
+ private String requestorUserName; // required
+ private String roleName; // required
+ private TSentryPrivilege privilege; // required
+
+ /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+ public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+ PROTOCOL_VERSION((short)1, "protocol_version"),
+ REQUESTOR_USER_NAME((short)2, "requestorUserName"),
+ ROLE_NAME((short)3, "roleName"),
+ PRIVILEGE((short)5, "privilege");
+
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+ static {
+ for (_Fields field : EnumSet.allOf(_Fields.class)) {
+ byName.put(field.getFieldName(), field);
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, or null if its not found.
+ */
+ public static _Fields findByThriftId(int fieldId) {
+ switch(fieldId) {
+ case 1: // PROTOCOL_VERSION
+ return PROTOCOL_VERSION;
+ case 2: // REQUESTOR_USER_NAME
+ return REQUESTOR_USER_NAME;
+ case 3: // ROLE_NAME
+ return ROLE_NAME;
+ case 5: // PRIVILEGE
+ return PRIVILEGE;
+ default:
+ return null;
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, throwing an exception
+ * if it is not found.
+ */
+ public static _Fields findByThriftIdOrThrow(int fieldId) {
+ _Fields fields = findByThriftId(fieldId);
+ if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+ return fields;
+ }
+
+ /**
+ * Find the _Fields constant that matches name, or null if its not found.
+ */
+ public static _Fields findByName(String name) {
+ return byName.get(name);
+ }
+
+ private final short _thriftId;
+ private final String _fieldName;
+
+ _Fields(short thriftId, String fieldName) {
+ _thriftId = thriftId;
+ _fieldName = fieldName;
+ }
+
+ public short getThriftFieldId() {
+ return _thriftId;
+ }
+
+ public String getFieldName() {
+ return _fieldName;
+ }
+ }
+
+ // isset id assignments
+ private static final int __PROTOCOL_VERSION_ISSET_ID = 0;
+ private byte __isset_bitfield = 0;
+ public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+ static {
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+ tmpMap.put(_Fields.PROTOCOL_VERSION, new org.apache.thrift.meta_data.FieldMetaData("protocol_version", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
+ tmpMap.put(_Fields.REQUESTOR_USER_NAME, new org.apache.thrift.meta_data.FieldMetaData("requestorUserName", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields.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.PRIVILEGE, new org.apache.thrift.meta_data.FieldMetaData("privilege", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ 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(TAlterSentryRoleRevokePrivilegeRequest.class, metaDataMap);
+ }
+
+ public TAlterSentryRoleRevokePrivilegeRequest() {
+ this.protocol_version = 1;
+
+ }
+
+ public TAlterSentryRoleRevokePrivilegeRequest(
+ int protocol_version,
+ String requestorUserName,
+ String roleName,
+ TSentryPrivilege privilege)
+ {
+ this();
+ this.protocol_version = protocol_version;
+ setProtocol_versionIsSet(true);
+ this.requestorUserName = requestorUserName;
+ this.roleName = roleName;
+ this.privilege = privilege;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public TAlterSentryRoleRevokePrivilegeRequest(TAlterSentryRoleRevokePrivilegeRequest other) {
+ __isset_bitfield = other.__isset_bitfield;
+ this.protocol_version = other.protocol_version;
+ if (other.isSetRequestorUserName()) {
+ this.requestorUserName = other.requestorUserName;
+ }
+ if (other.isSetRoleName()) {
+ this.roleName = other.roleName;
+ }
+ if (other.isSetPrivilege()) {
+ this.privilege = new TSentryPrivilege(other.privilege);
+ }
+ }
+
+ public TAlterSentryRoleRevokePrivilegeRequest deepCopy() {
+ return new TAlterSentryRoleRevokePrivilegeRequest(this);
+ }
+
+ @Override
+ public void clear() {
+ this.protocol_version = 1;
+
+ this.requestorUserName = null;
+ this.roleName = null;
+ this.privilege = null;
+ }
+
+ public int getProtocol_version() {
+ return this.protocol_version;
+ }
+
+ public void setProtocol_version(int protocol_version) {
+ this.protocol_version = protocol_version;
+ setProtocol_versionIsSet(true);
+ }
+
+ public void unsetProtocol_version() {
+ __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __PROTOCOL_VERSION_ISSET_ID);
+ }
+
+ /** Returns true if field protocol_version is set (has been assigned a value) and false otherwise */
+ public boolean isSetProtocol_version() {
+ return EncodingUtils.testBit(__isset_bitfield, __PROTOCOL_VERSION_ISSET_ID);
+ }
+
+ public void setProtocol_versionIsSet(boolean value) {
+ __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __PROTOCOL_VERSION_ISSET_ID, value);
+ }
+
+ public String getRequestorUserName() {
+ return this.requestorUserName;
+ }
+
+ public void setRequestorUserName(String requestorUserName) {
+ this.requestorUserName = requestorUserName;
+ }
+
+ public void unsetRequestorUserName() {
+ this.requestorUserName = null;
+ }
+
+ /** Returns true if field requestorUserName is set (has been assigned a value) and false otherwise */
+ public boolean isSetRequestorUserName() {
+ return this.requestorUserName != null;
+ }
+
+ public void setRequestorUserNameIsSet(boolean value) {
+ if (!value) {
+ this.requestorUserName = null;
+ }
+ }
+
+ public 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 TSentryPrivilege getPrivilege() {
+ return this.privilege;
+ }
+
+ public void setPrivilege(TSentryPrivilege privilege) {
+ this.privilege = privilege;
+ }
+
+ public void unsetPrivilege() {
+ this.privilege = null;
+ }
+
+ /** Returns true if field privilege is set (has been assigned a value) and false otherwise */
+ public boolean isSetPrivilege() {
+ return this.privilege != null;
+ }
+
+ public void setPrivilegeIsSet(boolean value) {
+ if (!value) {
+ this.privilege = null;
+ }
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case PROTOCOL_VERSION:
+ if (value == null) {
+ unsetProtocol_version();
+ } else {
+ setProtocol_version((Integer)value);
+ }
+ break;
+
+ case REQUESTOR_USER_NAME:
+ if (value == null) {
+ unsetRequestorUserName();
+ } else {
+ setRequestorUserName((String)value);
+ }
+ break;
+
+ case ROLE_NAME:
+ if (value == null) {
+ unsetRoleName();
+ } else {
+ setRoleName((String)value);
+ }
+ break;
+
+ case PRIVILEGE:
+ if (value == null) {
+ unsetPrivilege();
+ } else {
+ setPrivilege((TSentryPrivilege)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case PROTOCOL_VERSION:
+ return Integer.valueOf(getProtocol_version());
+
+ case REQUESTOR_USER_NAME:
+ return getRequestorUserName();
+
+ case ROLE_NAME:
+ return getRoleName();
+
+ case PRIVILEGE:
+ return getPrivilege();
+
+ }
+ throw new IllegalStateException();
+ }
+
+ /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+ public boolean isSet(_Fields field) {
+ if (field == null) {
+ throw new IllegalArgumentException();
+ }
+
+ switch (field) {
+ case PROTOCOL_VERSION:
+ return isSetProtocol_version();
+ case REQUESTOR_USER_NAME:
+ return isSetRequestorUserName();
+ case ROLE_NAME:
+ return isSetRoleName();
+ case PRIVILEGE:
+ return isSetPrivilege();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof TAlterSentryRoleRevokePrivilegeRequest)
+ return this.equals((TAlterSentryRoleRevokePrivilegeRequest)that);
+ return false;
+ }
+
+ public boolean equals(TAlterSentryRoleRevokePrivilegeRequest that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_protocol_version = true;
+ boolean that_present_protocol_version = true;
+ if (this_present_protocol_version || that_present_protocol_version) {
+ if (!(this_present_protocol_version && that_present_protocol_version))
+ return false;
+ if (this.protocol_version != that.protocol_version)
+ return false;
+ }
+
+ boolean this_present_requestorUserName = true && this.isSetRequestorUserName();
+ boolean that_present_requestorUserName = true && that.isSetRequestorUserName();
+ if (this_present_requestorUserName || that_present_requestorUserName) {
+ if (!(this_present_requestorUserName && that_present_requestorUserName))
+ return false;
+ if (!this.requestorUserName.equals(that.requestorUserName))
+ return false;
+ }
+
+ boolean this_present_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_privilege = true && this.isSetPrivilege();
+ boolean that_present_privilege = true && that.isSetPrivilege();
+ if (this_present_privilege || that_present_privilege) {
+ if (!(this_present_privilege && that_present_privilege))
+ return false;
+ if (!this.privilege.equals(that.privilege))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ HashCodeBuilder builder = new HashCodeBuilder();
+
+ boolean present_protocol_version = true;
+ builder.append(present_protocol_version);
+ if (present_protocol_version)
+ builder.append(protocol_version);
+
+ boolean present_requestorUserName = true && (isSetRequestorUserName());
+ builder.append(present_requestorUserName);
+ if (present_requestorUserName)
+ builder.append(requestorUserName);
+
+ boolean present_roleName = true && (isSetRoleName());
+ builder.append(present_roleName);
+ if (present_roleName)
+ builder.append(roleName);
+
+ boolean present_privilege = true && (isSetPrivilege());
+ builder.append(present_privilege);
+ if (present_privilege)
+ builder.append(privilege);
+
+ return builder.toHashCode();
+ }
+
+ public int compareTo(TAlterSentryRoleRevokePrivilegeRequest other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+ TAlterSentryRoleRevokePrivilegeRequest typedOther = (TAlterSentryRoleRevokePrivilegeRequest)other;
+
+ lastComparison = Boolean.valueOf(isSetProtocol_version()).compareTo(typedOther.isSetProtocol_version());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetProtocol_version()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.protocol_version, typedOther.protocol_version);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetRequestorUserName()).compareTo(typedOther.isSetRequestorUserName());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetRequestorUserName()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.requestorUserName, typedOther.requestorUserName);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetRoleName()).compareTo(typedOther.isSetRoleName());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetRoleName()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.roleName, typedOther.roleName);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetPrivilege()).compareTo(typedOther.isSetPrivilege());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetPrivilege()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.privilege, typedOther.privilege);
+ 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("TAlterSentryRoleRevokePrivilegeRequest(");
+ boolean first = true;
+
+ sb.append("protocol_version:");
+ sb.append(this.protocol_version);
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("requestorUserName:");
+ if (this.requestorUserName == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.requestorUserName);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("roleName:");
+ if (this.roleName == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.roleName);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("privilege:");
+ if (this.privilege == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.privilege);
+ }
+ first = false;
+ sb.append(")");
+ return sb.toString();
+ }
+
+ public void validate() throws org.apache.thrift.TException {
+ // check for required fields
+ if (!isSetProtocol_version()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'protocol_version' is unset! Struct:" + toString());
+ }
+
+ if (!isSetRequestorUserName()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'requestorUserName' is unset! Struct:" + toString());
+ }
+
+ if (!isSetRoleName()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'roleName' is unset! Struct:" + toString());
+ }
+
+ if (!isSetPrivilege()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'privilege' is unset! Struct:" + toString());
+ }
+
+ // check for sub-struct validity
+ if (privilege != null) {
+ privilege.validate();
+ }
+ }
+
+ private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+ try {
+ write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+ try {
+ // 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 TAlterSentryRoleRevokePrivilegeRequestStandardSchemeFactory implements SchemeFactory {
+ public TAlterSentryRoleRevokePrivilegeRequestStandardScheme getScheme() {
+ return new TAlterSentryRoleRevokePrivilegeRequestStandardScheme();
+ }
+ }
+
+ private static class TAlterSentryRoleRevokePrivilegeRequestStandardScheme extends StandardScheme<TAlterSentryRoleRevokePrivilegeRequest> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, TAlterSentryRoleRevokePrivilegeRequest struct) throws org.apache.thrift.TException {
+ org.apache.thrift.protocol.TField schemeField;
+ iprot.readStructBegin();
+ while (true)
+ {
+ schemeField = iprot.readFieldBegin();
+ if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
+ break;
+ }
+ switch (schemeField.id) {
+ case 1: // PROTOCOL_VERSION
+ if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
+ struct.protocol_version = iprot.readI32();
+ struct.setProtocol_versionIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 2: // REQUESTOR_USER_NAME
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.requestorUserName = iprot.readString();
+ struct.setRequestorUserNameIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 3: // 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 5: // PRIVILEGE
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+ struct.privilege = new TSentryPrivilege();
+ struct.privilege.read(iprot);
+ struct.setPrivilegeIsSet(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, TAlterSentryRoleRevokePrivilegeRequest struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ oprot.writeFieldBegin(PROTOCOL_VERSION_FIELD_DESC);
+ oprot.writeI32(struct.protocol_version);
+ oprot.writeFieldEnd();
+ if (struct.requestorUserName != null) {
+ oprot.writeFieldBegin(REQUESTOR_USER_NAME_FIELD_DESC);
+ oprot.writeString(struct.requestorUserName);
+ oprot.writeFieldEnd();
+ }
+ if (struct.roleName != null) {
+ oprot.writeFieldBegin(ROLE_NAME_FIELD_DESC);
+ oprot.writeString(struct.roleName);
+ oprot.writeFieldEnd();
+ }
+ if (struct.privilege != null) {
+ oprot.writeFieldBegin(PRIVILEGE_FIELD_DESC);
+ struct.privilege.write(oprot);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class TAlterSentryRoleRevokePrivilegeRequestTupleSchemeFactory implements SchemeFactory {
+ public TAlterSentryRoleRevokePrivilegeRequestTupleScheme getScheme() {
+ return new TAlterSentryRoleRevokePrivilegeRequestTupleScheme();
+ }
+ }
+
+ private static class TAlterSentryRoleRevokePrivilegeRequestTupleScheme extends TupleScheme<TAlterSentryRoleRevokePrivilegeRequest> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleRevokePrivilegeRequest struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ oprot.writeI32(struct.protocol_version);
+ oprot.writeString(struct.requestorUserName);
+ oprot.writeString(struct.roleName);
+ struct.privilege.write(oprot);
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleRevokePrivilegeRequest struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ struct.protocol_version = iprot.readI32();
+ struct.setProtocol_versionIsSet(true);
+ struct.requestorUserName = iprot.readString();
+ struct.setRequestorUserNameIsSet(true);
+ struct.roleName = iprot.readString();
+ struct.setRoleNameIsSet(true);
+ struct.privilege = new TSentryPrivilege();
+ struct.privilege.read(iprot);
+ struct.setPrivilegeIsSet(true);
+ }
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleRevokePrivilegeResponse.java
----------------------------------------------------------------------
diff --git a/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleRevokePrivilegeResponse.java b/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleRevokePrivilegeResponse.java
new file mode 100644
index 0000000..d431e37
--- /dev/null
+++ b/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleRevokePrivilegeResponse.java
@@ -0,0 +1,390 @@
+/**
+ * Autogenerated by Thrift Compiler (0.9.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+package org.apache.sentry.provider.db.service.thrift;
+
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EnumMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.EnumSet;
+import java.util.Collections;
+import java.util.BitSet;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class TAlterSentryRoleRevokePrivilegeResponse implements org.apache.thrift.TBase<TAlterSentryRoleRevokePrivilegeResponse, TAlterSentryRoleRevokePrivilegeResponse._Fields>, java.io.Serializable, Cloneable {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TAlterSentryRoleRevokePrivilegeResponse");
+
+ private static final org.apache.thrift.protocol.TField STATUS_FIELD_DESC = new org.apache.thrift.protocol.TField("status", org.apache.thrift.protocol.TType.STRUCT, (short)1);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new TAlterSentryRoleRevokePrivilegeResponseStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new TAlterSentryRoleRevokePrivilegeResponseTupleSchemeFactory());
+ }
+
+ private org.apache.sentry.service.thrift.TSentryResponseStatus status; // required
+
+ /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+ public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+ STATUS((short)1, "status");
+
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+ static {
+ for (_Fields field : EnumSet.allOf(_Fields.class)) {
+ byName.put(field.getFieldName(), field);
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, or null if its not found.
+ */
+ public static _Fields findByThriftId(int fieldId) {
+ switch(fieldId) {
+ case 1: // STATUS
+ return STATUS;
+ default:
+ return null;
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, throwing an exception
+ * if it is not found.
+ */
+ public static _Fields findByThriftIdOrThrow(int fieldId) {
+ _Fields fields = findByThriftId(fieldId);
+ if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+ return fields;
+ }
+
+ /**
+ * Find the _Fields constant that matches name, or null if its not found.
+ */
+ public static _Fields findByName(String name) {
+ return byName.get(name);
+ }
+
+ private final short _thriftId;
+ private final String _fieldName;
+
+ _Fields(short thriftId, String fieldName) {
+ _thriftId = thriftId;
+ _fieldName = fieldName;
+ }
+
+ public short getThriftFieldId() {
+ return _thriftId;
+ }
+
+ public String getFieldName() {
+ return _fieldName;
+ }
+ }
+
+ // isset id assignments
+ public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+ static {
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+ tmpMap.put(_Fields.STATUS, new org.apache.thrift.meta_data.FieldMetaData("status", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.sentry.service.thrift.TSentryResponseStatus.class)));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TAlterSentryRoleRevokePrivilegeResponse.class, metaDataMap);
+ }
+
+ public TAlterSentryRoleRevokePrivilegeResponse() {
+ }
+
+ public TAlterSentryRoleRevokePrivilegeResponse(
+ org.apache.sentry.service.thrift.TSentryResponseStatus status)
+ {
+ this();
+ this.status = status;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public TAlterSentryRoleRevokePrivilegeResponse(TAlterSentryRoleRevokePrivilegeResponse other) {
+ if (other.isSetStatus()) {
+ this.status = new org.apache.sentry.service.thrift.TSentryResponseStatus(other.status);
+ }
+ }
+
+ public TAlterSentryRoleRevokePrivilegeResponse deepCopy() {
+ return new TAlterSentryRoleRevokePrivilegeResponse(this);
+ }
+
+ @Override
+ public void clear() {
+ this.status = null;
+ }
+
+ public org.apache.sentry.service.thrift.TSentryResponseStatus getStatus() {
+ return this.status;
+ }
+
+ public void setStatus(org.apache.sentry.service.thrift.TSentryResponseStatus status) {
+ this.status = status;
+ }
+
+ public void unsetStatus() {
+ this.status = null;
+ }
+
+ /** Returns true if field status is set (has been assigned a value) and false otherwise */
+ public boolean isSetStatus() {
+ return this.status != null;
+ }
+
+ public void setStatusIsSet(boolean value) {
+ if (!value) {
+ this.status = null;
+ }
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case STATUS:
+ if (value == null) {
+ unsetStatus();
+ } else {
+ setStatus((org.apache.sentry.service.thrift.TSentryResponseStatus)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case STATUS:
+ return getStatus();
+
+ }
+ throw new IllegalStateException();
+ }
+
+ /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+ public boolean isSet(_Fields field) {
+ if (field == null) {
+ throw new IllegalArgumentException();
+ }
+
+ switch (field) {
+ case STATUS:
+ return isSetStatus();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof TAlterSentryRoleRevokePrivilegeResponse)
+ return this.equals((TAlterSentryRoleRevokePrivilegeResponse)that);
+ return false;
+ }
+
+ public boolean equals(TAlterSentryRoleRevokePrivilegeResponse that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_status = true && this.isSetStatus();
+ boolean that_present_status = true && that.isSetStatus();
+ if (this_present_status || that_present_status) {
+ if (!(this_present_status && that_present_status))
+ return false;
+ if (!this.status.equals(that.status))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ HashCodeBuilder builder = new HashCodeBuilder();
+
+ boolean present_status = true && (isSetStatus());
+ builder.append(present_status);
+ if (present_status)
+ builder.append(status);
+
+ return builder.toHashCode();
+ }
+
+ public int compareTo(TAlterSentryRoleRevokePrivilegeResponse other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+ TAlterSentryRoleRevokePrivilegeResponse typedOther = (TAlterSentryRoleRevokePrivilegeResponse)other;
+
+ lastComparison = Boolean.valueOf(isSetStatus()).compareTo(typedOther.isSetStatus());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetStatus()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.status, typedOther.status);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ 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("TAlterSentryRoleRevokePrivilegeResponse(");
+ boolean first = true;
+
+ sb.append("status:");
+ if (this.status == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.status);
+ }
+ first = false;
+ sb.append(")");
+ return sb.toString();
+ }
+
+ public void validate() throws org.apache.thrift.TException {
+ // check for required fields
+ if (!isSetStatus()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'status' is unset! Struct:" + toString());
+ }
+
+ // check for sub-struct validity
+ if (status != null) {
+ status.validate();
+ }
+ }
+
+ private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+ try {
+ write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+ try {
+ read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private static class TAlterSentryRoleRevokePrivilegeResponseStandardSchemeFactory implements SchemeFactory {
+ public TAlterSentryRoleRevokePrivilegeResponseStandardScheme getScheme() {
+ return new TAlterSentryRoleRevokePrivilegeResponseStandardScheme();
+ }
+ }
+
+ private static class TAlterSentryRoleRevokePrivilegeResponseStandardScheme extends StandardScheme<TAlterSentryRoleRevokePrivilegeResponse> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, TAlterSentryRoleRevokePrivilegeResponse struct) throws org.apache.thrift.TException {
+ org.apache.thrift.protocol.TField schemeField;
+ iprot.readStructBegin();
+ while (true)
+ {
+ schemeField = iprot.readFieldBegin();
+ if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
+ break;
+ }
+ switch (schemeField.id) {
+ case 1: // STATUS
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+ struct.status = new org.apache.sentry.service.thrift.TSentryResponseStatus();
+ struct.status.read(iprot);
+ struct.setStatusIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ 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, TAlterSentryRoleRevokePrivilegeResponse struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.status != null) {
+ oprot.writeFieldBegin(STATUS_FIELD_DESC);
+ struct.status.write(oprot);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class TAlterSentryRoleRevokePrivilegeResponseTupleSchemeFactory implements SchemeFactory {
+ public TAlterSentryRoleRevokePrivilegeResponseTupleScheme getScheme() {
+ return new TAlterSentryRoleRevokePrivilegeResponseTupleScheme();
+ }
+ }
+
+ private static class TAlterSentryRoleRevokePrivilegeResponseTupleScheme extends TupleScheme<TAlterSentryRoleRevokePrivilegeResponse> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleRevokePrivilegeResponse struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ struct.status.write(oprot);
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleRevokePrivilegeResponse struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ struct.status = new org.apache.sentry.service.thrift.TSentryResponseStatus();
+ struct.status.read(iprot);
+ struct.setStatusIsSet(true);
+ }
+ }
+
+}
+
[12/25] SENTRY-432. HDFS ingration. Initial patch
Posted by pr...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/SentryPolicyService.java
----------------------------------------------------------------------
diff --git a/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/SentryPolicyService.java b/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/SentryPolicyService.java
new file mode 100644
index 0000000..f7dddae
--- /dev/null
+++ b/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/SentryPolicyService.java
@@ -0,0 +1,11554 @@
+/**
+ * Autogenerated by Thrift Compiler (0.9.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+package org.apache.sentry.provider.db.service.thrift;
+
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EnumMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.EnumSet;
+import java.util.Collections;
+import java.util.BitSet;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class SentryPolicyService {
+
+ public interface Iface {
+
+ public TCreateSentryRoleResponse create_sentry_role(TCreateSentryRoleRequest request) throws org.apache.thrift.TException;
+
+ public TDropSentryRoleResponse drop_sentry_role(TDropSentryRoleRequest request) throws org.apache.thrift.TException;
+
+ public TAlterSentryRoleGrantPrivilegeResponse alter_sentry_role_grant_privilege(TAlterSentryRoleGrantPrivilegeRequest request) throws org.apache.thrift.TException;
+
+ public TAlterSentryRoleRevokePrivilegeResponse alter_sentry_role_revoke_privilege(TAlterSentryRoleRevokePrivilegeRequest request) throws org.apache.thrift.TException;
+
+ public TAlterSentryRoleAddGroupsResponse alter_sentry_role_add_groups(TAlterSentryRoleAddGroupsRequest request) throws org.apache.thrift.TException;
+
+ public TAlterSentryRoleDeleteGroupsResponse alter_sentry_role_delete_groups(TAlterSentryRoleDeleteGroupsRequest request) throws org.apache.thrift.TException;
+
+ public TListSentryRolesResponse list_sentry_roles_by_group(TListSentryRolesRequest request) throws org.apache.thrift.TException;
+
+ public TListSentryPrivilegesResponse list_sentry_privileges_by_role(TListSentryPrivilegesRequest request) throws org.apache.thrift.TException;
+
+ public TListSentryPrivilegesForProviderResponse list_sentry_privileges_for_provider(TListSentryPrivilegesForProviderRequest request) throws org.apache.thrift.TException;
+
+ public TDropPrivilegesResponse drop_sentry_privilege(TDropPrivilegesRequest request) throws org.apache.thrift.TException;
+
+ public TRenamePrivilegesResponse rename_sentry_privilege(TRenamePrivilegesRequest request) throws org.apache.thrift.TException;
+
+ public void handle_hms_notification(TPathsUpdate pathsUpdate) throws org.apache.thrift.TException;
+
+ public TAuthzUpdateResponse get_all_authz_updates_from(long permSeqNum, long pathSeqNum) throws org.apache.thrift.TException;
+
+ public Map<String,List<String>> get_all_related_paths(String path, boolean exactMatch) throws org.apache.thrift.TException;
+
+ }
+
+ public interface AsyncIface {
+
+ public void create_sentry_role(TCreateSentryRoleRequest request, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.create_sentry_role_call> resultHandler) throws org.apache.thrift.TException;
+
+ public void drop_sentry_role(TDropSentryRoleRequest request, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.drop_sentry_role_call> resultHandler) throws org.apache.thrift.TException;
+
+ public void alter_sentry_role_grant_privilege(TAlterSentryRoleGrantPrivilegeRequest request, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.alter_sentry_role_grant_privilege_call> resultHandler) throws org.apache.thrift.TException;
+
+ public void alter_sentry_role_revoke_privilege(TAlterSentryRoleRevokePrivilegeRequest request, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.alter_sentry_role_revoke_privilege_call> resultHandler) throws org.apache.thrift.TException;
+
+ public void alter_sentry_role_add_groups(TAlterSentryRoleAddGroupsRequest request, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.alter_sentry_role_add_groups_call> resultHandler) throws org.apache.thrift.TException;
+
+ public void alter_sentry_role_delete_groups(TAlterSentryRoleDeleteGroupsRequest request, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.alter_sentry_role_delete_groups_call> resultHandler) throws org.apache.thrift.TException;
+
+ public void list_sentry_roles_by_group(TListSentryRolesRequest request, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.list_sentry_roles_by_group_call> resultHandler) throws org.apache.thrift.TException;
+
+ public void list_sentry_privileges_by_role(TListSentryPrivilegesRequest request, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.list_sentry_privileges_by_role_call> resultHandler) throws org.apache.thrift.TException;
+
+ public void list_sentry_privileges_for_provider(TListSentryPrivilegesForProviderRequest request, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.list_sentry_privileges_for_provider_call> resultHandler) throws org.apache.thrift.TException;
+
+ public void drop_sentry_privilege(TDropPrivilegesRequest request, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.drop_sentry_privilege_call> resultHandler) throws org.apache.thrift.TException;
+
+ public void rename_sentry_privilege(TRenamePrivilegesRequest request, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.rename_sentry_privilege_call> resultHandler) throws org.apache.thrift.TException;
+
+ public void handle_hms_notification(TPathsUpdate pathsUpdate, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.handle_hms_notification_call> resultHandler) throws org.apache.thrift.TException;
+
+ public void get_all_authz_updates_from(long permSeqNum, long pathSeqNum, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.get_all_authz_updates_from_call> resultHandler) throws org.apache.thrift.TException;
+
+ public void get_all_related_paths(String path, boolean exactMatch, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.get_all_related_paths_call> resultHandler) throws org.apache.thrift.TException;
+
+ }
+
+ public static class Client extends org.apache.thrift.TServiceClient implements Iface {
+ public static class Factory implements org.apache.thrift.TServiceClientFactory<Client> {
+ public Factory() {}
+ public Client getClient(org.apache.thrift.protocol.TProtocol prot) {
+ return new Client(prot);
+ }
+ public Client getClient(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) {
+ return new Client(iprot, oprot);
+ }
+ }
+
+ public Client(org.apache.thrift.protocol.TProtocol prot)
+ {
+ super(prot, prot);
+ }
+
+ public Client(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) {
+ super(iprot, oprot);
+ }
+
+ public TCreateSentryRoleResponse create_sentry_role(TCreateSentryRoleRequest request) throws org.apache.thrift.TException
+ {
+ send_create_sentry_role(request);
+ return recv_create_sentry_role();
+ }
+
+ public void send_create_sentry_role(TCreateSentryRoleRequest request) throws org.apache.thrift.TException
+ {
+ create_sentry_role_args args = new create_sentry_role_args();
+ args.setRequest(request);
+ sendBase("create_sentry_role", args);
+ }
+
+ public TCreateSentryRoleResponse recv_create_sentry_role() throws org.apache.thrift.TException
+ {
+ create_sentry_role_result result = new create_sentry_role_result();
+ receiveBase(result, "create_sentry_role");
+ if (result.isSetSuccess()) {
+ return result.success;
+ }
+ throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "create_sentry_role failed: unknown result");
+ }
+
+ public TDropSentryRoleResponse drop_sentry_role(TDropSentryRoleRequest request) throws org.apache.thrift.TException
+ {
+ send_drop_sentry_role(request);
+ return recv_drop_sentry_role();
+ }
+
+ public void send_drop_sentry_role(TDropSentryRoleRequest request) throws org.apache.thrift.TException
+ {
+ drop_sentry_role_args args = new drop_sentry_role_args();
+ args.setRequest(request);
+ sendBase("drop_sentry_role", args);
+ }
+
+ public TDropSentryRoleResponse recv_drop_sentry_role() throws org.apache.thrift.TException
+ {
+ drop_sentry_role_result result = new drop_sentry_role_result();
+ receiveBase(result, "drop_sentry_role");
+ if (result.isSetSuccess()) {
+ return result.success;
+ }
+ throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "drop_sentry_role failed: unknown result");
+ }
+
+ public TAlterSentryRoleGrantPrivilegeResponse alter_sentry_role_grant_privilege(TAlterSentryRoleGrantPrivilegeRequest request) throws org.apache.thrift.TException
+ {
+ send_alter_sentry_role_grant_privilege(request);
+ return recv_alter_sentry_role_grant_privilege();
+ }
+
+ public void send_alter_sentry_role_grant_privilege(TAlterSentryRoleGrantPrivilegeRequest request) throws org.apache.thrift.TException
+ {
+ alter_sentry_role_grant_privilege_args args = new alter_sentry_role_grant_privilege_args();
+ args.setRequest(request);
+ sendBase("alter_sentry_role_grant_privilege", args);
+ }
+
+ public TAlterSentryRoleGrantPrivilegeResponse recv_alter_sentry_role_grant_privilege() throws org.apache.thrift.TException
+ {
+ alter_sentry_role_grant_privilege_result result = new alter_sentry_role_grant_privilege_result();
+ receiveBase(result, "alter_sentry_role_grant_privilege");
+ if (result.isSetSuccess()) {
+ return result.success;
+ }
+ throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "alter_sentry_role_grant_privilege failed: unknown result");
+ }
+
+ public TAlterSentryRoleRevokePrivilegeResponse alter_sentry_role_revoke_privilege(TAlterSentryRoleRevokePrivilegeRequest request) throws org.apache.thrift.TException
+ {
+ send_alter_sentry_role_revoke_privilege(request);
+ return recv_alter_sentry_role_revoke_privilege();
+ }
+
+ public void send_alter_sentry_role_revoke_privilege(TAlterSentryRoleRevokePrivilegeRequest request) throws org.apache.thrift.TException
+ {
+ alter_sentry_role_revoke_privilege_args args = new alter_sentry_role_revoke_privilege_args();
+ args.setRequest(request);
+ sendBase("alter_sentry_role_revoke_privilege", args);
+ }
+
+ public TAlterSentryRoleRevokePrivilegeResponse recv_alter_sentry_role_revoke_privilege() throws org.apache.thrift.TException
+ {
+ alter_sentry_role_revoke_privilege_result result = new alter_sentry_role_revoke_privilege_result();
+ receiveBase(result, "alter_sentry_role_revoke_privilege");
+ if (result.isSetSuccess()) {
+ return result.success;
+ }
+ throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "alter_sentry_role_revoke_privilege failed: unknown result");
+ }
+
+ public TAlterSentryRoleAddGroupsResponse alter_sentry_role_add_groups(TAlterSentryRoleAddGroupsRequest request) throws org.apache.thrift.TException
+ {
+ send_alter_sentry_role_add_groups(request);
+ return recv_alter_sentry_role_add_groups();
+ }
+
+ public void send_alter_sentry_role_add_groups(TAlterSentryRoleAddGroupsRequest request) throws org.apache.thrift.TException
+ {
+ alter_sentry_role_add_groups_args args = new alter_sentry_role_add_groups_args();
+ args.setRequest(request);
+ sendBase("alter_sentry_role_add_groups", args);
+ }
+
+ public TAlterSentryRoleAddGroupsResponse recv_alter_sentry_role_add_groups() throws org.apache.thrift.TException
+ {
+ alter_sentry_role_add_groups_result result = new alter_sentry_role_add_groups_result();
+ receiveBase(result, "alter_sentry_role_add_groups");
+ if (result.isSetSuccess()) {
+ return result.success;
+ }
+ throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "alter_sentry_role_add_groups failed: unknown result");
+ }
+
+ public TAlterSentryRoleDeleteGroupsResponse alter_sentry_role_delete_groups(TAlterSentryRoleDeleteGroupsRequest request) throws org.apache.thrift.TException
+ {
+ send_alter_sentry_role_delete_groups(request);
+ return recv_alter_sentry_role_delete_groups();
+ }
+
+ public void send_alter_sentry_role_delete_groups(TAlterSentryRoleDeleteGroupsRequest request) throws org.apache.thrift.TException
+ {
+ alter_sentry_role_delete_groups_args args = new alter_sentry_role_delete_groups_args();
+ args.setRequest(request);
+ sendBase("alter_sentry_role_delete_groups", args);
+ }
+
+ public TAlterSentryRoleDeleteGroupsResponse recv_alter_sentry_role_delete_groups() throws org.apache.thrift.TException
+ {
+ alter_sentry_role_delete_groups_result result = new alter_sentry_role_delete_groups_result();
+ receiveBase(result, "alter_sentry_role_delete_groups");
+ if (result.isSetSuccess()) {
+ return result.success;
+ }
+ throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "alter_sentry_role_delete_groups failed: unknown result");
+ }
+
+ public TListSentryRolesResponse list_sentry_roles_by_group(TListSentryRolesRequest request) throws org.apache.thrift.TException
+ {
+ send_list_sentry_roles_by_group(request);
+ return recv_list_sentry_roles_by_group();
+ }
+
+ public void send_list_sentry_roles_by_group(TListSentryRolesRequest request) throws org.apache.thrift.TException
+ {
+ list_sentry_roles_by_group_args args = new list_sentry_roles_by_group_args();
+ args.setRequest(request);
+ sendBase("list_sentry_roles_by_group", args);
+ }
+
+ public TListSentryRolesResponse recv_list_sentry_roles_by_group() throws org.apache.thrift.TException
+ {
+ list_sentry_roles_by_group_result result = new list_sentry_roles_by_group_result();
+ receiveBase(result, "list_sentry_roles_by_group");
+ if (result.isSetSuccess()) {
+ return result.success;
+ }
+ throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "list_sentry_roles_by_group failed: unknown result");
+ }
+
+ public TListSentryPrivilegesResponse list_sentry_privileges_by_role(TListSentryPrivilegesRequest request) throws org.apache.thrift.TException
+ {
+ send_list_sentry_privileges_by_role(request);
+ return recv_list_sentry_privileges_by_role();
+ }
+
+ public void send_list_sentry_privileges_by_role(TListSentryPrivilegesRequest request) throws org.apache.thrift.TException
+ {
+ list_sentry_privileges_by_role_args args = new list_sentry_privileges_by_role_args();
+ args.setRequest(request);
+ sendBase("list_sentry_privileges_by_role", args);
+ }
+
+ public TListSentryPrivilegesResponse recv_list_sentry_privileges_by_role() throws org.apache.thrift.TException
+ {
+ list_sentry_privileges_by_role_result result = new list_sentry_privileges_by_role_result();
+ receiveBase(result, "list_sentry_privileges_by_role");
+ if (result.isSetSuccess()) {
+ return result.success;
+ }
+ throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "list_sentry_privileges_by_role failed: unknown result");
+ }
+
+ public TListSentryPrivilegesForProviderResponse list_sentry_privileges_for_provider(TListSentryPrivilegesForProviderRequest request) throws org.apache.thrift.TException
+ {
+ send_list_sentry_privileges_for_provider(request);
+ return recv_list_sentry_privileges_for_provider();
+ }
+
+ public void send_list_sentry_privileges_for_provider(TListSentryPrivilegesForProviderRequest request) throws org.apache.thrift.TException
+ {
+ list_sentry_privileges_for_provider_args args = new list_sentry_privileges_for_provider_args();
+ args.setRequest(request);
+ sendBase("list_sentry_privileges_for_provider", args);
+ }
+
+ public TListSentryPrivilegesForProviderResponse recv_list_sentry_privileges_for_provider() throws org.apache.thrift.TException
+ {
+ list_sentry_privileges_for_provider_result result = new list_sentry_privileges_for_provider_result();
+ receiveBase(result, "list_sentry_privileges_for_provider");
+ if (result.isSetSuccess()) {
+ return result.success;
+ }
+ throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "list_sentry_privileges_for_provider failed: unknown result");
+ }
+
+ public TDropPrivilegesResponse drop_sentry_privilege(TDropPrivilegesRequest request) throws org.apache.thrift.TException
+ {
+ send_drop_sentry_privilege(request);
+ return recv_drop_sentry_privilege();
+ }
+
+ public void send_drop_sentry_privilege(TDropPrivilegesRequest request) throws org.apache.thrift.TException
+ {
+ drop_sentry_privilege_args args = new drop_sentry_privilege_args();
+ args.setRequest(request);
+ sendBase("drop_sentry_privilege", args);
+ }
+
+ public TDropPrivilegesResponse recv_drop_sentry_privilege() throws org.apache.thrift.TException
+ {
+ drop_sentry_privilege_result result = new drop_sentry_privilege_result();
+ receiveBase(result, "drop_sentry_privilege");
+ if (result.isSetSuccess()) {
+ return result.success;
+ }
+ throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "drop_sentry_privilege failed: unknown result");
+ }
+
+ public TRenamePrivilegesResponse rename_sentry_privilege(TRenamePrivilegesRequest request) throws org.apache.thrift.TException
+ {
+ send_rename_sentry_privilege(request);
+ return recv_rename_sentry_privilege();
+ }
+
+ public void send_rename_sentry_privilege(TRenamePrivilegesRequest request) throws org.apache.thrift.TException
+ {
+ rename_sentry_privilege_args args = new rename_sentry_privilege_args();
+ args.setRequest(request);
+ sendBase("rename_sentry_privilege", args);
+ }
+
+ public TRenamePrivilegesResponse recv_rename_sentry_privilege() throws org.apache.thrift.TException
+ {
+ rename_sentry_privilege_result result = new rename_sentry_privilege_result();
+ receiveBase(result, "rename_sentry_privilege");
+ if (result.isSetSuccess()) {
+ return result.success;
+ }
+ throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "rename_sentry_privilege failed: unknown result");
+ }
+
+ public void handle_hms_notification(TPathsUpdate pathsUpdate) throws org.apache.thrift.TException
+ {
+ send_handle_hms_notification(pathsUpdate);
+ recv_handle_hms_notification();
+ }
+
+ public void send_handle_hms_notification(TPathsUpdate pathsUpdate) throws org.apache.thrift.TException
+ {
+ handle_hms_notification_args args = new handle_hms_notification_args();
+ args.setPathsUpdate(pathsUpdate);
+ sendBase("handle_hms_notification", args);
+ }
+
+ public void recv_handle_hms_notification() throws org.apache.thrift.TException
+ {
+ handle_hms_notification_result result = new handle_hms_notification_result();
+ receiveBase(result, "handle_hms_notification");
+ return;
+ }
+
+ public TAuthzUpdateResponse get_all_authz_updates_from(long permSeqNum, long pathSeqNum) throws org.apache.thrift.TException
+ {
+ send_get_all_authz_updates_from(permSeqNum, pathSeqNum);
+ return recv_get_all_authz_updates_from();
+ }
+
+ public void send_get_all_authz_updates_from(long permSeqNum, long pathSeqNum) throws org.apache.thrift.TException
+ {
+ get_all_authz_updates_from_args args = new get_all_authz_updates_from_args();
+ args.setPermSeqNum(permSeqNum);
+ args.setPathSeqNum(pathSeqNum);
+ sendBase("get_all_authz_updates_from", args);
+ }
+
+ public TAuthzUpdateResponse recv_get_all_authz_updates_from() throws org.apache.thrift.TException
+ {
+ get_all_authz_updates_from_result result = new get_all_authz_updates_from_result();
+ receiveBase(result, "get_all_authz_updates_from");
+ if (result.isSetSuccess()) {
+ return result.success;
+ }
+ throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "get_all_authz_updates_from failed: unknown result");
+ }
+
+ public Map<String,List<String>> get_all_related_paths(String path, boolean exactMatch) throws org.apache.thrift.TException
+ {
+ send_get_all_related_paths(path, exactMatch);
+ return recv_get_all_related_paths();
+ }
+
+ public void send_get_all_related_paths(String path, boolean exactMatch) throws org.apache.thrift.TException
+ {
+ get_all_related_paths_args args = new get_all_related_paths_args();
+ args.setPath(path);
+ args.setExactMatch(exactMatch);
+ sendBase("get_all_related_paths", args);
+ }
+
+ public Map<String,List<String>> recv_get_all_related_paths() throws org.apache.thrift.TException
+ {
+ get_all_related_paths_result result = new get_all_related_paths_result();
+ receiveBase(result, "get_all_related_paths");
+ if (result.isSetSuccess()) {
+ return result.success;
+ }
+ throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "get_all_related_paths failed: unknown result");
+ }
+
+ }
+ public static class AsyncClient extends org.apache.thrift.async.TAsyncClient implements AsyncIface {
+ public static class Factory implements org.apache.thrift.async.TAsyncClientFactory<AsyncClient> {
+ private org.apache.thrift.async.TAsyncClientManager clientManager;
+ private org.apache.thrift.protocol.TProtocolFactory protocolFactory;
+ public Factory(org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.protocol.TProtocolFactory protocolFactory) {
+ this.clientManager = clientManager;
+ this.protocolFactory = protocolFactory;
+ }
+ public AsyncClient getAsyncClient(org.apache.thrift.transport.TNonblockingTransport transport) {
+ return new AsyncClient(protocolFactory, clientManager, transport);
+ }
+ }
+
+ public AsyncClient(org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.transport.TNonblockingTransport transport) {
+ super(protocolFactory, clientManager, transport);
+ }
+
+ public void create_sentry_role(TCreateSentryRoleRequest request, org.apache.thrift.async.AsyncMethodCallback<create_sentry_role_call> resultHandler) throws org.apache.thrift.TException {
+ checkReady();
+ create_sentry_role_call method_call = new create_sentry_role_call(request, resultHandler, this, ___protocolFactory, ___transport);
+ this.___currentMethod = method_call;
+ ___manager.call(method_call);
+ }
+
+ public static class create_sentry_role_call extends org.apache.thrift.async.TAsyncMethodCall {
+ private TCreateSentryRoleRequest request;
+ public create_sentry_role_call(TCreateSentryRoleRequest request, org.apache.thrift.async.AsyncMethodCallback<create_sentry_role_call> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
+ super(client, protocolFactory, transport, resultHandler, false);
+ this.request = request;
+ }
+
+ public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
+ prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("create_sentry_role", org.apache.thrift.protocol.TMessageType.CALL, 0));
+ create_sentry_role_args args = new create_sentry_role_args();
+ args.setRequest(request);
+ args.write(prot);
+ prot.writeMessageEnd();
+ }
+
+ public TCreateSentryRoleResponse getResult() throws org.apache.thrift.TException {
+ if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
+ throw new IllegalStateException("Method call not finished!");
+ }
+ org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
+ org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
+ return (new Client(prot)).recv_create_sentry_role();
+ }
+ }
+
+ public void drop_sentry_role(TDropSentryRoleRequest request, org.apache.thrift.async.AsyncMethodCallback<drop_sentry_role_call> resultHandler) throws org.apache.thrift.TException {
+ checkReady();
+ drop_sentry_role_call method_call = new drop_sentry_role_call(request, resultHandler, this, ___protocolFactory, ___transport);
+ this.___currentMethod = method_call;
+ ___manager.call(method_call);
+ }
+
+ public static class drop_sentry_role_call extends org.apache.thrift.async.TAsyncMethodCall {
+ private TDropSentryRoleRequest request;
+ public drop_sentry_role_call(TDropSentryRoleRequest request, org.apache.thrift.async.AsyncMethodCallback<drop_sentry_role_call> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
+ super(client, protocolFactory, transport, resultHandler, false);
+ this.request = request;
+ }
+
+ public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
+ prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("drop_sentry_role", org.apache.thrift.protocol.TMessageType.CALL, 0));
+ drop_sentry_role_args args = new drop_sentry_role_args();
+ args.setRequest(request);
+ args.write(prot);
+ prot.writeMessageEnd();
+ }
+
+ public TDropSentryRoleResponse getResult() throws org.apache.thrift.TException {
+ if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
+ throw new IllegalStateException("Method call not finished!");
+ }
+ org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
+ org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
+ return (new Client(prot)).recv_drop_sentry_role();
+ }
+ }
+
+ public void alter_sentry_role_grant_privilege(TAlterSentryRoleGrantPrivilegeRequest request, org.apache.thrift.async.AsyncMethodCallback<alter_sentry_role_grant_privilege_call> resultHandler) throws org.apache.thrift.TException {
+ checkReady();
+ alter_sentry_role_grant_privilege_call method_call = new alter_sentry_role_grant_privilege_call(request, resultHandler, this, ___protocolFactory, ___transport);
+ this.___currentMethod = method_call;
+ ___manager.call(method_call);
+ }
+
+ public static class alter_sentry_role_grant_privilege_call extends org.apache.thrift.async.TAsyncMethodCall {
+ private TAlterSentryRoleGrantPrivilegeRequest request;
+ public alter_sentry_role_grant_privilege_call(TAlterSentryRoleGrantPrivilegeRequest request, org.apache.thrift.async.AsyncMethodCallback<alter_sentry_role_grant_privilege_call> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
+ super(client, protocolFactory, transport, resultHandler, false);
+ this.request = request;
+ }
+
+ public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
+ prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("alter_sentry_role_grant_privilege", org.apache.thrift.protocol.TMessageType.CALL, 0));
+ alter_sentry_role_grant_privilege_args args = new alter_sentry_role_grant_privilege_args();
+ args.setRequest(request);
+ args.write(prot);
+ prot.writeMessageEnd();
+ }
+
+ public TAlterSentryRoleGrantPrivilegeResponse getResult() throws org.apache.thrift.TException {
+ if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
+ throw new IllegalStateException("Method call not finished!");
+ }
+ org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
+ org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
+ return (new Client(prot)).recv_alter_sentry_role_grant_privilege();
+ }
+ }
+
+ public void alter_sentry_role_revoke_privilege(TAlterSentryRoleRevokePrivilegeRequest request, org.apache.thrift.async.AsyncMethodCallback<alter_sentry_role_revoke_privilege_call> resultHandler) throws org.apache.thrift.TException {
+ checkReady();
+ alter_sentry_role_revoke_privilege_call method_call = new alter_sentry_role_revoke_privilege_call(request, resultHandler, this, ___protocolFactory, ___transport);
+ this.___currentMethod = method_call;
+ ___manager.call(method_call);
+ }
+
+ public static class alter_sentry_role_revoke_privilege_call extends org.apache.thrift.async.TAsyncMethodCall {
+ private TAlterSentryRoleRevokePrivilegeRequest request;
+ public alter_sentry_role_revoke_privilege_call(TAlterSentryRoleRevokePrivilegeRequest request, org.apache.thrift.async.AsyncMethodCallback<alter_sentry_role_revoke_privilege_call> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
+ super(client, protocolFactory, transport, resultHandler, false);
+ this.request = request;
+ }
+
+ public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
+ prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("alter_sentry_role_revoke_privilege", org.apache.thrift.protocol.TMessageType.CALL, 0));
+ alter_sentry_role_revoke_privilege_args args = new alter_sentry_role_revoke_privilege_args();
+ args.setRequest(request);
+ args.write(prot);
+ prot.writeMessageEnd();
+ }
+
+ public TAlterSentryRoleRevokePrivilegeResponse getResult() throws org.apache.thrift.TException {
+ if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
+ throw new IllegalStateException("Method call not finished!");
+ }
+ org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
+ org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
+ return (new Client(prot)).recv_alter_sentry_role_revoke_privilege();
+ }
+ }
+
+ public void alter_sentry_role_add_groups(TAlterSentryRoleAddGroupsRequest request, org.apache.thrift.async.AsyncMethodCallback<alter_sentry_role_add_groups_call> resultHandler) throws org.apache.thrift.TException {
+ checkReady();
+ alter_sentry_role_add_groups_call method_call = new alter_sentry_role_add_groups_call(request, resultHandler, this, ___protocolFactory, ___transport);
+ this.___currentMethod = method_call;
+ ___manager.call(method_call);
+ }
+
+ public static class alter_sentry_role_add_groups_call extends org.apache.thrift.async.TAsyncMethodCall {
+ private TAlterSentryRoleAddGroupsRequest request;
+ public alter_sentry_role_add_groups_call(TAlterSentryRoleAddGroupsRequest request, org.apache.thrift.async.AsyncMethodCallback<alter_sentry_role_add_groups_call> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
+ super(client, protocolFactory, transport, resultHandler, false);
+ this.request = request;
+ }
+
+ public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
+ prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("alter_sentry_role_add_groups", org.apache.thrift.protocol.TMessageType.CALL, 0));
+ alter_sentry_role_add_groups_args args = new alter_sentry_role_add_groups_args();
+ args.setRequest(request);
+ args.write(prot);
+ prot.writeMessageEnd();
+ }
+
+ public TAlterSentryRoleAddGroupsResponse getResult() throws org.apache.thrift.TException {
+ if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
+ throw new IllegalStateException("Method call not finished!");
+ }
+ org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
+ org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
+ return (new Client(prot)).recv_alter_sentry_role_add_groups();
+ }
+ }
+
+ public void alter_sentry_role_delete_groups(TAlterSentryRoleDeleteGroupsRequest request, org.apache.thrift.async.AsyncMethodCallback<alter_sentry_role_delete_groups_call> resultHandler) throws org.apache.thrift.TException {
+ checkReady();
+ alter_sentry_role_delete_groups_call method_call = new alter_sentry_role_delete_groups_call(request, resultHandler, this, ___protocolFactory, ___transport);
+ this.___currentMethod = method_call;
+ ___manager.call(method_call);
+ }
+
+ public static class alter_sentry_role_delete_groups_call extends org.apache.thrift.async.TAsyncMethodCall {
+ private TAlterSentryRoleDeleteGroupsRequest request;
+ public alter_sentry_role_delete_groups_call(TAlterSentryRoleDeleteGroupsRequest request, org.apache.thrift.async.AsyncMethodCallback<alter_sentry_role_delete_groups_call> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
+ super(client, protocolFactory, transport, resultHandler, false);
+ this.request = request;
+ }
+
+ public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
+ prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("alter_sentry_role_delete_groups", org.apache.thrift.protocol.TMessageType.CALL, 0));
+ alter_sentry_role_delete_groups_args args = new alter_sentry_role_delete_groups_args();
+ args.setRequest(request);
+ args.write(prot);
+ prot.writeMessageEnd();
+ }
+
+ public TAlterSentryRoleDeleteGroupsResponse getResult() throws org.apache.thrift.TException {
+ if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
+ throw new IllegalStateException("Method call not finished!");
+ }
+ org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
+ org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
+ return (new Client(prot)).recv_alter_sentry_role_delete_groups();
+ }
+ }
+
+ public void list_sentry_roles_by_group(TListSentryRolesRequest request, org.apache.thrift.async.AsyncMethodCallback<list_sentry_roles_by_group_call> resultHandler) throws org.apache.thrift.TException {
+ checkReady();
+ list_sentry_roles_by_group_call method_call = new list_sentry_roles_by_group_call(request, resultHandler, this, ___protocolFactory, ___transport);
+ this.___currentMethod = method_call;
+ ___manager.call(method_call);
+ }
+
+ public static class list_sentry_roles_by_group_call extends org.apache.thrift.async.TAsyncMethodCall {
+ private TListSentryRolesRequest request;
+ public list_sentry_roles_by_group_call(TListSentryRolesRequest request, org.apache.thrift.async.AsyncMethodCallback<list_sentry_roles_by_group_call> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
+ super(client, protocolFactory, transport, resultHandler, false);
+ this.request = request;
+ }
+
+ public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
+ prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("list_sentry_roles_by_group", org.apache.thrift.protocol.TMessageType.CALL, 0));
+ list_sentry_roles_by_group_args args = new list_sentry_roles_by_group_args();
+ args.setRequest(request);
+ args.write(prot);
+ prot.writeMessageEnd();
+ }
+
+ public TListSentryRolesResponse getResult() throws org.apache.thrift.TException {
+ if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
+ throw new IllegalStateException("Method call not finished!");
+ }
+ org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
+ org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
+ return (new Client(prot)).recv_list_sentry_roles_by_group();
+ }
+ }
+
+ public void list_sentry_privileges_by_role(TListSentryPrivilegesRequest request, org.apache.thrift.async.AsyncMethodCallback<list_sentry_privileges_by_role_call> resultHandler) throws org.apache.thrift.TException {
+ checkReady();
+ list_sentry_privileges_by_role_call method_call = new list_sentry_privileges_by_role_call(request, resultHandler, this, ___protocolFactory, ___transport);
+ this.___currentMethod = method_call;
+ ___manager.call(method_call);
+ }
+
+ public static class list_sentry_privileges_by_role_call extends org.apache.thrift.async.TAsyncMethodCall {
+ private TListSentryPrivilegesRequest request;
+ public list_sentry_privileges_by_role_call(TListSentryPrivilegesRequest request, org.apache.thrift.async.AsyncMethodCallback<list_sentry_privileges_by_role_call> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
+ super(client, protocolFactory, transport, resultHandler, false);
+ this.request = request;
+ }
+
+ public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
+ prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("list_sentry_privileges_by_role", org.apache.thrift.protocol.TMessageType.CALL, 0));
+ list_sentry_privileges_by_role_args args = new list_sentry_privileges_by_role_args();
+ args.setRequest(request);
+ args.write(prot);
+ prot.writeMessageEnd();
+ }
+
+ public TListSentryPrivilegesResponse getResult() throws org.apache.thrift.TException {
+ if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
+ throw new IllegalStateException("Method call not finished!");
+ }
+ org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
+ org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
+ return (new Client(prot)).recv_list_sentry_privileges_by_role();
+ }
+ }
+
+ public void list_sentry_privileges_for_provider(TListSentryPrivilegesForProviderRequest request, org.apache.thrift.async.AsyncMethodCallback<list_sentry_privileges_for_provider_call> resultHandler) throws org.apache.thrift.TException {
+ checkReady();
+ list_sentry_privileges_for_provider_call method_call = new list_sentry_privileges_for_provider_call(request, resultHandler, this, ___protocolFactory, ___transport);
+ this.___currentMethod = method_call;
+ ___manager.call(method_call);
+ }
+
+ public static class list_sentry_privileges_for_provider_call extends org.apache.thrift.async.TAsyncMethodCall {
+ private TListSentryPrivilegesForProviderRequest request;
+ public list_sentry_privileges_for_provider_call(TListSentryPrivilegesForProviderRequest request, org.apache.thrift.async.AsyncMethodCallback<list_sentry_privileges_for_provider_call> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
+ super(client, protocolFactory, transport, resultHandler, false);
+ this.request = request;
+ }
+
+ public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
+ prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("list_sentry_privileges_for_provider", org.apache.thrift.protocol.TMessageType.CALL, 0));
+ list_sentry_privileges_for_provider_args args = new list_sentry_privileges_for_provider_args();
+ args.setRequest(request);
+ args.write(prot);
+ prot.writeMessageEnd();
+ }
+
+ public TListSentryPrivilegesForProviderResponse getResult() throws org.apache.thrift.TException {
+ if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
+ throw new IllegalStateException("Method call not finished!");
+ }
+ org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
+ org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
+ return (new Client(prot)).recv_list_sentry_privileges_for_provider();
+ }
+ }
+
+ public void drop_sentry_privilege(TDropPrivilegesRequest request, org.apache.thrift.async.AsyncMethodCallback<drop_sentry_privilege_call> resultHandler) throws org.apache.thrift.TException {
+ checkReady();
+ drop_sentry_privilege_call method_call = new drop_sentry_privilege_call(request, resultHandler, this, ___protocolFactory, ___transport);
+ this.___currentMethod = method_call;
+ ___manager.call(method_call);
+ }
+
+ public static class drop_sentry_privilege_call extends org.apache.thrift.async.TAsyncMethodCall {
+ private TDropPrivilegesRequest request;
+ public drop_sentry_privilege_call(TDropPrivilegesRequest request, org.apache.thrift.async.AsyncMethodCallback<drop_sentry_privilege_call> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
+ super(client, protocolFactory, transport, resultHandler, false);
+ this.request = request;
+ }
+
+ public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
+ prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("drop_sentry_privilege", org.apache.thrift.protocol.TMessageType.CALL, 0));
+ drop_sentry_privilege_args args = new drop_sentry_privilege_args();
+ args.setRequest(request);
+ args.write(prot);
+ prot.writeMessageEnd();
+ }
+
+ public TDropPrivilegesResponse getResult() throws org.apache.thrift.TException {
+ if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
+ throw new IllegalStateException("Method call not finished!");
+ }
+ org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
+ org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
+ return (new Client(prot)).recv_drop_sentry_privilege();
+ }
+ }
+
+ public void rename_sentry_privilege(TRenamePrivilegesRequest request, org.apache.thrift.async.AsyncMethodCallback<rename_sentry_privilege_call> resultHandler) throws org.apache.thrift.TException {
+ checkReady();
+ rename_sentry_privilege_call method_call = new rename_sentry_privilege_call(request, resultHandler, this, ___protocolFactory, ___transport);
+ this.___currentMethod = method_call;
+ ___manager.call(method_call);
+ }
+
+ public static class rename_sentry_privilege_call extends org.apache.thrift.async.TAsyncMethodCall {
+ private TRenamePrivilegesRequest request;
+ public rename_sentry_privilege_call(TRenamePrivilegesRequest request, org.apache.thrift.async.AsyncMethodCallback<rename_sentry_privilege_call> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
+ super(client, protocolFactory, transport, resultHandler, false);
+ this.request = request;
+ }
+
+ public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
+ prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("rename_sentry_privilege", org.apache.thrift.protocol.TMessageType.CALL, 0));
+ rename_sentry_privilege_args args = new rename_sentry_privilege_args();
+ args.setRequest(request);
+ args.write(prot);
+ prot.writeMessageEnd();
+ }
+
+ public TRenamePrivilegesResponse getResult() throws org.apache.thrift.TException {
+ if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
+ throw new IllegalStateException("Method call not finished!");
+ }
+ org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
+ org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
+ return (new Client(prot)).recv_rename_sentry_privilege();
+ }
+ }
+
+ public void handle_hms_notification(TPathsUpdate pathsUpdate, org.apache.thrift.async.AsyncMethodCallback<handle_hms_notification_call> resultHandler) throws org.apache.thrift.TException {
+ checkReady();
+ handle_hms_notification_call method_call = new handle_hms_notification_call(pathsUpdate, resultHandler, this, ___protocolFactory, ___transport);
+ this.___currentMethod = method_call;
+ ___manager.call(method_call);
+ }
+
+ public static class handle_hms_notification_call extends org.apache.thrift.async.TAsyncMethodCall {
+ private TPathsUpdate pathsUpdate;
+ public handle_hms_notification_call(TPathsUpdate pathsUpdate, org.apache.thrift.async.AsyncMethodCallback<handle_hms_notification_call> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
+ super(client, protocolFactory, transport, resultHandler, false);
+ this.pathsUpdate = pathsUpdate;
+ }
+
+ public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
+ prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("handle_hms_notification", org.apache.thrift.protocol.TMessageType.CALL, 0));
+ handle_hms_notification_args args = new handle_hms_notification_args();
+ args.setPathsUpdate(pathsUpdate);
+ args.write(prot);
+ prot.writeMessageEnd();
+ }
+
+ public void getResult() throws org.apache.thrift.TException {
+ if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
+ throw new IllegalStateException("Method call not finished!");
+ }
+ org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
+ org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
+ (new Client(prot)).recv_handle_hms_notification();
+ }
+ }
+
+ public void get_all_authz_updates_from(long permSeqNum, long pathSeqNum, org.apache.thrift.async.AsyncMethodCallback<get_all_authz_updates_from_call> resultHandler) throws org.apache.thrift.TException {
+ checkReady();
+ get_all_authz_updates_from_call method_call = new get_all_authz_updates_from_call(permSeqNum, pathSeqNum, resultHandler, this, ___protocolFactory, ___transport);
+ this.___currentMethod = method_call;
+ ___manager.call(method_call);
+ }
+
+ public static class get_all_authz_updates_from_call extends org.apache.thrift.async.TAsyncMethodCall {
+ private long permSeqNum;
+ private long pathSeqNum;
+ public get_all_authz_updates_from_call(long permSeqNum, long pathSeqNum, org.apache.thrift.async.AsyncMethodCallback<get_all_authz_updates_from_call> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
+ super(client, protocolFactory, transport, resultHandler, false);
+ this.permSeqNum = permSeqNum;
+ this.pathSeqNum = pathSeqNum;
+ }
+
+ public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
+ prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("get_all_authz_updates_from", org.apache.thrift.protocol.TMessageType.CALL, 0));
+ get_all_authz_updates_from_args args = new get_all_authz_updates_from_args();
+ args.setPermSeqNum(permSeqNum);
+ args.setPathSeqNum(pathSeqNum);
+ args.write(prot);
+ prot.writeMessageEnd();
+ }
+
+ public TAuthzUpdateResponse getResult() throws org.apache.thrift.TException {
+ if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
+ throw new IllegalStateException("Method call not finished!");
+ }
+ org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
+ org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
+ return (new Client(prot)).recv_get_all_authz_updates_from();
+ }
+ }
+
+ public void get_all_related_paths(String path, boolean exactMatch, org.apache.thrift.async.AsyncMethodCallback<get_all_related_paths_call> resultHandler) throws org.apache.thrift.TException {
+ checkReady();
+ get_all_related_paths_call method_call = new get_all_related_paths_call(path, exactMatch, resultHandler, this, ___protocolFactory, ___transport);
+ this.___currentMethod = method_call;
+ ___manager.call(method_call);
+ }
+
+ public static class get_all_related_paths_call extends org.apache.thrift.async.TAsyncMethodCall {
+ private String path;
+ private boolean exactMatch;
+ public get_all_related_paths_call(String path, boolean exactMatch, org.apache.thrift.async.AsyncMethodCallback<get_all_related_paths_call> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
+ super(client, protocolFactory, transport, resultHandler, false);
+ this.path = path;
+ this.exactMatch = exactMatch;
+ }
+
+ public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
+ prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("get_all_related_paths", org.apache.thrift.protocol.TMessageType.CALL, 0));
+ get_all_related_paths_args args = new get_all_related_paths_args();
+ args.setPath(path);
+ args.setExactMatch(exactMatch);
+ args.write(prot);
+ prot.writeMessageEnd();
+ }
+
+ public Map<String,List<String>> getResult() throws org.apache.thrift.TException {
+ if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
+ throw new IllegalStateException("Method call not finished!");
+ }
+ org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
+ org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
+ return (new Client(prot)).recv_get_all_related_paths();
+ }
+ }
+
+ }
+
+ public static class Processor<I extends Iface> extends org.apache.thrift.TBaseProcessor<I> implements org.apache.thrift.TProcessor {
+ private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName());
+ public Processor(I iface) {
+ super(iface, getProcessMap(new HashMap<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>>()));
+ }
+
+ protected Processor(I iface, Map<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>> processMap) {
+ super(iface, getProcessMap(processMap));
+ }
+
+ private static <I extends Iface> Map<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>> getProcessMap(Map<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>> processMap) {
+ processMap.put("create_sentry_role", new create_sentry_role());
+ processMap.put("drop_sentry_role", new drop_sentry_role());
+ processMap.put("alter_sentry_role_grant_privilege", new alter_sentry_role_grant_privilege());
+ processMap.put("alter_sentry_role_revoke_privilege", new alter_sentry_role_revoke_privilege());
+ processMap.put("alter_sentry_role_add_groups", new alter_sentry_role_add_groups());
+ processMap.put("alter_sentry_role_delete_groups", new alter_sentry_role_delete_groups());
+ processMap.put("list_sentry_roles_by_group", new list_sentry_roles_by_group());
+ processMap.put("list_sentry_privileges_by_role", new list_sentry_privileges_by_role());
+ processMap.put("list_sentry_privileges_for_provider", new list_sentry_privileges_for_provider());
+ processMap.put("drop_sentry_privilege", new drop_sentry_privilege());
+ processMap.put("rename_sentry_privilege", new rename_sentry_privilege());
+ processMap.put("handle_hms_notification", new handle_hms_notification());
+ processMap.put("get_all_authz_updates_from", new get_all_authz_updates_from());
+ processMap.put("get_all_related_paths", new get_all_related_paths());
+ return processMap;
+ }
+
+ public static class create_sentry_role<I extends Iface> extends org.apache.thrift.ProcessFunction<I, create_sentry_role_args> {
+ public create_sentry_role() {
+ super("create_sentry_role");
+ }
+
+ public create_sentry_role_args getEmptyArgsInstance() {
+ return new create_sentry_role_args();
+ }
+
+ protected boolean isOneway() {
+ return false;
+ }
+
+ public create_sentry_role_result getResult(I iface, create_sentry_role_args args) throws org.apache.thrift.TException {
+ create_sentry_role_result result = new create_sentry_role_result();
+ result.success = iface.create_sentry_role(args.request);
+ return result;
+ }
+ }
+
+ public static class drop_sentry_role<I extends Iface> extends org.apache.thrift.ProcessFunction<I, drop_sentry_role_args> {
+ public drop_sentry_role() {
+ super("drop_sentry_role");
+ }
+
+ public drop_sentry_role_args getEmptyArgsInstance() {
+ return new drop_sentry_role_args();
+ }
+
+ protected boolean isOneway() {
+ return false;
+ }
+
+ public drop_sentry_role_result getResult(I iface, drop_sentry_role_args args) throws org.apache.thrift.TException {
+ drop_sentry_role_result result = new drop_sentry_role_result();
+ result.success = iface.drop_sentry_role(args.request);
+ return result;
+ }
+ }
+
+ public static class alter_sentry_role_grant_privilege<I extends Iface> extends org.apache.thrift.ProcessFunction<I, alter_sentry_role_grant_privilege_args> {
+ public alter_sentry_role_grant_privilege() {
+ super("alter_sentry_role_grant_privilege");
+ }
+
+ public alter_sentry_role_grant_privilege_args getEmptyArgsInstance() {
+ return new alter_sentry_role_grant_privilege_args();
+ }
+
+ protected boolean isOneway() {
+ return false;
+ }
+
+ public alter_sentry_role_grant_privilege_result getResult(I iface, alter_sentry_role_grant_privilege_args args) throws org.apache.thrift.TException {
+ alter_sentry_role_grant_privilege_result result = new alter_sentry_role_grant_privilege_result();
+ result.success = iface.alter_sentry_role_grant_privilege(args.request);
+ return result;
+ }
+ }
+
+ public static class alter_sentry_role_revoke_privilege<I extends Iface> extends org.apache.thrift.ProcessFunction<I, alter_sentry_role_revoke_privilege_args> {
+ public alter_sentry_role_revoke_privilege() {
+ super("alter_sentry_role_revoke_privilege");
+ }
+
+ public alter_sentry_role_revoke_privilege_args getEmptyArgsInstance() {
+ return new alter_sentry_role_revoke_privilege_args();
+ }
+
+ protected boolean isOneway() {
+ return false;
+ }
+
+ public alter_sentry_role_revoke_privilege_result getResult(I iface, alter_sentry_role_revoke_privilege_args args) throws org.apache.thrift.TException {
+ alter_sentry_role_revoke_privilege_result result = new alter_sentry_role_revoke_privilege_result();
+ result.success = iface.alter_sentry_role_revoke_privilege(args.request);
+ return result;
+ }
+ }
+
+ public static class alter_sentry_role_add_groups<I extends Iface> extends org.apache.thrift.ProcessFunction<I, alter_sentry_role_add_groups_args> {
+ public alter_sentry_role_add_groups() {
+ super("alter_sentry_role_add_groups");
+ }
+
+ public alter_sentry_role_add_groups_args getEmptyArgsInstance() {
+ return new alter_sentry_role_add_groups_args();
+ }
+
+ protected boolean isOneway() {
+ return false;
+ }
+
+ public alter_sentry_role_add_groups_result getResult(I iface, alter_sentry_role_add_groups_args args) throws org.apache.thrift.TException {
+ alter_sentry_role_add_groups_result result = new alter_sentry_role_add_groups_result();
+ result.success = iface.alter_sentry_role_add_groups(args.request);
+ return result;
+ }
+ }
+
+ public static class alter_sentry_role_delete_groups<I extends Iface> extends org.apache.thrift.ProcessFunction<I, alter_sentry_role_delete_groups_args> {
+ public alter_sentry_role_delete_groups() {
+ super("alter_sentry_role_delete_groups");
+ }
+
+ public alter_sentry_role_delete_groups_args getEmptyArgsInstance() {
+ return new alter_sentry_role_delete_groups_args();
+ }
+
+ protected boolean isOneway() {
+ return false;
+ }
+
+ public alter_sentry_role_delete_groups_result getResult(I iface, alter_sentry_role_delete_groups_args args) throws org.apache.thrift.TException {
+ alter_sentry_role_delete_groups_result result = new alter_sentry_role_delete_groups_result();
+ result.success = iface.alter_sentry_role_delete_groups(args.request);
+ return result;
+ }
+ }
+
+ public static class list_sentry_roles_by_group<I extends Iface> extends org.apache.thrift.ProcessFunction<I, list_sentry_roles_by_group_args> {
+ public list_sentry_roles_by_group() {
+ super("list_sentry_roles_by_group");
+ }
+
+ public list_sentry_roles_by_group_args getEmptyArgsInstance() {
+ return new list_sentry_roles_by_group_args();
+ }
+
+ protected boolean isOneway() {
+ return false;
+ }
+
+ public list_sentry_roles_by_group_result getResult(I iface, list_sentry_roles_by_group_args args) throws org.apache.thrift.TException {
+ list_sentry_roles_by_group_result result = new list_sentry_roles_by_group_result();
+ result.success = iface.list_sentry_roles_by_group(args.request);
+ return result;
+ }
+ }
+
+ public static class list_sentry_privileges_by_role<I extends Iface> extends org.apache.thrift.ProcessFunction<I, list_sentry_privileges_by_role_args> {
+ public list_sentry_privileges_by_role() {
+ super("list_sentry_privileges_by_role");
+ }
+
+ public list_sentry_privileges_by_role_args getEmptyArgsInstance() {
+ return new list_sentry_privileges_by_role_args();
+ }
+
+ protected boolean isOneway() {
+ return false;
+ }
+
+ public list_sentry_privileges_by_role_result getResult(I iface, list_sentry_privileges_by_role_args args) throws org.apache.thrift.TException {
+ list_sentry_privileges_by_role_result result = new list_sentry_privileges_by_role_result();
+ result.success = iface.list_sentry_privileges_by_role(args.request);
+ return result;
+ }
+ }
+
+ public static class list_sentry_privileges_for_provider<I extends Iface> extends org.apache.thrift.ProcessFunction<I, list_sentry_privileges_for_provider_args> {
+ public list_sentry_privileges_for_provider() {
+ super("list_sentry_privileges_for_provider");
+ }
+
+ public list_sentry_privileges_for_provider_args getEmptyArgsInstance() {
+ return new list_sentry_privileges_for_provider_args();
+ }
+
+ protected boolean isOneway() {
+ return false;
+ }
+
+ public list_sentry_privileges_for_provider_result getResult(I iface, list_sentry_privileges_for_provider_args args) throws org.apache.thrift.TException {
+ list_sentry_privileges_for_provider_result result = new list_sentry_privileges_for_provider_result();
+ result.success = iface.list_sentry_privileges_for_provider(args.request);
+ return result;
+ }
+ }
+
+ public static class drop_sentry_privilege<I extends Iface> extends org.apache.thrift.ProcessFunction<I, drop_sentry_privilege_args> {
+ public drop_sentry_privilege() {
+ super("drop_sentry_privilege");
+ }
+
+ public drop_sentry_privilege_args getEmptyArgsInstance() {
+ return new drop_sentry_privilege_args();
+ }
+
+ protected boolean isOneway() {
+ return false;
+ }
+
+ public drop_sentry_privilege_result getResult(I iface, drop_sentry_privilege_args args) throws org.apache.thrift.TException {
+ drop_sentry_privilege_result result = new drop_sentry_privilege_result();
+ result.success = iface.drop_sentry_privilege(args.request);
+ return result;
+ }
+ }
+
+ public static class rename_sentry_privilege<I extends Iface> extends org.apache.thrift.ProcessFunction<I, rename_sentry_privilege_args> {
+ public rename_sentry_privilege() {
+ super("rename_sentry_privilege");
+ }
+
+ public rename_sentry_privilege_args getEmptyArgsInstance() {
+ return new rename_sentry_privilege_args();
+ }
+
+ protected boolean isOneway() {
+ return false;
+ }
+
+ public rename_sentry_privilege_result getResult(I iface, rename_sentry_privilege_args args) throws org.apache.thrift.TException {
+ rename_sentry_privilege_result result = new rename_sentry_privilege_result();
+ result.success = iface.rename_sentry_privilege(args.request);
+ return result;
+ }
+ }
+
+ public static class handle_hms_notification<I extends Iface> extends org.apache.thrift.ProcessFunction<I, handle_hms_notification_args> {
+ public handle_hms_notification() {
+ super("handle_hms_notification");
+ }
+
+ public handle_hms_notification_args getEmptyArgsInstance() {
+ return new handle_hms_notification_args();
+ }
+
+ protected boolean isOneway() {
+ return false;
+ }
+
+ public handle_hms_notification_result getResult(I iface, handle_hms_notification_args args) throws org.apache.thrift.TException {
+ handle_hms_notification_result result = new handle_hms_notification_result();
+ iface.handle_hms_notification(args.pathsUpdate);
+ return result;
+ }
+ }
+
+ public static class get_all_authz_updates_from<I extends Iface> extends org.apache.thrift.ProcessFunction<I, get_all_authz_updates_from_args> {
+ public get_all_authz_updates_from() {
+ super("get_all_authz_updates_from");
+ }
+
+ public get_all_authz_updates_from_args getEmptyArgsInstance() {
+ return new get_all_authz_updates_from_args();
+ }
+
+ protected boolean isOneway() {
+ return false;
+ }
+
+ public get_all_authz_updates_from_result getResult(I iface, get_all_authz_updates_from_args args) throws org.apache.thrift.TException {
+ get_all_authz_updates_from_result result = new get_all_authz_updates_from_result();
+ result.success = iface.get_all_authz_updates_from(args.permSeqNum, args.pathSeqNum);
+ return result;
+ }
+ }
+
+ public static class get_all_related_paths<I extends Iface> extends org.apache.thrift.ProcessFunction<I, get_all_related_paths_args> {
+ public get_all_related_paths() {
+ super("get_all_related_paths");
+ }
+
+ public get_all_related_paths_args getEmptyArgsInstance() {
+ return new get_all_related_paths_args();
+ }
+
+ protected boolean isOneway() {
+ return false;
+ }
+
+ public get_all_related_paths_result getResult(I iface, get_all_related_paths_args args) throws org.apache.thrift.TException {
+ get_all_related_paths_result result = new get_all_related_paths_result();
+ result.success = iface.get_all_related_paths(args.path, args.exactMatch);
+ return result;
+ }
+ }
+
+ }
+
+ public static class create_sentry_role_args implements org.apache.thrift.TBase<create_sentry_role_args, create_sentry_role_args._Fields>, java.io.Serializable, Cloneable {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("create_sentry_role_args");
+
+ private static final org.apache.thrift.protocol.TField REQUEST_FIELD_DESC = new org.apache.thrift.protocol.TField("request", org.apache.thrift.protocol.TType.STRUCT, (short)1);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new create_sentry_role_argsStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new create_sentry_role_argsTupleSchemeFactory());
+ }
+
+ private TCreateSentryRoleRequest request; // required
+
+ /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+ public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+ REQUEST((short)1, "request");
+
+ 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: // REQUEST
+ return REQUEST;
+ 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.REQUEST, new org.apache.thrift.meta_data.FieldMetaData("request", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TCreateSentryRoleRequest.class)));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(create_sentry_role_args.class, metaDataMap);
+ }
+
+ public create_sentry_role_args() {
+ }
+
+ public create_sentry_role_args(
+ TCreateSentryRoleRequest request)
+ {
+ this();
+ this.request = request;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public create_sentry_role_args(create_sentry_role_args other) {
+ if (other.isSetRequest()) {
+ this.request = new TCreateSentryRoleRequest(other.request);
+ }
+ }
+
+ public create_sentry_role_args deepCopy() {
+ return new create_sentry_role_args(this);
+ }
+
+ @Override
+ public void clear() {
+ this.request = null;
+ }
+
+ public TCreateSentryRoleRequest getRequest() {
+ return this.request;
+ }
+
+ public void setRequest(TCreateSentryRoleRequest request) {
+ this.request = request;
+ }
+
+ public void unsetRequest() {
+ this.request = null;
+ }
+
+ /** Returns true if field request is set (has been assigned a value) and false otherwise */
+ public boolean isSetRequest() {
+ return this.request != null;
+ }
+
+ public void setRequestIsSet(boolean value) {
+ if (!value) {
+ this.request = null;
+ }
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case REQUEST:
+ if (value == null) {
+ unsetRequest();
+ } else {
+ setRequest((TCreateSentryRoleRequest)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case REQUEST:
+ return getRequest();
+
+ }
+ 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 REQUEST:
+ return isSetRequest();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof create_sentry_role_args)
+ return this.equals((create_sentry_role_args)that);
+ return false;
+ }
+
+ public boolean equals(create_sentry_role_args that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_request = true && this.isSetRequest();
+ boolean that_present_request = true && that.isSetRequest();
+ if (this_present_request || that_present_request) {
+ if (!(this_present_request && that_present_request))
+ return false;
+ if (!this.request.equals(that.request))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ HashCodeBuilder builder = new HashCodeBuilder();
+
+ boolean present_request = true && (isSetRequest());
+ builder.append(present_request);
+ if (present_request)
+ builder.append(request);
+
+ return builder.toHashCode();
+ }
+
+ public int compareTo(create_sentry_role_args other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+ create_sentry_role_args typedOther = (create_sentry_role_args)other;
+
+ lastComparison = Boolean.valueOf(isSetRequest()).compareTo(typedOther.isSetRequest());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetRequest()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.request, typedOther.request);
+ 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("create_sentry_role_args(");
+ boolean first = true;
+
+ sb.append("request:");
+ if (this.request == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.request);
+ }
+ first = false;
+ sb.append(")");
+ return sb.toString();
+ }
+
+ public void validate() throws org.apache.thrift.TException {
+ // check for required fields
+ // check for sub-struct validity
+ if (request != null) {
+ request.validate();
+ }
+ }
+
+ private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+ try {
+ write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+ try {
+ read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private static class create_sentry_role_argsStandardSchemeFactory implements SchemeFactory {
+ public create_sentry_role_argsStandardScheme getScheme() {
+ return new create_sentry_role_argsStandardScheme();
+ }
+ }
+
+ private static class create_sentry_role_argsStandardScheme extends StandardScheme<create_sentry_role_args> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, create_sentry_role_args 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: // REQUEST
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+ struct.request = new TCreateSentryRoleRequest();
+ struct.request.read(iprot);
+ struct.setRequestIsSet(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, create_sentry_role_args struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.request != null) {
+ oprot.writeFieldBegin(REQUEST_FIELD_DESC);
+ struct.request.write(oprot);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class create_sentry_role_argsTupleSchemeFactory implements SchemeFactory {
+ public create_sentry_role_argsTupleScheme getScheme() {
+ return new create_sentry_role_argsTupleScheme();
+ }
+ }
+
+ private static class create_sentry_role_argsTupleScheme extends TupleScheme<create_sentry_role_args> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, create_sentry_role_args struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ BitSet optionals = new BitSet();
+ if (struct.isSetRequest()) {
+ optionals.set(0);
+ }
+ oprot.writeBitSet(optionals, 1);
+ if (struct.isSetRequest()) {
+ struct.request.write(oprot);
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, create_sentry_role_args struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ BitSet incoming = iprot.readBitSet(1);
+ if (incoming.get(0)) {
+ struct.request = new TCreateSentryRoleRequest();
+ struct.request.read(iprot);
+ struct.setRequestIsSet(true);
+ }
+ }
+ }
+
+ }
+
+ public static class create_sentry_role_result implements org.apache.thrift.TBase<create_sentry_role_result, create_sentry_role_result._Fields>, java.io.Serializable, Cloneable {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("create_sentry_role_result");
+
+ private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRUCT, (short)0);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new create_sentry_role_resultStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new create_sentry_role_resultTupleSchemeFactory());
+ }
+
+ private TCreateSentryRoleResponse success; // required
+
+ /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+ public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+ SUCCESS((short)0, "success");
+
+ 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 0: // SUCCESS
+ return SUCCESS;
+ 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.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TCreateSentryRoleResponse.class)));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(create_sentry_role_result.class, metaDataMap);
+ }
+
+ public create_sentry_role_result() {
+ }
+
+ public create_sentry_role_result(
+ TCreateSentryRoleResponse success)
+ {
+ this();
+ this.success = success;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public create_sentry_role_result(create_sentry_role_result other) {
+ if (other.isSetSuccess()) {
+ this.success = new TCreateSentryRoleResponse(other.success);
+ }
+ }
+
+ public create_sentry_role_result deepCopy() {
+ return new create_sentry_role_result(this);
+ }
+
+ @Override
+ public void clear() {
+ this.success = null;
+ }
+
+ public TCreateSentryRoleResponse getSuccess() {
+ return this.success;
+ }
+
+ public void setSuccess(TCreateSentryRoleResponse success) {
+ this.success = success;
+ }
+
+ public void unsetSuccess() {
+ this.success = null;
+ }
+
+ /** Returns true if field success is set (has been assigned a value) and false otherwise */
+ public boolean isSetSuccess() {
+ return this.success != null;
+ }
+
+ public void setSuccessIsSet(boolean value) {
+ if (!value) {
+ this.success = null;
+ }
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case SUCCESS:
+ if (value == null) {
+ unsetSuccess();
+ } else {
+ setSuccess((TCreateSentryRoleResponse)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case SUCCESS:
+ return getSuccess();
+
+ }
+ 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 SUCCESS:
+ return isSetSuccess();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof create_sentry_role_result)
+ return this.equals((create_sentry_role_result)that);
+ return false;
+ }
+
+ public boolean equals(create_sentry_role_result that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_success = true && this.isSetSuccess();
+ boolean that_present_success = true && that.isSetSuccess();
+ if (this_present_success || that_present_success) {
+ if (!(this_present_success && that_present_success))
+ return false;
+ if (!this.success.equals(that.success))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ HashCodeBuilder builder = new HashCodeBuilder();
+
+ boolean present_success = true && (isSetSuccess());
+ builder.append(present_success);
+ if (present_success)
+ builder.append(success);
+
+ return builder.toHashCode();
+ }
+
+ public int compareTo(create_sentry_role_result other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+ create_sentry_role_result typedOther = (create_sentry_role_result)other;
+
+ lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetSuccess()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, typedOther.success);
+ 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("create_sentry_role_result(");
+ boolean first = true;
+
+ sb.append("success:");
+ if (this.success == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.success);
+ }
+ first = false;
+ sb.append(")");
+ return sb.toString();
+ }
+
+ public void validate() throws org.apache.thrift.TException {
+ // check for required fields
+ // check for sub-struct validity
+ if (success != null) {
+ success.validate();
+ }
+ }
+
+ private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+ try {
+ write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.tra
<TRUNCATED>
[14/25] SENTRY-432. HDFS ingration. Initial patch
Posted by pr...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/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 81abd90..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/service/thrift/TSentryResponseStatus.java
+++ /dev/null
@@ -1,594 +0,0 @@
-/**
- * Autogenerated by Thrift Compiler (0.9.0)
- *
- * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
- * @generated
- */
-package org.apache.sentry.service.thrift;
-
-import org.apache.commons.lang.builder.HashCodeBuilder;
-import org.apache.thrift.scheme.IScheme;
-import org.apache.thrift.scheme.SchemeFactory;
-import org.apache.thrift.scheme.StandardScheme;
-
-import org.apache.thrift.scheme.TupleScheme;
-import org.apache.thrift.protocol.TTupleProtocol;
-import org.apache.thrift.protocol.TProtocolException;
-import org.apache.thrift.EncodingUtils;
-import org.apache.thrift.TException;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.EnumMap;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.EnumSet;
-import java.util.Collections;
-import java.util.BitSet;
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class TSentryResponseStatus implements org.apache.thrift.TBase<TSentryResponseStatus, TSentryResponseStatus._Fields>, java.io.Serializable, Cloneable {
- 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 _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 Integer.valueOf(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() {
- HashCodeBuilder builder = new HashCodeBuilder();
-
- boolean present_value = true;
- builder.append(present_value);
- if (present_value)
- builder.append(value);
-
- boolean present_message = true && (isSetMessage());
- builder.append(present_message);
- if (present_message)
- builder.append(message);
-
- boolean present_stack = true && (isSetStack());
- builder.append(present_stack);
- if (present_stack)
- builder.append(stack);
-
- return builder.toHashCode();
- }
-
- public int compareTo(TSentryResponseStatus other) {
- if (!getClass().equals(other.getClass())) {
- return getClass().getName().compareTo(other.getClass().getName());
- }
-
- int lastComparison = 0;
- TSentryResponseStatus typedOther = (TSentryResponseStatus)other;
-
- lastComparison = Boolean.valueOf(isSetValue()).compareTo(typedOther.isSetValue());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetValue()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.value, typedOther.value);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetMessage()).compareTo(typedOther.isSetMessage());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetMessage()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.message, typedOther.message);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetStack()).compareTo(typedOther.isSetStack());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetStack()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.stack, typedOther.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/incubator-sentry/blob/0eb6645e/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 4fdeaeb..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/service/thrift/sentry_common_serviceConstants.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * Autogenerated by Thrift Compiler (0.9.0)
- *
- * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
- * @generated
- */
-package org.apache.sentry.service.thrift;
-
-import org.apache.commons.lang.builder.HashCodeBuilder;
-import org.apache.thrift.scheme.IScheme;
-import org.apache.thrift.scheme.SchemeFactory;
-import org.apache.thrift.scheme.StandardScheme;
-
-import org.apache.thrift.scheme.TupleScheme;
-import org.apache.thrift.protocol.TTupleProtocol;
-import org.apache.thrift.protocol.TProtocolException;
-import org.apache.thrift.EncodingUtils;
-import org.apache.thrift.TException;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.EnumMap;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.EnumSet;
-import java.util.Collections;
-import java.util.BitSet;
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class sentry_common_serviceConstants {
-
- public static final int TSENTRY_SERVICE_V1 = 1;
-
- 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;
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/UpdateForwarder.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/UpdateForwarder.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/UpdateForwarder.java
new file mode 100644
index 0000000..037cfe7
--- /dev/null
+++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/UpdateForwarder.java
@@ -0,0 +1,227 @@
+/**
+ * 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.service;
+
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.concurrent.Executor;
+import java.util.concurrent.Executors;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.concurrent.locks.ReadWriteLock;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
+
+import org.apache.sentry.hdfs.Updateable;
+
+import com.google.common.collect.Lists;
+
+public class UpdateForwarder<K extends Updateable.Update> implements
+ Updateable<K> {
+
+ public static interface ExternalImageRetriever<K> {
+
+ public K retrieveFullImage(long currSeqNum);
+
+ }
+
+ private final AtomicLong lastSeenSeqNum = new AtomicLong(0);
+ private final AtomicLong lastCommittedSeqNum = new AtomicLong(0);
+ // Updates should be handled in order
+ private final Executor updateHandler = Executors.newSingleThreadExecutor();
+
+ // Update log is used when propagate updates to a downstream cache.
+ // The preUpdate log stores all commits that were applied to this cache.
+ // When the update log is filled to capacity (updateLogSize), all
+ // entries are cleared and a compact image if the state of the cache is
+ // appended to the log.
+ // The first entry in an update log (consequently the first preUpdate a
+ // downstream cache sees) will be a full image. All subsequent entries are
+ // partial edits
+ private final LinkedList<K> updateLog = new LinkedList<K>();
+ // UpdateLog is dissabled when updateLogSize = 0;
+ private final int updateLogSize;
+
+ private final ExternalImageRetriever<K> imageRetreiver;
+
+ private volatile Updateable<K> updateable;
+
+ private final ReadWriteLock lock = new ReentrantReadWriteLock();
+ private static final long INIT_SEQ_NUM = -2;
+
+ public UpdateForwarder(Updateable<K> updateable,
+ ExternalImageRetriever<K> imageRetreiver, int updateLogSize) {
+ this.updateLogSize = updateLogSize;
+ this.imageRetreiver = imageRetreiver;
+ K fullImage = imageRetreiver.retrieveFullImage(INIT_SEQ_NUM);
+ appendToUpdateLog(fullImage);
+ this.updateable = updateable.updateFull(fullImage);
+ }
+
+ /**
+ * Handle notifications from HMS plug-in or upstream Cache
+ * @param update
+ */
+ public void handleUpdateNotification(final K update) {
+ // Correct the seqNums on the first update
+ if (lastCommittedSeqNum.get() == INIT_SEQ_NUM) {
+ K firstUpdate = updateLog.peek();
+ long firstSeqNum = update.getSeqNum() - 1;
+ firstUpdate.setSeqNum(firstSeqNum);
+ lastCommittedSeqNum.set(firstSeqNum);
+ lastSeenSeqNum.set(firstSeqNum);
+ }
+ final boolean editNotMissed =
+ lastSeenSeqNum.incrementAndGet() == update.getSeqNum();
+ if (!editNotMissed) {
+ lastSeenSeqNum.set(update.getSeqNum());
+ }
+ Runnable task = new Runnable() {
+ @Override
+ public void run() {
+ K toUpdate = update;
+ if (update.hasFullImage()) {
+ updateable = updateable.updateFull(update);
+ } else {
+ if (editNotMissed) {
+ // apply partial preUpdate
+ updateable.updatePartial(Lists.newArrayList(update), lock);
+ } else {
+ // Retrieve full update from External Source and
+ toUpdate = imageRetreiver
+ .retrieveFullImage(update.getSeqNum());
+ updateable = updateable.updateFull(toUpdate);
+ }
+ }
+ appendToUpdateLog(toUpdate);
+ }
+ };
+ updateHandler.execute(task);
+ }
+
+ private void appendToUpdateLog(K update) {
+ synchronized (updateLog) {
+ if (updateLogSize > 0) {
+ if (update.hasFullImage() || (updateLog.size() == updateLogSize)) {
+ // Essentially a log compaction
+ updateLog.clear();
+ updateLog.add(update.hasFullImage() ? update
+ : createFullImageUpdate(update.getSeqNum()));
+ } else {
+ updateLog.add(update);
+ }
+ }
+ lastCommittedSeqNum.set(update.getSeqNum());
+ }
+ }
+
+ /**
+ * Return all updates from requested seqNum (inclusive)
+ * @param seqNum
+ * @return
+ */
+ public List<K> getAllUpdatesFrom(long seqNum) {
+ List<K> retVal = new LinkedList<K>();
+ synchronized (updateLog) {
+ long currSeqNum = lastCommittedSeqNum.get();
+ if (updateLogSize == 0) {
+ // no updatelog configured..
+ return retVal;
+ }
+ K head = updateLog.peek();
+ if (seqNum > currSeqNum + 1) {
+ // This process has probably restarted since downstream
+ // recieved last update
+ retVal.addAll(updateLog);
+ return retVal;
+ }
+ if (head.getSeqNum() > seqNum) {
+ // Caller has diverged greatly..
+ if (head.hasFullImage()) {
+ // head is a refresh(full) image
+ // Send full image along with partial updates
+ for (K u : updateLog) {
+ retVal.add(u);
+ }
+ } else {
+ // Create a full image
+ // clear updateLog
+ // add fullImage to head of Log
+ // NOTE : This should ideally never happen
+ K fullImage = createFullImageUpdate(currSeqNum);
+ updateLog.clear();
+ updateLog.add(fullImage);
+ retVal.add(fullImage);
+ }
+ } else {
+ // increment iterator to requested seqNum
+ Iterator<K> iter = updateLog.iterator();
+ K u = null;
+ while (iter.hasNext()) {
+ u = iter.next();
+ if (u.getSeqNum() == seqNum) {
+ break;
+ }
+ }
+ // add all updates from requestedSeq
+ // to committedSeqNum
+ for (long seq = seqNum; seq <= currSeqNum; seq ++) {
+ retVal.add(u);
+ if (iter.hasNext()) {
+ u = iter.next();
+ } else {
+ break;
+ }
+ }
+ }
+ }
+ return retVal;
+ }
+
+ public boolean areAllUpdatesCommited() {
+ return lastCommittedSeqNum.get() == lastSeenSeqNum.get();
+ }
+
+ public long getLastCommitted() {
+ return lastCommittedSeqNum.get();
+ }
+
+ public long getLastSeen() {
+ return lastSeenSeqNum.get();
+ }
+
+ @Override
+ public Updateable<K> updateFull(K update) {
+ return updateable.updateFull(update);
+ }
+
+ @Override
+ public void updatePartial(Iterable<K> updates, ReadWriteLock lock) {
+ updateable.updatePartial(updates, lock);
+ }
+
+ @Override
+ public long getLastUpdatedSeqNum() {
+ return updateable.getLastUpdatedSeqNum();
+ }
+
+ @Override
+ public K createFullImageUpdate(long currSeqNum) {
+ return updateable.createFullImageUpdate(currSeqNum);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/UpdateablePermissions.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/UpdateablePermissions.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/UpdateablePermissions.java
new file mode 100644
index 0000000..a91cd9c
--- /dev/null
+++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/UpdateablePermissions.java
@@ -0,0 +1,62 @@
+/**
+ * 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.service;
+
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.concurrent.locks.ReadWriteLock;
+
+import org.apache.sentry.hdfs.PermissionsUpdate;
+import org.apache.sentry.hdfs.Updateable;
+import org.apache.sentry.provider.db.service.UpdateForwarder.ExternalImageRetriever;
+
+public class UpdateablePermissions implements Updateable<PermissionsUpdate>{
+
+ private AtomicLong seqNum = new AtomicLong();
+ private final ExternalImageRetriever<PermissionsUpdate> imageRetreiver;
+
+ public UpdateablePermissions(
+ ExternalImageRetriever<PermissionsUpdate> imageRetreiver) {
+ this.imageRetreiver = imageRetreiver;
+ }
+
+ @Override
+ public PermissionsUpdate createFullImageUpdate(long currSeqNum) {
+ return imageRetreiver.retrieveFullImage(currSeqNum);
+ }
+
+ @Override
+ public long getLastUpdatedSeqNum() {
+ return seqNum.get();
+ }
+
+ @Override
+ public void updatePartial(Iterable<PermissionsUpdate> update,
+ ReadWriteLock lock) {
+ for (PermissionsUpdate permsUpdate : update) {
+ seqNum.set(permsUpdate.getSeqNum());
+ }
+ }
+
+ @Override
+ public Updateable<PermissionsUpdate> updateFull(PermissionsUpdate update) {
+ UpdateablePermissions other = new UpdateablePermissions(imageRetreiver);
+ other.seqNum.set(update.getSeqNum());
+ return other;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryStore.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryStore.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryStore.java
index 718306d..6e66823 100644
--- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryStore.java
+++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryStore.java
@@ -23,6 +23,7 @@ import static org.apache.sentry.provider.common.ProviderConstants.KV_JOINER;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
@@ -40,20 +41,25 @@ import javax.jdo.Transaction;
import org.apache.commons.lang.StringUtils;
import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.permission.FsAction;
import org.apache.sentry.SentryUserException;
import org.apache.sentry.core.model.db.AccessConstants;
import org.apache.sentry.core.model.db.DBModelAuthorizable.AuthorizableType;
+import org.apache.sentry.hdfs.PermissionsUpdate;
import org.apache.sentry.provider.common.ProviderConstants;
import org.apache.sentry.provider.db.SentryAccessDeniedException;
import org.apache.sentry.provider.db.SentryAlreadyExistsException;
import org.apache.sentry.provider.db.SentryGrantDeniedException;
import org.apache.sentry.provider.db.SentryInvalidInputException;
import org.apache.sentry.provider.db.SentryNoSuchObjectException;
+import org.apache.sentry.provider.db.service.UpdateForwarder.ExternalImageRetriever;
import org.apache.sentry.provider.db.service.model.MSentryGroup;
import org.apache.sentry.provider.db.service.model.MSentryPrivilege;
import org.apache.sentry.provider.db.service.model.MSentryRole;
import org.apache.sentry.provider.db.service.model.MSentryVersion;
import org.apache.sentry.provider.db.service.thrift.SentryPolicyStoreProcessor;
+import org.apache.sentry.provider.db.service.thrift.TPrivilegeChanges;
+import org.apache.sentry.provider.db.service.thrift.TRoleChanges;
import org.apache.sentry.provider.db.service.thrift.TSentryActiveRoleSet;
import org.apache.sentry.provider.db.service.thrift.TSentryAuthorizable;
import org.apache.sentry.provider.db.service.thrift.TSentryGrantOption;
@@ -79,11 +85,21 @@ import com.google.common.collect.Sets;
* such as role and group names will be normalized to lowercase
* in addition to starting and ending whitespace.
*/
-public class SentryStore {
+public class SentryStore implements ExternalImageRetriever<PermissionsUpdate> {
private static final UUID SERVER_UUID = UUID.randomUUID();
public static String NULL_COL = "__NULL__";
static final String DEFAULT_DATA_DIR = "sentry_policy_db";
+
+ public static Map<String, FsAction> ACTION_MAPPING = new HashMap<String, FsAction>();
+ static {
+ ACTION_MAPPING.put("ALL", FsAction.ALL);
+ ACTION_MAPPING.put(AccessConstants.ALL, FsAction.ALL);
+ ACTION_MAPPING.put(AccessConstants.SELECT, FsAction.READ);
+ ACTION_MAPPING.put("SELECT", FsAction.READ);
+ ACTION_MAPPING.put(AccessConstants.INSERT, FsAction.WRITE);
+ ACTION_MAPPING.put("INSERT", FsAction.WRITE);
+ }
/**
* Commit order sequence id. This is used by notification handlers
* to know the order in which events where committed to the database.
@@ -714,7 +730,6 @@ public class SentryStore {
}
}
-
List<MSentryPrivilege> getMSentryPrivileges(Set<String> roleNames, TSentryAuthorizable authHierarchy) {
if ((roleNames.size() == 0)||(roleNames == null)) return new ArrayList<MSentryPrivilege>();
boolean rollbackTransaction = true;
@@ -1369,4 +1384,56 @@ public class SentryStore {
return Sets.newHashSet(conf.getStrings(
ServerConfig.ADMIN_GROUPS, new String[]{}));
}
+
+ @Override
+ public PermissionsUpdate retrieveFullImage(long seqNum) {
+ PermissionsUpdate retVal = new PermissionsUpdate(seqNum, true);
+ boolean rollbackTransaction = true;
+ PersistenceManager pm = null;
+ try {
+ pm = openTransaction();
+ Query query = pm.newQuery(MSentryPrivilege.class);
+ String filters = "(serverName != \"__NULL__\") "
+ + "&& (dbName != \"__NULL__\") "
+ + "&& (URI == \"__NULL__\")";
+ query.setFilter(filters.toString());
+ query.setOrdering("serverName ascending, dbName ascending, tableName ascending");
+ List<MSentryPrivilege> privileges = (List<MSentryPrivilege>) query.execute();
+ rollbackTransaction = false;
+ for (MSentryPrivilege mPriv : privileges) {
+ String authzObj = mPriv.getDbName();
+ if (!isNULL(mPriv.getTableName())) {
+ authzObj = authzObj + "." + mPriv.getTableName();
+ }
+ TPrivilegeChanges pUpdate = retVal.addPrivilegeUpdate(authzObj);
+ for (MSentryRole mRole : mPriv.getRoles()) {
+ String existingPriv = pUpdate.getAddPrivileges().get(mRole.getRoleName());
+ if (existingPriv == null) {
+ pUpdate.putToAddPrivileges(mRole.getRoleName(),
+ ACTION_MAPPING.get(mPriv.getAction()).SYMBOL);
+ } else {
+ pUpdate.putToAddPrivileges(
+ mRole.getRoleName(),
+ FsAction.getFsAction(existingPriv)
+ .or(ACTION_MAPPING.get(mPriv.getAction())).SYMBOL);
+ }
+ }
+ }
+ query = pm.newQuery(MSentryGroup.class);
+ List<MSentryGroup> groups = (List<MSentryGroup>) query.execute();
+ for (MSentryGroup mGroup : groups) {
+ for (MSentryRole role : mGroup.getRoles()) {
+ TRoleChanges rUpdate = retVal.addRoleUpdate(role.getRoleName());
+ rUpdate.addToAddGroups(mGroup.getGroupName());
+ }
+ }
+ commitTransaction(pm);
+ return retVal;
+ } finally {
+ if (rollbackTransaction) {
+ rollbackTransaction(pm);
+ }
+ }
+ }
+
}
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/SentryPolicyServiceClient.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/SentryPolicyServiceClient.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/SentryPolicyServiceClient.java
index 6358289..4a079d6 100644
--- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/SentryPolicyServiceClient.java
+++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/SentryPolicyServiceClient.java
@@ -38,13 +38,14 @@ import org.apache.sentry.core.common.ActiveRoleSet;
import org.apache.sentry.core.common.Authorizable;
import org.apache.sentry.core.model.db.AccessConstants;
import org.apache.sentry.core.model.db.DBModelAuthorizable;
+import org.apache.sentry.hdfs.PathsUpdate;
import org.apache.sentry.service.thrift.ServiceConstants.ClientConfig;
import org.apache.sentry.service.thrift.ServiceConstants.PrivilegeScope;
import org.apache.sentry.service.thrift.ServiceConstants.ServerConfig;
import org.apache.sentry.service.thrift.ServiceConstants.ThriftConstants;
import org.apache.sentry.service.thrift.Status;
import org.apache.thrift.TException;
-import org.apache.thrift.protocol.TBinaryProtocol;
+import org.apache.thrift.protocol.TCompactProtocol;
import org.apache.thrift.protocol.TMultiplexedProtocol;
import org.apache.thrift.transport.TSaslClientTransport;
import org.apache.thrift.transport.TSocket;
@@ -156,7 +157,7 @@ public class SentryPolicyServiceClient {
}
LOGGER.debug("Successfully opened transport: " + transport + " to " + serverAddress);
TMultiplexedProtocol protocol = new TMultiplexedProtocol(
- new TBinaryProtocol(transport),
+ new TCompactProtocol(transport),
SentryPolicyStoreProcessor.SENTRY_POLICY_SERVICE_NAME);
client = new SentryPolicyService.Client(protocol);
LOGGER.debug("Successfully created client");
@@ -571,6 +572,15 @@ TSENTRY_SERVICE_VERSION_CURRENT, requestorUserName,
}
}
+ public synchronized void notifyHMSUpdate(PathsUpdate update)
+ throws SentryUserException {
+ try {
+ client.handle_hms_notification(update.getThriftObject());
+ } catch (Exception e) {
+ throw new SentryUserException(THRIFT_EXCEPTION_MESSAGE, e);
+ }
+ }
+
public void close() {
if (transport != null) {
transport.close();
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/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 070c494..685c906 100644
--- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/SentryPolicyStoreProcessor.java
+++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/SentryPolicyStoreProcessor.java
@@ -18,15 +18,32 @@
package org.apache.sentry.provider.db.service.thrift;
+import java.io.IOException;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
+import java.util.HashMap;
import java.util.HashSet;
+import java.util.LinkedList;
import java.util.List;
+import java.util.Map;
import java.util.Set;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hive.conf.HiveConf;
+import org.apache.hadoop.hive.metastore.HiveMetaStoreClient;
+import org.apache.hadoop.hive.metastore.api.Database;
+import org.apache.hadoop.hive.metastore.api.Partition;
+import org.apache.hadoop.hive.metastore.api.Table;
import org.apache.sentry.SentryUserException;
import org.apache.sentry.core.model.db.AccessConstants;
+import org.apache.sentry.hdfs.ExtendedMetastoreClient;
+import org.apache.sentry.hdfs.HMSPaths;
+import org.apache.sentry.hdfs.MetastoreClient;
+import org.apache.sentry.hdfs.PathsUpdate;
+import org.apache.sentry.hdfs.PermissionsUpdate;
+import org.apache.sentry.hdfs.UpdateableAuthzPaths;
import org.apache.sentry.provider.common.GroupMappingService;
import org.apache.sentry.provider.db.SentryAccessDeniedException;
import org.apache.sentry.provider.db.SentryAlreadyExistsException;
@@ -34,6 +51,9 @@ import org.apache.sentry.provider.db.SentryInvalidInputException;
import org.apache.sentry.provider.db.SentryNoSuchObjectException;
import org.apache.sentry.provider.db.log.entity.JsonLogEntityFactory;
import org.apache.sentry.provider.db.log.util.Constants;
+import org.apache.sentry.provider.db.service.UpdateForwarder;
+import org.apache.sentry.provider.db.service.UpdateForwarder.ExternalImageRetriever;
+import org.apache.sentry.provider.db.service.UpdateablePermissions;
import org.apache.sentry.provider.db.service.persistent.CommitContext;
import org.apache.sentry.provider.db.service.persistent.SentryStore;
import org.apache.sentry.provider.db.service.thrift.PolicyStoreConstants.PolicyStoreServerConfig;
@@ -65,6 +85,13 @@ public class SentryPolicyStoreProcessor implements SentryPolicyService.Iface {
private final ImmutableSet<String> adminGroups;
private boolean isReady;
+ private final UpdateForwarder<PathsUpdate> pathsUpdater;
+ private final UpdateForwarder<PermissionsUpdate> permsUpdater;
+
+ // Initialized to some value > 1 so that the first update notification
+ // will trigger a full Image fetch
+ private final AtomicLong permSeqNum = new AtomicLong(5);
+
public SentryPolicyStoreProcessor(String name, Configuration conf) throws Exception {
super();
this.name = name;
@@ -76,6 +103,55 @@ public class SentryPolicyStoreProcessor implements SentryPolicyService.Iface {
isReady = true;
adminGroups = ImmutableSet.copyOf(toTrimedLower(Sets.newHashSet(conf.getStrings(
ServerConfig.ADMIN_GROUPS, new String[]{}))));
+ HiveConf hiveConf = new HiveConf(conf, Configuration.class);
+ if (conf.getBoolean(ServerConfig.SENTRY_HDFS_INTEGRATION_ENABLE, true)) {
+ final MetastoreClient hmsClient = new ExtendedMetastoreClient(hiveConf);
+ final String[] pathPrefixes = conf
+ .getStrings(ServerConfig.SENTRY_HDFS_INTEGRATION_PATH_PREFIXES, new String[]{"/"});
+ pathsUpdater = new UpdateForwarder<PathsUpdate>(new UpdateableAuthzPaths(
+ pathPrefixes), createHMSImageRetriever(pathPrefixes, hmsClient), 100);
+ permsUpdater = new UpdateForwarder<PermissionsUpdate>(
+ new UpdateablePermissions(sentryStore), sentryStore, 100);
+ } else {
+ pathsUpdater = null;
+ permsUpdater = null;
+ }
+ }
+
+ private ExternalImageRetriever<PathsUpdate> createHMSImageRetriever(
+ final String[] pathPrefixes, final MetastoreClient hmsClient) {
+ return new ExternalImageRetriever<PathsUpdate>() {
+ @Override
+ public PathsUpdate retrieveFullImage(long currSeqNum) {
+ PathsUpdate tempUpdate = new PathsUpdate(currSeqNum, false);
+ List<Database> allDatabases = hmsClient.getAllDatabases();
+ for (Database db : allDatabases) {
+ tempUpdate.newPathChange(db.getName()).addToAddPaths(
+ PathsUpdate.cleanPath(db.getLocationUri()));
+ List<Table> allTables = hmsClient.getAllTablesOfDatabase(db);
+ for (Table tbl : allTables) {
+ TPathChanges tblPathChange = tempUpdate.newPathChange(tbl
+ .getDbName() + "." + tbl.getTableName());
+ List<Partition> tblParts = hmsClient.listAllPartitions(db, tbl);
+ tblPathChange.addToAddPaths(PathsUpdate.cleanPath(tbl.getSd()
+ .getLocation() == null ? db.getLocationUri() : tbl
+ .getSd().getLocation()));
+ for (Partition part : tblParts) {
+ tblPathChange.addToAddPaths(PathsUpdate.cleanPath(part.getSd()
+ .getLocation()));
+ }
+ }
+ }
+ UpdateableAuthzPaths tmpAuthzPaths = new UpdateableAuthzPaths(
+ pathPrefixes);
+ tmpAuthzPaths.updatePartial(Lists.newArrayList(tempUpdate),
+ new ReentrantReadWriteLock());
+ PathsUpdate retUpdate = new PathsUpdate(currSeqNum, true);
+ retUpdate.getThriftObject().setPathsDump(
+ tmpAuthzPaths.getPathsDump().createPathsDump());
+ return retUpdate;
+ }
+ };
}
public void stop() {
@@ -183,6 +259,16 @@ public class SentryPolicyStoreProcessor implements SentryPolicyService.Iface {
response.setStatus(Status.OK());
notificationHandlerInvoker.alter_sentry_role_grant_privilege(commitContext,
request, response);
+ String authzObj = getAuthzObj(request.getPrivilege());
+ if (authzObj != null) {
+ PermissionsUpdate update = new PermissionsUpdate(permSeqNum.incrementAndGet(), false);
+ update.addPrivilegeUpdate(authzObj).putToAddPrivileges(
+ request.getRoleName(),
+ SentryStore.ACTION_MAPPING.get(request.getPrivilege().getAction())
+ .SYMBOL);
+ permsUpdater.handleUpdateNotification(update);
+ LOGGER.info("Authz Perm preUpdate [" + update.getSeqNum() + "]..");
+ }
} catch (SentryNoSuchObjectException e) {
String msg = "Role: " + request.getRoleName() + " doesn't exist.";
LOGGER.error(msg, e);
@@ -215,6 +301,16 @@ public class SentryPolicyStoreProcessor implements SentryPolicyService.Iface {
response.setStatus(Status.OK());
notificationHandlerInvoker.alter_sentry_role_revoke_privilege(commitContext,
request, response);
+ String authzObj = getAuthzObj(request.getPrivilege());
+ if (authzObj != null) {
+ PermissionsUpdate update = new PermissionsUpdate(permSeqNum.incrementAndGet(), false);
+ update.addPrivilegeUpdate(authzObj).putToDelPrivileges(
+ request.getRoleName(),
+ SentryStore.ACTION_MAPPING.get(request.getPrivilege().getAction())
+ .SYMBOL);
+ permsUpdater.handleUpdateNotification(update);
+ LOGGER.info("Authz Perm preUpdate [" + update.getSeqNum() + ", " + authzObj + "]..");
+ }
} catch (SentryNoSuchObjectException e) {
String msg = "Privilege: [server=" + request.getPrivilege().getServerName() +
",db=" + request.getPrivilege().getDbName() +
@@ -253,6 +349,12 @@ public class SentryPolicyStoreProcessor implements SentryPolicyService.Iface {
response.setStatus(Status.OK());
notificationHandlerInvoker.drop_sentry_role(commitContext,
request, response);
+ PermissionsUpdate update = new PermissionsUpdate(permSeqNum.incrementAndGet(), false);
+ update.addPrivilegeUpdate(PermissionsUpdate.ALL_AUTHZ_OBJ).putToDelPrivileges(
+ request.getRoleName(), PermissionsUpdate.ALL_AUTHZ_OBJ);
+ update.addRoleUpdate(request.getRoleName()).addToDelGroups(PermissionsUpdate.ALL_GROUPS);
+ permsUpdater.handleUpdateNotification(update);
+ LOGGER.info("Authz Perm preUpdate [" + update.getSeqNum() + ", " + request.getRoleName() + "]..");
} catch (SentryNoSuchObjectException e) {
String msg = "Role :" + request + " does not exist.";
LOGGER.error(msg, e);
@@ -283,6 +385,13 @@ public class SentryPolicyStoreProcessor implements SentryPolicyService.Iface {
response.setStatus(Status.OK());
notificationHandlerInvoker.alter_sentry_role_add_groups(commitContext,
request, response);
+ PermissionsUpdate update = new PermissionsUpdate(permSeqNum.incrementAndGet(), false);
+ TRoleChanges rUpdate = update.addRoleUpdate(request.getRoleName());
+ for (TSentryGroup group : request.getGroups()) {
+ rUpdate.addToAddGroups(group.getGroupName());
+ }
+ permsUpdater.handleUpdateNotification(update);
+ LOGGER.info("Authz Perm preUpdate [" + update.getSeqNum() + ", " + request.getRoleName() + "]..");
} catch (SentryNoSuchObjectException e) {
String msg = "Role: " + request + " does not exist.";
LOGGER.error(msg, e);
@@ -313,6 +422,13 @@ public class SentryPolicyStoreProcessor implements SentryPolicyService.Iface {
response.setStatus(Status.OK());
notificationHandlerInvoker.alter_sentry_role_delete_groups(commitContext,
request, response);
+ PermissionsUpdate update = new PermissionsUpdate(permSeqNum.incrementAndGet(), false);
+ TRoleChanges rUpdate = update.addRoleUpdate(request.getRoleName());
+ for (TSentryGroup group : request.getGroups()) {
+ rUpdate.addToDelGroups(group.getGroupName());
+ }
+ permsUpdater.handleUpdateNotification(update);
+ LOGGER.info("Authz Perm preUpdate [" + update.getSeqNum() + ", " + request.getRoleName() + "]..");
} catch (SentryNoSuchObjectException e) {
String msg = "Role: " + request + " does not exist.";
LOGGER.error(msg, e);
@@ -491,6 +607,7 @@ public class SentryPolicyStoreProcessor implements SentryPolicyService.Iface {
authorize(request.getRequestorUserName(), adminGroups);
sentryStore.dropPrivilege(request.getAuthorizable());
response.setStatus(Status.OK());
+ // TODO : Sentry - HDFS : Have to handle this
} catch (SentryAccessDeniedException e) {
LOGGER.error(e.getMessage(), e);
response.setStatus(Status.AccessDenied(e.getMessage(), e));
@@ -512,6 +629,7 @@ public class SentryPolicyStoreProcessor implements SentryPolicyService.Iface {
sentryStore.renamePrivilege(request.getOldAuthorizable(),
request.getNewAuthorizable(), request.getRequestorUserName());
response.setStatus(Status.OK());
+ // TODO : Sentry - HDFS : Have to handle this
} catch (SentryAccessDeniedException e) {
LOGGER.error(e.getMessage(), e);
response.setStatus(Status.AccessDenied(e.getMessage(), e));
@@ -524,4 +642,76 @@ public class SentryPolicyStoreProcessor implements SentryPolicyService.Iface {
return response;
}
+ @Override
+ public void handle_hms_notification(TPathsUpdate update) throws TException {
+ if (pathsUpdater == null) {
+ throw new TException("HiveMetastore Path Cache not enabled !!");
+ }
+ try {
+ PathsUpdate hmsUpdate = new PathsUpdate(update);
+ pathsUpdater.handleUpdateNotification(hmsUpdate);
+ LOGGER.info("Authz Path preUpdate [" + hmsUpdate.getSeqNum() + "]..");
+ } catch (Exception e) {
+ LOGGER.error("Error handling notification from HMS", e);
+ throw new TException(e);
+ }
+ }
+
+ @Override
+ public TAuthzUpdateResponse get_all_authz_updates_from(long permSeqNum, long pathSeqNum) throws TException {
+ if (pathsUpdater == null) {
+ throw new TException("HiveMetastore Path Cache not enabled !!");
+ }
+ List<PathsUpdate> pathUpdates = pathsUpdater.getAllUpdatesFrom(pathSeqNum);
+ List<PermissionsUpdate> permUpdates = permsUpdater.getAllUpdatesFrom(permSeqNum);
+ TAuthzUpdateResponse retVal = new TAuthzUpdateResponse();
+ retVal.setAuthzPathUpdate(new LinkedList<TPathsUpdate>());
+ retVal.setAuthzPermUpdate(new LinkedList<TPermissionsUpdate>());
+ try {
+ for (PathsUpdate update : pathUpdates) {
+ if (LOGGER.isDebugEnabled()) {
+ LOGGER.debug("### Sending PATH preUpdate seq [" + update.getSeqNum() + "] ###");
+ LOGGER.debug("### Sending PATH preUpdate [" + update.getThriftObject() + "] ###");
+ }
+ retVal.getAuthzPathUpdate().add(update.getThriftObject());
+ }
+ for (PermissionsUpdate update : permUpdates) {
+ if (LOGGER.isDebugEnabled()) {
+ LOGGER.debug("### Sending PERM preUpdate seq [" + update.getSeqNum() + "] ###");
+ LOGGER.debug("### Sending PERM preUpdate [" + update.getThriftObject() + "] ###");
+ }
+ retVal.getAuthzPermUpdate().add(update.getThriftObject());
+ }
+ } catch (Exception e) {
+ LOGGER.error("Error Sending updates to downstream Cache", e);
+ throw new TException(e);
+ }
+ return retVal;
+ }
+
+ @Override
+ public Map<String, List<String>> get_all_related_paths(String path,
+ boolean exactMatch) throws TException {
+ if (pathsUpdater == null) {
+ throw new TException("HiveMetastore Path Cache not enabled !!");
+ }
+// Map<String, LinkedList<String>> relatedPaths = hmsPathCache
+// .getAllRelatedPaths(path, exactMatch);
+ return new HashMap<String, List<String>>();
+ }
+
+ private String getAuthzObj(TSentryPrivilege privilege) {
+ String authzObj = null;
+ if (!SentryStore.isNULL(privilege.getDbName())) {
+ String dbName = privilege.getDbName();
+ String tblName = privilege.getTableName();
+ if (tblName == null) {
+ authzObj = dbName;
+ } else {
+ authzObj = dbName + "." + tblName;
+ }
+ }
+ return authzObj;
+ }
+
}
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/SentryService.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/SentryService.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/SentryService.java
index 6843e80..6c08431 100644
--- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/SentryService.java
+++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/SentryService.java
@@ -49,6 +49,7 @@ import org.apache.sentry.service.thrift.ServiceConstants.ConfUtilties;
import org.apache.sentry.service.thrift.ServiceConstants.ServerConfig;
import org.apache.thrift.TMultiplexedProcessor;
import org.apache.thrift.protocol.TBinaryProtocol;
+import org.apache.thrift.protocol.TCompactProtocol;
import org.apache.thrift.server.TServer;
import org.apache.thrift.server.TThreadPoolServer;
import org.apache.thrift.transport.TSaslServerTransport;
@@ -207,7 +208,7 @@ public class SentryService implements Callable {
TThreadPoolServer.Args args = new TThreadPoolServer.Args(
serverTransport).processor(processor)
.transportFactory(transportFactory)
- .protocolFactory(new TBinaryProtocol.Factory())
+ .protocolFactory(new TCompactProtocol.Factory())
.minWorkerThreads(minThreads).maxWorkerThreads(maxThreads);
thriftServer = new TThreadPoolServer(args);
LOGGER.info("Serving on " + address);
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/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 52eaeed..0000000
--- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/ServiceConstants.java
+++ /dev/null
@@ -1,150 +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 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";
- 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 PROCESSOR_FACTORIES = "sentry.service.processor.factories";
- public static final String PROCESSOR_FACTORIES_DEFAULT =
- "org.apache.sentry.provider.db.service.thrift.SentryPolicyStoreProcessorFactory";
- 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_PASS_DEFAULT = "Sentry";
- 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 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.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 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;
- }
-
- /**
- * 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_V1;
- }
-
- /* Privilege operation scope */
- public static enum PrivilegeScope {
- SERVER,
- URI,
- DATABASE,
- TABLE,
- COLUMN
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/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 9456274..0000000
--- a/sentry-provider/sentry-provider-db/src/main/resources/sentry_common_service.thrift
+++ /dev/null
@@ -1,42 +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;
-
-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;
-
-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
-}
-
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-provider/sentry-provider-db/src/main/resources/sentry_policy_service.thrift
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/resources/sentry_policy_service.thrift b/sentry-provider/sentry-provider-db/src/main/resources/sentry_policy_service.thrift
deleted file mode 100644
index b14616b..0000000
--- a/sentry-provider/sentry-provider-db/src/main/resources/sentry_policy_service.thrift
+++ /dev/null
@@ -1,223 +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.
- */
-
-#
-# Thrift Service that the MetaStore is built on
-#
-
-include "share/fb303/if/fb303.thrift"
-include "sentry_common_service.thrift"
-
-namespace java org.apache.sentry.provider.db.service.thrift
-namespace php sentry.provider.db.service.thrift
-namespace cpp Apache.Sentry.Provider.Db.Service.Thrift
-
-enum TSentryGrantOption {
- TRUE = 1,
- FALSE = 0,
- # UNSET is used for revoke privilege, the component like 'hive'
- # didn't support getting grant option, so use UNSET is stand
- # for revoke both privileges with grant option and without grant
- # option.
- UNSET = -1
-}
-
-# Represents a Privilege in transport from the client to the server
-struct TSentryPrivilege {
-1: required string privilegeScope, # Valid values are SERVER, DATABASE, TABLE
-3: required string serverName,
-4: optional string dbName = "",
-5: optional string tableName = "",
-6: optional string URI = "",
-7: required string action = "",
-8: optional i64 createTime, # Set on server side
-9: optional string grantorPrincipal, # Set on server side
-10: optional TSentryGrantOption grantOption = TSentryGrantOption.FALSE
-}
-
-# TODO can this be deleted? it's not adding value to TAlterSentryRoleAddGroupsRequest
-struct TSentryGroup {
-1: required string groupName
-}
-
-# CREATE ROLE r1
-struct TCreateSentryRoleRequest {
-1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V1,
-2: required string requestorUserName, # user on whose behalf the request is issued
-3: required string roleName, # TSentryRole is not required for this request
-}
-struct TCreateSentryRoleResponse {
-1: required sentry_common_service.TSentryResponseStatus status
-}
-
-# DROP ROLE r1
-struct TDropSentryRoleRequest {
-1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V1,
-2: required string requestorUserName, # user on whose behalf the request is issued
-3: required string roleName # role to drop
-}
-struct TDropSentryRoleResponse {
-1: required sentry_common_service.TSentryResponseStatus status
-}
-
-# GRANT ROLE r1 TO GROUP g1
-struct TAlterSentryRoleAddGroupsRequest {
-1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V1,
-2: required string requestorUserName, # user on whose behalf the request is issued
-3: required string roleName,
-5: required set<TSentryGroup> groups
-}
-
-struct TAlterSentryRoleAddGroupsResponse {
-1: required sentry_common_service.TSentryResponseStatus status
-}
-
-# REVOLE ROLE r1 FROM GROUP g1
-struct TAlterSentryRoleDeleteGroupsRequest {
-1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V1,
-2: required string requestorUserName, # user on whose behalf the request is issued
-3: required string roleName,
-5: required set<TSentryGroup> groups
-}
-struct TAlterSentryRoleDeleteGroupsResponse {
-1: required sentry_common_service.TSentryResponseStatus status
-}
-
-# GRANT ... ON ... TO ROLE ...
-struct TAlterSentryRoleGrantPrivilegeRequest {
-1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V1,
-2: required string requestorUserName, # user on whose behalf the request is issued
-3: required string roleName,
-5: required TSentryPrivilege privilege
-}
-struct TAlterSentryRoleGrantPrivilegeResponse {
-1: required sentry_common_service.TSentryResponseStatus status
-}
-
-# REVOKE ... ON ... FROM ROLE ...
-struct TAlterSentryRoleRevokePrivilegeRequest {
-1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V1,
-2: required string requestorUserName, # user on whose behalf the request is issued
-3: required string roleName,
-5: required TSentryPrivilege privilege
-}
-struct TAlterSentryRoleRevokePrivilegeResponse {
-1: required sentry_common_service.TSentryResponseStatus status
-}
-
-# SHOW ROLE GRANT
-struct TListSentryRolesRequest {
-1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V1,
-2: required string requestorUserName, # user on whose behalf the request is issued
-3: optional string groupName # for this group, or all roles for all groups if null
-}
-# used only for TListSentryRolesResponse
-struct TSentryRole {
-1: required string roleName,
-2: required set<TSentryGroup> groups,
-3: required string grantorPrincipal
-}
-struct TListSentryRolesResponse {
-1: required sentry_common_service.TSentryResponseStatus status
-2: optional set<TSentryRole> roles
-}
-
-struct TSentryAuthorizable {
-1: required string server,
-2: optional string uri,
-3: optional string db,
-4: optional string table,
-}
-
-# SHOW GRANT
-struct TListSentryPrivilegesRequest {
-1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V1,
-2: required string requestorUserName, # user on whose behalf the request is issued
-4: required string roleName, # get privileges assigned for this role
-5: optional TSentryAuthorizable authorizableHierarchy # get privileges assigned for this role
-}
-struct TListSentryPrivilegesResponse {
-1: required sentry_common_service.TSentryResponseStatus status
-2: optional set<TSentryPrivilege> privileges
-}
-
-# Drop privilege
-struct TDropPrivilegesRequest {
-1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V1,
-2: required string requestorUserName, # user on whose behalf the request is issued
-3: required TSentryAuthorizable authorizable
-}
-
-struct TDropPrivilegesResponse {
-1: required sentry_common_service.TSentryResponseStatus status
-}
-
-struct TRenamePrivilegesRequest {
-1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V1,
-2: required string requestorUserName, # user on whose behalf the request is issued
-3: required TSentryAuthorizable oldAuthorizable
-4: required TSentryAuthorizable newAuthorizable
-}
-
-struct TRenamePrivilegesResponse {
-1: required sentry_common_service.TSentryResponseStatus status
-}
-
-# This API was created specifically for ProviderBackend.getPrivileges
-# and is not mean for general purpose privilege retrieval.
-# This request/response pair are created specifically so we can
-# efficiently obtain the specific privilges for a user query
-struct TSentryActiveRoleSet {
-1: required bool all,
-2: required set<string> roles,
-}
-struct TListSentryPrivilegesForProviderRequest {
-1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V1,
-2: required set<string> groups,
-3: required TSentryActiveRoleSet roleSet,
-4: optional TSentryAuthorizable authorizableHierarchy,
-}
-struct TListSentryPrivilegesForProviderResponse {
-1: required sentry_common_service.TSentryResponseStatus status
-2: required set<string> privileges
-}
-
-service SentryPolicyService
-{
- TCreateSentryRoleResponse create_sentry_role(1:TCreateSentryRoleRequest request)
- TDropSentryRoleResponse drop_sentry_role(1:TDropSentryRoleRequest request)
-
- TAlterSentryRoleGrantPrivilegeResponse alter_sentry_role_grant_privilege(1:TAlterSentryRoleGrantPrivilegeRequest request)
- TAlterSentryRoleRevokePrivilegeResponse alter_sentry_role_revoke_privilege(1:TAlterSentryRoleRevokePrivilegeRequest request)
-
- TAlterSentryRoleAddGroupsResponse alter_sentry_role_add_groups(1:TAlterSentryRoleAddGroupsRequest request)
- TAlterSentryRoleDeleteGroupsResponse alter_sentry_role_delete_groups(1:TAlterSentryRoleDeleteGroupsRequest request)
-
- TListSentryRolesResponse list_sentry_roles_by_group(1:TListSentryRolesRequest request)
-
- TListSentryPrivilegesResponse list_sentry_privileges_by_role(1:TListSentryPrivilegesRequest request)
-
- # For use with ProviderBackend.getPrivileges only
- TListSentryPrivilegesForProviderResponse list_sentry_privileges_for_provider(1:TListSentryPrivilegesForProviderRequest request)
-
- TDropPrivilegesResponse drop_sentry_privilege(1:TDropPrivilegesRequest request);
-
- TRenamePrivilegesResponse rename_sentry_privilege(1:TRenamePrivilegesRequest request);
-}
[15/25] SENTRY-432. HDFS ingration. Initial patch
Posted by pr...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryGroup.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryGroup.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryGroup.java
deleted file mode 100644
index 4aadd22..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryGroup.java
+++ /dev/null
@@ -1,385 +0,0 @@
-/**
- * Autogenerated by Thrift Compiler (0.9.0)
- *
- * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
- * @generated
- */
-package org.apache.sentry.provider.db.service.thrift;
-
-import org.apache.commons.lang.builder.HashCodeBuilder;
-import org.apache.thrift.scheme.IScheme;
-import org.apache.thrift.scheme.SchemeFactory;
-import org.apache.thrift.scheme.StandardScheme;
-
-import org.apache.thrift.scheme.TupleScheme;
-import org.apache.thrift.protocol.TTupleProtocol;
-import org.apache.thrift.protocol.TProtocolException;
-import org.apache.thrift.EncodingUtils;
-import org.apache.thrift.TException;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.EnumMap;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.EnumSet;
-import java.util.Collections;
-import java.util.BitSet;
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class TSentryGroup implements org.apache.thrift.TBase<TSentryGroup, TSentryGroup._Fields>, java.io.Serializable, Cloneable {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TSentryGroup");
-
- private static final org.apache.thrift.protocol.TField GROUP_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("groupName", org.apache.thrift.protocol.TType.STRING, (short)1);
-
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TSentryGroupStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TSentryGroupTupleSchemeFactory());
- }
-
- private String groupName; // 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 {
- GROUP_NAME((short)1, "groupName");
-
- 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: // GROUP_NAME
- return GROUP_NAME;
- default:
- return null;
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, throwing an exception
- * if it is not found.
- */
- public static _Fields findByThriftIdOrThrow(int fieldId) {
- _Fields fields = findByThriftId(fieldId);
- if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
- return fields;
- }
-
- /**
- * Find the _Fields constant that matches name, or null if its not found.
- */
- public static _Fields findByName(String name) {
- return byName.get(name);
- }
-
- private final short _thriftId;
- private final String _fieldName;
-
- _Fields(short thriftId, String fieldName) {
- _thriftId = thriftId;
- _fieldName = fieldName;
- }
-
- public short getThriftFieldId() {
- return _thriftId;
- }
-
- public String getFieldName() {
- return _fieldName;
- }
- }
-
- // isset id assignments
- 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.GROUP_NAME, new org.apache.thrift.meta_data.FieldMetaData("groupName", 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(TSentryGroup.class, metaDataMap);
- }
-
- public TSentryGroup() {
- }
-
- public TSentryGroup(
- String groupName)
- {
- this();
- this.groupName = groupName;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TSentryGroup(TSentryGroup other) {
- if (other.isSetGroupName()) {
- this.groupName = other.groupName;
- }
- }
-
- public TSentryGroup deepCopy() {
- return new TSentryGroup(this);
- }
-
- @Override
- public void clear() {
- this.groupName = null;
- }
-
- public String getGroupName() {
- return this.groupName;
- }
-
- public void setGroupName(String groupName) {
- this.groupName = groupName;
- }
-
- public void unsetGroupName() {
- this.groupName = null;
- }
-
- /** Returns true if field groupName is set (has been assigned a value) and false otherwise */
- public boolean isSetGroupName() {
- return this.groupName != null;
- }
-
- public void setGroupNameIsSet(boolean value) {
- if (!value) {
- this.groupName = null;
- }
- }
-
- public void setFieldValue(_Fields field, Object value) {
- switch (field) {
- case GROUP_NAME:
- if (value == null) {
- unsetGroupName();
- } else {
- setGroupName((String)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case GROUP_NAME:
- return getGroupName();
-
- }
- 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 GROUP_NAME:
- return isSetGroupName();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TSentryGroup)
- return this.equals((TSentryGroup)that);
- return false;
- }
-
- public boolean equals(TSentryGroup that) {
- if (that == null)
- return false;
-
- boolean this_present_groupName = true && this.isSetGroupName();
- boolean that_present_groupName = true && that.isSetGroupName();
- if (this_present_groupName || that_present_groupName) {
- if (!(this_present_groupName && that_present_groupName))
- return false;
- if (!this.groupName.equals(that.groupName))
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode() {
- HashCodeBuilder builder = new HashCodeBuilder();
-
- boolean present_groupName = true && (isSetGroupName());
- builder.append(present_groupName);
- if (present_groupName)
- builder.append(groupName);
-
- return builder.toHashCode();
- }
-
- public int compareTo(TSentryGroup other) {
- if (!getClass().equals(other.getClass())) {
- return getClass().getName().compareTo(other.getClass().getName());
- }
-
- int lastComparison = 0;
- TSentryGroup typedOther = (TSentryGroup)other;
-
- lastComparison = Boolean.valueOf(isSetGroupName()).compareTo(typedOther.isSetGroupName());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetGroupName()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.groupName, typedOther.groupName);
- 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("TSentryGroup(");
- boolean first = true;
-
- sb.append("groupName:");
- if (this.groupName == null) {
- sb.append("null");
- } else {
- sb.append(this.groupName);
- }
- first = false;
- sb.append(")");
- return sb.toString();
- }
-
- public void validate() throws org.apache.thrift.TException {
- // check for required fields
- if (!isSetGroupName()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'groupName' 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 TSentryGroupStandardSchemeFactory implements SchemeFactory {
- public TSentryGroupStandardScheme getScheme() {
- return new TSentryGroupStandardScheme();
- }
- }
-
- private static class TSentryGroupStandardScheme extends StandardScheme<TSentryGroup> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TSentryGroup 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: // GROUP_NAME
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.groupName = iprot.readString();
- struct.setGroupNameIsSet(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, TSentryGroup struct) throws org.apache.thrift.TException {
- struct.validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- if (struct.groupName != null) {
- oprot.writeFieldBegin(GROUP_NAME_FIELD_DESC);
- oprot.writeString(struct.groupName);
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TSentryGroupTupleSchemeFactory implements SchemeFactory {
- public TSentryGroupTupleScheme getScheme() {
- return new TSentryGroupTupleScheme();
- }
- }
-
- private static class TSentryGroupTupleScheme extends TupleScheme<TSentryGroup> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, TSentryGroup struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- oprot.writeString(struct.groupName);
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TSentryGroup struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- struct.groupName = iprot.readString();
- struct.setGroupNameIsSet(true);
- }
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryPrivilege.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryPrivilege.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryPrivilege.java
deleted file mode 100644
index 54b6204..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryPrivilege.java
+++ /dev/null
@@ -1,1251 +0,0 @@
-/**
- * Autogenerated by Thrift Compiler (0.9.0)
- *
- * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
- * @generated
- */
-package org.apache.sentry.provider.db.service.thrift;
-
-import org.apache.commons.lang.builder.HashCodeBuilder;
-import org.apache.thrift.scheme.IScheme;
-import org.apache.thrift.scheme.SchemeFactory;
-import org.apache.thrift.scheme.StandardScheme;
-
-import org.apache.thrift.scheme.TupleScheme;
-import org.apache.thrift.protocol.TTupleProtocol;
-import org.apache.thrift.protocol.TProtocolException;
-import org.apache.thrift.EncodingUtils;
-import org.apache.thrift.TException;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.EnumMap;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.EnumSet;
-import java.util.Collections;
-import java.util.BitSet;
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class TSentryPrivilege implements org.apache.thrift.TBase<TSentryPrivilege, TSentryPrivilege._Fields>, java.io.Serializable, Cloneable {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TSentryPrivilege");
-
- private static final org.apache.thrift.protocol.TField PRIVILEGE_SCOPE_FIELD_DESC = new org.apache.thrift.protocol.TField("privilegeScope", org.apache.thrift.protocol.TType.STRING, (short)1);
- private static final org.apache.thrift.protocol.TField SERVER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("serverName", org.apache.thrift.protocol.TType.STRING, (short)3);
- private static final org.apache.thrift.protocol.TField DB_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("dbName", org.apache.thrift.protocol.TType.STRING, (short)4);
- private static final org.apache.thrift.protocol.TField TABLE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("tableName", org.apache.thrift.protocol.TType.STRING, (short)5);
- private static final org.apache.thrift.protocol.TField URI_FIELD_DESC = new org.apache.thrift.protocol.TField("URI", org.apache.thrift.protocol.TType.STRING, (short)6);
- private static final org.apache.thrift.protocol.TField ACTION_FIELD_DESC = new org.apache.thrift.protocol.TField("action", org.apache.thrift.protocol.TType.STRING, (short)7);
- private static final org.apache.thrift.protocol.TField CREATE_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("createTime", org.apache.thrift.protocol.TType.I64, (short)8);
- 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)9);
- private static final org.apache.thrift.protocol.TField GRANT_OPTION_FIELD_DESC = new org.apache.thrift.protocol.TField("grantOption", org.apache.thrift.protocol.TType.I32, (short)10);
-
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TSentryPrivilegeStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TSentryPrivilegeTupleSchemeFactory());
- }
-
- private String privilegeScope; // required
- private String serverName; // required
- private String dbName; // optional
- private String tableName; // optional
- private String URI; // optional
- private String action; // required
- private long createTime; // optional
- private String grantorPrincipal; // optional
- private TSentryGrantOption grantOption; // 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 {
- PRIVILEGE_SCOPE((short)1, "privilegeScope"),
- SERVER_NAME((short)3, "serverName"),
- DB_NAME((short)4, "dbName"),
- TABLE_NAME((short)5, "tableName"),
- URI((short)6, "URI"),
- ACTION((short)7, "action"),
- CREATE_TIME((short)8, "createTime"),
- GRANTOR_PRINCIPAL((short)9, "grantorPrincipal"),
- /**
- *
- * @see TSentryGrantOption
- */
- GRANT_OPTION((short)10, "grantOption");
-
- 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_SCOPE
- return PRIVILEGE_SCOPE;
- case 3: // SERVER_NAME
- return SERVER_NAME;
- case 4: // DB_NAME
- return DB_NAME;
- case 5: // TABLE_NAME
- return TABLE_NAME;
- case 6: // URI
- return URI;
- case 7: // ACTION
- return ACTION;
- case 8: // CREATE_TIME
- return CREATE_TIME;
- case 9: // GRANTOR_PRINCIPAL
- return GRANTOR_PRINCIPAL;
- case 10: // GRANT_OPTION
- return GRANT_OPTION;
- 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 __CREATETIME_ISSET_ID = 0;
- private byte __isset_bitfield = 0;
- private _Fields optionals[] = {_Fields.DB_NAME,_Fields.TABLE_NAME,_Fields.URI,_Fields.CREATE_TIME,_Fields.GRANTOR_PRINCIPAL,_Fields.GRANT_OPTION};
- 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_SCOPE, new org.apache.thrift.meta_data.FieldMetaData("privilegeScope", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.SERVER_NAME, new org.apache.thrift.meta_data.FieldMetaData("serverName", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.DB_NAME, new org.apache.thrift.meta_data.FieldMetaData("dbName", org.apache.thrift.TFieldRequirementType.OPTIONAL,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.TABLE_NAME, new org.apache.thrift.meta_data.FieldMetaData("tableName", org.apache.thrift.TFieldRequirementType.OPTIONAL,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.URI, new org.apache.thrift.meta_data.FieldMetaData("URI", org.apache.thrift.TFieldRequirementType.OPTIONAL,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.ACTION, new org.apache.thrift.meta_data.FieldMetaData("action", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.CREATE_TIME, new org.apache.thrift.meta_data.FieldMetaData("createTime", org.apache.thrift.TFieldRequirementType.OPTIONAL,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
- tmpMap.put(_Fields.GRANTOR_PRINCIPAL, new org.apache.thrift.meta_data.FieldMetaData("grantorPrincipal", org.apache.thrift.TFieldRequirementType.OPTIONAL,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.GRANT_OPTION, new org.apache.thrift.meta_data.FieldMetaData("grantOption", org.apache.thrift.TFieldRequirementType.OPTIONAL,
- new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, TSentryGrantOption.class)));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TSentryPrivilege.class, metaDataMap);
- }
-
- public TSentryPrivilege() {
- this.dbName = "";
-
- this.tableName = "";
-
- this.URI = "";
-
- this.action = "";
-
- this.grantOption = org.apache.sentry.provider.db.service.thrift.TSentryGrantOption.FALSE;
-
- }
-
- public TSentryPrivilege(
- String privilegeScope,
- String serverName,
- String action)
- {
- this();
- this.privilegeScope = privilegeScope;
- this.serverName = serverName;
- this.action = action;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TSentryPrivilege(TSentryPrivilege other) {
- __isset_bitfield = other.__isset_bitfield;
- if (other.isSetPrivilegeScope()) {
- this.privilegeScope = other.privilegeScope;
- }
- if (other.isSetServerName()) {
- this.serverName = other.serverName;
- }
- if (other.isSetDbName()) {
- this.dbName = other.dbName;
- }
- if (other.isSetTableName()) {
- this.tableName = other.tableName;
- }
- if (other.isSetURI()) {
- this.URI = other.URI;
- }
- if (other.isSetAction()) {
- this.action = other.action;
- }
- this.createTime = other.createTime;
- if (other.isSetGrantorPrincipal()) {
- this.grantorPrincipal = other.grantorPrincipal;
- }
- if (other.isSetGrantOption()) {
- this.grantOption = other.grantOption;
- }
- }
-
- public TSentryPrivilege deepCopy() {
- return new TSentryPrivilege(this);
- }
-
- @Override
- public void clear() {
- this.privilegeScope = null;
- this.serverName = null;
- this.dbName = "";
-
- this.tableName = "";
-
- this.URI = "";
-
- this.action = "";
-
- setCreateTimeIsSet(false);
- this.createTime = 0;
- this.grantorPrincipal = null;
- this.grantOption = org.apache.sentry.provider.db.service.thrift.TSentryGrantOption.FALSE;
-
- }
-
- public String getPrivilegeScope() {
- return this.privilegeScope;
- }
-
- public void setPrivilegeScope(String privilegeScope) {
- this.privilegeScope = privilegeScope;
- }
-
- public void unsetPrivilegeScope() {
- this.privilegeScope = null;
- }
-
- /** Returns true if field privilegeScope is set (has been assigned a value) and false otherwise */
- public boolean isSetPrivilegeScope() {
- return this.privilegeScope != null;
- }
-
- public void setPrivilegeScopeIsSet(boolean value) {
- if (!value) {
- this.privilegeScope = null;
- }
- }
-
- public String getServerName() {
- return this.serverName;
- }
-
- public void setServerName(String serverName) {
- this.serverName = serverName;
- }
-
- public void unsetServerName() {
- this.serverName = null;
- }
-
- /** Returns true if field serverName is set (has been assigned a value) and false otherwise */
- public boolean isSetServerName() {
- return this.serverName != null;
- }
-
- public void setServerNameIsSet(boolean value) {
- if (!value) {
- this.serverName = null;
- }
- }
-
- public String getDbName() {
- return this.dbName;
- }
-
- public void setDbName(String dbName) {
- this.dbName = dbName;
- }
-
- public void unsetDbName() {
- this.dbName = null;
- }
-
- /** Returns true if field dbName is set (has been assigned a value) and false otherwise */
- public boolean isSetDbName() {
- return this.dbName != null;
- }
-
- public void setDbNameIsSet(boolean value) {
- if (!value) {
- this.dbName = null;
- }
- }
-
- public String getTableName() {
- return this.tableName;
- }
-
- public void setTableName(String tableName) {
- this.tableName = tableName;
- }
-
- public void unsetTableName() {
- this.tableName = null;
- }
-
- /** Returns true if field tableName is set (has been assigned a value) and false otherwise */
- public boolean isSetTableName() {
- return this.tableName != null;
- }
-
- public void setTableNameIsSet(boolean value) {
- if (!value) {
- this.tableName = null;
- }
- }
-
- public String getURI() {
- return this.URI;
- }
-
- public void setURI(String URI) {
- this.URI = URI;
- }
-
- public void unsetURI() {
- this.URI = null;
- }
-
- /** Returns true if field URI is set (has been assigned a value) and false otherwise */
- public boolean isSetURI() {
- return this.URI != null;
- }
-
- public void setURIIsSet(boolean value) {
- if (!value) {
- this.URI = null;
- }
- }
-
- public String getAction() {
- return this.action;
- }
-
- public void setAction(String action) {
- this.action = action;
- }
-
- public void unsetAction() {
- this.action = null;
- }
-
- /** Returns true if field action is set (has been assigned a value) and false otherwise */
- public boolean isSetAction() {
- return this.action != null;
- }
-
- public void setActionIsSet(boolean value) {
- if (!value) {
- this.action = null;
- }
- }
-
- public long getCreateTime() {
- return this.createTime;
- }
-
- public void setCreateTime(long createTime) {
- this.createTime = createTime;
- setCreateTimeIsSet(true);
- }
-
- public void unsetCreateTime() {
- __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __CREATETIME_ISSET_ID);
- }
-
- /** Returns true if field createTime is set (has been assigned a value) and false otherwise */
- public boolean isSetCreateTime() {
- return EncodingUtils.testBit(__isset_bitfield, __CREATETIME_ISSET_ID);
- }
-
- public void setCreateTimeIsSet(boolean value) {
- __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __CREATETIME_ISSET_ID, value);
- }
-
- 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;
- }
- }
-
- /**
- *
- * @see TSentryGrantOption
- */
- public TSentryGrantOption getGrantOption() {
- return this.grantOption;
- }
-
- /**
- *
- * @see TSentryGrantOption
- */
- public void setGrantOption(TSentryGrantOption grantOption) {
- this.grantOption = grantOption;
- }
-
- public void unsetGrantOption() {
- this.grantOption = null;
- }
-
- /** Returns true if field grantOption is set (has been assigned a value) and false otherwise */
- public boolean isSetGrantOption() {
- return this.grantOption != null;
- }
-
- public void setGrantOptionIsSet(boolean value) {
- if (!value) {
- this.grantOption = null;
- }
- }
-
- public void setFieldValue(_Fields field, Object value) {
- switch (field) {
- case PRIVILEGE_SCOPE:
- if (value == null) {
- unsetPrivilegeScope();
- } else {
- setPrivilegeScope((String)value);
- }
- break;
-
- case SERVER_NAME:
- if (value == null) {
- unsetServerName();
- } else {
- setServerName((String)value);
- }
- break;
-
- case DB_NAME:
- if (value == null) {
- unsetDbName();
- } else {
- setDbName((String)value);
- }
- break;
-
- case TABLE_NAME:
- if (value == null) {
- unsetTableName();
- } else {
- setTableName((String)value);
- }
- break;
-
- case URI:
- if (value == null) {
- unsetURI();
- } else {
- setURI((String)value);
- }
- break;
-
- case ACTION:
- if (value == null) {
- unsetAction();
- } else {
- setAction((String)value);
- }
- break;
-
- case CREATE_TIME:
- if (value == null) {
- unsetCreateTime();
- } else {
- setCreateTime((Long)value);
- }
- break;
-
- case GRANTOR_PRINCIPAL:
- if (value == null) {
- unsetGrantorPrincipal();
- } else {
- setGrantorPrincipal((String)value);
- }
- break;
-
- case GRANT_OPTION:
- if (value == null) {
- unsetGrantOption();
- } else {
- setGrantOption((TSentryGrantOption)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case PRIVILEGE_SCOPE:
- return getPrivilegeScope();
-
- case SERVER_NAME:
- return getServerName();
-
- case DB_NAME:
- return getDbName();
-
- case TABLE_NAME:
- return getTableName();
-
- case URI:
- return getURI();
-
- case ACTION:
- return getAction();
-
- case CREATE_TIME:
- return Long.valueOf(getCreateTime());
-
- case GRANTOR_PRINCIPAL:
- return getGrantorPrincipal();
-
- case GRANT_OPTION:
- return getGrantOption();
-
- }
- 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_SCOPE:
- return isSetPrivilegeScope();
- case SERVER_NAME:
- return isSetServerName();
- case DB_NAME:
- return isSetDbName();
- case TABLE_NAME:
- return isSetTableName();
- case URI:
- return isSetURI();
- case ACTION:
- return isSetAction();
- case CREATE_TIME:
- return isSetCreateTime();
- case GRANTOR_PRINCIPAL:
- return isSetGrantorPrincipal();
- case GRANT_OPTION:
- return isSetGrantOption();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TSentryPrivilege)
- return this.equals((TSentryPrivilege)that);
- return false;
- }
-
- public boolean equals(TSentryPrivilege that) {
- if (that == null)
- return false;
-
- boolean this_present_privilegeScope = true && this.isSetPrivilegeScope();
- boolean that_present_privilegeScope = true && that.isSetPrivilegeScope();
- if (this_present_privilegeScope || that_present_privilegeScope) {
- if (!(this_present_privilegeScope && that_present_privilegeScope))
- return false;
- if (!this.privilegeScope.equals(that.privilegeScope))
- return false;
- }
-
- boolean this_present_serverName = true && this.isSetServerName();
- boolean that_present_serverName = true && that.isSetServerName();
- if (this_present_serverName || that_present_serverName) {
- if (!(this_present_serverName && that_present_serverName))
- return false;
- if (!this.serverName.equals(that.serverName))
- return false;
- }
-
- boolean this_present_dbName = true && this.isSetDbName();
- boolean that_present_dbName = true && that.isSetDbName();
- if (this_present_dbName || that_present_dbName) {
- if (!(this_present_dbName && that_present_dbName))
- return false;
- if (!this.dbName.equals(that.dbName))
- return false;
- }
-
- boolean this_present_tableName = true && this.isSetTableName();
- boolean that_present_tableName = true && that.isSetTableName();
- if (this_present_tableName || that_present_tableName) {
- if (!(this_present_tableName && that_present_tableName))
- return false;
- if (!this.tableName.equals(that.tableName))
- return false;
- }
-
- boolean this_present_URI = true && this.isSetURI();
- boolean that_present_URI = true && that.isSetURI();
- if (this_present_URI || that_present_URI) {
- if (!(this_present_URI && that_present_URI))
- return false;
- if (!this.URI.equals(that.URI))
- return false;
- }
-
- boolean this_present_action = true && this.isSetAction();
- boolean that_present_action = true && that.isSetAction();
- if (this_present_action || that_present_action) {
- if (!(this_present_action && that_present_action))
- return false;
- if (!this.action.equals(that.action))
- return false;
- }
-
- boolean this_present_createTime = true && this.isSetCreateTime();
- boolean that_present_createTime = true && that.isSetCreateTime();
- if (this_present_createTime || that_present_createTime) {
- if (!(this_present_createTime && that_present_createTime))
- return false;
- if (this.createTime != that.createTime)
- 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;
- }
-
- boolean this_present_grantOption = true && this.isSetGrantOption();
- boolean that_present_grantOption = true && that.isSetGrantOption();
- if (this_present_grantOption || that_present_grantOption) {
- if (!(this_present_grantOption && that_present_grantOption))
- return false;
- if (!this.grantOption.equals(that.grantOption))
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode() {
- HashCodeBuilder builder = new HashCodeBuilder();
-
- boolean present_privilegeScope = true && (isSetPrivilegeScope());
- builder.append(present_privilegeScope);
- if (present_privilegeScope)
- builder.append(privilegeScope);
-
- boolean present_serverName = true && (isSetServerName());
- builder.append(present_serverName);
- if (present_serverName)
- builder.append(serverName);
-
- boolean present_dbName = true && (isSetDbName());
- builder.append(present_dbName);
- if (present_dbName)
- builder.append(dbName);
-
- boolean present_tableName = true && (isSetTableName());
- builder.append(present_tableName);
- if (present_tableName)
- builder.append(tableName);
-
- boolean present_URI = true && (isSetURI());
- builder.append(present_URI);
- if (present_URI)
- builder.append(URI);
-
- boolean present_action = true && (isSetAction());
- builder.append(present_action);
- if (present_action)
- builder.append(action);
-
- boolean present_createTime = true && (isSetCreateTime());
- builder.append(present_createTime);
- if (present_createTime)
- builder.append(createTime);
-
- boolean present_grantorPrincipal = true && (isSetGrantorPrincipal());
- builder.append(present_grantorPrincipal);
- if (present_grantorPrincipal)
- builder.append(grantorPrincipal);
-
- boolean present_grantOption = true && (isSetGrantOption());
- builder.append(present_grantOption);
- if (present_grantOption)
- builder.append(grantOption.getValue());
-
- return builder.toHashCode();
- }
-
- public int compareTo(TSentryPrivilege other) {
- if (!getClass().equals(other.getClass())) {
- return getClass().getName().compareTo(other.getClass().getName());
- }
-
- int lastComparison = 0;
- TSentryPrivilege typedOther = (TSentryPrivilege)other;
-
- lastComparison = Boolean.valueOf(isSetPrivilegeScope()).compareTo(typedOther.isSetPrivilegeScope());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetPrivilegeScope()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.privilegeScope, typedOther.privilegeScope);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetServerName()).compareTo(typedOther.isSetServerName());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetServerName()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.serverName, typedOther.serverName);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetDbName()).compareTo(typedOther.isSetDbName());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetDbName()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.dbName, typedOther.dbName);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetTableName()).compareTo(typedOther.isSetTableName());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetTableName()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.tableName, typedOther.tableName);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetURI()).compareTo(typedOther.isSetURI());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetURI()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.URI, typedOther.URI);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetAction()).compareTo(typedOther.isSetAction());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetAction()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.action, typedOther.action);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetCreateTime()).compareTo(typedOther.isSetCreateTime());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetCreateTime()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.createTime, typedOther.createTime);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetGrantorPrincipal()).compareTo(typedOther.isSetGrantorPrincipal());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetGrantorPrincipal()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.grantorPrincipal, typedOther.grantorPrincipal);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetGrantOption()).compareTo(typedOther.isSetGrantOption());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetGrantOption()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.grantOption, typedOther.grantOption);
- 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("TSentryPrivilege(");
- boolean first = true;
-
- sb.append("privilegeScope:");
- if (this.privilegeScope == null) {
- sb.append("null");
- } else {
- sb.append(this.privilegeScope);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("serverName:");
- if (this.serverName == null) {
- sb.append("null");
- } else {
- sb.append(this.serverName);
- }
- first = false;
- if (isSetDbName()) {
- if (!first) sb.append(", ");
- sb.append("dbName:");
- if (this.dbName == null) {
- sb.append("null");
- } else {
- sb.append(this.dbName);
- }
- first = false;
- }
- if (isSetTableName()) {
- if (!first) sb.append(", ");
- sb.append("tableName:");
- if (this.tableName == null) {
- sb.append("null");
- } else {
- sb.append(this.tableName);
- }
- first = false;
- }
- if (isSetURI()) {
- if (!first) sb.append(", ");
- sb.append("URI:");
- if (this.URI == null) {
- sb.append("null");
- } else {
- sb.append(this.URI);
- }
- first = false;
- }
- if (!first) sb.append(", ");
- sb.append("action:");
- if (this.action == null) {
- sb.append("null");
- } else {
- sb.append(this.action);
- }
- first = false;
- if (isSetCreateTime()) {
- if (!first) sb.append(", ");
- sb.append("createTime:");
- sb.append(this.createTime);
- first = false;
- }
- if (isSetGrantorPrincipal()) {
- if (!first) sb.append(", ");
- sb.append("grantorPrincipal:");
- if (this.grantorPrincipal == null) {
- sb.append("null");
- } else {
- sb.append(this.grantorPrincipal);
- }
- first = false;
- }
- if (isSetGrantOption()) {
- if (!first) sb.append(", ");
- sb.append("grantOption:");
- if (this.grantOption == null) {
- sb.append("null");
- } else {
- sb.append(this.grantOption);
- }
- first = false;
- }
- sb.append(")");
- return sb.toString();
- }
-
- public void validate() throws org.apache.thrift.TException {
- // check for required fields
- if (!isSetPrivilegeScope()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'privilegeScope' is unset! Struct:" + toString());
- }
-
- if (!isSetServerName()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'serverName' is unset! Struct:" + toString());
- }
-
- if (!isSetAction()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'action' 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 TSentryPrivilegeStandardSchemeFactory implements SchemeFactory {
- public TSentryPrivilegeStandardScheme getScheme() {
- return new TSentryPrivilegeStandardScheme();
- }
- }
-
- private static class TSentryPrivilegeStandardScheme extends StandardScheme<TSentryPrivilege> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TSentryPrivilege 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_SCOPE
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.privilegeScope = iprot.readString();
- struct.setPrivilegeScopeIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 3: // SERVER_NAME
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.serverName = iprot.readString();
- struct.setServerNameIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 4: // DB_NAME
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.dbName = iprot.readString();
- struct.setDbNameIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 5: // TABLE_NAME
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.tableName = iprot.readString();
- struct.setTableNameIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 6: // URI
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.URI = iprot.readString();
- struct.setURIIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 7: // ACTION
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.action = iprot.readString();
- struct.setActionIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 8: // CREATE_TIME
- if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
- struct.createTime = iprot.readI64();
- struct.setCreateTimeIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 9: // 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;
- case 10: // GRANT_OPTION
- if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
- struct.grantOption = TSentryGrantOption.findByValue(iprot.readI32());
- struct.setGrantOptionIsSet(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, TSentryPrivilege struct) throws org.apache.thrift.TException {
- struct.validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- if (struct.privilegeScope != null) {
- oprot.writeFieldBegin(PRIVILEGE_SCOPE_FIELD_DESC);
- oprot.writeString(struct.privilegeScope);
- oprot.writeFieldEnd();
- }
- if (struct.serverName != null) {
- oprot.writeFieldBegin(SERVER_NAME_FIELD_DESC);
- oprot.writeString(struct.serverName);
- oprot.writeFieldEnd();
- }
- if (struct.dbName != null) {
- if (struct.isSetDbName()) {
- oprot.writeFieldBegin(DB_NAME_FIELD_DESC);
- oprot.writeString(struct.dbName);
- oprot.writeFieldEnd();
- }
- }
- if (struct.tableName != null) {
- if (struct.isSetTableName()) {
- oprot.writeFieldBegin(TABLE_NAME_FIELD_DESC);
- oprot.writeString(struct.tableName);
- oprot.writeFieldEnd();
- }
- }
- if (struct.URI != null) {
- if (struct.isSetURI()) {
- oprot.writeFieldBegin(URI_FIELD_DESC);
- oprot.writeString(struct.URI);
- oprot.writeFieldEnd();
- }
- }
- if (struct.action != null) {
- oprot.writeFieldBegin(ACTION_FIELD_DESC);
- oprot.writeString(struct.action);
- oprot.writeFieldEnd();
- }
- if (struct.isSetCreateTime()) {
- oprot.writeFieldBegin(CREATE_TIME_FIELD_DESC);
- oprot.writeI64(struct.createTime);
- oprot.writeFieldEnd();
- }
- if (struct.grantorPrincipal != null) {
- if (struct.isSetGrantorPrincipal()) {
- oprot.writeFieldBegin(GRANTOR_PRINCIPAL_FIELD_DESC);
- oprot.writeString(struct.grantorPrincipal);
- oprot.writeFieldEnd();
- }
- }
- if (struct.grantOption != null) {
- if (struct.isSetGrantOption()) {
- oprot.writeFieldBegin(GRANT_OPTION_FIELD_DESC);
- oprot.writeI32(struct.grantOption.getValue());
- oprot.writeFieldEnd();
- }
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TSentryPrivilegeTupleSchemeFactory implements SchemeFactory {
- public TSentryPrivilegeTupleScheme getScheme() {
- return new TSentryPrivilegeTupleScheme();
- }
- }
-
- private static class TSentryPrivilegeTupleScheme extends TupleScheme<TSentryPrivilege> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, TSentryPrivilege struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- oprot.writeString(struct.privilegeScope);
- oprot.writeString(struct.serverName);
- oprot.writeString(struct.action);
- BitSet optionals = new BitSet();
- if (struct.isSetDbName()) {
- optionals.set(0);
- }
- if (struct.isSetTableName()) {
- optionals.set(1);
- }
- if (struct.isSetURI()) {
- optionals.set(2);
- }
- if (struct.isSetCreateTime()) {
- optionals.set(3);
- }
- if (struct.isSetGrantorPrincipal()) {
- optionals.set(4);
- }
- if (struct.isSetGrantOption()) {
- optionals.set(5);
- }
- oprot.writeBitSet(optionals, 6);
- if (struct.isSetDbName()) {
- oprot.writeString(struct.dbName);
- }
- if (struct.isSetTableName()) {
- oprot.writeString(struct.tableName);
- }
- if (struct.isSetURI()) {
- oprot.writeString(struct.URI);
- }
- if (struct.isSetCreateTime()) {
- oprot.writeI64(struct.createTime);
- }
- if (struct.isSetGrantorPrincipal()) {
- oprot.writeString(struct.grantorPrincipal);
- }
- if (struct.isSetGrantOption()) {
- oprot.writeI32(struct.grantOption.getValue());
- }
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TSentryPrivilege struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- struct.privilegeScope = iprot.readString();
- struct.setPrivilegeScopeIsSet(true);
- struct.serverName = iprot.readString();
- struct.setServerNameIsSet(true);
- struct.action = iprot.readString();
- struct.setActionIsSet(true);
- BitSet incoming = iprot.readBitSet(6);
- if (incoming.get(0)) {
- struct.dbName = iprot.readString();
- struct.setDbNameIsSet(true);
- }
- if (incoming.get(1)) {
- struct.tableName = iprot.readString();
- struct.setTableNameIsSet(true);
- }
- if (incoming.get(2)) {
- struct.URI = iprot.readString();
- struct.setURIIsSet(true);
- }
- if (incoming.get(3)) {
- struct.createTime = iprot.readI64();
- struct.setCreateTimeIsSet(true);
- }
- if (incoming.get(4)) {
- struct.grantorPrincipal = iprot.readString();
- struct.setGrantorPrincipalIsSet(true);
- }
- if (incoming.get(5)) {
- struct.grantOption = TSentryGrantOption.findByValue(iprot.readI32());
- struct.setGrantOptionIsSet(true);
- }
- }
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/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 f43a6d5..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryRole.java
+++ /dev/null
@@ -1,641 +0,0 @@
-/**
- * Autogenerated by Thrift Compiler (0.9.0)
- *
- * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
- * @generated
- */
-package org.apache.sentry.provider.db.service.thrift;
-
-import org.apache.commons.lang.builder.HashCodeBuilder;
-import org.apache.thrift.scheme.IScheme;
-import org.apache.thrift.scheme.SchemeFactory;
-import org.apache.thrift.scheme.StandardScheme;
-
-import org.apache.thrift.scheme.TupleScheme;
-import org.apache.thrift.protocol.TTupleProtocol;
-import org.apache.thrift.protocol.TProtocolException;
-import org.apache.thrift.EncodingUtils;
-import org.apache.thrift.TException;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.EnumMap;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.EnumSet;
-import java.util.Collections;
-import java.util.BitSet;
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class TSentryRole implements org.apache.thrift.TBase<TSentryRole, TSentryRole._Fields>, java.io.Serializable, Cloneable {
- 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>();
- 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() {
- HashCodeBuilder builder = new HashCodeBuilder();
-
- boolean present_roleName = true && (isSetRoleName());
- builder.append(present_roleName);
- if (present_roleName)
- builder.append(roleName);
-
- boolean present_groups = true && (isSetGroups());
- builder.append(present_groups);
- if (present_groups)
- builder.append(groups);
-
- boolean present_grantorPrincipal = true && (isSetGrantorPrincipal());
- builder.append(present_grantorPrincipal);
- if (present_grantorPrincipal)
- builder.append(grantorPrincipal);
-
- return builder.toHashCode();
- }
-
- public int compareTo(TSentryRole other) {
- if (!getClass().equals(other.getClass())) {
- return getClass().getName().compareTo(other.getClass().getName());
- }
-
- int lastComparison = 0;
- TSentryRole typedOther = (TSentryRole)other;
-
- lastComparison = Boolean.valueOf(isSetRoleName()).compareTo(typedOther.isSetRoleName());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetRoleName()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.roleName, typedOther.roleName);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetGroups()).compareTo(typedOther.isSetGroups());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetGroups()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.groups, typedOther.groups);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetGrantorPrincipal()).compareTo(typedOther.isSetGrantorPrincipal());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetGrantorPrincipal()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.grantorPrincipal, typedOther.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 _set16 = iprot.readSetBegin();
- struct.groups = new HashSet<TSentryGroup>(2*_set16.size);
- for (int _i17 = 0; _i17 < _set16.size; ++_i17)
- {
- TSentryGroup _elem18; // required
- _elem18 = new TSentryGroup();
- _elem18.read(iprot);
- struct.groups.add(_elem18);
- }
- 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 _iter19 : struct.groups)
- {
- _iter19.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 _iter20 : struct.groups)
- {
- _iter20.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 _set21 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
- struct.groups = new HashSet<TSentryGroup>(2*_set21.size);
- for (int _i22 = 0; _i22 < _set21.size; ++_i22)
- {
- TSentryGroup _elem23; // required
- _elem23 = new TSentryGroup();
- _elem23.read(iprot);
- struct.groups.add(_elem23);
- }
- }
- struct.setGroupsIsSet(true);
- struct.grantorPrincipal = iprot.readString();
- struct.setGrantorPrincipalIsSet(true);
- }
- }
-
-}
-
[13/25] SENTRY-432. HDFS ingration. Initial patch
Posted by pr...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/TestUpdateForwarder.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/TestUpdateForwarder.java b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/TestUpdateForwarder.java
new file mode 100644
index 0000000..3bf32f8
--- /dev/null
+++ b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/TestUpdateForwarder.java
@@ -0,0 +1,277 @@
+/**
+ * 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.service;
+
+import java.util.LinkedList;
+import java.util.List;
+import java.util.concurrent.locks.ReadWriteLock;
+
+import junit.framework.Assert;
+
+import org.apache.sentry.hdfs.Updateable;
+import org.apache.sentry.hdfs.Updateable.Update;
+import org.apache.sentry.provider.db.service.UpdateForwarder.ExternalImageRetriever;
+import org.junit.Test;
+
+import com.google.common.base.Joiner;
+import com.google.common.collect.Lists;
+
+public class TestUpdateForwarder {
+
+ static class DummyUpdate implements Update {
+ private long seqNum = 0;
+ private boolean hasFullUpdate = false;
+ private String stuff;
+ public DummyUpdate(long seqNum, boolean hasFullUpdate) {
+ this.seqNum = seqNum;
+ this.hasFullUpdate = hasFullUpdate;
+ }
+ public String getStuff() {
+ return stuff;
+ }
+ public DummyUpdate setStuff(String stuff) {
+ this.stuff = stuff;
+ return this;
+ }
+ @Override
+ public boolean hasFullImage() {
+ return hasFullUpdate;
+ }
+ @Override
+ public long getSeqNum() {
+ return seqNum;
+ }
+ @Override
+ public void setSeqNum(long seqNum) {
+ this.seqNum = seqNum;
+ }
+ }
+
+ static class DummyUpdatable implements Updateable<DummyUpdate> {
+
+ private List<String> state = new LinkedList<String>();
+ private long lastUpdatedSeqNum = 0;
+
+ @Override
+ public void updatePartial(Iterable<DummyUpdate> update, ReadWriteLock lock) {
+ for (DummyUpdate u : update) {
+ state.add(u.getStuff());
+ lastUpdatedSeqNum = u.seqNum;
+ }
+ }
+
+ @Override
+ public Updateable<DummyUpdate> updateFull(DummyUpdate update) {
+ DummyUpdatable retVal = new DummyUpdatable();
+ retVal.lastUpdatedSeqNum = update.seqNum;
+ retVal.state = Lists.newArrayList(update.stuff.split(","));
+ return retVal;
+ }
+
+ @Override
+ public long getLastUpdatedSeqNum() {
+ return lastUpdatedSeqNum;
+ }
+
+ @Override
+ public DummyUpdate createFullImageUpdate(long currSeqNum) {
+ DummyUpdate retVal = new DummyUpdate(currSeqNum, true);
+ retVal.stuff = Joiner.on(",").join(state);
+ return retVal;
+ }
+
+ public String getState() {
+ return Joiner.on(",").join(state);
+ }
+ }
+
+ static class DummyImageRetreiver implements ExternalImageRetriever<DummyUpdate> {
+
+ private String state;
+ public void setState(String state) {
+ this.state = state;
+ }
+ @Override
+ public DummyUpdate retrieveFullImage(long currSeqNum) {
+ DummyUpdate retVal = new DummyUpdate(currSeqNum, true);
+ retVal.stuff = state;
+ return retVal;
+ }
+ }
+
+ @Test
+ public void testInit() {
+ DummyImageRetreiver imageRetreiver = new DummyImageRetreiver();
+ imageRetreiver.setState("a,b,c");
+ UpdateForwarder<DummyUpdate> updateForwarder = new UpdateForwarder<DummyUpdate>(
+ new DummyUpdatable(), imageRetreiver, 10);
+ Assert.assertEquals(-2, updateForwarder.getLastUpdatedSeqNum());
+ List<DummyUpdate> allUpdates = updateForwarder.getAllUpdatesFrom(0);
+ Assert.assertTrue(allUpdates.size() == 1);
+ Assert.assertEquals("a,b,c", allUpdates.get(0).getStuff());
+
+ // If the current process has restarted the input seqNum will be > currSeq
+ allUpdates = updateForwarder.getAllUpdatesFrom(100);
+ Assert.assertTrue(allUpdates.size() == 1);
+ Assert.assertEquals("a,b,c", allUpdates.get(0).getStuff());
+ Assert.assertEquals(-2, allUpdates.get(0).getSeqNum());
+ allUpdates = updateForwarder.getAllUpdatesFrom(-1);
+ Assert.assertEquals(0, allUpdates.size());
+ }
+
+ @Test
+ public void testUpdateReceive() throws Exception {
+ DummyImageRetreiver imageRetreiver = new DummyImageRetreiver();
+ imageRetreiver.setState("a,b,c");
+ UpdateForwarder<DummyUpdate> updateForwarder = new UpdateForwarder<DummyUpdate>(
+ new DummyUpdatable(), imageRetreiver, 5);
+ updateForwarder.handleUpdateNotification(new DummyUpdate(5, false).setStuff("d"));
+ while(!updateForwarder.areAllUpdatesCommited()) {
+ Thread.sleep(100);
+ }
+ Assert.assertEquals(5, updateForwarder.getLastUpdatedSeqNum());
+ List<DummyUpdate> allUpdates = updateForwarder.getAllUpdatesFrom(0);
+ Assert.assertEquals(2, allUpdates.size());
+ Assert.assertEquals("a,b,c", allUpdates.get(0).getStuff());
+ Assert.assertEquals("d", allUpdates.get(1).getStuff());
+ }
+
+ @Test
+ public void testGetUpdates() throws Exception {
+ DummyImageRetreiver imageRetreiver = new DummyImageRetreiver();
+ imageRetreiver.setState("a,b,c");
+ UpdateForwarder<DummyUpdate> updateForwarder = new UpdateForwarder<DummyUpdate>(
+ new DummyUpdatable(), imageRetreiver, 5);
+ updateForwarder.handleUpdateNotification(new DummyUpdate(5, false).setStuff("d"));
+ while(!updateForwarder.areAllUpdatesCommited()) {
+ Thread.sleep(100);
+ }
+ Assert.assertEquals(5, updateForwarder.getLastUpdatedSeqNum());
+ List<DummyUpdate> allUpdates = updateForwarder.getAllUpdatesFrom(0);
+ Assert.assertEquals(2, allUpdates.size());
+
+ updateForwarder.handleUpdateNotification(new DummyUpdate(6, false).setStuff("e"));
+ updateForwarder.handleUpdateNotification(new DummyUpdate(7, false).setStuff("f"));
+
+ while(!updateForwarder.areAllUpdatesCommited()) {
+ Thread.sleep(100);
+ }
+ Assert.assertEquals(7, updateForwarder.getLastUpdatedSeqNum());
+ allUpdates = updateForwarder.getAllUpdatesFrom(0);
+ Assert.assertEquals(4, allUpdates.size());
+ Assert.assertEquals("a,b,c", allUpdates.get(0).getStuff());
+ Assert.assertEquals(4, allUpdates.get(0).getSeqNum());
+ Assert.assertEquals("d", allUpdates.get(1).getStuff());
+ Assert.assertEquals(5, allUpdates.get(1).getSeqNum());
+ Assert.assertEquals("e", allUpdates.get(2).getStuff());
+ Assert.assertEquals(6, allUpdates.get(2).getSeqNum());
+ Assert.assertEquals("f", allUpdates.get(3).getStuff());
+ Assert.assertEquals(7, allUpdates.get(3).getSeqNum());
+
+ updateForwarder.handleUpdateNotification(new DummyUpdate(8, false).setStuff("g"));
+ while(!updateForwarder.areAllUpdatesCommited()) {
+ Thread.sleep(100);
+ }
+ Assert.assertEquals(8, updateForwarder.getLastUpdatedSeqNum());
+ allUpdates = updateForwarder.getAllUpdatesFrom(8);
+ Assert.assertEquals(1, allUpdates.size());
+ Assert.assertEquals("g", allUpdates.get(0).getStuff());
+ }
+
+ @Test
+ public void testGetUpdatesAfterExternalEntityReset() throws Exception {
+ DummyImageRetreiver imageRetreiver = new DummyImageRetreiver();
+ imageRetreiver.setState("a,b,c");
+ UpdateForwarder<DummyUpdate> updateForwarder = new UpdateForwarder<DummyUpdate>(
+ new DummyUpdatable(), imageRetreiver, 5);
+ updateForwarder.handleUpdateNotification(new DummyUpdate(5, false).setStuff("d"));
+ while(!updateForwarder.areAllUpdatesCommited()) {
+ Thread.sleep(100);
+ }
+
+ updateForwarder.handleUpdateNotification(new DummyUpdate(6, false).setStuff("e"));
+ updateForwarder.handleUpdateNotification(new DummyUpdate(7, false).setStuff("f"));
+
+ while(!updateForwarder.areAllUpdatesCommited()) {
+ Thread.sleep(100);
+ }
+ Assert.assertEquals(7, updateForwarder.getLastUpdatedSeqNum());
+ List<DummyUpdate> allUpdates = updateForwarder.getAllUpdatesFrom(0);
+ Assert.assertEquals(4, allUpdates.size());
+ Assert.assertEquals("f", allUpdates.get(3).getStuff());
+ Assert.assertEquals(7, allUpdates.get(3).getSeqNum());
+
+ updateForwarder.handleUpdateNotification(new DummyUpdate(8, false).setStuff("g"));
+ while(!updateForwarder.areAllUpdatesCommited()) {
+ Thread.sleep(100);
+ }
+ Assert.assertEquals(8, updateForwarder.getLastUpdatedSeqNum());
+ allUpdates = updateForwarder.getAllUpdatesFrom(8);
+ Assert.assertEquals(1, allUpdates.size());
+ Assert.assertEquals("g", allUpdates.get(0).getStuff());
+
+ imageRetreiver.setState("a,b,c,d,e,f,g,h");
+
+ // New update comes with SeqNum = 1
+ updateForwarder.handleUpdateNotification(new DummyUpdate(1, false).setStuff("h"));
+ while(!updateForwarder.areAllUpdatesCommited()) {
+ Thread.sleep(100);
+ }
+ // NN plugin asks for next update
+ allUpdates = updateForwarder.getAllUpdatesFrom(9);
+ Assert.assertEquals(1, allUpdates.size());
+ Assert.assertEquals("a,b,c,d,e,f,g,h", allUpdates.get(0).getStuff());
+ Assert.assertEquals(1, allUpdates.get(0).getSeqNum());
+ }
+
+ @Test
+ public void testUpdateLogCompression() throws Exception {
+ DummyImageRetreiver imageRetreiver = new DummyImageRetreiver();
+ imageRetreiver.setState("a,b,c");
+ UpdateForwarder<DummyUpdate> updateForwarder = new UpdateForwarder<DummyUpdate>(
+ new DummyUpdatable(), imageRetreiver, 5);
+ updateForwarder.handleUpdateNotification(new DummyUpdate(5, false).setStuff("d"));
+ while(!updateForwarder.areAllUpdatesCommited()) {
+ Thread.sleep(100);
+ }
+ Assert.assertEquals(5, updateForwarder.getLastUpdatedSeqNum());
+ List<DummyUpdate> allUpdates = updateForwarder.getAllUpdatesFrom(0);
+ Assert.assertEquals(2, allUpdates.size());
+
+ updateForwarder.handleUpdateNotification(new DummyUpdate(6, false).setStuff("e"));
+ updateForwarder.handleUpdateNotification(new DummyUpdate(7, false).setStuff("f"));
+ updateForwarder.handleUpdateNotification(new DummyUpdate(8, false).setStuff("g"));
+ updateForwarder.handleUpdateNotification(new DummyUpdate(9, false).setStuff("h"));
+ updateForwarder.handleUpdateNotification(new DummyUpdate(10, false).setStuff("i"));
+ updateForwarder.handleUpdateNotification(new DummyUpdate(11, false).setStuff("j"));
+
+ while(!updateForwarder.areAllUpdatesCommited()) {
+ Thread.sleep(100);
+ }
+ Assert.assertEquals(11, updateForwarder.getLastUpdatedSeqNum());
+ allUpdates = updateForwarder.getAllUpdatesFrom(0);
+ Assert.assertEquals(3, allUpdates.size());
+ Assert.assertEquals("a,b,c,d,e,f,g,h", allUpdates.get(0).getStuff());
+ Assert.assertEquals(9, allUpdates.get(0).getSeqNum());
+ Assert.assertEquals("i", allUpdates.get(1).getStuff());
+ Assert.assertEquals(10, allUpdates.get(1).getSeqNum());
+ Assert.assertEquals("j", allUpdates.get(2).getStuff());
+ Assert.assertEquals(11, allUpdates.get(2).getSeqNum());
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryPolicyStoreProcessor.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryPolicyStoreProcessor.java b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryPolicyStoreProcessor.java
index 46f8fb8..14207de 100644
--- a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryPolicyStoreProcessor.java
+++ b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryPolicyStoreProcessor.java
@@ -21,6 +21,7 @@ import junit.framework.Assert;
import org.apache.hadoop.conf.Configuration;
import org.apache.sentry.provider.db.service.thrift.PolicyStoreConstants.PolicyStoreServerConfig;
+import org.apache.sentry.service.thrift.ServiceConstants.ServerConfig;
import org.junit.Before;
import org.junit.Test;
@@ -31,6 +32,7 @@ public class TestSentryPolicyStoreProcessor {
@Before
public void setup() {
conf = new Configuration(false);
+ conf.setBoolean(ServerConfig.SENTRY_HDFS_INTEGRATION_ENABLE, true);
}
@Test(expected=SentryConfigurationException.class)
public void testConfigNotNotificationHandler() throws Exception {
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServerWithoutKerberos.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServerWithoutKerberos.java b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServerWithoutKerberos.java
index e5238a6..b3ad2c9 100644
--- a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServerWithoutKerberos.java
+++ b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServerWithoutKerberos.java
@@ -18,18 +18,27 @@
package org.apache.sentry.provider.db.service.thrift;
import static junit.framework.Assert.assertEquals;
-import static org.junit.Assert.assertEquals;
+import java.io.IOException;
import java.util.HashSet;
+import java.util.List;
import java.util.Set;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReadWriteLock;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
import junit.framework.Assert;
+import org.apache.hadoop.fs.permission.AclEntry;
import org.apache.sentry.core.common.ActiveRoleSet;
import org.apache.sentry.core.model.db.AccessConstants;
import org.apache.sentry.core.model.db.Database;
import org.apache.sentry.core.model.db.Server;
import org.apache.sentry.core.model.db.Table;
+import org.apache.sentry.hdfs.PermissionsUpdate;
+import org.apache.sentry.hdfs.SentryServiceClient;
+import org.apache.sentry.hdfs.SentryServiceClient.SentryAuthzUpdate;
+import org.apache.sentry.hdfs.UpdateableAuthzPermissions;
import org.apache.sentry.service.thrift.SentryServiceIntegrationBase;
import org.junit.Test;
@@ -38,6 +47,30 @@ import com.google.common.collect.Sets;
public class TestSentryServerWithoutKerberos extends SentryServiceIntegrationBase {
+ public class SentryAdapter {
+
+ private SentryServiceClient sentryClient;
+ private UpdateableAuthzPermissions perms;
+ private final ReadWriteLock lock = new ReentrantReadWriteLock();
+
+ public SentryAdapter(UpdateableAuthzPermissions perms, SentryPolicyServiceClient sentryClient) throws Exception {
+ this.perms = perms;
+ this.sentryClient = new SentryServiceClient(conf);
+ }
+
+ public void pullUpdates() throws IOException {
+ SentryAuthzUpdate sentryUpdates = sentryClient.getAllUpdatesFrom(
+ perms.getLastUpdatedSeqNum() + 1, 0);
+ for (PermissionsUpdate update : sentryUpdates.getPermUpdates()) {
+ if (update.hasFullImage()) {
+ perms = perms.updateFull(update);
+ }
+ perms.updatePartial(Lists.newArrayList(update), lock);
+ }
+ }
+
+ }
+
@Override
public void beforeSetup() throws Exception {
this.kerberos = false;
@@ -61,6 +94,8 @@ public class TestSentryServerWithoutKerberos extends SentryServiceIntegrationBas
Set<String> requestorUserGroupNames = Sets.newHashSet(ADMIN_GROUP);
setLocalGroupMapping(requestorUserName, requestorUserGroupNames);
writePolicyFile();
+
+ UpdateableAuthzPermissions authzPerms = new UpdateableAuthzPermissions();
String roleName1 = "admin_r1";
String roleName2 = "admin_r2";
@@ -77,6 +112,12 @@ public class TestSentryServerWithoutKerberos extends SentryServiceIntegrationBas
client.grantTablePrivilege(requestorUserName, roleName1, "server", "db2", "table3", "ALL");
client.grantTablePrivilege(requestorUserName, roleName1, "server", "db2", "table4", "ALL");
+ SentryAdapter adapter = new SentryAdapter(authzPerms, client);
+ adapter.pullUpdates();
+// waitToCommit(authzPerms);
+
+ List<AclEntry> sentryAcls = authzPerms.getAcls("db1.table1");
+ System.out.println("1 : " + sentryAcls);
client.dropRoleIfExists(requestorUserName, roleName2);
client.createRole(requestorUserName, roleName2);
@@ -89,6 +130,12 @@ public class TestSentryServerWithoutKerberos extends SentryServiceIntegrationBas
client.grantTablePrivilege(requestorUserName, roleName2, "server", "db2", "table4", "ALL");
client.grantTablePrivilege(requestorUserName, roleName2, "server", "db3", "table5", "ALL");
+ adapter.pullUpdates();
+// waitToCommit(authzPermCache);
+ sentryAcls = authzPerms.getAcls("db1.table1");
+ System.out.println("2 : " + sentryAcls);
+
+
Set<TSentryPrivilege> listPrivilegesByRoleName = client.listPrivilegesByRoleName(requestorUserName, roleName2, Lists.newArrayList(new Server("server"), new Database("db1")));
assertEquals("Privilege not assigned to role2 !!", 2, listPrivilegesByRoleName.size());
@@ -162,4 +209,15 @@ public class TestSentryServerWithoutKerberos extends SentryServiceIntegrationBas
assertEquals(0, client.listPrivilegesForProvider(requestorUserGroupNames,
ActiveRoleSet.ALL).size());
}
+
+// private void waitToCommit(Update hmsCache) throws InterruptedException {
+// int counter = 0;
+// while(!hmsCache.areAllUpdatesCommited()) {
+// Thread.sleep(200);
+// counter++;
+// if (counter > 10000) {
+// fail("Updates taking too long to commit !!");
+// }
+// }
+// }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-service-client/pom.xml
----------------------------------------------------------------------
diff --git a/sentry-service-client/pom.xml b/sentry-service-client/pom.xml
new file mode 100644
index 0000000..9c158aa
--- /dev/null
+++ b/sentry-service-client/pom.xml
@@ -0,0 +1,164 @@
+<?xml version="1.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.
+-->
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.sentry</groupId>
+ <artifactId>sentry</artifactId>
+ <version>1.5.0-incubating-SNAPSHOT</version>
+ <relativePath>..</relativePath>
+ </parent>
+
+ <artifactId>sentry-service-client</artifactId>
+ <name>Sentry Thrift client</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.shiro</groupId>
+ <artifactId>shiro-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.thrift</groupId>
+ <artifactId>libfb303</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.thrift</groupId>
+ <artifactId>libthrift</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>ant-contrib</groupId>
+ <artifactId>ant-contrib</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-all</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <sourceDirectory>${basedir}/src/main/java</sourceDirectory>
+ <testSourceDirectory>${basedir}/src/test/java</testSourceDirectory>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>add-source</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>add-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>src/gen/thrift/gen-javabean</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ <profiles>
+ <profile>
+ <id>thriftif</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>generate-thrift-sources</id>
+ <phase>generate-sources</phase>
+ <configuration>
+ <target>
+ <taskdef name="for" classname="net.sf.antcontrib.logic.ForTask"
+ classpathref="maven.plugin.classpath" />
+ <property name="thrift.args" value="-I ${thrift.home} --gen java:beans,hashcode"/>
+ <property name="thrift.gen.dir" value="${basedir}/src/gen/thrift"/>
+ <delete dir="${thrift.gen.dir}"/>
+ <mkdir dir="${thrift.gen.dir}"/>
+ <for param="thrift.file">
+ <path>
+ <fileset dir="${basedir}/src/main/resources/" includes="**/*.thrift" />
+ </path>
+ <sequential>
+ <echo message="Generating Thrift code for @{thrift.file}"/>
+ <exec executable="${thrift.home}/bin/thrift" failonerror="true" dir=".">
+ <arg line="${thrift.args} -I ${basedir}/src/main/resources/ -o ${thrift.gen.dir} @{thrift.file} " />
+ </exec>
+ </sequential>
+ </for>
+ </target>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-enforcer-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>enforce-property</id>
+ <goals>
+ <goal>enforce</goal>
+ </goals>
+ <configuration>
+ <rules>
+ <requireProperty>
+ <property>thrift.home</property>
+ </requireProperty>
+ </rules>
+ <fail>true</fail>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+</project>
[18/25] SENTRY-432. HDFS ingration. Initial patch
Posted by pr...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TDropSentryRoleRequest.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TDropSentryRoleRequest.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TDropSentryRoleRequest.java
deleted file mode 100644
index e2971ec..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TDropSentryRoleRequest.java
+++ /dev/null
@@ -1,587 +0,0 @@
-/**
- * Autogenerated by Thrift Compiler (0.9.0)
- *
- * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
- * @generated
- */
-package org.apache.sentry.provider.db.service.thrift;
-
-import org.apache.commons.lang.builder.HashCodeBuilder;
-import org.apache.thrift.scheme.IScheme;
-import org.apache.thrift.scheme.SchemeFactory;
-import org.apache.thrift.scheme.StandardScheme;
-
-import org.apache.thrift.scheme.TupleScheme;
-import org.apache.thrift.protocol.TTupleProtocol;
-import org.apache.thrift.protocol.TProtocolException;
-import org.apache.thrift.EncodingUtils;
-import org.apache.thrift.TException;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.EnumMap;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.EnumSet;
-import java.util.Collections;
-import java.util.BitSet;
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class TDropSentryRoleRequest implements org.apache.thrift.TBase<TDropSentryRoleRequest, TDropSentryRoleRequest._Fields>, java.io.Serializable, Cloneable {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TDropSentryRoleRequest");
-
- private static final org.apache.thrift.protocol.TField PROTOCOL_VERSION_FIELD_DESC = new org.apache.thrift.protocol.TField("protocol_version", org.apache.thrift.protocol.TType.I32, (short)1);
- private static final org.apache.thrift.protocol.TField REQUESTOR_USER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("requestorUserName", org.apache.thrift.protocol.TType.STRING, (short)2);
- private static final org.apache.thrift.protocol.TField ROLE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("roleName", 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 TDropSentryRoleRequestStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TDropSentryRoleRequestTupleSchemeFactory());
- }
-
- private int protocol_version; // required
- private String requestorUserName; // required
- private String roleName; // required
-
- /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
- public enum _Fields implements org.apache.thrift.TFieldIdEnum {
- PROTOCOL_VERSION((short)1, "protocol_version"),
- REQUESTOR_USER_NAME((short)2, "requestorUserName"),
- ROLE_NAME((short)3, "roleName");
-
- private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
-
- static {
- for (_Fields field : EnumSet.allOf(_Fields.class)) {
- byName.put(field.getFieldName(), field);
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, or null if its not found.
- */
- public static _Fields findByThriftId(int fieldId) {
- switch(fieldId) {
- case 1: // PROTOCOL_VERSION
- return PROTOCOL_VERSION;
- case 2: // REQUESTOR_USER_NAME
- return REQUESTOR_USER_NAME;
- case 3: // ROLE_NAME
- return ROLE_NAME;
- default:
- return null;
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, throwing an exception
- * if it is not found.
- */
- public static _Fields findByThriftIdOrThrow(int fieldId) {
- _Fields fields = findByThriftId(fieldId);
- if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
- return fields;
- }
-
- /**
- * Find the _Fields constant that matches name, or null if its not found.
- */
- public static _Fields findByName(String name) {
- return byName.get(name);
- }
-
- private final short _thriftId;
- private final String _fieldName;
-
- _Fields(short thriftId, String fieldName) {
- _thriftId = thriftId;
- _fieldName = fieldName;
- }
-
- public short getThriftFieldId() {
- return _thriftId;
- }
-
- public String getFieldName() {
- return _fieldName;
- }
- }
-
- // isset id assignments
- private static final int __PROTOCOL_VERSION_ISSET_ID = 0;
- private byte __isset_bitfield = 0;
- public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
- static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
- tmpMap.put(_Fields.PROTOCOL_VERSION, new org.apache.thrift.meta_data.FieldMetaData("protocol_version", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
- tmpMap.put(_Fields.REQUESTOR_USER_NAME, new org.apache.thrift.meta_data.FieldMetaData("requestorUserName", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.ROLE_NAME, new org.apache.thrift.meta_data.FieldMetaData("roleName", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TDropSentryRoleRequest.class, metaDataMap);
- }
-
- public TDropSentryRoleRequest() {
- this.protocol_version = 1;
-
- }
-
- public TDropSentryRoleRequest(
- int protocol_version,
- String requestorUserName,
- String roleName)
- {
- this();
- this.protocol_version = protocol_version;
- setProtocol_versionIsSet(true);
- this.requestorUserName = requestorUserName;
- this.roleName = roleName;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TDropSentryRoleRequest(TDropSentryRoleRequest other) {
- __isset_bitfield = other.__isset_bitfield;
- this.protocol_version = other.protocol_version;
- if (other.isSetRequestorUserName()) {
- this.requestorUserName = other.requestorUserName;
- }
- if (other.isSetRoleName()) {
- this.roleName = other.roleName;
- }
- }
-
- public TDropSentryRoleRequest deepCopy() {
- return new TDropSentryRoleRequest(this);
- }
-
- @Override
- public void clear() {
- this.protocol_version = 1;
-
- this.requestorUserName = null;
- this.roleName = null;
- }
-
- public int getProtocol_version() {
- return this.protocol_version;
- }
-
- public void setProtocol_version(int protocol_version) {
- this.protocol_version = protocol_version;
- setProtocol_versionIsSet(true);
- }
-
- public void unsetProtocol_version() {
- __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __PROTOCOL_VERSION_ISSET_ID);
- }
-
- /** Returns true if field protocol_version is set (has been assigned a value) and false otherwise */
- public boolean isSetProtocol_version() {
- return EncodingUtils.testBit(__isset_bitfield, __PROTOCOL_VERSION_ISSET_ID);
- }
-
- public void setProtocol_versionIsSet(boolean value) {
- __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __PROTOCOL_VERSION_ISSET_ID, value);
- }
-
- public String getRequestorUserName() {
- return this.requestorUserName;
- }
-
- public void setRequestorUserName(String requestorUserName) {
- this.requestorUserName = requestorUserName;
- }
-
- public void unsetRequestorUserName() {
- this.requestorUserName = null;
- }
-
- /** Returns true if field requestorUserName is set (has been assigned a value) and false otherwise */
- public boolean isSetRequestorUserName() {
- return this.requestorUserName != null;
- }
-
- public void setRequestorUserNameIsSet(boolean value) {
- if (!value) {
- this.requestorUserName = null;
- }
- }
-
- public String getRoleName() {
- return this.roleName;
- }
-
- public void setRoleName(String roleName) {
- this.roleName = roleName;
- }
-
- public void unsetRoleName() {
- this.roleName = null;
- }
-
- /** Returns true if field roleName is set (has been assigned a value) and false otherwise */
- public boolean isSetRoleName() {
- return this.roleName != null;
- }
-
- public void setRoleNameIsSet(boolean value) {
- if (!value) {
- this.roleName = null;
- }
- }
-
- public void setFieldValue(_Fields field, Object value) {
- switch (field) {
- case PROTOCOL_VERSION:
- if (value == null) {
- unsetProtocol_version();
- } else {
- setProtocol_version((Integer)value);
- }
- break;
-
- case REQUESTOR_USER_NAME:
- if (value == null) {
- unsetRequestorUserName();
- } else {
- setRequestorUserName((String)value);
- }
- break;
-
- case ROLE_NAME:
- if (value == null) {
- unsetRoleName();
- } else {
- setRoleName((String)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case PROTOCOL_VERSION:
- return Integer.valueOf(getProtocol_version());
-
- case REQUESTOR_USER_NAME:
- return getRequestorUserName();
-
- case ROLE_NAME:
- return getRoleName();
-
- }
- throw new IllegalStateException();
- }
-
- /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
- public boolean isSet(_Fields field) {
- if (field == null) {
- throw new IllegalArgumentException();
- }
-
- switch (field) {
- case PROTOCOL_VERSION:
- return isSetProtocol_version();
- case REQUESTOR_USER_NAME:
- return isSetRequestorUserName();
- case ROLE_NAME:
- return isSetRoleName();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TDropSentryRoleRequest)
- return this.equals((TDropSentryRoleRequest)that);
- return false;
- }
-
- public boolean equals(TDropSentryRoleRequest that) {
- if (that == null)
- return false;
-
- boolean this_present_protocol_version = true;
- boolean that_present_protocol_version = true;
- if (this_present_protocol_version || that_present_protocol_version) {
- if (!(this_present_protocol_version && that_present_protocol_version))
- return false;
- if (this.protocol_version != that.protocol_version)
- return false;
- }
-
- boolean this_present_requestorUserName = true && this.isSetRequestorUserName();
- boolean that_present_requestorUserName = true && that.isSetRequestorUserName();
- if (this_present_requestorUserName || that_present_requestorUserName) {
- if (!(this_present_requestorUserName && that_present_requestorUserName))
- return false;
- if (!this.requestorUserName.equals(that.requestorUserName))
- return false;
- }
-
- boolean this_present_roleName = true && this.isSetRoleName();
- boolean that_present_roleName = true && that.isSetRoleName();
- if (this_present_roleName || that_present_roleName) {
- if (!(this_present_roleName && that_present_roleName))
- return false;
- if (!this.roleName.equals(that.roleName))
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode() {
- HashCodeBuilder builder = new HashCodeBuilder();
-
- boolean present_protocol_version = true;
- builder.append(present_protocol_version);
- if (present_protocol_version)
- builder.append(protocol_version);
-
- boolean present_requestorUserName = true && (isSetRequestorUserName());
- builder.append(present_requestorUserName);
- if (present_requestorUserName)
- builder.append(requestorUserName);
-
- boolean present_roleName = true && (isSetRoleName());
- builder.append(present_roleName);
- if (present_roleName)
- builder.append(roleName);
-
- return builder.toHashCode();
- }
-
- public int compareTo(TDropSentryRoleRequest other) {
- if (!getClass().equals(other.getClass())) {
- return getClass().getName().compareTo(other.getClass().getName());
- }
-
- int lastComparison = 0;
- TDropSentryRoleRequest typedOther = (TDropSentryRoleRequest)other;
-
- lastComparison = Boolean.valueOf(isSetProtocol_version()).compareTo(typedOther.isSetProtocol_version());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetProtocol_version()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.protocol_version, typedOther.protocol_version);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetRequestorUserName()).compareTo(typedOther.isSetRequestorUserName());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetRequestorUserName()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.requestorUserName, typedOther.requestorUserName);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetRoleName()).compareTo(typedOther.isSetRoleName());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetRoleName()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.roleName, typedOther.roleName);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- return 0;
- }
-
- public _Fields fieldForId(int fieldId) {
- return _Fields.findByThriftId(fieldId);
- }
-
- public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
- schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
- }
-
- public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
- schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
- }
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder("TDropSentryRoleRequest(");
- boolean first = true;
-
- sb.append("protocol_version:");
- sb.append(this.protocol_version);
- first = false;
- if (!first) sb.append(", ");
- sb.append("requestorUserName:");
- if (this.requestorUserName == null) {
- sb.append("null");
- } else {
- sb.append(this.requestorUserName);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("roleName:");
- if (this.roleName == null) {
- sb.append("null");
- } else {
- sb.append(this.roleName);
- }
- first = false;
- sb.append(")");
- return sb.toString();
- }
-
- public void validate() throws org.apache.thrift.TException {
- // check for required fields
- if (!isSetProtocol_version()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'protocol_version' is unset! Struct:" + toString());
- }
-
- if (!isSetRequestorUserName()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'requestorUserName' is unset! Struct:" + toString());
- }
-
- if (!isSetRoleName()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'roleName' is unset! Struct:" + toString());
- }
-
- // check for sub-struct validity
- }
-
- private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
- try {
- write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
- try {
- // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
- __isset_bitfield = 0;
- read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private static class TDropSentryRoleRequestStandardSchemeFactory implements SchemeFactory {
- public TDropSentryRoleRequestStandardScheme getScheme() {
- return new TDropSentryRoleRequestStandardScheme();
- }
- }
-
- private static class TDropSentryRoleRequestStandardScheme extends StandardScheme<TDropSentryRoleRequest> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TDropSentryRoleRequest struct) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TField schemeField;
- iprot.readStructBegin();
- while (true)
- {
- schemeField = iprot.readFieldBegin();
- if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
- break;
- }
- switch (schemeField.id) {
- case 1: // PROTOCOL_VERSION
- if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
- struct.protocol_version = iprot.readI32();
- struct.setProtocol_versionIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 2: // REQUESTOR_USER_NAME
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.requestorUserName = iprot.readString();
- struct.setRequestorUserNameIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 3: // ROLE_NAME
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.roleName = iprot.readString();
- struct.setRoleNameIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- default:
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- iprot.readFieldEnd();
- }
- iprot.readStructEnd();
- struct.validate();
- }
-
- public void write(org.apache.thrift.protocol.TProtocol oprot, TDropSentryRoleRequest struct) throws org.apache.thrift.TException {
- struct.validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- oprot.writeFieldBegin(PROTOCOL_VERSION_FIELD_DESC);
- oprot.writeI32(struct.protocol_version);
- oprot.writeFieldEnd();
- if (struct.requestorUserName != null) {
- oprot.writeFieldBegin(REQUESTOR_USER_NAME_FIELD_DESC);
- oprot.writeString(struct.requestorUserName);
- oprot.writeFieldEnd();
- }
- if (struct.roleName != null) {
- oprot.writeFieldBegin(ROLE_NAME_FIELD_DESC);
- oprot.writeString(struct.roleName);
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TDropSentryRoleRequestTupleSchemeFactory implements SchemeFactory {
- public TDropSentryRoleRequestTupleScheme getScheme() {
- return new TDropSentryRoleRequestTupleScheme();
- }
- }
-
- private static class TDropSentryRoleRequestTupleScheme extends TupleScheme<TDropSentryRoleRequest> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, TDropSentryRoleRequest struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- oprot.writeI32(struct.protocol_version);
- oprot.writeString(struct.requestorUserName);
- oprot.writeString(struct.roleName);
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TDropSentryRoleRequest struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- struct.protocol_version = iprot.readI32();
- struct.setProtocol_versionIsSet(true);
- struct.requestorUserName = iprot.readString();
- struct.setRequestorUserNameIsSet(true);
- struct.roleName = iprot.readString();
- struct.setRoleNameIsSet(true);
- }
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TDropSentryRoleResponse.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TDropSentryRoleResponse.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TDropSentryRoleResponse.java
deleted file mode 100644
index efcf96d..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TDropSentryRoleResponse.java
+++ /dev/null
@@ -1,390 +0,0 @@
-/**
- * Autogenerated by Thrift Compiler (0.9.0)
- *
- * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
- * @generated
- */
-package org.apache.sentry.provider.db.service.thrift;
-
-import org.apache.commons.lang.builder.HashCodeBuilder;
-import org.apache.thrift.scheme.IScheme;
-import org.apache.thrift.scheme.SchemeFactory;
-import org.apache.thrift.scheme.StandardScheme;
-
-import org.apache.thrift.scheme.TupleScheme;
-import org.apache.thrift.protocol.TTupleProtocol;
-import org.apache.thrift.protocol.TProtocolException;
-import org.apache.thrift.EncodingUtils;
-import org.apache.thrift.TException;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.EnumMap;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.EnumSet;
-import java.util.Collections;
-import java.util.BitSet;
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class TDropSentryRoleResponse implements org.apache.thrift.TBase<TDropSentryRoleResponse, TDropSentryRoleResponse._Fields>, java.io.Serializable, Cloneable {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TDropSentryRoleResponse");
-
- private static final org.apache.thrift.protocol.TField STATUS_FIELD_DESC = new org.apache.thrift.protocol.TField("status", org.apache.thrift.protocol.TType.STRUCT, (short)1);
-
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TDropSentryRoleResponseStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TDropSentryRoleResponseTupleSchemeFactory());
- }
-
- private org.apache.sentry.service.thrift.TSentryResponseStatus status; // required
-
- /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
- public enum _Fields implements org.apache.thrift.TFieldIdEnum {
- STATUS((short)1, "status");
-
- private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
-
- static {
- for (_Fields field : EnumSet.allOf(_Fields.class)) {
- byName.put(field.getFieldName(), field);
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, or null if its not found.
- */
- public static _Fields findByThriftId(int fieldId) {
- switch(fieldId) {
- case 1: // STATUS
- return STATUS;
- default:
- return null;
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, throwing an exception
- * if it is not found.
- */
- public static _Fields findByThriftIdOrThrow(int fieldId) {
- _Fields fields = findByThriftId(fieldId);
- if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
- return fields;
- }
-
- /**
- * Find the _Fields constant that matches name, or null if its not found.
- */
- public static _Fields findByName(String name) {
- return byName.get(name);
- }
-
- private final short _thriftId;
- private final String _fieldName;
-
- _Fields(short thriftId, String fieldName) {
- _thriftId = thriftId;
- _fieldName = fieldName;
- }
-
- public short getThriftFieldId() {
- return _thriftId;
- }
-
- public String getFieldName() {
- return _fieldName;
- }
- }
-
- // isset id assignments
- public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
- static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
- tmpMap.put(_Fields.STATUS, new org.apache.thrift.meta_data.FieldMetaData("status", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.sentry.service.thrift.TSentryResponseStatus.class)));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TDropSentryRoleResponse.class, metaDataMap);
- }
-
- public TDropSentryRoleResponse() {
- }
-
- public TDropSentryRoleResponse(
- org.apache.sentry.service.thrift.TSentryResponseStatus status)
- {
- this();
- this.status = status;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TDropSentryRoleResponse(TDropSentryRoleResponse other) {
- if (other.isSetStatus()) {
- this.status = new org.apache.sentry.service.thrift.TSentryResponseStatus(other.status);
- }
- }
-
- public TDropSentryRoleResponse deepCopy() {
- return new TDropSentryRoleResponse(this);
- }
-
- @Override
- public void clear() {
- this.status = null;
- }
-
- public org.apache.sentry.service.thrift.TSentryResponseStatus getStatus() {
- return this.status;
- }
-
- public void setStatus(org.apache.sentry.service.thrift.TSentryResponseStatus status) {
- this.status = status;
- }
-
- public void unsetStatus() {
- this.status = null;
- }
-
- /** Returns true if field status is set (has been assigned a value) and false otherwise */
- public boolean isSetStatus() {
- return this.status != null;
- }
-
- public void setStatusIsSet(boolean value) {
- if (!value) {
- this.status = null;
- }
- }
-
- public void setFieldValue(_Fields field, Object value) {
- switch (field) {
- case STATUS:
- if (value == null) {
- unsetStatus();
- } else {
- setStatus((org.apache.sentry.service.thrift.TSentryResponseStatus)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case STATUS:
- return getStatus();
-
- }
- throw new IllegalStateException();
- }
-
- /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
- public boolean isSet(_Fields field) {
- if (field == null) {
- throw new IllegalArgumentException();
- }
-
- switch (field) {
- case STATUS:
- return isSetStatus();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TDropSentryRoleResponse)
- return this.equals((TDropSentryRoleResponse)that);
- return false;
- }
-
- public boolean equals(TDropSentryRoleResponse that) {
- if (that == null)
- return false;
-
- boolean this_present_status = true && this.isSetStatus();
- boolean that_present_status = true && that.isSetStatus();
- if (this_present_status || that_present_status) {
- if (!(this_present_status && that_present_status))
- return false;
- if (!this.status.equals(that.status))
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode() {
- HashCodeBuilder builder = new HashCodeBuilder();
-
- boolean present_status = true && (isSetStatus());
- builder.append(present_status);
- if (present_status)
- builder.append(status);
-
- return builder.toHashCode();
- }
-
- public int compareTo(TDropSentryRoleResponse other) {
- if (!getClass().equals(other.getClass())) {
- return getClass().getName().compareTo(other.getClass().getName());
- }
-
- int lastComparison = 0;
- TDropSentryRoleResponse typedOther = (TDropSentryRoleResponse)other;
-
- lastComparison = Boolean.valueOf(isSetStatus()).compareTo(typedOther.isSetStatus());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetStatus()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.status, typedOther.status);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- 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("TDropSentryRoleResponse(");
- boolean first = true;
-
- sb.append("status:");
- if (this.status == null) {
- sb.append("null");
- } else {
- sb.append(this.status);
- }
- first = false;
- sb.append(")");
- return sb.toString();
- }
-
- public void validate() throws org.apache.thrift.TException {
- // check for required fields
- if (!isSetStatus()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'status' is unset! Struct:" + toString());
- }
-
- // check for sub-struct validity
- if (status != null) {
- status.validate();
- }
- }
-
- private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
- try {
- write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
- try {
- read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private static class TDropSentryRoleResponseStandardSchemeFactory implements SchemeFactory {
- public TDropSentryRoleResponseStandardScheme getScheme() {
- return new TDropSentryRoleResponseStandardScheme();
- }
- }
-
- private static class TDropSentryRoleResponseStandardScheme extends StandardScheme<TDropSentryRoleResponse> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TDropSentryRoleResponse struct) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TField schemeField;
- iprot.readStructBegin();
- while (true)
- {
- schemeField = iprot.readFieldBegin();
- if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
- break;
- }
- switch (schemeField.id) {
- case 1: // STATUS
- if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
- struct.status = new org.apache.sentry.service.thrift.TSentryResponseStatus();
- struct.status.read(iprot);
- struct.setStatusIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- 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, TDropSentryRoleResponse struct) throws org.apache.thrift.TException {
- struct.validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- if (struct.status != null) {
- oprot.writeFieldBegin(STATUS_FIELD_DESC);
- struct.status.write(oprot);
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TDropSentryRoleResponseTupleSchemeFactory implements SchemeFactory {
- public TDropSentryRoleResponseTupleScheme getScheme() {
- return new TDropSentryRoleResponseTupleScheme();
- }
- }
-
- private static class TDropSentryRoleResponseTupleScheme extends TupleScheme<TDropSentryRoleResponse> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, TDropSentryRoleResponse struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- struct.status.write(oprot);
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TDropSentryRoleResponse struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- struct.status = new org.apache.sentry.service.thrift.TSentryResponseStatus();
- struct.status.read(iprot);
- struct.setStatusIsSet(true);
- }
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryPrivilegesForProviderRequest.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryPrivilegesForProviderRequest.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryPrivilegesForProviderRequest.java
deleted file mode 100644
index 10ab56b..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryPrivilegesForProviderRequest.java
+++ /dev/null
@@ -1,759 +0,0 @@
-/**
- * Autogenerated by Thrift Compiler (0.9.0)
- *
- * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
- * @generated
- */
-package org.apache.sentry.provider.db.service.thrift;
-
-import org.apache.commons.lang.builder.HashCodeBuilder;
-import org.apache.thrift.scheme.IScheme;
-import org.apache.thrift.scheme.SchemeFactory;
-import org.apache.thrift.scheme.StandardScheme;
-
-import org.apache.thrift.scheme.TupleScheme;
-import org.apache.thrift.protocol.TTupleProtocol;
-import org.apache.thrift.protocol.TProtocolException;
-import org.apache.thrift.EncodingUtils;
-import org.apache.thrift.TException;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.EnumMap;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.EnumSet;
-import java.util.Collections;
-import java.util.BitSet;
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class TListSentryPrivilegesForProviderRequest implements org.apache.thrift.TBase<TListSentryPrivilegesForProviderRequest, TListSentryPrivilegesForProviderRequest._Fields>, java.io.Serializable, Cloneable {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TListSentryPrivilegesForProviderRequest");
-
- private static final org.apache.thrift.protocol.TField PROTOCOL_VERSION_FIELD_DESC = new org.apache.thrift.protocol.TField("protocol_version", org.apache.thrift.protocol.TType.I32, (short)1);
- private static final org.apache.thrift.protocol.TField 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 ROLE_SET_FIELD_DESC = new org.apache.thrift.protocol.TField("roleSet", org.apache.thrift.protocol.TType.STRUCT, (short)3);
- private static final org.apache.thrift.protocol.TField AUTHORIZABLE_HIERARCHY_FIELD_DESC = new org.apache.thrift.protocol.TField("authorizableHierarchy", org.apache.thrift.protocol.TType.STRUCT, (short)4);
-
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TListSentryPrivilegesForProviderRequestStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TListSentryPrivilegesForProviderRequestTupleSchemeFactory());
- }
-
- private int protocol_version; // required
- private Set<String> groups; // required
- private TSentryActiveRoleSet roleSet; // required
- private TSentryAuthorizable authorizableHierarchy; // optional
-
- /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
- public enum _Fields implements org.apache.thrift.TFieldIdEnum {
- PROTOCOL_VERSION((short)1, "protocol_version"),
- GROUPS((short)2, "groups"),
- ROLE_SET((short)3, "roleSet"),
- AUTHORIZABLE_HIERARCHY((short)4, "authorizableHierarchy");
-
- private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
-
- static {
- for (_Fields field : EnumSet.allOf(_Fields.class)) {
- byName.put(field.getFieldName(), field);
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, or null if its not found.
- */
- public static _Fields findByThriftId(int fieldId) {
- switch(fieldId) {
- case 1: // PROTOCOL_VERSION
- return PROTOCOL_VERSION;
- case 2: // GROUPS
- return GROUPS;
- case 3: // ROLE_SET
- return ROLE_SET;
- case 4: // AUTHORIZABLE_HIERARCHY
- return AUTHORIZABLE_HIERARCHY;
- default:
- return null;
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, throwing an exception
- * if it is not found.
- */
- public static _Fields findByThriftIdOrThrow(int fieldId) {
- _Fields fields = findByThriftId(fieldId);
- if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
- return fields;
- }
-
- /**
- * Find the _Fields constant that matches name, or null if its not found.
- */
- public static _Fields findByName(String name) {
- return byName.get(name);
- }
-
- private final short _thriftId;
- private final String _fieldName;
-
- _Fields(short thriftId, String fieldName) {
- _thriftId = thriftId;
- _fieldName = fieldName;
- }
-
- public short getThriftFieldId() {
- return _thriftId;
- }
-
- public String getFieldName() {
- return _fieldName;
- }
- }
-
- // isset id assignments
- private static final int __PROTOCOL_VERSION_ISSET_ID = 0;
- private byte __isset_bitfield = 0;
- private _Fields optionals[] = {_Fields.AUTHORIZABLE_HIERARCHY};
- public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
- static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
- tmpMap.put(_Fields.PROTOCOL_VERSION, new org.apache.thrift.meta_data.FieldMetaData("protocol_version", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
- tmpMap.put(_Fields.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.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
- tmpMap.put(_Fields.ROLE_SET, new org.apache.thrift.meta_data.FieldMetaData("roleSet", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TSentryActiveRoleSet.class)));
- tmpMap.put(_Fields.AUTHORIZABLE_HIERARCHY, new org.apache.thrift.meta_data.FieldMetaData("authorizableHierarchy", org.apache.thrift.TFieldRequirementType.OPTIONAL,
- new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TSentryAuthorizable.class)));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TListSentryPrivilegesForProviderRequest.class, metaDataMap);
- }
-
- public TListSentryPrivilegesForProviderRequest() {
- this.protocol_version = 1;
-
- }
-
- public TListSentryPrivilegesForProviderRequest(
- int protocol_version,
- Set<String> groups,
- TSentryActiveRoleSet roleSet)
- {
- this();
- this.protocol_version = protocol_version;
- setProtocol_versionIsSet(true);
- this.groups = groups;
- this.roleSet = roleSet;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TListSentryPrivilegesForProviderRequest(TListSentryPrivilegesForProviderRequest other) {
- __isset_bitfield = other.__isset_bitfield;
- this.protocol_version = other.protocol_version;
- if (other.isSetGroups()) {
- Set<String> __this__groups = new HashSet<String>();
- for (String other_element : other.groups) {
- __this__groups.add(other_element);
- }
- this.groups = __this__groups;
- }
- if (other.isSetRoleSet()) {
- this.roleSet = new TSentryActiveRoleSet(other.roleSet);
- }
- if (other.isSetAuthorizableHierarchy()) {
- this.authorizableHierarchy = new TSentryAuthorizable(other.authorizableHierarchy);
- }
- }
-
- public TListSentryPrivilegesForProviderRequest deepCopy() {
- return new TListSentryPrivilegesForProviderRequest(this);
- }
-
- @Override
- public void clear() {
- this.protocol_version = 1;
-
- this.groups = null;
- this.roleSet = null;
- this.authorizableHierarchy = null;
- }
-
- public int getProtocol_version() {
- return this.protocol_version;
- }
-
- public void setProtocol_version(int protocol_version) {
- this.protocol_version = protocol_version;
- setProtocol_versionIsSet(true);
- }
-
- public void unsetProtocol_version() {
- __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __PROTOCOL_VERSION_ISSET_ID);
- }
-
- /** Returns true if field protocol_version is set (has been assigned a value) and false otherwise */
- public boolean isSetProtocol_version() {
- return EncodingUtils.testBit(__isset_bitfield, __PROTOCOL_VERSION_ISSET_ID);
- }
-
- public void setProtocol_versionIsSet(boolean value) {
- __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __PROTOCOL_VERSION_ISSET_ID, value);
- }
-
- public int getGroupsSize() {
- return (this.groups == null) ? 0 : this.groups.size();
- }
-
- public java.util.Iterator<String> getGroupsIterator() {
- return (this.groups == null) ? null : this.groups.iterator();
- }
-
- public void addToGroups(String elem) {
- if (this.groups == null) {
- this.groups = new HashSet<String>();
- }
- this.groups.add(elem);
- }
-
- public Set<String> getGroups() {
- return this.groups;
- }
-
- public void setGroups(Set<String> 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 TSentryActiveRoleSet getRoleSet() {
- return this.roleSet;
- }
-
- public void setRoleSet(TSentryActiveRoleSet roleSet) {
- this.roleSet = roleSet;
- }
-
- public void unsetRoleSet() {
- this.roleSet = null;
- }
-
- /** Returns true if field roleSet is set (has been assigned a value) and false otherwise */
- public boolean isSetRoleSet() {
- return this.roleSet != null;
- }
-
- public void setRoleSetIsSet(boolean value) {
- if (!value) {
- this.roleSet = null;
- }
- }
-
- public TSentryAuthorizable getAuthorizableHierarchy() {
- return this.authorizableHierarchy;
- }
-
- public void setAuthorizableHierarchy(TSentryAuthorizable authorizableHierarchy) {
- this.authorizableHierarchy = authorizableHierarchy;
- }
-
- public void unsetAuthorizableHierarchy() {
- this.authorizableHierarchy = null;
- }
-
- /** Returns true if field authorizableHierarchy is set (has been assigned a value) and false otherwise */
- public boolean isSetAuthorizableHierarchy() {
- return this.authorizableHierarchy != null;
- }
-
- public void setAuthorizableHierarchyIsSet(boolean value) {
- if (!value) {
- this.authorizableHierarchy = null;
- }
- }
-
- public void setFieldValue(_Fields field, Object value) {
- switch (field) {
- case PROTOCOL_VERSION:
- if (value == null) {
- unsetProtocol_version();
- } else {
- setProtocol_version((Integer)value);
- }
- break;
-
- case GROUPS:
- if (value == null) {
- unsetGroups();
- } else {
- setGroups((Set<String>)value);
- }
- break;
-
- case ROLE_SET:
- if (value == null) {
- unsetRoleSet();
- } else {
- setRoleSet((TSentryActiveRoleSet)value);
- }
- break;
-
- case AUTHORIZABLE_HIERARCHY:
- if (value == null) {
- unsetAuthorizableHierarchy();
- } else {
- setAuthorizableHierarchy((TSentryAuthorizable)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case PROTOCOL_VERSION:
- return Integer.valueOf(getProtocol_version());
-
- case GROUPS:
- return getGroups();
-
- case ROLE_SET:
- return getRoleSet();
-
- case AUTHORIZABLE_HIERARCHY:
- return getAuthorizableHierarchy();
-
- }
- throw new IllegalStateException();
- }
-
- /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
- public boolean isSet(_Fields field) {
- if (field == null) {
- throw new IllegalArgumentException();
- }
-
- switch (field) {
- case PROTOCOL_VERSION:
- return isSetProtocol_version();
- case GROUPS:
- return isSetGroups();
- case ROLE_SET:
- return isSetRoleSet();
- case AUTHORIZABLE_HIERARCHY:
- return isSetAuthorizableHierarchy();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TListSentryPrivilegesForProviderRequest)
- return this.equals((TListSentryPrivilegesForProviderRequest)that);
- return false;
- }
-
- public boolean equals(TListSentryPrivilegesForProviderRequest that) {
- if (that == null)
- return false;
-
- boolean this_present_protocol_version = true;
- boolean that_present_protocol_version = true;
- if (this_present_protocol_version || that_present_protocol_version) {
- if (!(this_present_protocol_version && that_present_protocol_version))
- return false;
- if (this.protocol_version != that.protocol_version)
- return false;
- }
-
- boolean this_present_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_roleSet = true && this.isSetRoleSet();
- boolean that_present_roleSet = true && that.isSetRoleSet();
- if (this_present_roleSet || that_present_roleSet) {
- if (!(this_present_roleSet && that_present_roleSet))
- return false;
- if (!this.roleSet.equals(that.roleSet))
- return false;
- }
-
- boolean this_present_authorizableHierarchy = true && this.isSetAuthorizableHierarchy();
- boolean that_present_authorizableHierarchy = true && that.isSetAuthorizableHierarchy();
- if (this_present_authorizableHierarchy || that_present_authorizableHierarchy) {
- if (!(this_present_authorizableHierarchy && that_present_authorizableHierarchy))
- return false;
- if (!this.authorizableHierarchy.equals(that.authorizableHierarchy))
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode() {
- HashCodeBuilder builder = new HashCodeBuilder();
-
- boolean present_protocol_version = true;
- builder.append(present_protocol_version);
- if (present_protocol_version)
- builder.append(protocol_version);
-
- boolean present_groups = true && (isSetGroups());
- builder.append(present_groups);
- if (present_groups)
- builder.append(groups);
-
- boolean present_roleSet = true && (isSetRoleSet());
- builder.append(present_roleSet);
- if (present_roleSet)
- builder.append(roleSet);
-
- boolean present_authorizableHierarchy = true && (isSetAuthorizableHierarchy());
- builder.append(present_authorizableHierarchy);
- if (present_authorizableHierarchy)
- builder.append(authorizableHierarchy);
-
- return builder.toHashCode();
- }
-
- public int compareTo(TListSentryPrivilegesForProviderRequest other) {
- if (!getClass().equals(other.getClass())) {
- return getClass().getName().compareTo(other.getClass().getName());
- }
-
- int lastComparison = 0;
- TListSentryPrivilegesForProviderRequest typedOther = (TListSentryPrivilegesForProviderRequest)other;
-
- lastComparison = Boolean.valueOf(isSetProtocol_version()).compareTo(typedOther.isSetProtocol_version());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetProtocol_version()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.protocol_version, typedOther.protocol_version);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetGroups()).compareTo(typedOther.isSetGroups());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetGroups()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.groups, typedOther.groups);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetRoleSet()).compareTo(typedOther.isSetRoleSet());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetRoleSet()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.roleSet, typedOther.roleSet);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetAuthorizableHierarchy()).compareTo(typedOther.isSetAuthorizableHierarchy());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetAuthorizableHierarchy()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.authorizableHierarchy, typedOther.authorizableHierarchy);
- 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("TListSentryPrivilegesForProviderRequest(");
- boolean first = true;
-
- sb.append("protocol_version:");
- sb.append(this.protocol_version);
- 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("roleSet:");
- if (this.roleSet == null) {
- sb.append("null");
- } else {
- sb.append(this.roleSet);
- }
- first = false;
- if (isSetAuthorizableHierarchy()) {
- if (!first) sb.append(", ");
- sb.append("authorizableHierarchy:");
- if (this.authorizableHierarchy == null) {
- sb.append("null");
- } else {
- sb.append(this.authorizableHierarchy);
- }
- first = false;
- }
- sb.append(")");
- return sb.toString();
- }
-
- public void validate() throws org.apache.thrift.TException {
- // check for required fields
- if (!isSetProtocol_version()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'protocol_version' is unset! Struct:" + toString());
- }
-
- if (!isSetGroups()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'groups' is unset! Struct:" + toString());
- }
-
- if (!isSetRoleSet()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'roleSet' is unset! Struct:" + toString());
- }
-
- // check for sub-struct validity
- if (roleSet != null) {
- roleSet.validate();
- }
- if (authorizableHierarchy != null) {
- authorizableHierarchy.validate();
- }
- }
-
- private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
- try {
- write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
- try {
- // 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 TListSentryPrivilegesForProviderRequestStandardSchemeFactory implements SchemeFactory {
- public TListSentryPrivilegesForProviderRequestStandardScheme getScheme() {
- return new TListSentryPrivilegesForProviderRequestStandardScheme();
- }
- }
-
- private static class TListSentryPrivilegesForProviderRequestStandardScheme extends StandardScheme<TListSentryPrivilegesForProviderRequest> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TListSentryPrivilegesForProviderRequest struct) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TField schemeField;
- iprot.readStructBegin();
- while (true)
- {
- schemeField = iprot.readFieldBegin();
- if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
- break;
- }
- switch (schemeField.id) {
- case 1: // PROTOCOL_VERSION
- if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
- struct.protocol_version = iprot.readI32();
- struct.setProtocol_versionIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 2: // GROUPS
- if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
- {
- org.apache.thrift.protocol.TSet _set48 = iprot.readSetBegin();
- struct.groups = new HashSet<String>(2*_set48.size);
- for (int _i49 = 0; _i49 < _set48.size; ++_i49)
- {
- String _elem50; // required
- _elem50 = iprot.readString();
- struct.groups.add(_elem50);
- }
- iprot.readSetEnd();
- }
- struct.setGroupsIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 3: // ROLE_SET
- if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
- struct.roleSet = new TSentryActiveRoleSet();
- struct.roleSet.read(iprot);
- struct.setRoleSetIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 4: // AUTHORIZABLE_HIERARCHY
- if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
- struct.authorizableHierarchy = new TSentryAuthorizable();
- struct.authorizableHierarchy.read(iprot);
- struct.setAuthorizableHierarchyIsSet(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, TListSentryPrivilegesForProviderRequest struct) throws org.apache.thrift.TException {
- struct.validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- oprot.writeFieldBegin(PROTOCOL_VERSION_FIELD_DESC);
- oprot.writeI32(struct.protocol_version);
- oprot.writeFieldEnd();
- if (struct.groups != null) {
- oprot.writeFieldBegin(GROUPS_FIELD_DESC);
- {
- oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, struct.groups.size()));
- for (String _iter51 : struct.groups)
- {
- oprot.writeString(_iter51);
- }
- oprot.writeSetEnd();
- }
- oprot.writeFieldEnd();
- }
- if (struct.roleSet != null) {
- oprot.writeFieldBegin(ROLE_SET_FIELD_DESC);
- struct.roleSet.write(oprot);
- oprot.writeFieldEnd();
- }
- if (struct.authorizableHierarchy != null) {
- if (struct.isSetAuthorizableHierarchy()) {
- oprot.writeFieldBegin(AUTHORIZABLE_HIERARCHY_FIELD_DESC);
- struct.authorizableHierarchy.write(oprot);
- oprot.writeFieldEnd();
- }
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TListSentryPrivilegesForProviderRequestTupleSchemeFactory implements SchemeFactory {
- public TListSentryPrivilegesForProviderRequestTupleScheme getScheme() {
- return new TListSentryPrivilegesForProviderRequestTupleScheme();
- }
- }
-
- private static class TListSentryPrivilegesForProviderRequestTupleScheme extends TupleScheme<TListSentryPrivilegesForProviderRequest> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, TListSentryPrivilegesForProviderRequest struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- oprot.writeI32(struct.protocol_version);
- {
- oprot.writeI32(struct.groups.size());
- for (String _iter52 : struct.groups)
- {
- oprot.writeString(_iter52);
- }
- }
- struct.roleSet.write(oprot);
- BitSet optionals = new BitSet();
- if (struct.isSetAuthorizableHierarchy()) {
- optionals.set(0);
- }
- oprot.writeBitSet(optionals, 1);
- if (struct.isSetAuthorizableHierarchy()) {
- struct.authorizableHierarchy.write(oprot);
- }
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TListSentryPrivilegesForProviderRequest struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- struct.protocol_version = iprot.readI32();
- struct.setProtocol_versionIsSet(true);
- {
- org.apache.thrift.protocol.TSet _set53 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
- struct.groups = new HashSet<String>(2*_set53.size);
- for (int _i54 = 0; _i54 < _set53.size; ++_i54)
- {
- String _elem55; // required
- _elem55 = iprot.readString();
- struct.groups.add(_elem55);
- }
- }
- struct.setGroupsIsSet(true);
- struct.roleSet = new TSentryActiveRoleSet();
- struct.roleSet.read(iprot);
- struct.setRoleSetIsSet(true);
- BitSet incoming = iprot.readBitSet(1);
- if (incoming.get(0)) {
- struct.authorizableHierarchy = new TSentryAuthorizable();
- struct.authorizableHierarchy.read(iprot);
- struct.setAuthorizableHierarchyIsSet(true);
- }
- }
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryPrivilegesForProviderResponse.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryPrivilegesForProviderResponse.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryPrivilegesForProviderResponse.java
deleted file mode 100644
index 4c571c2..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryPrivilegesForProviderResponse.java
+++ /dev/null
@@ -1,543 +0,0 @@
-/**
- * Autogenerated by Thrift Compiler (0.9.0)
- *
- * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
- * @generated
- */
-package org.apache.sentry.provider.db.service.thrift;
-
-import org.apache.commons.lang.builder.HashCodeBuilder;
-import org.apache.thrift.scheme.IScheme;
-import org.apache.thrift.scheme.SchemeFactory;
-import org.apache.thrift.scheme.StandardScheme;
-
-import org.apache.thrift.scheme.TupleScheme;
-import org.apache.thrift.protocol.TTupleProtocol;
-import org.apache.thrift.protocol.TProtocolException;
-import org.apache.thrift.EncodingUtils;
-import org.apache.thrift.TException;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.EnumMap;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.EnumSet;
-import java.util.Collections;
-import java.util.BitSet;
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class TListSentryPrivilegesForProviderResponse implements org.apache.thrift.TBase<TListSentryPrivilegesForProviderResponse, TListSentryPrivilegesForProviderResponse._Fields>, java.io.Serializable, Cloneable {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TListSentryPrivilegesForProviderResponse");
-
- private static final org.apache.thrift.protocol.TField STATUS_FIELD_DESC = new org.apache.thrift.protocol.TField("status", org.apache.thrift.protocol.TType.STRUCT, (short)1);
- private static final org.apache.thrift.protocol.TField PRIVILEGES_FIELD_DESC = new org.apache.thrift.protocol.TField("privileges", org.apache.thrift.protocol.TType.SET, (short)2);
-
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TListSentryPrivilegesForProviderResponseStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TListSentryPrivilegesForProviderResponseTupleSchemeFactory());
- }
-
- private org.apache.sentry.service.thrift.TSentryResponseStatus status; // required
- private Set<String> privileges; // required
-
- /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
- public enum _Fields implements org.apache.thrift.TFieldIdEnum {
- STATUS((short)1, "status"),
- PRIVILEGES((short)2, "privileges");
-
- private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
-
- static {
- for (_Fields field : EnumSet.allOf(_Fields.class)) {
- byName.put(field.getFieldName(), field);
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, or null if its not found.
- */
- public static _Fields findByThriftId(int fieldId) {
- switch(fieldId) {
- case 1: // STATUS
- return STATUS;
- case 2: // PRIVILEGES
- return PRIVILEGES;
- default:
- return null;
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, throwing an exception
- * if it is not found.
- */
- public static _Fields findByThriftIdOrThrow(int fieldId) {
- _Fields fields = findByThriftId(fieldId);
- if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
- return fields;
- }
-
- /**
- * Find the _Fields constant that matches name, or null if its not found.
- */
- public static _Fields findByName(String name) {
- return byName.get(name);
- }
-
- private final short _thriftId;
- private final String _fieldName;
-
- _Fields(short thriftId, String fieldName) {
- _thriftId = thriftId;
- _fieldName = fieldName;
- }
-
- public short getThriftFieldId() {
- return _thriftId;
- }
-
- public String getFieldName() {
- return _fieldName;
- }
- }
-
- // isset id assignments
- public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
- static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
- tmpMap.put(_Fields.STATUS, new org.apache.thrift.meta_data.FieldMetaData("status", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.sentry.service.thrift.TSentryResponseStatus.class)));
- tmpMap.put(_Fields.PRIVILEGES, new org.apache.thrift.meta_data.FieldMetaData("privileges", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TListSentryPrivilegesForProviderResponse.class, metaDataMap);
- }
-
- public TListSentryPrivilegesForProviderResponse() {
- }
-
- public TListSentryPrivilegesForProviderResponse(
- org.apache.sentry.service.thrift.TSentryResponseStatus status,
- Set<String> privileges)
- {
- this();
- this.status = status;
- this.privileges = privileges;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TListSentryPrivilegesForProviderResponse(TListSentryPrivilegesForProviderResponse other) {
- if (other.isSetStatus()) {
- this.status = new org.apache.sentry.service.thrift.TSentryResponseStatus(other.status);
- }
- if (other.isSetPrivileges()) {
- Set<String> __this__privileges = new HashSet<String>();
- for (String other_element : other.privileges) {
- __this__privileges.add(other_element);
- }
- this.privileges = __this__privileges;
- }
- }
-
- public TListSentryPrivilegesForProviderResponse deepCopy() {
- return new TListSentryPrivilegesForProviderResponse(this);
- }
-
- @Override
- public void clear() {
- this.status = null;
- this.privileges = null;
- }
-
- public org.apache.sentry.service.thrift.TSentryResponseStatus getStatus() {
- return this.status;
- }
-
- public void setStatus(org.apache.sentry.service.thrift.TSentryResponseStatus status) {
- this.status = status;
- }
-
- public void unsetStatus() {
- this.status = null;
- }
-
- /** Returns true if field status is set (has been assigned a value) and false otherwise */
- public boolean isSetStatus() {
- return this.status != null;
- }
-
- public void setStatusIsSet(boolean value) {
- if (!value) {
- this.status = null;
- }
- }
-
- public int getPrivilegesSize() {
- return (this.privileges == null) ? 0 : this.privileges.size();
- }
-
- public java.util.Iterator<String> getPrivilegesIterator() {
- return (this.privileges == null) ? null : this.privileges.iterator();
- }
-
- public void addToPrivileges(String elem) {
- if (this.privileges == null) {
- this.privileges = new HashSet<String>();
- }
- this.privileges.add(elem);
- }
-
- public Set<String> getPrivileges() {
- return this.privileges;
- }
-
- public void setPrivileges(Set<String> privileges) {
- this.privileges = privileges;
- }
-
- public void unsetPrivileges() {
- this.privileges = null;
- }
-
- /** Returns true if field privileges is set (has been assigned a value) and false otherwise */
- public boolean isSetPrivileges() {
- return this.privileges != null;
- }
-
- public void setPrivilegesIsSet(boolean value) {
- if (!value) {
- this.privileges = null;
- }
- }
-
- public void setFieldValue(_Fields field, Object value) {
- switch (field) {
- case STATUS:
- if (value == null) {
- unsetStatus();
- } else {
- setStatus((org.apache.sentry.service.thrift.TSentryResponseStatus)value);
- }
- break;
-
- case PRIVILEGES:
- if (value == null) {
- unsetPrivileges();
- } else {
- setPrivileges((Set<String>)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case STATUS:
- return getStatus();
-
- case PRIVILEGES:
- return getPrivileges();
-
- }
- throw new IllegalStateException();
- }
-
- /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
- public boolean isSet(_Fields field) {
- if (field == null) {
- throw new IllegalArgumentException();
- }
-
- switch (field) {
- case STATUS:
- return isSetStatus();
- case PRIVILEGES:
- return isSetPrivileges();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TListSentryPrivilegesForProviderResponse)
- return this.equals((TListSentryPrivilegesForProviderResponse)that);
- return false;
- }
-
- public boolean equals(TListSentryPrivilegesForProviderResponse that) {
- if (that == null)
- return false;
-
- boolean this_present_status = true && this.isSetStatus();
- boolean that_present_status = true && that.isSetStatus();
- if (this_present_status || that_present_status) {
- if (!(this_present_status && that_present_status))
- return false;
- if (!this.status.equals(that.status))
- return false;
- }
-
- boolean this_present_privileges = true && this.isSetPrivileges();
- boolean that_present_privileges = true && that.isSetPrivileges();
- if (this_present_privileges || that_present_privileges) {
- if (!(this_present_privileges && that_present_privileges))
- return false;
- if (!this.privileges.equals(that.privileges))
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode() {
- HashCodeBuilder builder = new HashCodeBuilder();
-
- boolean present_status = true && (isSetStatus());
- builder.append(present_status);
- if (present_status)
- builder.append(status);
-
- boolean present_privileges = true && (isSetPrivileges());
- builder.append(present_privileges);
- if (present_privileges)
- builder.append(privileges);
-
- return builder.toHashCode();
- }
-
- public int compareTo(TListSentryPrivilegesForProviderResponse other) {
- if (!getClass().equals(other.getClass())) {
- return getClass().getName().compareTo(other.getClass().getName());
- }
-
- int lastComparison = 0;
- TListSentryPrivilegesForProviderResponse typedOther = (TListSentryPrivilegesForProviderResponse)other;
-
- lastComparison = Boolean.valueOf(isSetStatus()).compareTo(typedOther.isSetStatus());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetStatus()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.status, typedOther.status);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetPrivileges()).compareTo(typedOther.isSetPrivileges());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetPrivileges()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.privileges, typedOther.privileges);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- return 0;
- }
-
- public _Fields fieldForId(int fieldId) {
- return _Fields.findByThriftId(fieldId);
- }
-
- public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
- schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
- }
-
- public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
- schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
- }
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder("TListSentryPrivilegesForProviderResponse(");
- boolean first = true;
-
- sb.append("status:");
- if (this.status == null) {
- sb.append("null");
- } else {
- sb.append(this.status);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("privileges:");
- if (this.privileges == null) {
- sb.append("null");
- } else {
- sb.append(this.privileges);
- }
- first = false;
- sb.append(")");
- return sb.toString();
- }
-
- public void validate() throws org.apache.thrift.TException {
- // check for required fields
- if (!isSetStatus()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'status' is unset! Struct:" + toString());
- }
-
- if (!isSetPrivileges()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'privileges' is unset! Struct:" + toString());
- }
-
- // check for sub-struct validity
- if (status != null) {
- status.validate();
- }
- }
-
- private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
- try {
- write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
- try {
- read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private static class TListSentryPrivilegesForProviderResponseStandardSchemeFactory implements SchemeFactory {
- public TListSentryPrivilegesForProviderResponseStandardScheme getScheme() {
- return new TListSentryPrivilegesForProviderResponseStandardScheme();
- }
- }
-
- private static class TListSentryPrivilegesForProviderResponseStandardScheme extends StandardScheme<TListSentryPrivilegesForProviderResponse> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TListSentryPrivilegesForProviderResponse struct) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TField schemeField;
- iprot.readStructBegin();
- while (true)
- {
- schemeField = iprot.readFieldBegin();
- if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
- break;
- }
- switch (schemeField.id) {
- case 1: // STATUS
- if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
- struct.status = new org.apache.sentry.service.thrift.TSentryResponseStatus();
- struct.status.read(iprot);
- struct.setStatusIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 2: // PRIVILEGES
- if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
- {
- org.apache.thrift.protocol.TSet _set56 = iprot.readSetBegin();
- struct.privileges = new HashSet<String>(2*_set56.size);
- for (int _i57 = 0; _i57 < _set56.size; ++_i57)
- {
- String _elem58; // required
- _elem58 = iprot.readString();
- struct.privileges.add(_elem58);
- }
- iprot.readSetEnd();
- }
- struct.setPrivilegesIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- default:
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- iprot.readFieldEnd();
- }
- iprot.readStructEnd();
- struct.validate();
- }
-
- public void write(org.apache.thrift.protocol.TProtocol oprot, TListSentryPrivilegesForProviderResponse struct) throws org.apache.thrift.TException {
- struct.validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- if (struct.status != null) {
- oprot.writeFieldBegin(STATUS_FIELD_DESC);
- struct.status.write(oprot);
- oprot.writeFieldEnd();
- }
- if (struct.privileges != null) {
- oprot.writeFieldBegin(PRIVILEGES_FIELD_DESC);
- {
- oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, struct.privileges.size()));
- for (String _iter59 : struct.privileges)
- {
- oprot.writeString(_iter59);
- }
- oprot.writeSetEnd();
- }
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TListSentryPrivilegesForProviderResponseTupleSchemeFactory implements SchemeFactory {
- public TListSentryPrivilegesForProviderResponseTupleScheme getScheme() {
- return new TListSentryPrivilegesForProviderResponseTupleScheme();
- }
- }
-
- private static class TListSentryPrivilegesForProviderResponseTupleScheme extends TupleScheme<TListSentryPrivilegesForProviderResponse> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, TListSentryPrivilegesForProviderResponse struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- struct.status.write(oprot);
- {
- oprot.writeI32(struct.privileges.size());
- for (String _iter60 : struct.privileges)
- {
- oprot.writeString(_iter60);
- }
- }
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TListSentryPrivilegesForProviderResponse struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- struct.status = new org.apache.sentry.service.thrift.TSentryResponseStatus();
- struct.status.read(iprot);
- struct.setStatusIsSet(true);
- {
- org.apache.thrift.protocol.TSet _set61 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
- struct.privileges = new HashSet<String>(2*_set61.size);
- for (int _i62 = 0; _i62 < _set61.size; ++_i62)
- {
- String _elem63; // required
- _elem63 = iprot.readString();
- struct.privileges.add(_elem63);
- }
- }
- struct.setPrivilegesIsSet(true);
- }
- }
-
-}
-
[17/25] SENTRY-432. HDFS ingration. Initial patch
Posted by pr...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryPrivilegesRequest.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryPrivilegesRequest.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryPrivilegesRequest.java
deleted file mode 100644
index 393ff91..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryPrivilegesRequest.java
+++ /dev/null
@@ -1,702 +0,0 @@
-/**
- * Autogenerated by Thrift Compiler (0.9.0)
- *
- * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
- * @generated
- */
-package org.apache.sentry.provider.db.service.thrift;
-
-import org.apache.commons.lang.builder.HashCodeBuilder;
-import org.apache.thrift.scheme.IScheme;
-import org.apache.thrift.scheme.SchemeFactory;
-import org.apache.thrift.scheme.StandardScheme;
-
-import org.apache.thrift.scheme.TupleScheme;
-import org.apache.thrift.protocol.TTupleProtocol;
-import org.apache.thrift.protocol.TProtocolException;
-import org.apache.thrift.EncodingUtils;
-import org.apache.thrift.TException;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.EnumMap;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.EnumSet;
-import java.util.Collections;
-import java.util.BitSet;
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class TListSentryPrivilegesRequest implements org.apache.thrift.TBase<TListSentryPrivilegesRequest, TListSentryPrivilegesRequest._Fields>, java.io.Serializable, Cloneable {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TListSentryPrivilegesRequest");
-
- private static final org.apache.thrift.protocol.TField PROTOCOL_VERSION_FIELD_DESC = new org.apache.thrift.protocol.TField("protocol_version", org.apache.thrift.protocol.TType.I32, (short)1);
- private static final org.apache.thrift.protocol.TField REQUESTOR_USER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("requestorUserName", org.apache.thrift.protocol.TType.STRING, (short)2);
- private static final org.apache.thrift.protocol.TField ROLE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("roleName", org.apache.thrift.protocol.TType.STRING, (short)4);
- private static final org.apache.thrift.protocol.TField AUTHORIZABLE_HIERARCHY_FIELD_DESC = new org.apache.thrift.protocol.TField("authorizableHierarchy", org.apache.thrift.protocol.TType.STRUCT, (short)5);
-
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TListSentryPrivilegesRequestStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TListSentryPrivilegesRequestTupleSchemeFactory());
- }
-
- private int protocol_version; // required
- private String requestorUserName; // required
- private String roleName; // required
- private TSentryAuthorizable authorizableHierarchy; // optional
-
- /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
- public enum _Fields implements org.apache.thrift.TFieldIdEnum {
- PROTOCOL_VERSION((short)1, "protocol_version"),
- REQUESTOR_USER_NAME((short)2, "requestorUserName"),
- ROLE_NAME((short)4, "roleName"),
- AUTHORIZABLE_HIERARCHY((short)5, "authorizableHierarchy");
-
- private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
-
- static {
- for (_Fields field : EnumSet.allOf(_Fields.class)) {
- byName.put(field.getFieldName(), field);
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, or null if its not found.
- */
- public static _Fields findByThriftId(int fieldId) {
- switch(fieldId) {
- case 1: // PROTOCOL_VERSION
- return PROTOCOL_VERSION;
- case 2: // REQUESTOR_USER_NAME
- return REQUESTOR_USER_NAME;
- case 4: // ROLE_NAME
- return ROLE_NAME;
- case 5: // AUTHORIZABLE_HIERARCHY
- return AUTHORIZABLE_HIERARCHY;
- default:
- return null;
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, throwing an exception
- * if it is not found.
- */
- public static _Fields findByThriftIdOrThrow(int fieldId) {
- _Fields fields = findByThriftId(fieldId);
- if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
- return fields;
- }
-
- /**
- * Find the _Fields constant that matches name, or null if its not found.
- */
- public static _Fields findByName(String name) {
- return byName.get(name);
- }
-
- private final short _thriftId;
- private final String _fieldName;
-
- _Fields(short thriftId, String fieldName) {
- _thriftId = thriftId;
- _fieldName = fieldName;
- }
-
- public short getThriftFieldId() {
- return _thriftId;
- }
-
- public String getFieldName() {
- return _fieldName;
- }
- }
-
- // isset id assignments
- private static final int __PROTOCOL_VERSION_ISSET_ID = 0;
- private byte __isset_bitfield = 0;
- private _Fields optionals[] = {_Fields.AUTHORIZABLE_HIERARCHY};
- public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
- static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
- tmpMap.put(_Fields.PROTOCOL_VERSION, new org.apache.thrift.meta_data.FieldMetaData("protocol_version", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
- tmpMap.put(_Fields.REQUESTOR_USER_NAME, new org.apache.thrift.meta_data.FieldMetaData("requestorUserName", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.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.AUTHORIZABLE_HIERARCHY, new org.apache.thrift.meta_data.FieldMetaData("authorizableHierarchy", org.apache.thrift.TFieldRequirementType.OPTIONAL,
- new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TSentryAuthorizable.class)));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TListSentryPrivilegesRequest.class, metaDataMap);
- }
-
- public TListSentryPrivilegesRequest() {
- this.protocol_version = 1;
-
- }
-
- public TListSentryPrivilegesRequest(
- int protocol_version,
- String requestorUserName,
- String roleName)
- {
- this();
- this.protocol_version = protocol_version;
- setProtocol_versionIsSet(true);
- this.requestorUserName = requestorUserName;
- this.roleName = roleName;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TListSentryPrivilegesRequest(TListSentryPrivilegesRequest other) {
- __isset_bitfield = other.__isset_bitfield;
- this.protocol_version = other.protocol_version;
- if (other.isSetRequestorUserName()) {
- this.requestorUserName = other.requestorUserName;
- }
- if (other.isSetRoleName()) {
- this.roleName = other.roleName;
- }
- if (other.isSetAuthorizableHierarchy()) {
- this.authorizableHierarchy = new TSentryAuthorizable(other.authorizableHierarchy);
- }
- }
-
- public TListSentryPrivilegesRequest deepCopy() {
- return new TListSentryPrivilegesRequest(this);
- }
-
- @Override
- public void clear() {
- this.protocol_version = 1;
-
- this.requestorUserName = null;
- this.roleName = null;
- this.authorizableHierarchy = null;
- }
-
- public int getProtocol_version() {
- return this.protocol_version;
- }
-
- public void setProtocol_version(int protocol_version) {
- this.protocol_version = protocol_version;
- setProtocol_versionIsSet(true);
- }
-
- public void unsetProtocol_version() {
- __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __PROTOCOL_VERSION_ISSET_ID);
- }
-
- /** Returns true if field protocol_version is set (has been assigned a value) and false otherwise */
- public boolean isSetProtocol_version() {
- return EncodingUtils.testBit(__isset_bitfield, __PROTOCOL_VERSION_ISSET_ID);
- }
-
- public void setProtocol_versionIsSet(boolean value) {
- __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __PROTOCOL_VERSION_ISSET_ID, value);
- }
-
- public String getRequestorUserName() {
- return this.requestorUserName;
- }
-
- public void setRequestorUserName(String requestorUserName) {
- this.requestorUserName = requestorUserName;
- }
-
- public void unsetRequestorUserName() {
- this.requestorUserName = null;
- }
-
- /** Returns true if field requestorUserName is set (has been assigned a value) and false otherwise */
- public boolean isSetRequestorUserName() {
- return this.requestorUserName != null;
- }
-
- public void setRequestorUserNameIsSet(boolean value) {
- if (!value) {
- this.requestorUserName = null;
- }
- }
-
- public 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 TSentryAuthorizable getAuthorizableHierarchy() {
- return this.authorizableHierarchy;
- }
-
- public void setAuthorizableHierarchy(TSentryAuthorizable authorizableHierarchy) {
- this.authorizableHierarchy = authorizableHierarchy;
- }
-
- public void unsetAuthorizableHierarchy() {
- this.authorizableHierarchy = null;
- }
-
- /** Returns true if field authorizableHierarchy is set (has been assigned a value) and false otherwise */
- public boolean isSetAuthorizableHierarchy() {
- return this.authorizableHierarchy != null;
- }
-
- public void setAuthorizableHierarchyIsSet(boolean value) {
- if (!value) {
- this.authorizableHierarchy = null;
- }
- }
-
- public void setFieldValue(_Fields field, Object value) {
- switch (field) {
- case PROTOCOL_VERSION:
- if (value == null) {
- unsetProtocol_version();
- } else {
- setProtocol_version((Integer)value);
- }
- break;
-
- case REQUESTOR_USER_NAME:
- if (value == null) {
- unsetRequestorUserName();
- } else {
- setRequestorUserName((String)value);
- }
- break;
-
- case ROLE_NAME:
- if (value == null) {
- unsetRoleName();
- } else {
- setRoleName((String)value);
- }
- break;
-
- case AUTHORIZABLE_HIERARCHY:
- if (value == null) {
- unsetAuthorizableHierarchy();
- } else {
- setAuthorizableHierarchy((TSentryAuthorizable)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case PROTOCOL_VERSION:
- return Integer.valueOf(getProtocol_version());
-
- case REQUESTOR_USER_NAME:
- return getRequestorUserName();
-
- case ROLE_NAME:
- return getRoleName();
-
- case AUTHORIZABLE_HIERARCHY:
- return getAuthorizableHierarchy();
-
- }
- throw new IllegalStateException();
- }
-
- /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
- public boolean isSet(_Fields field) {
- if (field == null) {
- throw new IllegalArgumentException();
- }
-
- switch (field) {
- case PROTOCOL_VERSION:
- return isSetProtocol_version();
- case REQUESTOR_USER_NAME:
- return isSetRequestorUserName();
- case ROLE_NAME:
- return isSetRoleName();
- case AUTHORIZABLE_HIERARCHY:
- return isSetAuthorizableHierarchy();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TListSentryPrivilegesRequest)
- return this.equals((TListSentryPrivilegesRequest)that);
- return false;
- }
-
- public boolean equals(TListSentryPrivilegesRequest that) {
- if (that == null)
- return false;
-
- boolean this_present_protocol_version = true;
- boolean that_present_protocol_version = true;
- if (this_present_protocol_version || that_present_protocol_version) {
- if (!(this_present_protocol_version && that_present_protocol_version))
- return false;
- if (this.protocol_version != that.protocol_version)
- return false;
- }
-
- boolean this_present_requestorUserName = true && this.isSetRequestorUserName();
- boolean that_present_requestorUserName = true && that.isSetRequestorUserName();
- if (this_present_requestorUserName || that_present_requestorUserName) {
- if (!(this_present_requestorUserName && that_present_requestorUserName))
- return false;
- if (!this.requestorUserName.equals(that.requestorUserName))
- return false;
- }
-
- boolean this_present_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_authorizableHierarchy = true && this.isSetAuthorizableHierarchy();
- boolean that_present_authorizableHierarchy = true && that.isSetAuthorizableHierarchy();
- if (this_present_authorizableHierarchy || that_present_authorizableHierarchy) {
- if (!(this_present_authorizableHierarchy && that_present_authorizableHierarchy))
- return false;
- if (!this.authorizableHierarchy.equals(that.authorizableHierarchy))
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode() {
- HashCodeBuilder builder = new HashCodeBuilder();
-
- boolean present_protocol_version = true;
- builder.append(present_protocol_version);
- if (present_protocol_version)
- builder.append(protocol_version);
-
- boolean present_requestorUserName = true && (isSetRequestorUserName());
- builder.append(present_requestorUserName);
- if (present_requestorUserName)
- builder.append(requestorUserName);
-
- boolean present_roleName = true && (isSetRoleName());
- builder.append(present_roleName);
- if (present_roleName)
- builder.append(roleName);
-
- boolean present_authorizableHierarchy = true && (isSetAuthorizableHierarchy());
- builder.append(present_authorizableHierarchy);
- if (present_authorizableHierarchy)
- builder.append(authorizableHierarchy);
-
- return builder.toHashCode();
- }
-
- public int compareTo(TListSentryPrivilegesRequest other) {
- if (!getClass().equals(other.getClass())) {
- return getClass().getName().compareTo(other.getClass().getName());
- }
-
- int lastComparison = 0;
- TListSentryPrivilegesRequest typedOther = (TListSentryPrivilegesRequest)other;
-
- lastComparison = Boolean.valueOf(isSetProtocol_version()).compareTo(typedOther.isSetProtocol_version());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetProtocol_version()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.protocol_version, typedOther.protocol_version);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetRequestorUserName()).compareTo(typedOther.isSetRequestorUserName());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetRequestorUserName()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.requestorUserName, typedOther.requestorUserName);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetRoleName()).compareTo(typedOther.isSetRoleName());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetRoleName()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.roleName, typedOther.roleName);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetAuthorizableHierarchy()).compareTo(typedOther.isSetAuthorizableHierarchy());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetAuthorizableHierarchy()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.authorizableHierarchy, typedOther.authorizableHierarchy);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- return 0;
- }
-
- public _Fields fieldForId(int fieldId) {
- return _Fields.findByThriftId(fieldId);
- }
-
- public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
- schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
- }
-
- public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
- schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
- }
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder("TListSentryPrivilegesRequest(");
- boolean first = true;
-
- sb.append("protocol_version:");
- sb.append(this.protocol_version);
- first = false;
- if (!first) sb.append(", ");
- sb.append("requestorUserName:");
- if (this.requestorUserName == null) {
- sb.append("null");
- } else {
- sb.append(this.requestorUserName);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("roleName:");
- if (this.roleName == null) {
- sb.append("null");
- } else {
- sb.append(this.roleName);
- }
- first = false;
- if (isSetAuthorizableHierarchy()) {
- if (!first) sb.append(", ");
- sb.append("authorizableHierarchy:");
- if (this.authorizableHierarchy == null) {
- sb.append("null");
- } else {
- sb.append(this.authorizableHierarchy);
- }
- first = false;
- }
- sb.append(")");
- return sb.toString();
- }
-
- public void validate() throws org.apache.thrift.TException {
- // check for required fields
- if (!isSetProtocol_version()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'protocol_version' is unset! Struct:" + toString());
- }
-
- if (!isSetRequestorUserName()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'requestorUserName' is unset! Struct:" + toString());
- }
-
- if (!isSetRoleName()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'roleName' is unset! Struct:" + toString());
- }
-
- // check for sub-struct validity
- if (authorizableHierarchy != null) {
- authorizableHierarchy.validate();
- }
- }
-
- private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
- try {
- write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
- try {
- // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
- __isset_bitfield = 0;
- read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private static class TListSentryPrivilegesRequestStandardSchemeFactory implements SchemeFactory {
- public TListSentryPrivilegesRequestStandardScheme getScheme() {
- return new TListSentryPrivilegesRequestStandardScheme();
- }
- }
-
- private static class TListSentryPrivilegesRequestStandardScheme extends StandardScheme<TListSentryPrivilegesRequest> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TListSentryPrivilegesRequest struct) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TField schemeField;
- iprot.readStructBegin();
- while (true)
- {
- schemeField = iprot.readFieldBegin();
- if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
- break;
- }
- switch (schemeField.id) {
- case 1: // PROTOCOL_VERSION
- if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
- struct.protocol_version = iprot.readI32();
- struct.setProtocol_versionIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 2: // REQUESTOR_USER_NAME
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.requestorUserName = iprot.readString();
- struct.setRequestorUserNameIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 4: // ROLE_NAME
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.roleName = iprot.readString();
- struct.setRoleNameIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 5: // AUTHORIZABLE_HIERARCHY
- if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
- struct.authorizableHierarchy = new TSentryAuthorizable();
- struct.authorizableHierarchy.read(iprot);
- struct.setAuthorizableHierarchyIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- default:
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- iprot.readFieldEnd();
- }
- iprot.readStructEnd();
- struct.validate();
- }
-
- public void write(org.apache.thrift.protocol.TProtocol oprot, TListSentryPrivilegesRequest struct) throws org.apache.thrift.TException {
- struct.validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- oprot.writeFieldBegin(PROTOCOL_VERSION_FIELD_DESC);
- oprot.writeI32(struct.protocol_version);
- oprot.writeFieldEnd();
- if (struct.requestorUserName != null) {
- oprot.writeFieldBegin(REQUESTOR_USER_NAME_FIELD_DESC);
- oprot.writeString(struct.requestorUserName);
- oprot.writeFieldEnd();
- }
- if (struct.roleName != null) {
- oprot.writeFieldBegin(ROLE_NAME_FIELD_DESC);
- oprot.writeString(struct.roleName);
- oprot.writeFieldEnd();
- }
- if (struct.authorizableHierarchy != null) {
- if (struct.isSetAuthorizableHierarchy()) {
- oprot.writeFieldBegin(AUTHORIZABLE_HIERARCHY_FIELD_DESC);
- struct.authorizableHierarchy.write(oprot);
- oprot.writeFieldEnd();
- }
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TListSentryPrivilegesRequestTupleSchemeFactory implements SchemeFactory {
- public TListSentryPrivilegesRequestTupleScheme getScheme() {
- return new TListSentryPrivilegesRequestTupleScheme();
- }
- }
-
- private static class TListSentryPrivilegesRequestTupleScheme extends TupleScheme<TListSentryPrivilegesRequest> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, TListSentryPrivilegesRequest struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- oprot.writeI32(struct.protocol_version);
- oprot.writeString(struct.requestorUserName);
- oprot.writeString(struct.roleName);
- BitSet optionals = new BitSet();
- if (struct.isSetAuthorizableHierarchy()) {
- optionals.set(0);
- }
- oprot.writeBitSet(optionals, 1);
- if (struct.isSetAuthorizableHierarchy()) {
- struct.authorizableHierarchy.write(oprot);
- }
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TListSentryPrivilegesRequest struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- struct.protocol_version = iprot.readI32();
- struct.setProtocol_versionIsSet(true);
- struct.requestorUserName = iprot.readString();
- struct.setRequestorUserNameIsSet(true);
- struct.roleName = iprot.readString();
- struct.setRoleNameIsSet(true);
- BitSet incoming = iprot.readBitSet(1);
- if (incoming.get(0)) {
- struct.authorizableHierarchy = new TSentryAuthorizable();
- struct.authorizableHierarchy.read(iprot);
- struct.setAuthorizableHierarchyIsSet(true);
- }
- }
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryPrivilegesResponse.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryPrivilegesResponse.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryPrivilegesResponse.java
deleted file mode 100644
index d34205a..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryPrivilegesResponse.java
+++ /dev/null
@@ -1,554 +0,0 @@
-/**
- * Autogenerated by Thrift Compiler (0.9.0)
- *
- * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
- * @generated
- */
-package org.apache.sentry.provider.db.service.thrift;
-
-import org.apache.commons.lang.builder.HashCodeBuilder;
-import org.apache.thrift.scheme.IScheme;
-import org.apache.thrift.scheme.SchemeFactory;
-import org.apache.thrift.scheme.StandardScheme;
-
-import org.apache.thrift.scheme.TupleScheme;
-import org.apache.thrift.protocol.TTupleProtocol;
-import org.apache.thrift.protocol.TProtocolException;
-import org.apache.thrift.EncodingUtils;
-import org.apache.thrift.TException;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.EnumMap;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.EnumSet;
-import java.util.Collections;
-import java.util.BitSet;
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class TListSentryPrivilegesResponse implements org.apache.thrift.TBase<TListSentryPrivilegesResponse, TListSentryPrivilegesResponse._Fields>, java.io.Serializable, Cloneable {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TListSentryPrivilegesResponse");
-
- private static final org.apache.thrift.protocol.TField STATUS_FIELD_DESC = new org.apache.thrift.protocol.TField("status", org.apache.thrift.protocol.TType.STRUCT, (short)1);
- private static final org.apache.thrift.protocol.TField PRIVILEGES_FIELD_DESC = new org.apache.thrift.protocol.TField("privileges", org.apache.thrift.protocol.TType.SET, (short)2);
-
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TListSentryPrivilegesResponseStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TListSentryPrivilegesResponseTupleSchemeFactory());
- }
-
- private org.apache.sentry.service.thrift.TSentryResponseStatus status; // required
- private Set<TSentryPrivilege> privileges; // 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 {
- STATUS((short)1, "status"),
- PRIVILEGES((short)2, "privileges");
-
- private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
-
- static {
- for (_Fields field : EnumSet.allOf(_Fields.class)) {
- byName.put(field.getFieldName(), field);
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, or null if its not found.
- */
- public static _Fields findByThriftId(int fieldId) {
- switch(fieldId) {
- case 1: // STATUS
- return STATUS;
- case 2: // PRIVILEGES
- return PRIVILEGES;
- default:
- return null;
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, throwing an exception
- * if it is not found.
- */
- public static _Fields findByThriftIdOrThrow(int fieldId) {
- _Fields fields = findByThriftId(fieldId);
- if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
- return fields;
- }
-
- /**
- * Find the _Fields constant that matches name, or null if its not found.
- */
- public static _Fields findByName(String name) {
- return byName.get(name);
- }
-
- private final short _thriftId;
- private final String _fieldName;
-
- _Fields(short thriftId, String fieldName) {
- _thriftId = thriftId;
- _fieldName = fieldName;
- }
-
- public short getThriftFieldId() {
- return _thriftId;
- }
-
- public String getFieldName() {
- return _fieldName;
- }
- }
-
- // isset id assignments
- private _Fields optionals[] = {_Fields.PRIVILEGES};
- public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
- static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
- tmpMap.put(_Fields.STATUS, new org.apache.thrift.meta_data.FieldMetaData("status", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.sentry.service.thrift.TSentryResponseStatus.class)));
- tmpMap.put(_Fields.PRIVILEGES, new org.apache.thrift.meta_data.FieldMetaData("privileges", org.apache.thrift.TFieldRequirementType.OPTIONAL,
- new org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET,
- new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TSentryPrivilege.class))));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TListSentryPrivilegesResponse.class, metaDataMap);
- }
-
- public TListSentryPrivilegesResponse() {
- }
-
- public TListSentryPrivilegesResponse(
- org.apache.sentry.service.thrift.TSentryResponseStatus status)
- {
- this();
- this.status = status;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TListSentryPrivilegesResponse(TListSentryPrivilegesResponse other) {
- if (other.isSetStatus()) {
- this.status = new org.apache.sentry.service.thrift.TSentryResponseStatus(other.status);
- }
- if (other.isSetPrivileges()) {
- Set<TSentryPrivilege> __this__privileges = new HashSet<TSentryPrivilege>();
- for (TSentryPrivilege other_element : other.privileges) {
- __this__privileges.add(new TSentryPrivilege(other_element));
- }
- this.privileges = __this__privileges;
- }
- }
-
- public TListSentryPrivilegesResponse deepCopy() {
- return new TListSentryPrivilegesResponse(this);
- }
-
- @Override
- public void clear() {
- this.status = null;
- this.privileges = null;
- }
-
- public org.apache.sentry.service.thrift.TSentryResponseStatus getStatus() {
- return this.status;
- }
-
- public void setStatus(org.apache.sentry.service.thrift.TSentryResponseStatus status) {
- this.status = status;
- }
-
- public void unsetStatus() {
- this.status = null;
- }
-
- /** Returns true if field status is set (has been assigned a value) and false otherwise */
- public boolean isSetStatus() {
- return this.status != null;
- }
-
- public void setStatusIsSet(boolean value) {
- if (!value) {
- this.status = null;
- }
- }
-
- public int getPrivilegesSize() {
- return (this.privileges == null) ? 0 : this.privileges.size();
- }
-
- public java.util.Iterator<TSentryPrivilege> getPrivilegesIterator() {
- return (this.privileges == null) ? null : this.privileges.iterator();
- }
-
- public void addToPrivileges(TSentryPrivilege elem) {
- if (this.privileges == null) {
- this.privileges = new HashSet<TSentryPrivilege>();
- }
- this.privileges.add(elem);
- }
-
- public Set<TSentryPrivilege> getPrivileges() {
- return this.privileges;
- }
-
- public void setPrivileges(Set<TSentryPrivilege> privileges) {
- this.privileges = privileges;
- }
-
- public void unsetPrivileges() {
- this.privileges = null;
- }
-
- /** Returns true if field privileges is set (has been assigned a value) and false otherwise */
- public boolean isSetPrivileges() {
- return this.privileges != null;
- }
-
- public void setPrivilegesIsSet(boolean value) {
- if (!value) {
- this.privileges = null;
- }
- }
-
- public void setFieldValue(_Fields field, Object value) {
- switch (field) {
- case STATUS:
- if (value == null) {
- unsetStatus();
- } else {
- setStatus((org.apache.sentry.service.thrift.TSentryResponseStatus)value);
- }
- break;
-
- case PRIVILEGES:
- if (value == null) {
- unsetPrivileges();
- } else {
- setPrivileges((Set<TSentryPrivilege>)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case STATUS:
- return getStatus();
-
- case PRIVILEGES:
- return getPrivileges();
-
- }
- throw new IllegalStateException();
- }
-
- /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
- public boolean isSet(_Fields field) {
- if (field == null) {
- throw new IllegalArgumentException();
- }
-
- switch (field) {
- case STATUS:
- return isSetStatus();
- case PRIVILEGES:
- return isSetPrivileges();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TListSentryPrivilegesResponse)
- return this.equals((TListSentryPrivilegesResponse)that);
- return false;
- }
-
- public boolean equals(TListSentryPrivilegesResponse that) {
- if (that == null)
- return false;
-
- boolean this_present_status = true && this.isSetStatus();
- boolean that_present_status = true && that.isSetStatus();
- if (this_present_status || that_present_status) {
- if (!(this_present_status && that_present_status))
- return false;
- if (!this.status.equals(that.status))
- return false;
- }
-
- boolean this_present_privileges = true && this.isSetPrivileges();
- boolean that_present_privileges = true && that.isSetPrivileges();
- if (this_present_privileges || that_present_privileges) {
- if (!(this_present_privileges && that_present_privileges))
- return false;
- if (!this.privileges.equals(that.privileges))
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode() {
- HashCodeBuilder builder = new HashCodeBuilder();
-
- boolean present_status = true && (isSetStatus());
- builder.append(present_status);
- if (present_status)
- builder.append(status);
-
- boolean present_privileges = true && (isSetPrivileges());
- builder.append(present_privileges);
- if (present_privileges)
- builder.append(privileges);
-
- return builder.toHashCode();
- }
-
- public int compareTo(TListSentryPrivilegesResponse other) {
- if (!getClass().equals(other.getClass())) {
- return getClass().getName().compareTo(other.getClass().getName());
- }
-
- int lastComparison = 0;
- TListSentryPrivilegesResponse typedOther = (TListSentryPrivilegesResponse)other;
-
- lastComparison = Boolean.valueOf(isSetStatus()).compareTo(typedOther.isSetStatus());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetStatus()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.status, typedOther.status);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetPrivileges()).compareTo(typedOther.isSetPrivileges());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetPrivileges()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.privileges, typedOther.privileges);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- return 0;
- }
-
- public _Fields fieldForId(int fieldId) {
- return _Fields.findByThriftId(fieldId);
- }
-
- public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
- schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
- }
-
- public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
- schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
- }
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder("TListSentryPrivilegesResponse(");
- boolean first = true;
-
- sb.append("status:");
- if (this.status == null) {
- sb.append("null");
- } else {
- sb.append(this.status);
- }
- first = false;
- if (isSetPrivileges()) {
- if (!first) sb.append(", ");
- sb.append("privileges:");
- if (this.privileges == null) {
- sb.append("null");
- } else {
- sb.append(this.privileges);
- }
- first = false;
- }
- sb.append(")");
- return sb.toString();
- }
-
- public void validate() throws org.apache.thrift.TException {
- // check for required fields
- if (!isSetStatus()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'status' is unset! Struct:" + toString());
- }
-
- // check for sub-struct validity
- if (status != null) {
- status.validate();
- }
- }
-
- private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
- try {
- write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
- try {
- read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private static class TListSentryPrivilegesResponseStandardSchemeFactory implements SchemeFactory {
- public TListSentryPrivilegesResponseStandardScheme getScheme() {
- return new TListSentryPrivilegesResponseStandardScheme();
- }
- }
-
- private static class TListSentryPrivilegesResponseStandardScheme extends StandardScheme<TListSentryPrivilegesResponse> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TListSentryPrivilegesResponse struct) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TField schemeField;
- iprot.readStructBegin();
- while (true)
- {
- schemeField = iprot.readFieldBegin();
- if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
- break;
- }
- switch (schemeField.id) {
- case 1: // STATUS
- if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
- struct.status = new org.apache.sentry.service.thrift.TSentryResponseStatus();
- struct.status.read(iprot);
- struct.setStatusIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 2: // PRIVILEGES
- if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
- {
- org.apache.thrift.protocol.TSet _set32 = iprot.readSetBegin();
- struct.privileges = new HashSet<TSentryPrivilege>(2*_set32.size);
- for (int _i33 = 0; _i33 < _set32.size; ++_i33)
- {
- TSentryPrivilege _elem34; // required
- _elem34 = new TSentryPrivilege();
- _elem34.read(iprot);
- struct.privileges.add(_elem34);
- }
- iprot.readSetEnd();
- }
- struct.setPrivilegesIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- default:
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- iprot.readFieldEnd();
- }
- iprot.readStructEnd();
- struct.validate();
- }
-
- public void write(org.apache.thrift.protocol.TProtocol oprot, TListSentryPrivilegesResponse struct) throws org.apache.thrift.TException {
- struct.validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- if (struct.status != null) {
- oprot.writeFieldBegin(STATUS_FIELD_DESC);
- struct.status.write(oprot);
- oprot.writeFieldEnd();
- }
- if (struct.privileges != null) {
- if (struct.isSetPrivileges()) {
- oprot.writeFieldBegin(PRIVILEGES_FIELD_DESC);
- {
- oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, struct.privileges.size()));
- for (TSentryPrivilege _iter35 : struct.privileges)
- {
- _iter35.write(oprot);
- }
- oprot.writeSetEnd();
- }
- oprot.writeFieldEnd();
- }
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TListSentryPrivilegesResponseTupleSchemeFactory implements SchemeFactory {
- public TListSentryPrivilegesResponseTupleScheme getScheme() {
- return new TListSentryPrivilegesResponseTupleScheme();
- }
- }
-
- private static class TListSentryPrivilegesResponseTupleScheme extends TupleScheme<TListSentryPrivilegesResponse> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, TListSentryPrivilegesResponse struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- struct.status.write(oprot);
- BitSet optionals = new BitSet();
- if (struct.isSetPrivileges()) {
- optionals.set(0);
- }
- oprot.writeBitSet(optionals, 1);
- if (struct.isSetPrivileges()) {
- {
- oprot.writeI32(struct.privileges.size());
- for (TSentryPrivilege _iter36 : struct.privileges)
- {
- _iter36.write(oprot);
- }
- }
- }
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TListSentryPrivilegesResponse struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- struct.status = new org.apache.sentry.service.thrift.TSentryResponseStatus();
- struct.status.read(iprot);
- struct.setStatusIsSet(true);
- BitSet incoming = iprot.readBitSet(1);
- if (incoming.get(0)) {
- {
- org.apache.thrift.protocol.TSet _set37 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
- struct.privileges = new HashSet<TSentryPrivilege>(2*_set37.size);
- for (int _i38 = 0; _i38 < _set37.size; ++_i38)
- {
- TSentryPrivilege _elem39; // required
- _elem39 = new TSentryPrivilege();
- _elem39.read(iprot);
- struct.privileges.add(_elem39);
- }
- }
- struct.setPrivilegesIsSet(true);
- }
- }
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryRolesRequest.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryRolesRequest.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryRolesRequest.java
deleted file mode 100644
index 4eec1ed..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryRolesRequest.java
+++ /dev/null
@@ -1,596 +0,0 @@
-/**
- * Autogenerated by Thrift Compiler (0.9.0)
- *
- * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
- * @generated
- */
-package org.apache.sentry.provider.db.service.thrift;
-
-import org.apache.commons.lang.builder.HashCodeBuilder;
-import org.apache.thrift.scheme.IScheme;
-import org.apache.thrift.scheme.SchemeFactory;
-import org.apache.thrift.scheme.StandardScheme;
-
-import org.apache.thrift.scheme.TupleScheme;
-import org.apache.thrift.protocol.TTupleProtocol;
-import org.apache.thrift.protocol.TProtocolException;
-import org.apache.thrift.EncodingUtils;
-import org.apache.thrift.TException;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.EnumMap;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.EnumSet;
-import java.util.Collections;
-import java.util.BitSet;
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class TListSentryRolesRequest implements org.apache.thrift.TBase<TListSentryRolesRequest, TListSentryRolesRequest._Fields>, java.io.Serializable, Cloneable {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TListSentryRolesRequest");
-
- private static final org.apache.thrift.protocol.TField PROTOCOL_VERSION_FIELD_DESC = new org.apache.thrift.protocol.TField("protocol_version", org.apache.thrift.protocol.TType.I32, (short)1);
- private static final org.apache.thrift.protocol.TField REQUESTOR_USER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("requestorUserName", org.apache.thrift.protocol.TType.STRING, (short)2);
- private static final org.apache.thrift.protocol.TField GROUP_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("groupName", 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 TListSentryRolesRequestStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TListSentryRolesRequestTupleSchemeFactory());
- }
-
- private int protocol_version; // required
- private String requestorUserName; // required
- private String groupName; // optional
-
- /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
- public enum _Fields implements org.apache.thrift.TFieldIdEnum {
- PROTOCOL_VERSION((short)1, "protocol_version"),
- REQUESTOR_USER_NAME((short)2, "requestorUserName"),
- GROUP_NAME((short)3, "groupName");
-
- private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
-
- static {
- for (_Fields field : EnumSet.allOf(_Fields.class)) {
- byName.put(field.getFieldName(), field);
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, or null if its not found.
- */
- public static _Fields findByThriftId(int fieldId) {
- switch(fieldId) {
- case 1: // PROTOCOL_VERSION
- return PROTOCOL_VERSION;
- case 2: // REQUESTOR_USER_NAME
- return REQUESTOR_USER_NAME;
- case 3: // GROUP_NAME
- return GROUP_NAME;
- default:
- return null;
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, throwing an exception
- * if it is not found.
- */
- public static _Fields findByThriftIdOrThrow(int fieldId) {
- _Fields fields = findByThriftId(fieldId);
- if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
- return fields;
- }
-
- /**
- * Find the _Fields constant that matches name, or null if its not found.
- */
- public static _Fields findByName(String name) {
- return byName.get(name);
- }
-
- private final short _thriftId;
- private final String _fieldName;
-
- _Fields(short thriftId, String fieldName) {
- _thriftId = thriftId;
- _fieldName = fieldName;
- }
-
- public short getThriftFieldId() {
- return _thriftId;
- }
-
- public String getFieldName() {
- return _fieldName;
- }
- }
-
- // isset id assignments
- private static final int __PROTOCOL_VERSION_ISSET_ID = 0;
- private byte __isset_bitfield = 0;
- private _Fields optionals[] = {_Fields.GROUP_NAME};
- public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
- static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
- tmpMap.put(_Fields.PROTOCOL_VERSION, new org.apache.thrift.meta_data.FieldMetaData("protocol_version", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
- tmpMap.put(_Fields.REQUESTOR_USER_NAME, new org.apache.thrift.meta_data.FieldMetaData("requestorUserName", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.GROUP_NAME, new org.apache.thrift.meta_data.FieldMetaData("groupName", org.apache.thrift.TFieldRequirementType.OPTIONAL,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TListSentryRolesRequest.class, metaDataMap);
- }
-
- public TListSentryRolesRequest() {
- this.protocol_version = 1;
-
- }
-
- public TListSentryRolesRequest(
- int protocol_version,
- String requestorUserName)
- {
- this();
- this.protocol_version = protocol_version;
- setProtocol_versionIsSet(true);
- this.requestorUserName = requestorUserName;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TListSentryRolesRequest(TListSentryRolesRequest other) {
- __isset_bitfield = other.__isset_bitfield;
- this.protocol_version = other.protocol_version;
- if (other.isSetRequestorUserName()) {
- this.requestorUserName = other.requestorUserName;
- }
- if (other.isSetGroupName()) {
- this.groupName = other.groupName;
- }
- }
-
- public TListSentryRolesRequest deepCopy() {
- return new TListSentryRolesRequest(this);
- }
-
- @Override
- public void clear() {
- this.protocol_version = 1;
-
- this.requestorUserName = null;
- this.groupName = null;
- }
-
- public int getProtocol_version() {
- return this.protocol_version;
- }
-
- public void setProtocol_version(int protocol_version) {
- this.protocol_version = protocol_version;
- setProtocol_versionIsSet(true);
- }
-
- public void unsetProtocol_version() {
- __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __PROTOCOL_VERSION_ISSET_ID);
- }
-
- /** Returns true if field protocol_version is set (has been assigned a value) and false otherwise */
- public boolean isSetProtocol_version() {
- return EncodingUtils.testBit(__isset_bitfield, __PROTOCOL_VERSION_ISSET_ID);
- }
-
- public void setProtocol_versionIsSet(boolean value) {
- __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __PROTOCOL_VERSION_ISSET_ID, value);
- }
-
- public String getRequestorUserName() {
- return this.requestorUserName;
- }
-
- public void setRequestorUserName(String requestorUserName) {
- this.requestorUserName = requestorUserName;
- }
-
- public void unsetRequestorUserName() {
- this.requestorUserName = null;
- }
-
- /** Returns true if field requestorUserName is set (has been assigned a value) and false otherwise */
- public boolean isSetRequestorUserName() {
- return this.requestorUserName != null;
- }
-
- public void setRequestorUserNameIsSet(boolean value) {
- if (!value) {
- this.requestorUserName = null;
- }
- }
-
- public String getGroupName() {
- return this.groupName;
- }
-
- public void setGroupName(String groupName) {
- this.groupName = groupName;
- }
-
- public void unsetGroupName() {
- this.groupName = null;
- }
-
- /** Returns true if field groupName is set (has been assigned a value) and false otherwise */
- public boolean isSetGroupName() {
- return this.groupName != null;
- }
-
- public void setGroupNameIsSet(boolean value) {
- if (!value) {
- this.groupName = null;
- }
- }
-
- public void setFieldValue(_Fields field, Object value) {
- switch (field) {
- case PROTOCOL_VERSION:
- if (value == null) {
- unsetProtocol_version();
- } else {
- setProtocol_version((Integer)value);
- }
- break;
-
- case REQUESTOR_USER_NAME:
- if (value == null) {
- unsetRequestorUserName();
- } else {
- setRequestorUserName((String)value);
- }
- break;
-
- case GROUP_NAME:
- if (value == null) {
- unsetGroupName();
- } else {
- setGroupName((String)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case PROTOCOL_VERSION:
- return Integer.valueOf(getProtocol_version());
-
- case REQUESTOR_USER_NAME:
- return getRequestorUserName();
-
- case GROUP_NAME:
- return getGroupName();
-
- }
- throw new IllegalStateException();
- }
-
- /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
- public boolean isSet(_Fields field) {
- if (field == null) {
- throw new IllegalArgumentException();
- }
-
- switch (field) {
- case PROTOCOL_VERSION:
- return isSetProtocol_version();
- case REQUESTOR_USER_NAME:
- return isSetRequestorUserName();
- case GROUP_NAME:
- return isSetGroupName();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TListSentryRolesRequest)
- return this.equals((TListSentryRolesRequest)that);
- return false;
- }
-
- public boolean equals(TListSentryRolesRequest that) {
- if (that == null)
- return false;
-
- boolean this_present_protocol_version = true;
- boolean that_present_protocol_version = true;
- if (this_present_protocol_version || that_present_protocol_version) {
- if (!(this_present_protocol_version && that_present_protocol_version))
- return false;
- if (this.protocol_version != that.protocol_version)
- return false;
- }
-
- boolean this_present_requestorUserName = true && this.isSetRequestorUserName();
- boolean that_present_requestorUserName = true && that.isSetRequestorUserName();
- if (this_present_requestorUserName || that_present_requestorUserName) {
- if (!(this_present_requestorUserName && that_present_requestorUserName))
- return false;
- if (!this.requestorUserName.equals(that.requestorUserName))
- return false;
- }
-
- boolean this_present_groupName = true && this.isSetGroupName();
- boolean that_present_groupName = true && that.isSetGroupName();
- if (this_present_groupName || that_present_groupName) {
- if (!(this_present_groupName && that_present_groupName))
- return false;
- if (!this.groupName.equals(that.groupName))
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode() {
- HashCodeBuilder builder = new HashCodeBuilder();
-
- boolean present_protocol_version = true;
- builder.append(present_protocol_version);
- if (present_protocol_version)
- builder.append(protocol_version);
-
- boolean present_requestorUserName = true && (isSetRequestorUserName());
- builder.append(present_requestorUserName);
- if (present_requestorUserName)
- builder.append(requestorUserName);
-
- boolean present_groupName = true && (isSetGroupName());
- builder.append(present_groupName);
- if (present_groupName)
- builder.append(groupName);
-
- return builder.toHashCode();
- }
-
- public int compareTo(TListSentryRolesRequest other) {
- if (!getClass().equals(other.getClass())) {
- return getClass().getName().compareTo(other.getClass().getName());
- }
-
- int lastComparison = 0;
- TListSentryRolesRequest typedOther = (TListSentryRolesRequest)other;
-
- lastComparison = Boolean.valueOf(isSetProtocol_version()).compareTo(typedOther.isSetProtocol_version());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetProtocol_version()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.protocol_version, typedOther.protocol_version);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetRequestorUserName()).compareTo(typedOther.isSetRequestorUserName());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetRequestorUserName()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.requestorUserName, typedOther.requestorUserName);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetGroupName()).compareTo(typedOther.isSetGroupName());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetGroupName()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.groupName, typedOther.groupName);
- 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("TListSentryRolesRequest(");
- boolean first = true;
-
- sb.append("protocol_version:");
- sb.append(this.protocol_version);
- first = false;
- if (!first) sb.append(", ");
- sb.append("requestorUserName:");
- if (this.requestorUserName == null) {
- sb.append("null");
- } else {
- sb.append(this.requestorUserName);
- }
- first = false;
- if (isSetGroupName()) {
- if (!first) sb.append(", ");
- sb.append("groupName:");
- if (this.groupName == null) {
- sb.append("null");
- } else {
- sb.append(this.groupName);
- }
- first = false;
- }
- sb.append(")");
- return sb.toString();
- }
-
- public void validate() throws org.apache.thrift.TException {
- // check for required fields
- if (!isSetProtocol_version()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'protocol_version' is unset! Struct:" + toString());
- }
-
- if (!isSetRequestorUserName()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'requestorUserName' is unset! Struct:" + toString());
- }
-
- // 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 TListSentryRolesRequestStandardSchemeFactory implements SchemeFactory {
- public TListSentryRolesRequestStandardScheme getScheme() {
- return new TListSentryRolesRequestStandardScheme();
- }
- }
-
- private static class TListSentryRolesRequestStandardScheme extends StandardScheme<TListSentryRolesRequest> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TListSentryRolesRequest struct) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TField schemeField;
- iprot.readStructBegin();
- while (true)
- {
- schemeField = iprot.readFieldBegin();
- if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
- break;
- }
- switch (schemeField.id) {
- case 1: // PROTOCOL_VERSION
- if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
- struct.protocol_version = iprot.readI32();
- struct.setProtocol_versionIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 2: // REQUESTOR_USER_NAME
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.requestorUserName = iprot.readString();
- struct.setRequestorUserNameIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 3: // GROUP_NAME
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.groupName = iprot.readString();
- struct.setGroupNameIsSet(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, TListSentryRolesRequest struct) throws org.apache.thrift.TException {
- struct.validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- oprot.writeFieldBegin(PROTOCOL_VERSION_FIELD_DESC);
- oprot.writeI32(struct.protocol_version);
- oprot.writeFieldEnd();
- if (struct.requestorUserName != null) {
- oprot.writeFieldBegin(REQUESTOR_USER_NAME_FIELD_DESC);
- oprot.writeString(struct.requestorUserName);
- oprot.writeFieldEnd();
- }
- if (struct.groupName != null) {
- if (struct.isSetGroupName()) {
- oprot.writeFieldBegin(GROUP_NAME_FIELD_DESC);
- oprot.writeString(struct.groupName);
- oprot.writeFieldEnd();
- }
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TListSentryRolesRequestTupleSchemeFactory implements SchemeFactory {
- public TListSentryRolesRequestTupleScheme getScheme() {
- return new TListSentryRolesRequestTupleScheme();
- }
- }
-
- private static class TListSentryRolesRequestTupleScheme extends TupleScheme<TListSentryRolesRequest> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, TListSentryRolesRequest struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- oprot.writeI32(struct.protocol_version);
- oprot.writeString(struct.requestorUserName);
- BitSet optionals = new BitSet();
- if (struct.isSetGroupName()) {
- optionals.set(0);
- }
- oprot.writeBitSet(optionals, 1);
- if (struct.isSetGroupName()) {
- oprot.writeString(struct.groupName);
- }
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TListSentryRolesRequest struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- struct.protocol_version = iprot.readI32();
- struct.setProtocol_versionIsSet(true);
- struct.requestorUserName = iprot.readString();
- struct.setRequestorUserNameIsSet(true);
- BitSet incoming = iprot.readBitSet(1);
- if (incoming.get(0)) {
- struct.groupName = iprot.readString();
- struct.setGroupNameIsSet(true);
- }
- }
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryRolesResponse.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryRolesResponse.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryRolesResponse.java
deleted file mode 100644
index 13f22ff..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryRolesResponse.java
+++ /dev/null
@@ -1,554 +0,0 @@
-/**
- * Autogenerated by Thrift Compiler (0.9.0)
- *
- * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
- * @generated
- */
-package org.apache.sentry.provider.db.service.thrift;
-
-import org.apache.commons.lang.builder.HashCodeBuilder;
-import org.apache.thrift.scheme.IScheme;
-import org.apache.thrift.scheme.SchemeFactory;
-import org.apache.thrift.scheme.StandardScheme;
-
-import org.apache.thrift.scheme.TupleScheme;
-import org.apache.thrift.protocol.TTupleProtocol;
-import org.apache.thrift.protocol.TProtocolException;
-import org.apache.thrift.EncodingUtils;
-import org.apache.thrift.TException;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.EnumMap;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.EnumSet;
-import java.util.Collections;
-import java.util.BitSet;
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class TListSentryRolesResponse implements org.apache.thrift.TBase<TListSentryRolesResponse, TListSentryRolesResponse._Fields>, java.io.Serializable, Cloneable {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TListSentryRolesResponse");
-
- private static final org.apache.thrift.protocol.TField STATUS_FIELD_DESC = new org.apache.thrift.protocol.TField("status", org.apache.thrift.protocol.TType.STRUCT, (short)1);
- private static final org.apache.thrift.protocol.TField ROLES_FIELD_DESC = new org.apache.thrift.protocol.TField("roles", org.apache.thrift.protocol.TType.SET, (short)2);
-
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TListSentryRolesResponseStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TListSentryRolesResponseTupleSchemeFactory());
- }
-
- private org.apache.sentry.service.thrift.TSentryResponseStatus status; // required
- private Set<TSentryRole> roles; // 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 {
- STATUS((short)1, "status"),
- ROLES((short)2, "roles");
-
- private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
-
- static {
- for (_Fields field : EnumSet.allOf(_Fields.class)) {
- byName.put(field.getFieldName(), field);
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, or null if its not found.
- */
- public static _Fields findByThriftId(int fieldId) {
- switch(fieldId) {
- case 1: // STATUS
- return STATUS;
- case 2: // ROLES
- return ROLES;
- 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 _Fields optionals[] = {_Fields.ROLES};
- public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
- static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
- tmpMap.put(_Fields.STATUS, new org.apache.thrift.meta_data.FieldMetaData("status", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.sentry.service.thrift.TSentryResponseStatus.class)));
- tmpMap.put(_Fields.ROLES, new org.apache.thrift.meta_data.FieldMetaData("roles", org.apache.thrift.TFieldRequirementType.OPTIONAL,
- 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, TSentryRole.class))));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TListSentryRolesResponse.class, metaDataMap);
- }
-
- public TListSentryRolesResponse() {
- }
-
- public TListSentryRolesResponse(
- org.apache.sentry.service.thrift.TSentryResponseStatus status)
- {
- this();
- this.status = status;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TListSentryRolesResponse(TListSentryRolesResponse other) {
- if (other.isSetStatus()) {
- this.status = new org.apache.sentry.service.thrift.TSentryResponseStatus(other.status);
- }
- if (other.isSetRoles()) {
- Set<TSentryRole> __this__roles = new HashSet<TSentryRole>();
- for (TSentryRole other_element : other.roles) {
- __this__roles.add(new TSentryRole(other_element));
- }
- this.roles = __this__roles;
- }
- }
-
- public TListSentryRolesResponse deepCopy() {
- return new TListSentryRolesResponse(this);
- }
-
- @Override
- public void clear() {
- this.status = null;
- this.roles = null;
- }
-
- public org.apache.sentry.service.thrift.TSentryResponseStatus getStatus() {
- return this.status;
- }
-
- public void setStatus(org.apache.sentry.service.thrift.TSentryResponseStatus status) {
- this.status = status;
- }
-
- public void unsetStatus() {
- this.status = null;
- }
-
- /** Returns true if field status is set (has been assigned a value) and false otherwise */
- public boolean isSetStatus() {
- return this.status != null;
- }
-
- public void setStatusIsSet(boolean value) {
- if (!value) {
- this.status = null;
- }
- }
-
- public int getRolesSize() {
- return (this.roles == null) ? 0 : this.roles.size();
- }
-
- public java.util.Iterator<TSentryRole> getRolesIterator() {
- return (this.roles == null) ? null : this.roles.iterator();
- }
-
- public void addToRoles(TSentryRole elem) {
- if (this.roles == null) {
- this.roles = new HashSet<TSentryRole>();
- }
- this.roles.add(elem);
- }
-
- public Set<TSentryRole> getRoles() {
- return this.roles;
- }
-
- public void setRoles(Set<TSentryRole> roles) {
- this.roles = roles;
- }
-
- public void unsetRoles() {
- this.roles = null;
- }
-
- /** Returns true if field roles is set (has been assigned a value) and false otherwise */
- public boolean isSetRoles() {
- return this.roles != null;
- }
-
- public void setRolesIsSet(boolean value) {
- if (!value) {
- this.roles = null;
- }
- }
-
- public void setFieldValue(_Fields field, Object value) {
- switch (field) {
- case STATUS:
- if (value == null) {
- unsetStatus();
- } else {
- setStatus((org.apache.sentry.service.thrift.TSentryResponseStatus)value);
- }
- break;
-
- case ROLES:
- if (value == null) {
- unsetRoles();
- } else {
- setRoles((Set<TSentryRole>)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case STATUS:
- return getStatus();
-
- case ROLES:
- return getRoles();
-
- }
- throw new IllegalStateException();
- }
-
- /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
- public boolean isSet(_Fields field) {
- if (field == null) {
- throw new IllegalArgumentException();
- }
-
- switch (field) {
- case STATUS:
- return isSetStatus();
- case ROLES:
- return isSetRoles();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TListSentryRolesResponse)
- return this.equals((TListSentryRolesResponse)that);
- return false;
- }
-
- public boolean equals(TListSentryRolesResponse that) {
- if (that == null)
- return false;
-
- boolean this_present_status = true && this.isSetStatus();
- boolean that_present_status = true && that.isSetStatus();
- if (this_present_status || that_present_status) {
- if (!(this_present_status && that_present_status))
- return false;
- if (!this.status.equals(that.status))
- return false;
- }
-
- boolean this_present_roles = true && this.isSetRoles();
- boolean that_present_roles = true && that.isSetRoles();
- if (this_present_roles || that_present_roles) {
- if (!(this_present_roles && that_present_roles))
- return false;
- if (!this.roles.equals(that.roles))
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode() {
- HashCodeBuilder builder = new HashCodeBuilder();
-
- boolean present_status = true && (isSetStatus());
- builder.append(present_status);
- if (present_status)
- builder.append(status);
-
- boolean present_roles = true && (isSetRoles());
- builder.append(present_roles);
- if (present_roles)
- builder.append(roles);
-
- return builder.toHashCode();
- }
-
- public int compareTo(TListSentryRolesResponse other) {
- if (!getClass().equals(other.getClass())) {
- return getClass().getName().compareTo(other.getClass().getName());
- }
-
- int lastComparison = 0;
- TListSentryRolesResponse typedOther = (TListSentryRolesResponse)other;
-
- lastComparison = Boolean.valueOf(isSetStatus()).compareTo(typedOther.isSetStatus());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetStatus()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.status, typedOther.status);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetRoles()).compareTo(typedOther.isSetRoles());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetRoles()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.roles, typedOther.roles);
- 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("TListSentryRolesResponse(");
- boolean first = true;
-
- sb.append("status:");
- if (this.status == null) {
- sb.append("null");
- } else {
- sb.append(this.status);
- }
- first = false;
- if (isSetRoles()) {
- if (!first) sb.append(", ");
- sb.append("roles:");
- if (this.roles == null) {
- sb.append("null");
- } else {
- sb.append(this.roles);
- }
- first = false;
- }
- sb.append(")");
- return sb.toString();
- }
-
- public void validate() throws org.apache.thrift.TException {
- // check for required fields
- if (!isSetStatus()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'status' is unset! Struct:" + toString());
- }
-
- // check for sub-struct validity
- if (status != null) {
- status.validate();
- }
- }
-
- private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
- try {
- write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
- try {
- read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private static class TListSentryRolesResponseStandardSchemeFactory implements SchemeFactory {
- public TListSentryRolesResponseStandardScheme getScheme() {
- return new TListSentryRolesResponseStandardScheme();
- }
- }
-
- private static class TListSentryRolesResponseStandardScheme extends StandardScheme<TListSentryRolesResponse> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TListSentryRolesResponse struct) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TField schemeField;
- iprot.readStructBegin();
- while (true)
- {
- schemeField = iprot.readFieldBegin();
- if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
- break;
- }
- switch (schemeField.id) {
- case 1: // STATUS
- if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
- struct.status = new org.apache.sentry.service.thrift.TSentryResponseStatus();
- struct.status.read(iprot);
- struct.setStatusIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 2: // ROLES
- if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
- {
- org.apache.thrift.protocol.TSet _set24 = iprot.readSetBegin();
- struct.roles = new HashSet<TSentryRole>(2*_set24.size);
- for (int _i25 = 0; _i25 < _set24.size; ++_i25)
- {
- TSentryRole _elem26; // required
- _elem26 = new TSentryRole();
- _elem26.read(iprot);
- struct.roles.add(_elem26);
- }
- iprot.readSetEnd();
- }
- struct.setRolesIsSet(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, TListSentryRolesResponse struct) throws org.apache.thrift.TException {
- struct.validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- if (struct.status != null) {
- oprot.writeFieldBegin(STATUS_FIELD_DESC);
- struct.status.write(oprot);
- oprot.writeFieldEnd();
- }
- if (struct.roles != null) {
- if (struct.isSetRoles()) {
- oprot.writeFieldBegin(ROLES_FIELD_DESC);
- {
- oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, struct.roles.size()));
- for (TSentryRole _iter27 : struct.roles)
- {
- _iter27.write(oprot);
- }
- oprot.writeSetEnd();
- }
- oprot.writeFieldEnd();
- }
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TListSentryRolesResponseTupleSchemeFactory implements SchemeFactory {
- public TListSentryRolesResponseTupleScheme getScheme() {
- return new TListSentryRolesResponseTupleScheme();
- }
- }
-
- private static class TListSentryRolesResponseTupleScheme extends TupleScheme<TListSentryRolesResponse> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, TListSentryRolesResponse struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- struct.status.write(oprot);
- BitSet optionals = new BitSet();
- if (struct.isSetRoles()) {
- optionals.set(0);
- }
- oprot.writeBitSet(optionals, 1);
- if (struct.isSetRoles()) {
- {
- oprot.writeI32(struct.roles.size());
- for (TSentryRole _iter28 : struct.roles)
- {
- _iter28.write(oprot);
- }
- }
- }
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TListSentryRolesResponse struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- struct.status = new org.apache.sentry.service.thrift.TSentryResponseStatus();
- struct.status.read(iprot);
- struct.setStatusIsSet(true);
- BitSet incoming = iprot.readBitSet(1);
- if (incoming.get(0)) {
- {
- org.apache.thrift.protocol.TSet _set29 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
- struct.roles = new HashSet<TSentryRole>(2*_set29.size);
- for (int _i30 = 0; _i30 < _set29.size; ++_i30)
- {
- TSentryRole _elem31; // required
- _elem31 = new TSentryRole();
- _elem31.read(iprot);
- struct.roles.add(_elem31);
- }
- }
- struct.setRolesIsSet(true);
- }
- }
- }
-
-}
-
[21/25] SENTRY-432. HDFS ingration. Initial patch
Posted by pr...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleAddGroupsRequest.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleAddGroupsRequest.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleAddGroupsRequest.java
deleted file mode 100644
index 21efbd0..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleAddGroupsRequest.java
+++ /dev/null
@@ -1,742 +0,0 @@
-/**
- * Autogenerated by Thrift Compiler (0.9.0)
- *
- * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
- * @generated
- */
-package org.apache.sentry.provider.db.service.thrift;
-
-import org.apache.commons.lang.builder.HashCodeBuilder;
-import org.apache.thrift.scheme.IScheme;
-import org.apache.thrift.scheme.SchemeFactory;
-import org.apache.thrift.scheme.StandardScheme;
-
-import org.apache.thrift.scheme.TupleScheme;
-import org.apache.thrift.protocol.TTupleProtocol;
-import org.apache.thrift.protocol.TProtocolException;
-import org.apache.thrift.EncodingUtils;
-import org.apache.thrift.TException;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.EnumMap;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.EnumSet;
-import java.util.Collections;
-import java.util.BitSet;
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class TAlterSentryRoleAddGroupsRequest implements org.apache.thrift.TBase<TAlterSentryRoleAddGroupsRequest, TAlterSentryRoleAddGroupsRequest._Fields>, java.io.Serializable, Cloneable {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TAlterSentryRoleAddGroupsRequest");
-
- private static final org.apache.thrift.protocol.TField PROTOCOL_VERSION_FIELD_DESC = new org.apache.thrift.protocol.TField("protocol_version", org.apache.thrift.protocol.TType.I32, (short)1);
- private static final org.apache.thrift.protocol.TField REQUESTOR_USER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("requestorUserName", org.apache.thrift.protocol.TType.STRING, (short)2);
- private static final org.apache.thrift.protocol.TField ROLE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("roleName", org.apache.thrift.protocol.TType.STRING, (short)3);
- 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)5);
-
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TAlterSentryRoleAddGroupsRequestStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TAlterSentryRoleAddGroupsRequestTupleSchemeFactory());
- }
-
- private int protocol_version; // required
- private String requestorUserName; // required
- private String roleName; // required
- private Set<TSentryGroup> groups; // required
-
- /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
- public enum _Fields implements org.apache.thrift.TFieldIdEnum {
- PROTOCOL_VERSION((short)1, "protocol_version"),
- REQUESTOR_USER_NAME((short)2, "requestorUserName"),
- ROLE_NAME((short)3, "roleName"),
- GROUPS((short)5, "groups");
-
- private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
-
- static {
- for (_Fields field : EnumSet.allOf(_Fields.class)) {
- byName.put(field.getFieldName(), field);
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, or null if its not found.
- */
- public static _Fields findByThriftId(int fieldId) {
- switch(fieldId) {
- case 1: // PROTOCOL_VERSION
- return PROTOCOL_VERSION;
- case 2: // REQUESTOR_USER_NAME
- return REQUESTOR_USER_NAME;
- case 3: // ROLE_NAME
- return ROLE_NAME;
- case 5: // GROUPS
- return GROUPS;
- default:
- return null;
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, throwing an exception
- * if it is not found.
- */
- public static _Fields findByThriftIdOrThrow(int fieldId) {
- _Fields fields = findByThriftId(fieldId);
- if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
- return fields;
- }
-
- /**
- * Find the _Fields constant that matches name, or null if its not found.
- */
- public static _Fields findByName(String name) {
- return byName.get(name);
- }
-
- private final short _thriftId;
- private final String _fieldName;
-
- _Fields(short thriftId, String fieldName) {
- _thriftId = thriftId;
- _fieldName = fieldName;
- }
-
- public short getThriftFieldId() {
- return _thriftId;
- }
-
- public String getFieldName() {
- return _fieldName;
- }
- }
-
- // isset id assignments
- private static final int __PROTOCOL_VERSION_ISSET_ID = 0;
- private byte __isset_bitfield = 0;
- public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
- static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
- tmpMap.put(_Fields.PROTOCOL_VERSION, new org.apache.thrift.meta_data.FieldMetaData("protocol_version", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
- tmpMap.put(_Fields.REQUESTOR_USER_NAME, new org.apache.thrift.meta_data.FieldMetaData("requestorUserName", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.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))));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TAlterSentryRoleAddGroupsRequest.class, metaDataMap);
- }
-
- public TAlterSentryRoleAddGroupsRequest() {
- this.protocol_version = 1;
-
- }
-
- public TAlterSentryRoleAddGroupsRequest(
- int protocol_version,
- String requestorUserName,
- String roleName,
- Set<TSentryGroup> groups)
- {
- this();
- this.protocol_version = protocol_version;
- setProtocol_versionIsSet(true);
- this.requestorUserName = requestorUserName;
- this.roleName = roleName;
- this.groups = groups;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TAlterSentryRoleAddGroupsRequest(TAlterSentryRoleAddGroupsRequest other) {
- __isset_bitfield = other.__isset_bitfield;
- this.protocol_version = other.protocol_version;
- if (other.isSetRequestorUserName()) {
- this.requestorUserName = other.requestorUserName;
- }
- if (other.isSetRoleName()) {
- this.roleName = other.roleName;
- }
- if (other.isSetGroups()) {
- Set<TSentryGroup> __this__groups = new HashSet<TSentryGroup>();
- for (TSentryGroup other_element : other.groups) {
- __this__groups.add(new TSentryGroup(other_element));
- }
- this.groups = __this__groups;
- }
- }
-
- public TAlterSentryRoleAddGroupsRequest deepCopy() {
- return new TAlterSentryRoleAddGroupsRequest(this);
- }
-
- @Override
- public void clear() {
- this.protocol_version = 1;
-
- this.requestorUserName = null;
- this.roleName = null;
- this.groups = null;
- }
-
- public int getProtocol_version() {
- return this.protocol_version;
- }
-
- public void setProtocol_version(int protocol_version) {
- this.protocol_version = protocol_version;
- setProtocol_versionIsSet(true);
- }
-
- public void unsetProtocol_version() {
- __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __PROTOCOL_VERSION_ISSET_ID);
- }
-
- /** Returns true if field protocol_version is set (has been assigned a value) and false otherwise */
- public boolean isSetProtocol_version() {
- return EncodingUtils.testBit(__isset_bitfield, __PROTOCOL_VERSION_ISSET_ID);
- }
-
- public void setProtocol_versionIsSet(boolean value) {
- __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __PROTOCOL_VERSION_ISSET_ID, value);
- }
-
- public String getRequestorUserName() {
- return this.requestorUserName;
- }
-
- public void setRequestorUserName(String requestorUserName) {
- this.requestorUserName = requestorUserName;
- }
-
- public void unsetRequestorUserName() {
- this.requestorUserName = null;
- }
-
- /** Returns true if field requestorUserName is set (has been assigned a value) and false otherwise */
- public boolean isSetRequestorUserName() {
- return this.requestorUserName != null;
- }
-
- public void setRequestorUserNameIsSet(boolean value) {
- if (!value) {
- this.requestorUserName = null;
- }
- }
-
- public 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 void setFieldValue(_Fields field, Object value) {
- switch (field) {
- case PROTOCOL_VERSION:
- if (value == null) {
- unsetProtocol_version();
- } else {
- setProtocol_version((Integer)value);
- }
- break;
-
- case REQUESTOR_USER_NAME:
- if (value == null) {
- unsetRequestorUserName();
- } else {
- setRequestorUserName((String)value);
- }
- break;
-
- case ROLE_NAME:
- if (value == null) {
- unsetRoleName();
- } else {
- setRoleName((String)value);
- }
- break;
-
- case GROUPS:
- if (value == null) {
- unsetGroups();
- } else {
- setGroups((Set<TSentryGroup>)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case PROTOCOL_VERSION:
- return Integer.valueOf(getProtocol_version());
-
- case REQUESTOR_USER_NAME:
- return getRequestorUserName();
-
- case ROLE_NAME:
- return getRoleName();
-
- case GROUPS:
- return getGroups();
-
- }
- throw new IllegalStateException();
- }
-
- /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
- public boolean isSet(_Fields field) {
- if (field == null) {
- throw new IllegalArgumentException();
- }
-
- switch (field) {
- case PROTOCOL_VERSION:
- return isSetProtocol_version();
- case REQUESTOR_USER_NAME:
- return isSetRequestorUserName();
- case ROLE_NAME:
- return isSetRoleName();
- case GROUPS:
- return isSetGroups();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TAlterSentryRoleAddGroupsRequest)
- return this.equals((TAlterSentryRoleAddGroupsRequest)that);
- return false;
- }
-
- public boolean equals(TAlterSentryRoleAddGroupsRequest that) {
- if (that == null)
- return false;
-
- boolean this_present_protocol_version = true;
- boolean that_present_protocol_version = true;
- if (this_present_protocol_version || that_present_protocol_version) {
- if (!(this_present_protocol_version && that_present_protocol_version))
- return false;
- if (this.protocol_version != that.protocol_version)
- return false;
- }
-
- boolean this_present_requestorUserName = true && this.isSetRequestorUserName();
- boolean that_present_requestorUserName = true && that.isSetRequestorUserName();
- if (this_present_requestorUserName || that_present_requestorUserName) {
- if (!(this_present_requestorUserName && that_present_requestorUserName))
- return false;
- if (!this.requestorUserName.equals(that.requestorUserName))
- return false;
- }
-
- boolean this_present_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;
- }
-
- return true;
- }
-
- @Override
- public int hashCode() {
- HashCodeBuilder builder = new HashCodeBuilder();
-
- boolean present_protocol_version = true;
- builder.append(present_protocol_version);
- if (present_protocol_version)
- builder.append(protocol_version);
-
- boolean present_requestorUserName = true && (isSetRequestorUserName());
- builder.append(present_requestorUserName);
- if (present_requestorUserName)
- builder.append(requestorUserName);
-
- boolean present_roleName = true && (isSetRoleName());
- builder.append(present_roleName);
- if (present_roleName)
- builder.append(roleName);
-
- boolean present_groups = true && (isSetGroups());
- builder.append(present_groups);
- if (present_groups)
- builder.append(groups);
-
- return builder.toHashCode();
- }
-
- public int compareTo(TAlterSentryRoleAddGroupsRequest other) {
- if (!getClass().equals(other.getClass())) {
- return getClass().getName().compareTo(other.getClass().getName());
- }
-
- int lastComparison = 0;
- TAlterSentryRoleAddGroupsRequest typedOther = (TAlterSentryRoleAddGroupsRequest)other;
-
- lastComparison = Boolean.valueOf(isSetProtocol_version()).compareTo(typedOther.isSetProtocol_version());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetProtocol_version()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.protocol_version, typedOther.protocol_version);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetRequestorUserName()).compareTo(typedOther.isSetRequestorUserName());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetRequestorUserName()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.requestorUserName, typedOther.requestorUserName);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetRoleName()).compareTo(typedOther.isSetRoleName());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetRoleName()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.roleName, typedOther.roleName);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetGroups()).compareTo(typedOther.isSetGroups());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetGroups()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.groups, typedOther.groups);
- 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("TAlterSentryRoleAddGroupsRequest(");
- boolean first = true;
-
- sb.append("protocol_version:");
- sb.append(this.protocol_version);
- first = false;
- if (!first) sb.append(", ");
- sb.append("requestorUserName:");
- if (this.requestorUserName == null) {
- sb.append("null");
- } else {
- sb.append(this.requestorUserName);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("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;
- sb.append(")");
- return sb.toString();
- }
-
- public void validate() throws org.apache.thrift.TException {
- // check for required fields
- if (!isSetProtocol_version()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'protocol_version' is unset! Struct:" + toString());
- }
-
- if (!isSetRequestorUserName()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'requestorUserName' is unset! Struct:" + toString());
- }
-
- if (!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());
- }
-
- // 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 TAlterSentryRoleAddGroupsRequestStandardSchemeFactory implements SchemeFactory {
- public TAlterSentryRoleAddGroupsRequestStandardScheme getScheme() {
- return new TAlterSentryRoleAddGroupsRequestStandardScheme();
- }
- }
-
- private static class TAlterSentryRoleAddGroupsRequestStandardScheme extends StandardScheme<TAlterSentryRoleAddGroupsRequest> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TAlterSentryRoleAddGroupsRequest struct) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TField schemeField;
- iprot.readStructBegin();
- while (true)
- {
- schemeField = iprot.readFieldBegin();
- if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
- break;
- }
- switch (schemeField.id) {
- case 1: // PROTOCOL_VERSION
- if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
- struct.protocol_version = iprot.readI32();
- struct.setProtocol_versionIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 2: // REQUESTOR_USER_NAME
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.requestorUserName = iprot.readString();
- struct.setRequestorUserNameIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 3: // 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 5: // GROUPS
- if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
- {
- org.apache.thrift.protocol.TSet _set0 = iprot.readSetBegin();
- struct.groups = new HashSet<TSentryGroup>(2*_set0.size);
- for (int _i1 = 0; _i1 < _set0.size; ++_i1)
- {
- TSentryGroup _elem2; // required
- _elem2 = new TSentryGroup();
- _elem2.read(iprot);
- struct.groups.add(_elem2);
- }
- iprot.readSetEnd();
- }
- struct.setGroupsIsSet(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, TAlterSentryRoleAddGroupsRequest struct) throws org.apache.thrift.TException {
- struct.validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- oprot.writeFieldBegin(PROTOCOL_VERSION_FIELD_DESC);
- oprot.writeI32(struct.protocol_version);
- oprot.writeFieldEnd();
- if (struct.requestorUserName != null) {
- oprot.writeFieldBegin(REQUESTOR_USER_NAME_FIELD_DESC);
- oprot.writeString(struct.requestorUserName);
- oprot.writeFieldEnd();
- }
- if (struct.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 _iter3 : struct.groups)
- {
- _iter3.write(oprot);
- }
- oprot.writeSetEnd();
- }
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TAlterSentryRoleAddGroupsRequestTupleSchemeFactory implements SchemeFactory {
- public TAlterSentryRoleAddGroupsRequestTupleScheme getScheme() {
- return new TAlterSentryRoleAddGroupsRequestTupleScheme();
- }
- }
-
- private static class TAlterSentryRoleAddGroupsRequestTupleScheme extends TupleScheme<TAlterSentryRoleAddGroupsRequest> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleAddGroupsRequest struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- oprot.writeI32(struct.protocol_version);
- oprot.writeString(struct.requestorUserName);
- oprot.writeString(struct.roleName);
- {
- oprot.writeI32(struct.groups.size());
- for (TSentryGroup _iter4 : struct.groups)
- {
- _iter4.write(oprot);
- }
- }
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleAddGroupsRequest struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- struct.protocol_version = iprot.readI32();
- struct.setProtocol_versionIsSet(true);
- struct.requestorUserName = iprot.readString();
- struct.setRequestorUserNameIsSet(true);
- struct.roleName = iprot.readString();
- struct.setRoleNameIsSet(true);
- {
- org.apache.thrift.protocol.TSet _set5 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
- struct.groups = new HashSet<TSentryGroup>(2*_set5.size);
- for (int _i6 = 0; _i6 < _set5.size; ++_i6)
- {
- TSentryGroup _elem7; // required
- _elem7 = new TSentryGroup();
- _elem7.read(iprot);
- struct.groups.add(_elem7);
- }
- }
- struct.setGroupsIsSet(true);
- }
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleAddGroupsResponse.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleAddGroupsResponse.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleAddGroupsResponse.java
deleted file mode 100644
index 15b014e..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleAddGroupsResponse.java
+++ /dev/null
@@ -1,390 +0,0 @@
-/**
- * Autogenerated by Thrift Compiler (0.9.0)
- *
- * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
- * @generated
- */
-package org.apache.sentry.provider.db.service.thrift;
-
-import org.apache.commons.lang.builder.HashCodeBuilder;
-import org.apache.thrift.scheme.IScheme;
-import org.apache.thrift.scheme.SchemeFactory;
-import org.apache.thrift.scheme.StandardScheme;
-
-import org.apache.thrift.scheme.TupleScheme;
-import org.apache.thrift.protocol.TTupleProtocol;
-import org.apache.thrift.protocol.TProtocolException;
-import org.apache.thrift.EncodingUtils;
-import org.apache.thrift.TException;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.EnumMap;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.EnumSet;
-import java.util.Collections;
-import java.util.BitSet;
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class TAlterSentryRoleAddGroupsResponse implements org.apache.thrift.TBase<TAlterSentryRoleAddGroupsResponse, TAlterSentryRoleAddGroupsResponse._Fields>, java.io.Serializable, Cloneable {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TAlterSentryRoleAddGroupsResponse");
-
- private static final org.apache.thrift.protocol.TField STATUS_FIELD_DESC = new org.apache.thrift.protocol.TField("status", org.apache.thrift.protocol.TType.STRUCT, (short)1);
-
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TAlterSentryRoleAddGroupsResponseStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TAlterSentryRoleAddGroupsResponseTupleSchemeFactory());
- }
-
- private org.apache.sentry.service.thrift.TSentryResponseStatus status; // required
-
- /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
- public enum _Fields implements org.apache.thrift.TFieldIdEnum {
- STATUS((short)1, "status");
-
- private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
-
- static {
- for (_Fields field : EnumSet.allOf(_Fields.class)) {
- byName.put(field.getFieldName(), field);
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, or null if its not found.
- */
- public static _Fields findByThriftId(int fieldId) {
- switch(fieldId) {
- case 1: // STATUS
- return STATUS;
- default:
- return null;
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, throwing an exception
- * if it is not found.
- */
- public static _Fields findByThriftIdOrThrow(int fieldId) {
- _Fields fields = findByThriftId(fieldId);
- if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
- return fields;
- }
-
- /**
- * Find the _Fields constant that matches name, or null if its not found.
- */
- public static _Fields findByName(String name) {
- return byName.get(name);
- }
-
- private final short _thriftId;
- private final String _fieldName;
-
- _Fields(short thriftId, String fieldName) {
- _thriftId = thriftId;
- _fieldName = fieldName;
- }
-
- public short getThriftFieldId() {
- return _thriftId;
- }
-
- public String getFieldName() {
- return _fieldName;
- }
- }
-
- // isset id assignments
- public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
- static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
- tmpMap.put(_Fields.STATUS, new org.apache.thrift.meta_data.FieldMetaData("status", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.sentry.service.thrift.TSentryResponseStatus.class)));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TAlterSentryRoleAddGroupsResponse.class, metaDataMap);
- }
-
- public TAlterSentryRoleAddGroupsResponse() {
- }
-
- public TAlterSentryRoleAddGroupsResponse(
- org.apache.sentry.service.thrift.TSentryResponseStatus status)
- {
- this();
- this.status = status;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TAlterSentryRoleAddGroupsResponse(TAlterSentryRoleAddGroupsResponse other) {
- if (other.isSetStatus()) {
- this.status = new org.apache.sentry.service.thrift.TSentryResponseStatus(other.status);
- }
- }
-
- public TAlterSentryRoleAddGroupsResponse deepCopy() {
- return new TAlterSentryRoleAddGroupsResponse(this);
- }
-
- @Override
- public void clear() {
- this.status = null;
- }
-
- public org.apache.sentry.service.thrift.TSentryResponseStatus getStatus() {
- return this.status;
- }
-
- public void setStatus(org.apache.sentry.service.thrift.TSentryResponseStatus status) {
- this.status = status;
- }
-
- public void unsetStatus() {
- this.status = null;
- }
-
- /** Returns true if field status is set (has been assigned a value) and false otherwise */
- public boolean isSetStatus() {
- return this.status != null;
- }
-
- public void setStatusIsSet(boolean value) {
- if (!value) {
- this.status = null;
- }
- }
-
- public void setFieldValue(_Fields field, Object value) {
- switch (field) {
- case STATUS:
- if (value == null) {
- unsetStatus();
- } else {
- setStatus((org.apache.sentry.service.thrift.TSentryResponseStatus)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case STATUS:
- return getStatus();
-
- }
- throw new IllegalStateException();
- }
-
- /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
- public boolean isSet(_Fields field) {
- if (field == null) {
- throw new IllegalArgumentException();
- }
-
- switch (field) {
- case STATUS:
- return isSetStatus();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TAlterSentryRoleAddGroupsResponse)
- return this.equals((TAlterSentryRoleAddGroupsResponse)that);
- return false;
- }
-
- public boolean equals(TAlterSentryRoleAddGroupsResponse that) {
- if (that == null)
- return false;
-
- boolean this_present_status = true && this.isSetStatus();
- boolean that_present_status = true && that.isSetStatus();
- if (this_present_status || that_present_status) {
- if (!(this_present_status && that_present_status))
- return false;
- if (!this.status.equals(that.status))
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode() {
- HashCodeBuilder builder = new HashCodeBuilder();
-
- boolean present_status = true && (isSetStatus());
- builder.append(present_status);
- if (present_status)
- builder.append(status);
-
- return builder.toHashCode();
- }
-
- public int compareTo(TAlterSentryRoleAddGroupsResponse other) {
- if (!getClass().equals(other.getClass())) {
- return getClass().getName().compareTo(other.getClass().getName());
- }
-
- int lastComparison = 0;
- TAlterSentryRoleAddGroupsResponse typedOther = (TAlterSentryRoleAddGroupsResponse)other;
-
- lastComparison = Boolean.valueOf(isSetStatus()).compareTo(typedOther.isSetStatus());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetStatus()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.status, typedOther.status);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- 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("TAlterSentryRoleAddGroupsResponse(");
- boolean first = true;
-
- sb.append("status:");
- if (this.status == null) {
- sb.append("null");
- } else {
- sb.append(this.status);
- }
- first = false;
- sb.append(")");
- return sb.toString();
- }
-
- public void validate() throws org.apache.thrift.TException {
- // check for required fields
- if (!isSetStatus()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'status' is unset! Struct:" + toString());
- }
-
- // check for sub-struct validity
- if (status != null) {
- status.validate();
- }
- }
-
- private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
- try {
- write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
- try {
- read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private static class TAlterSentryRoleAddGroupsResponseStandardSchemeFactory implements SchemeFactory {
- public TAlterSentryRoleAddGroupsResponseStandardScheme getScheme() {
- return new TAlterSentryRoleAddGroupsResponseStandardScheme();
- }
- }
-
- private static class TAlterSentryRoleAddGroupsResponseStandardScheme extends StandardScheme<TAlterSentryRoleAddGroupsResponse> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TAlterSentryRoleAddGroupsResponse struct) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TField schemeField;
- iprot.readStructBegin();
- while (true)
- {
- schemeField = iprot.readFieldBegin();
- if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
- break;
- }
- switch (schemeField.id) {
- case 1: // STATUS
- if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
- struct.status = new org.apache.sentry.service.thrift.TSentryResponseStatus();
- struct.status.read(iprot);
- struct.setStatusIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- 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, TAlterSentryRoleAddGroupsResponse struct) throws org.apache.thrift.TException {
- struct.validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- if (struct.status != null) {
- oprot.writeFieldBegin(STATUS_FIELD_DESC);
- struct.status.write(oprot);
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TAlterSentryRoleAddGroupsResponseTupleSchemeFactory implements SchemeFactory {
- public TAlterSentryRoleAddGroupsResponseTupleScheme getScheme() {
- return new TAlterSentryRoleAddGroupsResponseTupleScheme();
- }
- }
-
- private static class TAlterSentryRoleAddGroupsResponseTupleScheme extends TupleScheme<TAlterSentryRoleAddGroupsResponse> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleAddGroupsResponse struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- struct.status.write(oprot);
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleAddGroupsResponse struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- struct.status = new org.apache.sentry.service.thrift.TSentryResponseStatus();
- struct.status.read(iprot);
- struct.setStatusIsSet(true);
- }
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleDeleteGroupsRequest.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleDeleteGroupsRequest.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleDeleteGroupsRequest.java
deleted file mode 100644
index 58e9870..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleDeleteGroupsRequest.java
+++ /dev/null
@@ -1,742 +0,0 @@
-/**
- * Autogenerated by Thrift Compiler (0.9.0)
- *
- * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
- * @generated
- */
-package org.apache.sentry.provider.db.service.thrift;
-
-import org.apache.commons.lang.builder.HashCodeBuilder;
-import org.apache.thrift.scheme.IScheme;
-import org.apache.thrift.scheme.SchemeFactory;
-import org.apache.thrift.scheme.StandardScheme;
-
-import org.apache.thrift.scheme.TupleScheme;
-import org.apache.thrift.protocol.TTupleProtocol;
-import org.apache.thrift.protocol.TProtocolException;
-import org.apache.thrift.EncodingUtils;
-import org.apache.thrift.TException;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.EnumMap;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.EnumSet;
-import java.util.Collections;
-import java.util.BitSet;
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class TAlterSentryRoleDeleteGroupsRequest implements org.apache.thrift.TBase<TAlterSentryRoleDeleteGroupsRequest, TAlterSentryRoleDeleteGroupsRequest._Fields>, java.io.Serializable, Cloneable {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TAlterSentryRoleDeleteGroupsRequest");
-
- private static final org.apache.thrift.protocol.TField PROTOCOL_VERSION_FIELD_DESC = new org.apache.thrift.protocol.TField("protocol_version", org.apache.thrift.protocol.TType.I32, (short)1);
- private static final org.apache.thrift.protocol.TField REQUESTOR_USER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("requestorUserName", org.apache.thrift.protocol.TType.STRING, (short)2);
- private static final org.apache.thrift.protocol.TField ROLE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("roleName", org.apache.thrift.protocol.TType.STRING, (short)3);
- 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)5);
-
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TAlterSentryRoleDeleteGroupsRequestStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TAlterSentryRoleDeleteGroupsRequestTupleSchemeFactory());
- }
-
- private int protocol_version; // required
- private String requestorUserName; // required
- private String roleName; // required
- private Set<TSentryGroup> groups; // required
-
- /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
- public enum _Fields implements org.apache.thrift.TFieldIdEnum {
- PROTOCOL_VERSION((short)1, "protocol_version"),
- REQUESTOR_USER_NAME((short)2, "requestorUserName"),
- ROLE_NAME((short)3, "roleName"),
- GROUPS((short)5, "groups");
-
- private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
-
- static {
- for (_Fields field : EnumSet.allOf(_Fields.class)) {
- byName.put(field.getFieldName(), field);
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, or null if its not found.
- */
- public static _Fields findByThriftId(int fieldId) {
- switch(fieldId) {
- case 1: // PROTOCOL_VERSION
- return PROTOCOL_VERSION;
- case 2: // REQUESTOR_USER_NAME
- return REQUESTOR_USER_NAME;
- case 3: // ROLE_NAME
- return ROLE_NAME;
- case 5: // GROUPS
- return GROUPS;
- default:
- return null;
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, throwing an exception
- * if it is not found.
- */
- public static _Fields findByThriftIdOrThrow(int fieldId) {
- _Fields fields = findByThriftId(fieldId);
- if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
- return fields;
- }
-
- /**
- * Find the _Fields constant that matches name, or null if its not found.
- */
- public static _Fields findByName(String name) {
- return byName.get(name);
- }
-
- private final short _thriftId;
- private final String _fieldName;
-
- _Fields(short thriftId, String fieldName) {
- _thriftId = thriftId;
- _fieldName = fieldName;
- }
-
- public short getThriftFieldId() {
- return _thriftId;
- }
-
- public String getFieldName() {
- return _fieldName;
- }
- }
-
- // isset id assignments
- private static final int __PROTOCOL_VERSION_ISSET_ID = 0;
- private byte __isset_bitfield = 0;
- public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
- static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
- tmpMap.put(_Fields.PROTOCOL_VERSION, new org.apache.thrift.meta_data.FieldMetaData("protocol_version", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
- tmpMap.put(_Fields.REQUESTOR_USER_NAME, new org.apache.thrift.meta_data.FieldMetaData("requestorUserName", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.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))));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TAlterSentryRoleDeleteGroupsRequest.class, metaDataMap);
- }
-
- public TAlterSentryRoleDeleteGroupsRequest() {
- this.protocol_version = 1;
-
- }
-
- public TAlterSentryRoleDeleteGroupsRequest(
- int protocol_version,
- String requestorUserName,
- String roleName,
- Set<TSentryGroup> groups)
- {
- this();
- this.protocol_version = protocol_version;
- setProtocol_versionIsSet(true);
- this.requestorUserName = requestorUserName;
- this.roleName = roleName;
- this.groups = groups;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TAlterSentryRoleDeleteGroupsRequest(TAlterSentryRoleDeleteGroupsRequest other) {
- __isset_bitfield = other.__isset_bitfield;
- this.protocol_version = other.protocol_version;
- if (other.isSetRequestorUserName()) {
- this.requestorUserName = other.requestorUserName;
- }
- if (other.isSetRoleName()) {
- this.roleName = other.roleName;
- }
- if (other.isSetGroups()) {
- Set<TSentryGroup> __this__groups = new HashSet<TSentryGroup>();
- for (TSentryGroup other_element : other.groups) {
- __this__groups.add(new TSentryGroup(other_element));
- }
- this.groups = __this__groups;
- }
- }
-
- public TAlterSentryRoleDeleteGroupsRequest deepCopy() {
- return new TAlterSentryRoleDeleteGroupsRequest(this);
- }
-
- @Override
- public void clear() {
- this.protocol_version = 1;
-
- this.requestorUserName = null;
- this.roleName = null;
- this.groups = null;
- }
-
- public int getProtocol_version() {
- return this.protocol_version;
- }
-
- public void setProtocol_version(int protocol_version) {
- this.protocol_version = protocol_version;
- setProtocol_versionIsSet(true);
- }
-
- public void unsetProtocol_version() {
- __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __PROTOCOL_VERSION_ISSET_ID);
- }
-
- /** Returns true if field protocol_version is set (has been assigned a value) and false otherwise */
- public boolean isSetProtocol_version() {
- return EncodingUtils.testBit(__isset_bitfield, __PROTOCOL_VERSION_ISSET_ID);
- }
-
- public void setProtocol_versionIsSet(boolean value) {
- __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __PROTOCOL_VERSION_ISSET_ID, value);
- }
-
- public String getRequestorUserName() {
- return this.requestorUserName;
- }
-
- public void setRequestorUserName(String requestorUserName) {
- this.requestorUserName = requestorUserName;
- }
-
- public void unsetRequestorUserName() {
- this.requestorUserName = null;
- }
-
- /** Returns true if field requestorUserName is set (has been assigned a value) and false otherwise */
- public boolean isSetRequestorUserName() {
- return this.requestorUserName != null;
- }
-
- public void setRequestorUserNameIsSet(boolean value) {
- if (!value) {
- this.requestorUserName = null;
- }
- }
-
- public 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 void setFieldValue(_Fields field, Object value) {
- switch (field) {
- case PROTOCOL_VERSION:
- if (value == null) {
- unsetProtocol_version();
- } else {
- setProtocol_version((Integer)value);
- }
- break;
-
- case REQUESTOR_USER_NAME:
- if (value == null) {
- unsetRequestorUserName();
- } else {
- setRequestorUserName((String)value);
- }
- break;
-
- case ROLE_NAME:
- if (value == null) {
- unsetRoleName();
- } else {
- setRoleName((String)value);
- }
- break;
-
- case GROUPS:
- if (value == null) {
- unsetGroups();
- } else {
- setGroups((Set<TSentryGroup>)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case PROTOCOL_VERSION:
- return Integer.valueOf(getProtocol_version());
-
- case REQUESTOR_USER_NAME:
- return getRequestorUserName();
-
- case ROLE_NAME:
- return getRoleName();
-
- case GROUPS:
- return getGroups();
-
- }
- throw new IllegalStateException();
- }
-
- /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
- public boolean isSet(_Fields field) {
- if (field == null) {
- throw new IllegalArgumentException();
- }
-
- switch (field) {
- case PROTOCOL_VERSION:
- return isSetProtocol_version();
- case REQUESTOR_USER_NAME:
- return isSetRequestorUserName();
- case ROLE_NAME:
- return isSetRoleName();
- case GROUPS:
- return isSetGroups();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TAlterSentryRoleDeleteGroupsRequest)
- return this.equals((TAlterSentryRoleDeleteGroupsRequest)that);
- return false;
- }
-
- public boolean equals(TAlterSentryRoleDeleteGroupsRequest that) {
- if (that == null)
- return false;
-
- boolean this_present_protocol_version = true;
- boolean that_present_protocol_version = true;
- if (this_present_protocol_version || that_present_protocol_version) {
- if (!(this_present_protocol_version && that_present_protocol_version))
- return false;
- if (this.protocol_version != that.protocol_version)
- return false;
- }
-
- boolean this_present_requestorUserName = true && this.isSetRequestorUserName();
- boolean that_present_requestorUserName = true && that.isSetRequestorUserName();
- if (this_present_requestorUserName || that_present_requestorUserName) {
- if (!(this_present_requestorUserName && that_present_requestorUserName))
- return false;
- if (!this.requestorUserName.equals(that.requestorUserName))
- return false;
- }
-
- boolean this_present_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;
- }
-
- return true;
- }
-
- @Override
- public int hashCode() {
- HashCodeBuilder builder = new HashCodeBuilder();
-
- boolean present_protocol_version = true;
- builder.append(present_protocol_version);
- if (present_protocol_version)
- builder.append(protocol_version);
-
- boolean present_requestorUserName = true && (isSetRequestorUserName());
- builder.append(present_requestorUserName);
- if (present_requestorUserName)
- builder.append(requestorUserName);
-
- boolean present_roleName = true && (isSetRoleName());
- builder.append(present_roleName);
- if (present_roleName)
- builder.append(roleName);
-
- boolean present_groups = true && (isSetGroups());
- builder.append(present_groups);
- if (present_groups)
- builder.append(groups);
-
- return builder.toHashCode();
- }
-
- public int compareTo(TAlterSentryRoleDeleteGroupsRequest other) {
- if (!getClass().equals(other.getClass())) {
- return getClass().getName().compareTo(other.getClass().getName());
- }
-
- int lastComparison = 0;
- TAlterSentryRoleDeleteGroupsRequest typedOther = (TAlterSentryRoleDeleteGroupsRequest)other;
-
- lastComparison = Boolean.valueOf(isSetProtocol_version()).compareTo(typedOther.isSetProtocol_version());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetProtocol_version()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.protocol_version, typedOther.protocol_version);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetRequestorUserName()).compareTo(typedOther.isSetRequestorUserName());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetRequestorUserName()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.requestorUserName, typedOther.requestorUserName);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetRoleName()).compareTo(typedOther.isSetRoleName());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetRoleName()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.roleName, typedOther.roleName);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetGroups()).compareTo(typedOther.isSetGroups());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetGroups()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.groups, typedOther.groups);
- 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("TAlterSentryRoleDeleteGroupsRequest(");
- boolean first = true;
-
- sb.append("protocol_version:");
- sb.append(this.protocol_version);
- first = false;
- if (!first) sb.append(", ");
- sb.append("requestorUserName:");
- if (this.requestorUserName == null) {
- sb.append("null");
- } else {
- sb.append(this.requestorUserName);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("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;
- sb.append(")");
- return sb.toString();
- }
-
- public void validate() throws org.apache.thrift.TException {
- // check for required fields
- if (!isSetProtocol_version()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'protocol_version' is unset! Struct:" + toString());
- }
-
- if (!isSetRequestorUserName()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'requestorUserName' is unset! Struct:" + toString());
- }
-
- if (!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());
- }
-
- // 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 TAlterSentryRoleDeleteGroupsRequestStandardSchemeFactory implements SchemeFactory {
- public TAlterSentryRoleDeleteGroupsRequestStandardScheme getScheme() {
- return new TAlterSentryRoleDeleteGroupsRequestStandardScheme();
- }
- }
-
- private static class TAlterSentryRoleDeleteGroupsRequestStandardScheme extends StandardScheme<TAlterSentryRoleDeleteGroupsRequest> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TAlterSentryRoleDeleteGroupsRequest struct) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TField schemeField;
- iprot.readStructBegin();
- while (true)
- {
- schemeField = iprot.readFieldBegin();
- if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
- break;
- }
- switch (schemeField.id) {
- case 1: // PROTOCOL_VERSION
- if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
- struct.protocol_version = iprot.readI32();
- struct.setProtocol_versionIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 2: // REQUESTOR_USER_NAME
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.requestorUserName = iprot.readString();
- struct.setRequestorUserNameIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 3: // 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 5: // GROUPS
- if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
- {
- org.apache.thrift.protocol.TSet _set8 = iprot.readSetBegin();
- struct.groups = new HashSet<TSentryGroup>(2*_set8.size);
- for (int _i9 = 0; _i9 < _set8.size; ++_i9)
- {
- TSentryGroup _elem10; // required
- _elem10 = new TSentryGroup();
- _elem10.read(iprot);
- struct.groups.add(_elem10);
- }
- iprot.readSetEnd();
- }
- struct.setGroupsIsSet(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, TAlterSentryRoleDeleteGroupsRequest struct) throws org.apache.thrift.TException {
- struct.validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- oprot.writeFieldBegin(PROTOCOL_VERSION_FIELD_DESC);
- oprot.writeI32(struct.protocol_version);
- oprot.writeFieldEnd();
- if (struct.requestorUserName != null) {
- oprot.writeFieldBegin(REQUESTOR_USER_NAME_FIELD_DESC);
- oprot.writeString(struct.requestorUserName);
- oprot.writeFieldEnd();
- }
- if (struct.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 _iter11 : struct.groups)
- {
- _iter11.write(oprot);
- }
- oprot.writeSetEnd();
- }
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TAlterSentryRoleDeleteGroupsRequestTupleSchemeFactory implements SchemeFactory {
- public TAlterSentryRoleDeleteGroupsRequestTupleScheme getScheme() {
- return new TAlterSentryRoleDeleteGroupsRequestTupleScheme();
- }
- }
-
- private static class TAlterSentryRoleDeleteGroupsRequestTupleScheme extends TupleScheme<TAlterSentryRoleDeleteGroupsRequest> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleDeleteGroupsRequest struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- oprot.writeI32(struct.protocol_version);
- oprot.writeString(struct.requestorUserName);
- oprot.writeString(struct.roleName);
- {
- oprot.writeI32(struct.groups.size());
- for (TSentryGroup _iter12 : struct.groups)
- {
- _iter12.write(oprot);
- }
- }
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleDeleteGroupsRequest struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- struct.protocol_version = iprot.readI32();
- struct.setProtocol_versionIsSet(true);
- struct.requestorUserName = iprot.readString();
- struct.setRequestorUserNameIsSet(true);
- struct.roleName = iprot.readString();
- struct.setRoleNameIsSet(true);
- {
- org.apache.thrift.protocol.TSet _set13 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
- struct.groups = new HashSet<TSentryGroup>(2*_set13.size);
- for (int _i14 = 0; _i14 < _set13.size; ++_i14)
- {
- TSentryGroup _elem15; // required
- _elem15 = new TSentryGroup();
- _elem15.read(iprot);
- struct.groups.add(_elem15);
- }
- }
- struct.setGroupsIsSet(true);
- }
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleDeleteGroupsResponse.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleDeleteGroupsResponse.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleDeleteGroupsResponse.java
deleted file mode 100644
index 0efa544..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAlterSentryRoleDeleteGroupsResponse.java
+++ /dev/null
@@ -1,390 +0,0 @@
-/**
- * Autogenerated by Thrift Compiler (0.9.0)
- *
- * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
- * @generated
- */
-package org.apache.sentry.provider.db.service.thrift;
-
-import org.apache.commons.lang.builder.HashCodeBuilder;
-import org.apache.thrift.scheme.IScheme;
-import org.apache.thrift.scheme.SchemeFactory;
-import org.apache.thrift.scheme.StandardScheme;
-
-import org.apache.thrift.scheme.TupleScheme;
-import org.apache.thrift.protocol.TTupleProtocol;
-import org.apache.thrift.protocol.TProtocolException;
-import org.apache.thrift.EncodingUtils;
-import org.apache.thrift.TException;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.EnumMap;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.EnumSet;
-import java.util.Collections;
-import java.util.BitSet;
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class TAlterSentryRoleDeleteGroupsResponse implements org.apache.thrift.TBase<TAlterSentryRoleDeleteGroupsResponse, TAlterSentryRoleDeleteGroupsResponse._Fields>, java.io.Serializable, Cloneable {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TAlterSentryRoleDeleteGroupsResponse");
-
- private static final org.apache.thrift.protocol.TField STATUS_FIELD_DESC = new org.apache.thrift.protocol.TField("status", org.apache.thrift.protocol.TType.STRUCT, (short)1);
-
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TAlterSentryRoleDeleteGroupsResponseStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TAlterSentryRoleDeleteGroupsResponseTupleSchemeFactory());
- }
-
- private org.apache.sentry.service.thrift.TSentryResponseStatus status; // required
-
- /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
- public enum _Fields implements org.apache.thrift.TFieldIdEnum {
- STATUS((short)1, "status");
-
- private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
-
- static {
- for (_Fields field : EnumSet.allOf(_Fields.class)) {
- byName.put(field.getFieldName(), field);
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, or null if its not found.
- */
- public static _Fields findByThriftId(int fieldId) {
- switch(fieldId) {
- case 1: // STATUS
- return STATUS;
- default:
- return null;
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, throwing an exception
- * if it is not found.
- */
- public static _Fields findByThriftIdOrThrow(int fieldId) {
- _Fields fields = findByThriftId(fieldId);
- if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
- return fields;
- }
-
- /**
- * Find the _Fields constant that matches name, or null if its not found.
- */
- public static _Fields findByName(String name) {
- return byName.get(name);
- }
-
- private final short _thriftId;
- private final String _fieldName;
-
- _Fields(short thriftId, String fieldName) {
- _thriftId = thriftId;
- _fieldName = fieldName;
- }
-
- public short getThriftFieldId() {
- return _thriftId;
- }
-
- public String getFieldName() {
- return _fieldName;
- }
- }
-
- // isset id assignments
- public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
- static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
- tmpMap.put(_Fields.STATUS, new org.apache.thrift.meta_data.FieldMetaData("status", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.sentry.service.thrift.TSentryResponseStatus.class)));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TAlterSentryRoleDeleteGroupsResponse.class, metaDataMap);
- }
-
- public TAlterSentryRoleDeleteGroupsResponse() {
- }
-
- public TAlterSentryRoleDeleteGroupsResponse(
- org.apache.sentry.service.thrift.TSentryResponseStatus status)
- {
- this();
- this.status = status;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TAlterSentryRoleDeleteGroupsResponse(TAlterSentryRoleDeleteGroupsResponse other) {
- if (other.isSetStatus()) {
- this.status = new org.apache.sentry.service.thrift.TSentryResponseStatus(other.status);
- }
- }
-
- public TAlterSentryRoleDeleteGroupsResponse deepCopy() {
- return new TAlterSentryRoleDeleteGroupsResponse(this);
- }
-
- @Override
- public void clear() {
- this.status = null;
- }
-
- public org.apache.sentry.service.thrift.TSentryResponseStatus getStatus() {
- return this.status;
- }
-
- public void setStatus(org.apache.sentry.service.thrift.TSentryResponseStatus status) {
- this.status = status;
- }
-
- public void unsetStatus() {
- this.status = null;
- }
-
- /** Returns true if field status is set (has been assigned a value) and false otherwise */
- public boolean isSetStatus() {
- return this.status != null;
- }
-
- public void setStatusIsSet(boolean value) {
- if (!value) {
- this.status = null;
- }
- }
-
- public void setFieldValue(_Fields field, Object value) {
- switch (field) {
- case STATUS:
- if (value == null) {
- unsetStatus();
- } else {
- setStatus((org.apache.sentry.service.thrift.TSentryResponseStatus)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case STATUS:
- return getStatus();
-
- }
- throw new IllegalStateException();
- }
-
- /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
- public boolean isSet(_Fields field) {
- if (field == null) {
- throw new IllegalArgumentException();
- }
-
- switch (field) {
- case STATUS:
- return isSetStatus();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TAlterSentryRoleDeleteGroupsResponse)
- return this.equals((TAlterSentryRoleDeleteGroupsResponse)that);
- return false;
- }
-
- public boolean equals(TAlterSentryRoleDeleteGroupsResponse that) {
- if (that == null)
- return false;
-
- boolean this_present_status = true && this.isSetStatus();
- boolean that_present_status = true && that.isSetStatus();
- if (this_present_status || that_present_status) {
- if (!(this_present_status && that_present_status))
- return false;
- if (!this.status.equals(that.status))
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode() {
- HashCodeBuilder builder = new HashCodeBuilder();
-
- boolean present_status = true && (isSetStatus());
- builder.append(present_status);
- if (present_status)
- builder.append(status);
-
- return builder.toHashCode();
- }
-
- public int compareTo(TAlterSentryRoleDeleteGroupsResponse other) {
- if (!getClass().equals(other.getClass())) {
- return getClass().getName().compareTo(other.getClass().getName());
- }
-
- int lastComparison = 0;
- TAlterSentryRoleDeleteGroupsResponse typedOther = (TAlterSentryRoleDeleteGroupsResponse)other;
-
- lastComparison = Boolean.valueOf(isSetStatus()).compareTo(typedOther.isSetStatus());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetStatus()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.status, typedOther.status);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- 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("TAlterSentryRoleDeleteGroupsResponse(");
- boolean first = true;
-
- sb.append("status:");
- if (this.status == null) {
- sb.append("null");
- } else {
- sb.append(this.status);
- }
- first = false;
- sb.append(")");
- return sb.toString();
- }
-
- public void validate() throws org.apache.thrift.TException {
- // check for required fields
- if (!isSetStatus()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'status' is unset! Struct:" + toString());
- }
-
- // check for sub-struct validity
- if (status != null) {
- status.validate();
- }
- }
-
- private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
- try {
- write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
- try {
- read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private static class TAlterSentryRoleDeleteGroupsResponseStandardSchemeFactory implements SchemeFactory {
- public TAlterSentryRoleDeleteGroupsResponseStandardScheme getScheme() {
- return new TAlterSentryRoleDeleteGroupsResponseStandardScheme();
- }
- }
-
- private static class TAlterSentryRoleDeleteGroupsResponseStandardScheme extends StandardScheme<TAlterSentryRoleDeleteGroupsResponse> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TAlterSentryRoleDeleteGroupsResponse struct) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TField schemeField;
- iprot.readStructBegin();
- while (true)
- {
- schemeField = iprot.readFieldBegin();
- if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
- break;
- }
- switch (schemeField.id) {
- case 1: // STATUS
- if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
- struct.status = new org.apache.sentry.service.thrift.TSentryResponseStatus();
- struct.status.read(iprot);
- struct.setStatusIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- 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, TAlterSentryRoleDeleteGroupsResponse struct) throws org.apache.thrift.TException {
- struct.validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- if (struct.status != null) {
- oprot.writeFieldBegin(STATUS_FIELD_DESC);
- struct.status.write(oprot);
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TAlterSentryRoleDeleteGroupsResponseTupleSchemeFactory implements SchemeFactory {
- public TAlterSentryRoleDeleteGroupsResponseTupleScheme getScheme() {
- return new TAlterSentryRoleDeleteGroupsResponseTupleScheme();
- }
- }
-
- private static class TAlterSentryRoleDeleteGroupsResponseTupleScheme extends TupleScheme<TAlterSentryRoleDeleteGroupsResponse> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleDeleteGroupsResponse struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- struct.status.write(oprot);
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TAlterSentryRoleDeleteGroupsResponse struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- struct.status = new org.apache.sentry.service.thrift.TSentryResponseStatus();
- struct.status.read(iprot);
- struct.setStatusIsSet(true);
- }
- }
-
-}
-
[03/25] SENTRY-432. HDFS ingration. Initial patch
Posted by pr...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryAuthorizable.java
----------------------------------------------------------------------
diff --git a/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryAuthorizable.java b/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryAuthorizable.java
new file mode 100644
index 0000000..59418a3
--- /dev/null
+++ b/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryAuthorizable.java
@@ -0,0 +1,707 @@
+/**
+ * Autogenerated by Thrift Compiler (0.9.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+package org.apache.sentry.provider.db.service.thrift;
+
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EnumMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.EnumSet;
+import java.util.Collections;
+import java.util.BitSet;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class TSentryAuthorizable implements org.apache.thrift.TBase<TSentryAuthorizable, TSentryAuthorizable._Fields>, java.io.Serializable, Cloneable {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TSentryAuthorizable");
+
+ private static final org.apache.thrift.protocol.TField SERVER_FIELD_DESC = new org.apache.thrift.protocol.TField("server", org.apache.thrift.protocol.TType.STRING, (short)1);
+ private static final org.apache.thrift.protocol.TField URI_FIELD_DESC = new org.apache.thrift.protocol.TField("uri", org.apache.thrift.protocol.TType.STRING, (short)2);
+ private static final org.apache.thrift.protocol.TField DB_FIELD_DESC = new org.apache.thrift.protocol.TField("db", org.apache.thrift.protocol.TType.STRING, (short)3);
+ private static final org.apache.thrift.protocol.TField TABLE_FIELD_DESC = new org.apache.thrift.protocol.TField("table", org.apache.thrift.protocol.TType.STRING, (short)4);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new TSentryAuthorizableStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new TSentryAuthorizableTupleSchemeFactory());
+ }
+
+ private String server; // required
+ private String uri; // optional
+ private String db; // optional
+ private String table; // 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 {
+ SERVER((short)1, "server"),
+ URI((short)2, "uri"),
+ DB((short)3, "db"),
+ TABLE((short)4, "table");
+
+ 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: // SERVER
+ return SERVER;
+ case 2: // URI
+ return URI;
+ case 3: // DB
+ return DB;
+ case 4: // TABLE
+ return TABLE;
+ 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 _Fields optionals[] = {_Fields.URI,_Fields.DB,_Fields.TABLE};
+ 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.SERVER, new org.apache.thrift.meta_data.FieldMetaData("server", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields.URI, new org.apache.thrift.meta_data.FieldMetaData("uri", org.apache.thrift.TFieldRequirementType.OPTIONAL,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields.DB, new org.apache.thrift.meta_data.FieldMetaData("db", org.apache.thrift.TFieldRequirementType.OPTIONAL,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields.TABLE, new org.apache.thrift.meta_data.FieldMetaData("table", 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(TSentryAuthorizable.class, metaDataMap);
+ }
+
+ public TSentryAuthorizable() {
+ }
+
+ public TSentryAuthorizable(
+ String server)
+ {
+ this();
+ this.server = server;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public TSentryAuthorizable(TSentryAuthorizable other) {
+ if (other.isSetServer()) {
+ this.server = other.server;
+ }
+ if (other.isSetUri()) {
+ this.uri = other.uri;
+ }
+ if (other.isSetDb()) {
+ this.db = other.db;
+ }
+ if (other.isSetTable()) {
+ this.table = other.table;
+ }
+ }
+
+ public TSentryAuthorizable deepCopy() {
+ return new TSentryAuthorizable(this);
+ }
+
+ @Override
+ public void clear() {
+ this.server = null;
+ this.uri = null;
+ this.db = null;
+ this.table = null;
+ }
+
+ public String getServer() {
+ return this.server;
+ }
+
+ public void setServer(String server) {
+ this.server = server;
+ }
+
+ public void unsetServer() {
+ this.server = null;
+ }
+
+ /** Returns true if field server is set (has been assigned a value) and false otherwise */
+ public boolean isSetServer() {
+ return this.server != null;
+ }
+
+ public void setServerIsSet(boolean value) {
+ if (!value) {
+ this.server = null;
+ }
+ }
+
+ public String getUri() {
+ return this.uri;
+ }
+
+ public void setUri(String uri) {
+ this.uri = uri;
+ }
+
+ public void unsetUri() {
+ this.uri = null;
+ }
+
+ /** Returns true if field uri is set (has been assigned a value) and false otherwise */
+ public boolean isSetUri() {
+ return this.uri != null;
+ }
+
+ public void setUriIsSet(boolean value) {
+ if (!value) {
+ this.uri = null;
+ }
+ }
+
+ public String getDb() {
+ return this.db;
+ }
+
+ public void setDb(String db) {
+ this.db = db;
+ }
+
+ public void unsetDb() {
+ this.db = null;
+ }
+
+ /** Returns true if field db is set (has been assigned a value) and false otherwise */
+ public boolean isSetDb() {
+ return this.db != null;
+ }
+
+ public void setDbIsSet(boolean value) {
+ if (!value) {
+ this.db = null;
+ }
+ }
+
+ public String getTable() {
+ return this.table;
+ }
+
+ public void setTable(String table) {
+ this.table = table;
+ }
+
+ public void unsetTable() {
+ this.table = null;
+ }
+
+ /** Returns true if field table is set (has been assigned a value) and false otherwise */
+ public boolean isSetTable() {
+ return this.table != null;
+ }
+
+ public void setTableIsSet(boolean value) {
+ if (!value) {
+ this.table = null;
+ }
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case SERVER:
+ if (value == null) {
+ unsetServer();
+ } else {
+ setServer((String)value);
+ }
+ break;
+
+ case URI:
+ if (value == null) {
+ unsetUri();
+ } else {
+ setUri((String)value);
+ }
+ break;
+
+ case DB:
+ if (value == null) {
+ unsetDb();
+ } else {
+ setDb((String)value);
+ }
+ break;
+
+ case TABLE:
+ if (value == null) {
+ unsetTable();
+ } else {
+ setTable((String)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case SERVER:
+ return getServer();
+
+ case URI:
+ return getUri();
+
+ case DB:
+ return getDb();
+
+ case TABLE:
+ return getTable();
+
+ }
+ 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 SERVER:
+ return isSetServer();
+ case URI:
+ return isSetUri();
+ case DB:
+ return isSetDb();
+ case TABLE:
+ return isSetTable();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof TSentryAuthorizable)
+ return this.equals((TSentryAuthorizable)that);
+ return false;
+ }
+
+ public boolean equals(TSentryAuthorizable that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_server = true && this.isSetServer();
+ boolean that_present_server = true && that.isSetServer();
+ if (this_present_server || that_present_server) {
+ if (!(this_present_server && that_present_server))
+ return false;
+ if (!this.server.equals(that.server))
+ return false;
+ }
+
+ boolean this_present_uri = true && this.isSetUri();
+ boolean that_present_uri = true && that.isSetUri();
+ if (this_present_uri || that_present_uri) {
+ if (!(this_present_uri && that_present_uri))
+ return false;
+ if (!this.uri.equals(that.uri))
+ return false;
+ }
+
+ boolean this_present_db = true && this.isSetDb();
+ boolean that_present_db = true && that.isSetDb();
+ if (this_present_db || that_present_db) {
+ if (!(this_present_db && that_present_db))
+ return false;
+ if (!this.db.equals(that.db))
+ return false;
+ }
+
+ boolean this_present_table = true && this.isSetTable();
+ boolean that_present_table = true && that.isSetTable();
+ if (this_present_table || that_present_table) {
+ if (!(this_present_table && that_present_table))
+ return false;
+ if (!this.table.equals(that.table))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ HashCodeBuilder builder = new HashCodeBuilder();
+
+ boolean present_server = true && (isSetServer());
+ builder.append(present_server);
+ if (present_server)
+ builder.append(server);
+
+ boolean present_uri = true && (isSetUri());
+ builder.append(present_uri);
+ if (present_uri)
+ builder.append(uri);
+
+ boolean present_db = true && (isSetDb());
+ builder.append(present_db);
+ if (present_db)
+ builder.append(db);
+
+ boolean present_table = true && (isSetTable());
+ builder.append(present_table);
+ if (present_table)
+ builder.append(table);
+
+ return builder.toHashCode();
+ }
+
+ public int compareTo(TSentryAuthorizable other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+ TSentryAuthorizable typedOther = (TSentryAuthorizable)other;
+
+ lastComparison = Boolean.valueOf(isSetServer()).compareTo(typedOther.isSetServer());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetServer()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.server, typedOther.server);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetUri()).compareTo(typedOther.isSetUri());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetUri()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.uri, typedOther.uri);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetDb()).compareTo(typedOther.isSetDb());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetDb()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.db, typedOther.db);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetTable()).compareTo(typedOther.isSetTable());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetTable()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.table, typedOther.table);
+ 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("TSentryAuthorizable(");
+ boolean first = true;
+
+ sb.append("server:");
+ if (this.server == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.server);
+ }
+ first = false;
+ if (isSetUri()) {
+ if (!first) sb.append(", ");
+ sb.append("uri:");
+ if (this.uri == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.uri);
+ }
+ first = false;
+ }
+ if (isSetDb()) {
+ if (!first) sb.append(", ");
+ sb.append("db:");
+ if (this.db == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.db);
+ }
+ first = false;
+ }
+ if (isSetTable()) {
+ if (!first) sb.append(", ");
+ sb.append("table:");
+ if (this.table == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.table);
+ }
+ first = false;
+ }
+ sb.append(")");
+ return sb.toString();
+ }
+
+ public void validate() throws org.apache.thrift.TException {
+ // check for required fields
+ if (!isSetServer()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'server' 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 TSentryAuthorizableStandardSchemeFactory implements SchemeFactory {
+ public TSentryAuthorizableStandardScheme getScheme() {
+ return new TSentryAuthorizableStandardScheme();
+ }
+ }
+
+ private static class TSentryAuthorizableStandardScheme extends StandardScheme<TSentryAuthorizable> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, TSentryAuthorizable 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: // SERVER
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.server = iprot.readString();
+ struct.setServerIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 2: // URI
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.uri = iprot.readString();
+ struct.setUriIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 3: // DB
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.db = iprot.readString();
+ struct.setDbIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 4: // TABLE
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.table = iprot.readString();
+ struct.setTableIsSet(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, TSentryAuthorizable struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.server != null) {
+ oprot.writeFieldBegin(SERVER_FIELD_DESC);
+ oprot.writeString(struct.server);
+ oprot.writeFieldEnd();
+ }
+ if (struct.uri != null) {
+ if (struct.isSetUri()) {
+ oprot.writeFieldBegin(URI_FIELD_DESC);
+ oprot.writeString(struct.uri);
+ oprot.writeFieldEnd();
+ }
+ }
+ if (struct.db != null) {
+ if (struct.isSetDb()) {
+ oprot.writeFieldBegin(DB_FIELD_DESC);
+ oprot.writeString(struct.db);
+ oprot.writeFieldEnd();
+ }
+ }
+ if (struct.table != null) {
+ if (struct.isSetTable()) {
+ oprot.writeFieldBegin(TABLE_FIELD_DESC);
+ oprot.writeString(struct.table);
+ oprot.writeFieldEnd();
+ }
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class TSentryAuthorizableTupleSchemeFactory implements SchemeFactory {
+ public TSentryAuthorizableTupleScheme getScheme() {
+ return new TSentryAuthorizableTupleScheme();
+ }
+ }
+
+ private static class TSentryAuthorizableTupleScheme extends TupleScheme<TSentryAuthorizable> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, TSentryAuthorizable struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ oprot.writeString(struct.server);
+ BitSet optionals = new BitSet();
+ if (struct.isSetUri()) {
+ optionals.set(0);
+ }
+ if (struct.isSetDb()) {
+ optionals.set(1);
+ }
+ if (struct.isSetTable()) {
+ optionals.set(2);
+ }
+ oprot.writeBitSet(optionals, 3);
+ if (struct.isSetUri()) {
+ oprot.writeString(struct.uri);
+ }
+ if (struct.isSetDb()) {
+ oprot.writeString(struct.db);
+ }
+ if (struct.isSetTable()) {
+ oprot.writeString(struct.table);
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, TSentryAuthorizable struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ struct.server = iprot.readString();
+ struct.setServerIsSet(true);
+ BitSet incoming = iprot.readBitSet(3);
+ if (incoming.get(0)) {
+ struct.uri = iprot.readString();
+ struct.setUriIsSet(true);
+ }
+ if (incoming.get(1)) {
+ struct.db = iprot.readString();
+ struct.setDbIsSet(true);
+ }
+ if (incoming.get(2)) {
+ struct.table = iprot.readString();
+ struct.setTableIsSet(true);
+ }
+ }
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryGrantOption.java
----------------------------------------------------------------------
diff --git a/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryGrantOption.java b/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryGrantOption.java
new file mode 100644
index 0000000..856ac21
--- /dev/null
+++ b/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryGrantOption.java
@@ -0,0 +1,48 @@
+/**
+ * Autogenerated by Thrift Compiler (0.9.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+package org.apache.sentry.provider.db.service.thrift;
+
+
+import java.util.Map;
+import java.util.HashMap;
+import org.apache.thrift.TEnum;
+
+public enum TSentryGrantOption implements org.apache.thrift.TEnum {
+ TRUE(1),
+ FALSE(0),
+ UNSET(-1);
+
+ private final int value;
+
+ private TSentryGrantOption(int value) {
+ this.value = value;
+ }
+
+ /**
+ * Get the integer value of this enum value, as defined in the Thrift IDL.
+ */
+ public int getValue() {
+ return value;
+ }
+
+ /**
+ * Find a the enum type by its integer value, as defined in the Thrift IDL.
+ * @return null if the value is not found.
+ */
+ public static TSentryGrantOption findByValue(int value) {
+ switch (value) {
+ case 1:
+ return TRUE;
+ case 0:
+ return FALSE;
+ case -1:
+ return UNSET;
+ default:
+ return null;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryGroup.java
----------------------------------------------------------------------
diff --git a/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryGroup.java b/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryGroup.java
new file mode 100644
index 0000000..4aadd22
--- /dev/null
+++ b/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryGroup.java
@@ -0,0 +1,385 @@
+/**
+ * Autogenerated by Thrift Compiler (0.9.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+package org.apache.sentry.provider.db.service.thrift;
+
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EnumMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.EnumSet;
+import java.util.Collections;
+import java.util.BitSet;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class TSentryGroup implements org.apache.thrift.TBase<TSentryGroup, TSentryGroup._Fields>, java.io.Serializable, Cloneable {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TSentryGroup");
+
+ private static final org.apache.thrift.protocol.TField GROUP_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("groupName", org.apache.thrift.protocol.TType.STRING, (short)1);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new TSentryGroupStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new TSentryGroupTupleSchemeFactory());
+ }
+
+ private String groupName; // 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 {
+ GROUP_NAME((short)1, "groupName");
+
+ 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: // GROUP_NAME
+ return GROUP_NAME;
+ default:
+ return null;
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, throwing an exception
+ * if it is not found.
+ */
+ public static _Fields findByThriftIdOrThrow(int fieldId) {
+ _Fields fields = findByThriftId(fieldId);
+ if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+ return fields;
+ }
+
+ /**
+ * Find the _Fields constant that matches name, or null if its not found.
+ */
+ public static _Fields findByName(String name) {
+ return byName.get(name);
+ }
+
+ private final short _thriftId;
+ private final String _fieldName;
+
+ _Fields(short thriftId, String fieldName) {
+ _thriftId = thriftId;
+ _fieldName = fieldName;
+ }
+
+ public short getThriftFieldId() {
+ return _thriftId;
+ }
+
+ public String getFieldName() {
+ return _fieldName;
+ }
+ }
+
+ // isset id assignments
+ 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.GROUP_NAME, new org.apache.thrift.meta_data.FieldMetaData("groupName", 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(TSentryGroup.class, metaDataMap);
+ }
+
+ public TSentryGroup() {
+ }
+
+ public TSentryGroup(
+ String groupName)
+ {
+ this();
+ this.groupName = groupName;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public TSentryGroup(TSentryGroup other) {
+ if (other.isSetGroupName()) {
+ this.groupName = other.groupName;
+ }
+ }
+
+ public TSentryGroup deepCopy() {
+ return new TSentryGroup(this);
+ }
+
+ @Override
+ public void clear() {
+ this.groupName = null;
+ }
+
+ public String getGroupName() {
+ return this.groupName;
+ }
+
+ public void setGroupName(String groupName) {
+ this.groupName = groupName;
+ }
+
+ public void unsetGroupName() {
+ this.groupName = null;
+ }
+
+ /** Returns true if field groupName is set (has been assigned a value) and false otherwise */
+ public boolean isSetGroupName() {
+ return this.groupName != null;
+ }
+
+ public void setGroupNameIsSet(boolean value) {
+ if (!value) {
+ this.groupName = null;
+ }
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case GROUP_NAME:
+ if (value == null) {
+ unsetGroupName();
+ } else {
+ setGroupName((String)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case GROUP_NAME:
+ return getGroupName();
+
+ }
+ 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 GROUP_NAME:
+ return isSetGroupName();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof TSentryGroup)
+ return this.equals((TSentryGroup)that);
+ return false;
+ }
+
+ public boolean equals(TSentryGroup that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_groupName = true && this.isSetGroupName();
+ boolean that_present_groupName = true && that.isSetGroupName();
+ if (this_present_groupName || that_present_groupName) {
+ if (!(this_present_groupName && that_present_groupName))
+ return false;
+ if (!this.groupName.equals(that.groupName))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ HashCodeBuilder builder = new HashCodeBuilder();
+
+ boolean present_groupName = true && (isSetGroupName());
+ builder.append(present_groupName);
+ if (present_groupName)
+ builder.append(groupName);
+
+ return builder.toHashCode();
+ }
+
+ public int compareTo(TSentryGroup other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+ TSentryGroup typedOther = (TSentryGroup)other;
+
+ lastComparison = Boolean.valueOf(isSetGroupName()).compareTo(typedOther.isSetGroupName());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetGroupName()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.groupName, typedOther.groupName);
+ 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("TSentryGroup(");
+ boolean first = true;
+
+ sb.append("groupName:");
+ if (this.groupName == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.groupName);
+ }
+ first = false;
+ sb.append(")");
+ return sb.toString();
+ }
+
+ public void validate() throws org.apache.thrift.TException {
+ // check for required fields
+ if (!isSetGroupName()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'groupName' 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 TSentryGroupStandardSchemeFactory implements SchemeFactory {
+ public TSentryGroupStandardScheme getScheme() {
+ return new TSentryGroupStandardScheme();
+ }
+ }
+
+ private static class TSentryGroupStandardScheme extends StandardScheme<TSentryGroup> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, TSentryGroup 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: // GROUP_NAME
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.groupName = iprot.readString();
+ struct.setGroupNameIsSet(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, TSentryGroup struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.groupName != null) {
+ oprot.writeFieldBegin(GROUP_NAME_FIELD_DESC);
+ oprot.writeString(struct.groupName);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class TSentryGroupTupleSchemeFactory implements SchemeFactory {
+ public TSentryGroupTupleScheme getScheme() {
+ return new TSentryGroupTupleScheme();
+ }
+ }
+
+ private static class TSentryGroupTupleScheme extends TupleScheme<TSentryGroup> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, TSentryGroup struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ oprot.writeString(struct.groupName);
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, TSentryGroup struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ struct.groupName = iprot.readString();
+ struct.setGroupNameIsSet(true);
+ }
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryPrivilege.java
----------------------------------------------------------------------
diff --git a/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryPrivilege.java b/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryPrivilege.java
new file mode 100644
index 0000000..54b6204
--- /dev/null
+++ b/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryPrivilege.java
@@ -0,0 +1,1251 @@
+/**
+ * Autogenerated by Thrift Compiler (0.9.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+package org.apache.sentry.provider.db.service.thrift;
+
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EnumMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.EnumSet;
+import java.util.Collections;
+import java.util.BitSet;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class TSentryPrivilege implements org.apache.thrift.TBase<TSentryPrivilege, TSentryPrivilege._Fields>, java.io.Serializable, Cloneable {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TSentryPrivilege");
+
+ private static final org.apache.thrift.protocol.TField PRIVILEGE_SCOPE_FIELD_DESC = new org.apache.thrift.protocol.TField("privilegeScope", org.apache.thrift.protocol.TType.STRING, (short)1);
+ private static final org.apache.thrift.protocol.TField SERVER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("serverName", org.apache.thrift.protocol.TType.STRING, (short)3);
+ private static final org.apache.thrift.protocol.TField DB_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("dbName", org.apache.thrift.protocol.TType.STRING, (short)4);
+ private static final org.apache.thrift.protocol.TField TABLE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("tableName", org.apache.thrift.protocol.TType.STRING, (short)5);
+ private static final org.apache.thrift.protocol.TField URI_FIELD_DESC = new org.apache.thrift.protocol.TField("URI", org.apache.thrift.protocol.TType.STRING, (short)6);
+ private static final org.apache.thrift.protocol.TField ACTION_FIELD_DESC = new org.apache.thrift.protocol.TField("action", org.apache.thrift.protocol.TType.STRING, (short)7);
+ private static final org.apache.thrift.protocol.TField CREATE_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("createTime", org.apache.thrift.protocol.TType.I64, (short)8);
+ 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)9);
+ private static final org.apache.thrift.protocol.TField GRANT_OPTION_FIELD_DESC = new org.apache.thrift.protocol.TField("grantOption", org.apache.thrift.protocol.TType.I32, (short)10);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new TSentryPrivilegeStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new TSentryPrivilegeTupleSchemeFactory());
+ }
+
+ private String privilegeScope; // required
+ private String serverName; // required
+ private String dbName; // optional
+ private String tableName; // optional
+ private String URI; // optional
+ private String action; // required
+ private long createTime; // optional
+ private String grantorPrincipal; // optional
+ private TSentryGrantOption grantOption; // 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 {
+ PRIVILEGE_SCOPE((short)1, "privilegeScope"),
+ SERVER_NAME((short)3, "serverName"),
+ DB_NAME((short)4, "dbName"),
+ TABLE_NAME((short)5, "tableName"),
+ URI((short)6, "URI"),
+ ACTION((short)7, "action"),
+ CREATE_TIME((short)8, "createTime"),
+ GRANTOR_PRINCIPAL((short)9, "grantorPrincipal"),
+ /**
+ *
+ * @see TSentryGrantOption
+ */
+ GRANT_OPTION((short)10, "grantOption");
+
+ 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_SCOPE
+ return PRIVILEGE_SCOPE;
+ case 3: // SERVER_NAME
+ return SERVER_NAME;
+ case 4: // DB_NAME
+ return DB_NAME;
+ case 5: // TABLE_NAME
+ return TABLE_NAME;
+ case 6: // URI
+ return URI;
+ case 7: // ACTION
+ return ACTION;
+ case 8: // CREATE_TIME
+ return CREATE_TIME;
+ case 9: // GRANTOR_PRINCIPAL
+ return GRANTOR_PRINCIPAL;
+ case 10: // GRANT_OPTION
+ return GRANT_OPTION;
+ 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 __CREATETIME_ISSET_ID = 0;
+ private byte __isset_bitfield = 0;
+ private _Fields optionals[] = {_Fields.DB_NAME,_Fields.TABLE_NAME,_Fields.URI,_Fields.CREATE_TIME,_Fields.GRANTOR_PRINCIPAL,_Fields.GRANT_OPTION};
+ 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_SCOPE, new org.apache.thrift.meta_data.FieldMetaData("privilegeScope", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields.SERVER_NAME, new org.apache.thrift.meta_data.FieldMetaData("serverName", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields.DB_NAME, new org.apache.thrift.meta_data.FieldMetaData("dbName", org.apache.thrift.TFieldRequirementType.OPTIONAL,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields.TABLE_NAME, new org.apache.thrift.meta_data.FieldMetaData("tableName", org.apache.thrift.TFieldRequirementType.OPTIONAL,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields.URI, new org.apache.thrift.meta_data.FieldMetaData("URI", org.apache.thrift.TFieldRequirementType.OPTIONAL,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields.ACTION, new org.apache.thrift.meta_data.FieldMetaData("action", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields.CREATE_TIME, new org.apache.thrift.meta_data.FieldMetaData("createTime", org.apache.thrift.TFieldRequirementType.OPTIONAL,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
+ tmpMap.put(_Fields.GRANTOR_PRINCIPAL, new org.apache.thrift.meta_data.FieldMetaData("grantorPrincipal", org.apache.thrift.TFieldRequirementType.OPTIONAL,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields.GRANT_OPTION, new org.apache.thrift.meta_data.FieldMetaData("grantOption", org.apache.thrift.TFieldRequirementType.OPTIONAL,
+ new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, TSentryGrantOption.class)));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TSentryPrivilege.class, metaDataMap);
+ }
+
+ public TSentryPrivilege() {
+ this.dbName = "";
+
+ this.tableName = "";
+
+ this.URI = "";
+
+ this.action = "";
+
+ this.grantOption = org.apache.sentry.provider.db.service.thrift.TSentryGrantOption.FALSE;
+
+ }
+
+ public TSentryPrivilege(
+ String privilegeScope,
+ String serverName,
+ String action)
+ {
+ this();
+ this.privilegeScope = privilegeScope;
+ this.serverName = serverName;
+ this.action = action;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public TSentryPrivilege(TSentryPrivilege other) {
+ __isset_bitfield = other.__isset_bitfield;
+ if (other.isSetPrivilegeScope()) {
+ this.privilegeScope = other.privilegeScope;
+ }
+ if (other.isSetServerName()) {
+ this.serverName = other.serverName;
+ }
+ if (other.isSetDbName()) {
+ this.dbName = other.dbName;
+ }
+ if (other.isSetTableName()) {
+ this.tableName = other.tableName;
+ }
+ if (other.isSetURI()) {
+ this.URI = other.URI;
+ }
+ if (other.isSetAction()) {
+ this.action = other.action;
+ }
+ this.createTime = other.createTime;
+ if (other.isSetGrantorPrincipal()) {
+ this.grantorPrincipal = other.grantorPrincipal;
+ }
+ if (other.isSetGrantOption()) {
+ this.grantOption = other.grantOption;
+ }
+ }
+
+ public TSentryPrivilege deepCopy() {
+ return new TSentryPrivilege(this);
+ }
+
+ @Override
+ public void clear() {
+ this.privilegeScope = null;
+ this.serverName = null;
+ this.dbName = "";
+
+ this.tableName = "";
+
+ this.URI = "";
+
+ this.action = "";
+
+ setCreateTimeIsSet(false);
+ this.createTime = 0;
+ this.grantorPrincipal = null;
+ this.grantOption = org.apache.sentry.provider.db.service.thrift.TSentryGrantOption.FALSE;
+
+ }
+
+ public String getPrivilegeScope() {
+ return this.privilegeScope;
+ }
+
+ public void setPrivilegeScope(String privilegeScope) {
+ this.privilegeScope = privilegeScope;
+ }
+
+ public void unsetPrivilegeScope() {
+ this.privilegeScope = null;
+ }
+
+ /** Returns true if field privilegeScope is set (has been assigned a value) and false otherwise */
+ public boolean isSetPrivilegeScope() {
+ return this.privilegeScope != null;
+ }
+
+ public void setPrivilegeScopeIsSet(boolean value) {
+ if (!value) {
+ this.privilegeScope = null;
+ }
+ }
+
+ public String getServerName() {
+ return this.serverName;
+ }
+
+ public void setServerName(String serverName) {
+ this.serverName = serverName;
+ }
+
+ public void unsetServerName() {
+ this.serverName = null;
+ }
+
+ /** Returns true if field serverName is set (has been assigned a value) and false otherwise */
+ public boolean isSetServerName() {
+ return this.serverName != null;
+ }
+
+ public void setServerNameIsSet(boolean value) {
+ if (!value) {
+ this.serverName = null;
+ }
+ }
+
+ public String getDbName() {
+ return this.dbName;
+ }
+
+ public void setDbName(String dbName) {
+ this.dbName = dbName;
+ }
+
+ public void unsetDbName() {
+ this.dbName = null;
+ }
+
+ /** Returns true if field dbName is set (has been assigned a value) and false otherwise */
+ public boolean isSetDbName() {
+ return this.dbName != null;
+ }
+
+ public void setDbNameIsSet(boolean value) {
+ if (!value) {
+ this.dbName = null;
+ }
+ }
+
+ public String getTableName() {
+ return this.tableName;
+ }
+
+ public void setTableName(String tableName) {
+ this.tableName = tableName;
+ }
+
+ public void unsetTableName() {
+ this.tableName = null;
+ }
+
+ /** Returns true if field tableName is set (has been assigned a value) and false otherwise */
+ public boolean isSetTableName() {
+ return this.tableName != null;
+ }
+
+ public void setTableNameIsSet(boolean value) {
+ if (!value) {
+ this.tableName = null;
+ }
+ }
+
+ public String getURI() {
+ return this.URI;
+ }
+
+ public void setURI(String URI) {
+ this.URI = URI;
+ }
+
+ public void unsetURI() {
+ this.URI = null;
+ }
+
+ /** Returns true if field URI is set (has been assigned a value) and false otherwise */
+ public boolean isSetURI() {
+ return this.URI != null;
+ }
+
+ public void setURIIsSet(boolean value) {
+ if (!value) {
+ this.URI = null;
+ }
+ }
+
+ public String getAction() {
+ return this.action;
+ }
+
+ public void setAction(String action) {
+ this.action = action;
+ }
+
+ public void unsetAction() {
+ this.action = null;
+ }
+
+ /** Returns true if field action is set (has been assigned a value) and false otherwise */
+ public boolean isSetAction() {
+ return this.action != null;
+ }
+
+ public void setActionIsSet(boolean value) {
+ if (!value) {
+ this.action = null;
+ }
+ }
+
+ public long getCreateTime() {
+ return this.createTime;
+ }
+
+ public void setCreateTime(long createTime) {
+ this.createTime = createTime;
+ setCreateTimeIsSet(true);
+ }
+
+ public void unsetCreateTime() {
+ __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __CREATETIME_ISSET_ID);
+ }
+
+ /** Returns true if field createTime is set (has been assigned a value) and false otherwise */
+ public boolean isSetCreateTime() {
+ return EncodingUtils.testBit(__isset_bitfield, __CREATETIME_ISSET_ID);
+ }
+
+ public void setCreateTimeIsSet(boolean value) {
+ __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __CREATETIME_ISSET_ID, value);
+ }
+
+ 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;
+ }
+ }
+
+ /**
+ *
+ * @see TSentryGrantOption
+ */
+ public TSentryGrantOption getGrantOption() {
+ return this.grantOption;
+ }
+
+ /**
+ *
+ * @see TSentryGrantOption
+ */
+ public void setGrantOption(TSentryGrantOption grantOption) {
+ this.grantOption = grantOption;
+ }
+
+ public void unsetGrantOption() {
+ this.grantOption = null;
+ }
+
+ /** Returns true if field grantOption is set (has been assigned a value) and false otherwise */
+ public boolean isSetGrantOption() {
+ return this.grantOption != null;
+ }
+
+ public void setGrantOptionIsSet(boolean value) {
+ if (!value) {
+ this.grantOption = null;
+ }
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case PRIVILEGE_SCOPE:
+ if (value == null) {
+ unsetPrivilegeScope();
+ } else {
+ setPrivilegeScope((String)value);
+ }
+ break;
+
+ case SERVER_NAME:
+ if (value == null) {
+ unsetServerName();
+ } else {
+ setServerName((String)value);
+ }
+ break;
+
+ case DB_NAME:
+ if (value == null) {
+ unsetDbName();
+ } else {
+ setDbName((String)value);
+ }
+ break;
+
+ case TABLE_NAME:
+ if (value == null) {
+ unsetTableName();
+ } else {
+ setTableName((String)value);
+ }
+ break;
+
+ case URI:
+ if (value == null) {
+ unsetURI();
+ } else {
+ setURI((String)value);
+ }
+ break;
+
+ case ACTION:
+ if (value == null) {
+ unsetAction();
+ } else {
+ setAction((String)value);
+ }
+ break;
+
+ case CREATE_TIME:
+ if (value == null) {
+ unsetCreateTime();
+ } else {
+ setCreateTime((Long)value);
+ }
+ break;
+
+ case GRANTOR_PRINCIPAL:
+ if (value == null) {
+ unsetGrantorPrincipal();
+ } else {
+ setGrantorPrincipal((String)value);
+ }
+ break;
+
+ case GRANT_OPTION:
+ if (value == null) {
+ unsetGrantOption();
+ } else {
+ setGrantOption((TSentryGrantOption)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case PRIVILEGE_SCOPE:
+ return getPrivilegeScope();
+
+ case SERVER_NAME:
+ return getServerName();
+
+ case DB_NAME:
+ return getDbName();
+
+ case TABLE_NAME:
+ return getTableName();
+
+ case URI:
+ return getURI();
+
+ case ACTION:
+ return getAction();
+
+ case CREATE_TIME:
+ return Long.valueOf(getCreateTime());
+
+ case GRANTOR_PRINCIPAL:
+ return getGrantorPrincipal();
+
+ case GRANT_OPTION:
+ return getGrantOption();
+
+ }
+ 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_SCOPE:
+ return isSetPrivilegeScope();
+ case SERVER_NAME:
+ return isSetServerName();
+ case DB_NAME:
+ return isSetDbName();
+ case TABLE_NAME:
+ return isSetTableName();
+ case URI:
+ return isSetURI();
+ case ACTION:
+ return isSetAction();
+ case CREATE_TIME:
+ return isSetCreateTime();
+ case GRANTOR_PRINCIPAL:
+ return isSetGrantorPrincipal();
+ case GRANT_OPTION:
+ return isSetGrantOption();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof TSentryPrivilege)
+ return this.equals((TSentryPrivilege)that);
+ return false;
+ }
+
+ public boolean equals(TSentryPrivilege that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_privilegeScope = true && this.isSetPrivilegeScope();
+ boolean that_present_privilegeScope = true && that.isSetPrivilegeScope();
+ if (this_present_privilegeScope || that_present_privilegeScope) {
+ if (!(this_present_privilegeScope && that_present_privilegeScope))
+ return false;
+ if (!this.privilegeScope.equals(that.privilegeScope))
+ return false;
+ }
+
+ boolean this_present_serverName = true && this.isSetServerName();
+ boolean that_present_serverName = true && that.isSetServerName();
+ if (this_present_serverName || that_present_serverName) {
+ if (!(this_present_serverName && that_present_serverName))
+ return false;
+ if (!this.serverName.equals(that.serverName))
+ return false;
+ }
+
+ boolean this_present_dbName = true && this.isSetDbName();
+ boolean that_present_dbName = true && that.isSetDbName();
+ if (this_present_dbName || that_present_dbName) {
+ if (!(this_present_dbName && that_present_dbName))
+ return false;
+ if (!this.dbName.equals(that.dbName))
+ return false;
+ }
+
+ boolean this_present_tableName = true && this.isSetTableName();
+ boolean that_present_tableName = true && that.isSetTableName();
+ if (this_present_tableName || that_present_tableName) {
+ if (!(this_present_tableName && that_present_tableName))
+ return false;
+ if (!this.tableName.equals(that.tableName))
+ return false;
+ }
+
+ boolean this_present_URI = true && this.isSetURI();
+ boolean that_present_URI = true && that.isSetURI();
+ if (this_present_URI || that_present_URI) {
+ if (!(this_present_URI && that_present_URI))
+ return false;
+ if (!this.URI.equals(that.URI))
+ return false;
+ }
+
+ boolean this_present_action = true && this.isSetAction();
+ boolean that_present_action = true && that.isSetAction();
+ if (this_present_action || that_present_action) {
+ if (!(this_present_action && that_present_action))
+ return false;
+ if (!this.action.equals(that.action))
+ return false;
+ }
+
+ boolean this_present_createTime = true && this.isSetCreateTime();
+ boolean that_present_createTime = true && that.isSetCreateTime();
+ if (this_present_createTime || that_present_createTime) {
+ if (!(this_present_createTime && that_present_createTime))
+ return false;
+ if (this.createTime != that.createTime)
+ 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;
+ }
+
+ boolean this_present_grantOption = true && this.isSetGrantOption();
+ boolean that_present_grantOption = true && that.isSetGrantOption();
+ if (this_present_grantOption || that_present_grantOption) {
+ if (!(this_present_grantOption && that_present_grantOption))
+ return false;
+ if (!this.grantOption.equals(that.grantOption))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ HashCodeBuilder builder = new HashCodeBuilder();
+
+ boolean present_privilegeScope = true && (isSetPrivilegeScope());
+ builder.append(present_privilegeScope);
+ if (present_privilegeScope)
+ builder.append(privilegeScope);
+
+ boolean present_serverName = true && (isSetServerName());
+ builder.append(present_serverName);
+ if (present_serverName)
+ builder.append(serverName);
+
+ boolean present_dbName = true && (isSetDbName());
+ builder.append(present_dbName);
+ if (present_dbName)
+ builder.append(dbName);
+
+ boolean present_tableName = true && (isSetTableName());
+ builder.append(present_tableName);
+ if (present_tableName)
+ builder.append(tableName);
+
+ boolean present_URI = true && (isSetURI());
+ builder.append(present_URI);
+ if (present_URI)
+ builder.append(URI);
+
+ boolean present_action = true && (isSetAction());
+ builder.append(present_action);
+ if (present_action)
+ builder.append(action);
+
+ boolean present_createTime = true && (isSetCreateTime());
+ builder.append(present_createTime);
+ if (present_createTime)
+ builder.append(createTime);
+
+ boolean present_grantorPrincipal = true && (isSetGrantorPrincipal());
+ builder.append(present_grantorPrincipal);
+ if (present_grantorPrincipal)
+ builder.append(grantorPrincipal);
+
+ boolean present_grantOption = true && (isSetGrantOption());
+ builder.append(present_grantOption);
+ if (present_grantOption)
+ builder.append(grantOption.getValue());
+
+ return builder.toHashCode();
+ }
+
+ public int compareTo(TSentryPrivilege other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+ TSentryPrivilege typedOther = (TSentryPrivilege)other;
+
+ lastComparison = Boolean.valueOf(isSetPrivilegeScope()).compareTo(typedOther.isSetPrivilegeScope());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetPrivilegeScope()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.privilegeScope, typedOther.privilegeScope);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetServerName()).compareTo(typedOther.isSetServerName());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetServerName()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.serverName, typedOther.serverName);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetDbName()).compareTo(typedOther.isSetDbName());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetDbName()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.dbName, typedOther.dbName);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetTableName()).compareTo(typedOther.isSetTableName());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetTableName()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.tableName, typedOther.tableName);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetURI()).compareTo(typedOther.isSetURI());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetURI()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.URI, typedOther.URI);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetAction()).compareTo(typedOther.isSetAction());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetAction()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.action, typedOther.action);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetCreateTime()).compareTo(typedOther.isSetCreateTime());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetCreateTime()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.createTime, typedOther.createTime);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetGrantorPrincipal()).compareTo(typedOther.isSetGrantorPrincipal());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetGrantorPrincipal()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.grantorPrincipal, typedOther.grantorPrincipal);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetGrantOption()).compareTo(typedOther.isSetGrantOption());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetGrantOption()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.grantOption, typedOther.grantOption);
+ 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("TSentryPrivilege(");
+ boolean first = true;
+
+ sb.append("privilegeScope:");
+ if (this.privilegeScope == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.privilegeScope);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("serverName:");
+ if (this.serverName == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.serverName);
+ }
+ first = false;
+ if (isSetDbName()) {
+ if (!first) sb.append(", ");
+ sb.append("dbName:");
+ if (this.dbName == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.dbName);
+ }
+ first = false;
+ }
+ if (isSetTableName()) {
+ if (!first) sb.append(", ");
+ sb.append("tableName:");
+ if (this.tableName == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.tableName);
+ }
+ first = false;
+ }
+ if (isSetURI()) {
+ if (!first) sb.append(", ");
+ sb.append("URI:");
+ if (this.URI == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.URI);
+ }
+ first = false;
+ }
+ if (!first) sb.append(", ");
+ sb.append("action:");
+ if (this.action == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.action);
+ }
+ first = false;
+ if (isSetCreateTime()) {
+ if (!first) sb.append(", ");
+ sb.append("createTime:");
+ sb.append(this.createTime);
+ first = false;
+ }
+ if (isSetGrantorPrincipal()) {
+ if (!first) sb.append(", ");
+ sb.append("grantorPrincipal:");
+ if (this.grantorPrincipal == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.grantorPrincipal);
+ }
+ first = false;
+ }
+ if (isSetGrantOption()) {
+ if (!first) sb.append(", ");
+ sb.append("grantOption:");
+ if (this.grantOption == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.grantOption);
+ }
+ first = false;
+ }
+ sb.append(")");
+ return sb.toString();
+ }
+
+ public void validate() throws org.apache.thrift.TException {
+ // check for required fields
+ if (!isSetPrivilegeScope()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'privilegeScope' is unset! Struct:" + toString());
+ }
+
+ if (!isSetServerName()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'serverName' is unset! Struct:" + toString());
+ }
+
+ if (!isSetAction()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'action' 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 TSentryPrivilegeStandardSchemeFactory implements SchemeFactory {
+ public TSentryPrivilegeStandardScheme getScheme() {
+ return new TSentryPrivilegeStandardScheme();
+ }
+ }
+
+ private static class TSentryPrivilegeStandardScheme extends StandardScheme<TSentryPrivilege> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, TSentryPrivilege 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_SCOPE
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.privilegeScope = iprot.readString();
+ struct.setPrivilegeScopeIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 3: // SERVER_NAME
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.serverName = iprot.readString();
+ struct.setServerNameIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 4: // DB_NAME
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.dbName = iprot.readString();
+ struct.setDbNameIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 5: // TABLE_NAME
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.tableName = iprot.readString();
+ struct.setTableNameIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 6: // URI
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.URI = iprot.readString();
+ struct.setURIIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 7: // ACTION
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.action = iprot.readString();
+ struct.setActionIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 8: // CREATE_TIME
+ if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
+ struct.createTime = iprot.readI64();
+ struct.setCreateTimeIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 9: // 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;
+ case 10: // GRANT_OPTION
+ if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
+ struct.grantOption = TSentryGrantOption.findByValue(iprot.readI32());
+ struct.setGrantOptionIsSet(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, TSentryPrivilege struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.privilegeScope != null) {
+ oprot.writeFieldBegin(PRIVILEGE_SCOPE_FIELD_DESC);
+ oprot.writeString(struct.privilegeScope);
+ oprot.writeFieldEnd();
+ }
+ if (struct.serverName != null) {
+ oprot.writeFieldBegin(SERVER_NAME_FIELD_DESC);
+ oprot.writeString(struct.serverName);
+ oprot.writeFieldEnd();
+ }
+ if (struct.dbName != null) {
+ if (struct.isSetDbName()) {
+ oprot.writeFieldBegin(DB_NAME_FIELD_DESC);
+ oprot.writeString(struct.dbName);
+ oprot.writeFieldEnd();
+ }
+ }
+ if (struct.tableName != null) {
+ if (struct.isSetTableName()) {
+ oprot.writeFieldBegin(TABLE_NAME_FIELD_DESC);
+ oprot.writeString(struct.tableName);
+ oprot.writeFieldEnd();
+ }
+ }
+ if (struct.URI != null) {
+ if (struct.isSetURI()) {
+ oprot.writeFieldBegin(URI_FIELD_DESC);
+ oprot.writeString(struct.URI);
+ oprot.writeFieldEnd();
+ }
+ }
+ if (struct.action != null) {
+ oprot.writeFieldBegin(ACTION_FIELD_DESC);
+ oprot.writeString(struct.action);
+ oprot.writeFieldEnd();
+ }
+ if (struct.isSetCreateTime()) {
+ oprot.writeFieldBegin(CREATE_TIME_FIELD_DESC);
+ oprot.writeI64(struct.createTime);
+ oprot.writeFieldEnd();
+ }
+ if (struct.grantorPrincipal != null) {
+ if (struct.isSetGrantorPrincipal()) {
+ oprot.writeFieldBegin(GRANTOR_PRINCIPAL_FIELD_DESC);
+ oprot.writeString(struct.grantorPrincipal);
+ oprot.writeFieldEnd();
+ }
+ }
+ if (struct.grantOption != null) {
+ if (struct.isSetGrantOption()) {
+ oprot.writeFieldBegin(GRANT_OPTION_FIELD_DESC);
+ oprot.writeI32(struct.grantOption.getValue());
+ oprot.writeFieldEnd();
+ }
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class TSentryPrivilegeTupleSchemeFactory implements SchemeFactory {
+ public TSentryPrivilegeTupleScheme getScheme() {
+ return new TSentryPrivilegeTupleScheme();
+ }
+ }
+
+ private static class TSentryPrivilegeTupleScheme extends TupleScheme<TSentryPrivilege> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, TSentryPrivilege struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ oprot.writeString(struct.privilegeScope);
+ oprot.writeString(struct.serverName);
+ oprot.writeString(struct.action);
+ BitSet optionals = new BitSet();
+ if (struct.isSetDbName()) {
+ optionals.set(0);
+ }
+ if (struct.isSetTableName()) {
+ optionals.set(1);
+ }
+ if (struct.isSetURI()) {
+ optionals.set(2);
+ }
+ if (struct.isSetCreateTime()) {
+ optionals.set(3);
+ }
+ if (struct.isSetGrantorPrincipal()) {
+ optionals.set(4);
+ }
+ if (struct.isSetGrantOption()) {
+ optionals.set(5);
+ }
+ oprot.writeBitSet(optionals, 6);
+ if (struct.isSetDbName()) {
+ oprot.writeString(struct.dbName);
+ }
+ if (struct.isSetTableName()) {
+ oprot.writeString(struct.tableName);
+ }
+ if (struct.isSetURI()) {
+ oprot.writeString(struct.URI);
+ }
+ if (struct.isSetCreateTime()) {
+ oprot.writeI64(struct.createTime);
+ }
+ if (struct.isSetGrantorPrincipal()) {
+ oprot.writeString(struct.grantorPrincipal);
+ }
+ if (struct.isSetGrantOption()) {
+ oprot.writeI32(struct.grantOption.getValue());
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, TSentryPrivilege struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ struct.privilegeScope = iprot.readString();
+ struct.setPrivilegeScopeIsSet(true);
+ struct.serverName = iprot.readString();
+ struct.setServerNameIsSet(true);
+ struct.action = iprot.readString();
+ struct.setActionIsSet(true);
+ BitSet incoming = iprot.readBitSet(6);
+ if (incoming.get(0)) {
+ struct.dbName = iprot.readString();
+ struct.setDbNameIsSet(true);
+ }
+ if (incoming.get(1)) {
+ struct.tableName = iprot.readString();
+ struct.setTableNameIsSet(true);
+ }
+ if (incoming.get(2)) {
+ struct.URI = iprot.readString();
+ struct.setURIIsSet(true);
+ }
+ if (incoming.get(3)) {
+ struct.createTime = iprot.readI64();
+ struct.setCreateTimeIsSet(true);
+ }
+ if (incoming.get(4)) {
+ struct.grantorPrincipal = iprot.readString();
+ struct.setGrantorPrincipalIsSet(true);
+ }
+ if (incoming.get(5)) {
+ struct.grantOption = TSentryGrantOption.findByValue(iprot.readI32());
+ struct.setGrantOptionIsSet(true);
+ }
+ }
+ }
+
+}
+
[23/25] SENTRY-432. HDFS ingration. Initial patch
Posted by pr...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-hdfs/src/test/java/org/apache/sentry/hdfs/TestAuthzPathCacheOld.java
----------------------------------------------------------------------
diff --git a/sentry-hdfs/src/test/java/org/apache/sentry/hdfs/TestAuthzPathCacheOld.java b/sentry-hdfs/src/test/java/org/apache/sentry/hdfs/TestAuthzPathCacheOld.java
new file mode 100644
index 0000000..ca3ebfe
--- /dev/null
+++ b/sentry-hdfs/src/test/java/org/apache/sentry/hdfs/TestAuthzPathCacheOld.java
@@ -0,0 +1,523 @@
+/**
+ * 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.hdfs;
+
+
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.hive.metastore.api.Database;
+import org.apache.hadoop.hive.metastore.api.Table;
+//import org.apache.sentry.hdfs.old.AuthzPathCacheOld;
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.util.Arrays;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.fail;
+
+public class TestAuthzPathCacheOld {
+
+// @Test
+// public void testGetPathElements() {
+// String[] as2 = AuthzPathCacheOld.getPathElements(new String("/a/b"));
+// String[] as1 = AuthzPathCacheOld.getPathElements(new String("/a/b"));
+// Assert.assertArrayEquals(as1, as2);
+//
+// String[] as = AuthzPathCacheOld.getPathElements(new String("/a/b"));
+// Assert.assertArrayEquals(new String[] {"a", "b"}, as);
+//
+// as = AuthzPathCacheOld.getPathElements(new String("//a/b"));
+// Assert.assertArrayEquals(new String[]{"a", "b"}, as);
+//
+// as = AuthzPathCacheOld.getPathElements(new String("/a//b"));
+// Assert.assertArrayEquals(new String[]{"a", "b"}, as);
+//
+// as = AuthzPathCacheOld.getPathElements(new String("/a/b/"));
+// Assert.assertArrayEquals(new String[]{"a", "b"}, as);
+//
+// as = AuthzPathCacheOld.getPathElements(new String("//a//b//"));
+// Assert.assertArrayEquals(new String[]{"a", "b"}, as);
+// }
+//
+// @Test
+// public void testGetPathsElements() {
+// String[][] as1 = AuthzPathCacheOld.gePathsElements(
+// new String[]{new String("/a/b")});
+// String[][] as2 = AuthzPathCacheOld.gePathsElements(
+// new String[]{new String("/a/b")});
+// Assert.assertEquals(as1.length, as2.length);
+// Assert.assertArrayEquals(as1[0], as2[0]);
+// }
+//
+// @Test
+// public void testEntryType() {
+// Assert.assertTrue(AuthzPathCacheOld.EntryType.DIR.isRemoveIfDangling());
+// Assert.assertFalse(AuthzPathCacheOld.EntryType.PREFIX.isRemoveIfDangling());
+// Assert.assertTrue(
+// AuthzPathCacheOld.EntryType.AUTHZ_OBJECT.isRemoveIfDangling());
+// }
+//
+// @Test
+// public void testRootEntry() {
+// AuthzPathCacheOld.Entry root = AuthzPathCacheOld.Entry.createRoot(false);
+// root.toString();
+// Assert.assertNull(root.getParent());
+// Assert.assertEquals(AuthzPathCacheOld.EntryType.DIR, root.getType());
+// // NOTE : This was causing some problems during serialization.. so dissabling
+//// Assert.assertNull(root.getPathElement());
+// Assert.assertNull(root.getAuthzObj());
+// Assert.assertEquals(Path.SEPARATOR, root.getFullPath());
+// Assert.assertTrue(root.getChildren().isEmpty());
+// root.delete();
+// try {
+// root.find(null, true);
+// Assert.fail();
+// } catch (IllegalArgumentException ex) {
+// //NOP
+// }
+// try {
+// root.find(new String[0], true);
+// Assert.fail();
+// } catch (IllegalArgumentException ex) {
+// //NOP
+// }
+// try {
+// root.find(null, false);
+// Assert.fail();
+// } catch (IllegalArgumentException ex) {
+// //NOP
+// }
+// try {
+// root.find(new String[0], false);
+// Assert.fail();
+// } catch (IllegalArgumentException ex) {
+// //NOP
+// }
+// Assert.assertEquals(root, root.find(new String[]{"a"}, true));
+// Assert.assertNull(root.find(new String[]{"a"}, false));
+// Assert.assertNull(root.findPrefixEntry(new String[]{"a"}));
+//
+// root.delete();
+// }
+//
+// @Test
+// public void testRootPrefixEntry() {
+// AuthzPathCacheOld.Entry root = AuthzPathCacheOld.Entry.createRoot(true);
+// root.toString();
+//
+// Assert.assertEquals(root, root.find(new String[]{"a"}, true));
+// Assert.assertEquals(null, root.find(new String[]{"a"}, false));
+// Assert.assertEquals(root, root.findPrefixEntry(new String[]{"a"}));
+// Assert.assertEquals(root, root.findPrefixEntry(new String[]{"a", "b"}));
+//
+// try {
+// root.createPrefix(new String[]{"a"});
+// Assert.fail();
+// } catch (IllegalArgumentException ex) {
+// //NOP
+// }
+// }
+//
+// @Test
+// public void testImmediatePrefixEntry() {
+// AuthzPathCacheOld.Entry root = AuthzPathCacheOld.Entry.createRoot(false);
+// AuthzPathCacheOld.Entry entry = root.createPrefix(new String[] {"a"});
+// entry.toString();
+//
+// Assert.assertEquals(1, root.getChildren().size());
+//
+// Assert.assertEquals(root, entry.getParent());
+// Assert.assertEquals(AuthzPathCacheOld.EntryType.PREFIX, entry.getType());
+// Assert.assertEquals("a", entry.getPathElement());
+// Assert.assertNull(entry.getAuthzObj());
+// Assert.assertEquals(Path.SEPARATOR + "a", entry.getFullPath());
+// Assert.assertTrue(entry.getChildren().isEmpty());
+//
+// Assert.assertEquals(entry, root.find(new String[]{"a"}, true));
+// Assert.assertEquals(entry, root.find(new String[]{"a"}, false));
+// Assert.assertEquals(entry, root.findPrefixEntry(new String[]{"a"}));
+// Assert.assertEquals(entry, root.findPrefixEntry(new String[]{"a", "b"}));
+//
+// Assert.assertEquals(entry, root.find(new String[]{"a", "b"}, true));
+// Assert.assertEquals(entry, root.find(new String[]{"a", "b", "c"}, true));
+// Assert.assertNull(root.find(new String[]{"a", "b"}, false));
+//
+// Assert.assertNull(root.find(new String[]{"b"}, false));
+// Assert.assertNull(root.findPrefixEntry(new String[]{"b"}));
+//
+// try {
+// root.createPrefix(new String[]{"a", "b"});
+// Assert.fail();
+// } catch (IllegalArgumentException ex) {
+// //NOP
+// }
+//
+// try {
+// root.createPrefix(new String[]{"a", "b", "c"});
+// Assert.fail();
+// } catch (IllegalArgumentException ex) {
+// //NOP
+// }
+//
+// entry.delete();
+// Assert.assertTrue(root.getChildren().isEmpty());
+// }
+//
+// @Test
+// public void testFurtherPrefixEntry() {
+// AuthzPathCacheOld.Entry root = AuthzPathCacheOld.Entry.createRoot(false);
+// AuthzPathCacheOld.Entry entry = root.createPrefix(new String[]{"a", "b"});
+// entry.toString();
+//
+// Assert.assertEquals(1, root.getChildren().size());
+//
+// Assert.assertEquals(root, entry.getParent().getParent());
+// Assert.assertEquals(AuthzPathCacheOld.EntryType.PREFIX, entry.getType());
+// Assert.assertEquals(AuthzPathCacheOld.EntryType.DIR,
+// entry.getParent().getType());
+// Assert.assertEquals("b", entry.getPathElement());
+// Assert.assertEquals("a", entry.getParent().getPathElement());
+// Assert.assertNull(entry.getAuthzObj());
+// Assert.assertNull(entry.getParent().getAuthzObj());
+// Assert.assertEquals(Path.SEPARATOR + "a" + Path.SEPARATOR + "b",
+// entry.getFullPath());
+// Assert.assertEquals(Path.SEPARATOR + "a", entry.getParent().getFullPath());
+// Assert.assertTrue(entry.getChildren().isEmpty());
+// Assert.assertEquals(1, entry.getParent().getChildren().size());
+//
+// Assert.assertEquals(entry, root.find(new String[]{"a", "b"}, true));
+// Assert.assertEquals(entry, root.find(new String[]{"a", "b"}, false));
+// Assert.assertEquals(entry, root.findPrefixEntry(new String[]{"a", "b"}));
+// Assert.assertNull(root.findPrefixEntry(new String[]{"a"}));
+//
+// Assert.assertEquals(entry, root.find(new String[]{"a", "b", "c"}, true));
+// Assert.assertNull(root.find(new String[]{"a", "b", "c"}, false));
+//
+// try {
+// root.createPrefix(new String[]{"a", "b"});
+// Assert.fail();
+// } catch (IllegalArgumentException ex) {
+// //NOP
+// }
+//
+// try {
+// root.createPrefix(new String[]{"a", "b", "c"});
+// Assert.fail();
+// } catch (IllegalArgumentException ex) {
+// //NOP
+// }
+//
+// entry.delete();
+// Assert.assertTrue(root.getChildren().isEmpty());
+// }
+//
+// @Test
+// public void testImmediateAuthzEntry() {
+// AuthzPathCacheOld.Entry root = AuthzPathCacheOld.Entry.createRoot(false);
+// AuthzPathCacheOld.Entry prefix = root.createPrefix(new String[]{"a", "b"});
+//
+// AuthzPathCacheOld.Entry entry = root.createAuthzObjPath(
+// new String[]{"a", "b", "p1"}, "A");
+// Assert.assertEquals(prefix, entry.getParent());
+// Assert.assertEquals(AuthzPathCacheOld.EntryType.AUTHZ_OBJECT, entry.getType());
+// Assert.assertEquals("p1", entry.getPathElement());
+// Assert.assertEquals("A", entry.getAuthzObj());
+// Assert.assertEquals(Path.SEPARATOR + "a" + Path.SEPARATOR + "b" +
+// Path.SEPARATOR + "p1", entry.getFullPath());
+//
+// try {
+// root.createPrefix(new String[]{"a", "b", "p1", "c"});
+// Assert.fail();
+// } catch (IllegalArgumentException ex) {
+// //NOP
+// }
+//
+// Assert.assertEquals(entry, root.find(new String[]{"a", "b", "p1"}, true));
+// Assert.assertEquals(entry, root.find(new String[]{"a", "b", "p1"}, false));
+// Assert.assertEquals(entry, root.find(new String[]{"a", "b", "p1", "c"},
+// true));
+// Assert.assertNull(root.find(new String[]{"a", "b", "p1", "c"}, false));
+// Assert.assertEquals(prefix, root.findPrefixEntry(
+// new String[]{"a", "b", "p1"}));
+//
+// root.find(new String[]{"a", "b", "p1"}, true).delete();
+// Assert.assertNull(root.find(new String[]{"a", "b", "p1"}, false));
+// Assert.assertNotNull(root.find(new String[]{"a", "b"}, false));
+// Assert.assertEquals(prefix, root.findPrefixEntry(
+// new String[]{"a", "b", "p1"}));
+//
+// }
+//
+// @Test
+// public void testFurtherAuthzEntry() {
+// AuthzPathCacheOld.Entry root = AuthzPathCacheOld.Entry.createRoot(false);
+// AuthzPathCacheOld.Entry prefix = root.createPrefix(new String[]{"a", "b"});
+//
+// AuthzPathCacheOld.Entry entry = root.createAuthzObjPath(
+// new String[]{"a", "b", "t", "p1"}, "A");
+// Assert.assertEquals(prefix, entry.getParent().getParent());
+// Assert.assertEquals(AuthzPathCacheOld.EntryType.AUTHZ_OBJECT, entry.getType());
+// Assert.assertEquals("p1", entry.getPathElement());
+// Assert.assertEquals("A", entry.getAuthzObj());
+// Assert.assertEquals(Path.SEPARATOR + "a" + Path.SEPARATOR + "b" +
+// Path.SEPARATOR + "t" + Path.SEPARATOR + "p1", entry.getFullPath());
+//
+// try {
+// root.createPrefix(new String[]{"a", "b", "p1", "t", "c"});
+// Assert.fail();
+// } catch (IllegalArgumentException ex) {
+// //NOP
+// }
+//
+// AuthzPathCacheOld.Entry ep2 = root.createAuthzObjPath(
+// new String[]{"a", "b", "t", "p1", "p2"}, "A");
+//
+// Assert.assertEquals(AuthzPathCacheOld.EntryType.AUTHZ_OBJECT, entry.getType());
+// Assert.assertEquals("p1", entry.getPathElement());
+// Assert.assertEquals("A", entry.getAuthzObj());
+//
+// Assert.assertEquals(AuthzPathCacheOld.EntryType.AUTHZ_OBJECT, ep2.getType());
+// Assert.assertEquals("p2", ep2.getPathElement());
+// Assert.assertEquals("A", entry.getAuthzObj());
+//
+// Assert.assertEquals(entry, root.find(new String[]{"a", "b", "t", "p1"},
+// true));
+// Assert.assertEquals(entry, root.find(new String[]{"a", "b", "t", "p1"},
+// false));
+// Assert.assertEquals(entry, root.find(new String[]{"a", "b", "t", "p1", "c"},
+// true));
+// Assert.assertNull(root.find(new String[]{"a", "b", "t", "p1", "c"}, false));
+// Assert.assertEquals(prefix, root.findPrefixEntry(
+// new String[]{"a", "b", "t", "p1"}));
+//
+// Assert.assertEquals(ep2, root.find(new String[]{"a", "b", "t", "p1", "p2"},
+// true));
+// Assert.assertEquals(ep2, root.find(new String[]{"a", "b", "t", "p1", "p2"},
+// false));
+// Assert.assertEquals(ep2, root.find(new String[]{"a", "b", "t", "p1", "p2", "c"},
+// true));
+// Assert.assertNull(root.find(new String[]{"a", "b", "t", "p1", "p2", "c"}, false));
+// Assert.assertEquals(prefix, root.findPrefixEntry(
+// new String[]{"a", "b", "t", "p1", "p2"}));
+//
+// root.find(new String[]{"a", "b", "t", "p1"}, false).delete();
+//
+// Assert.assertEquals(entry, root.find(new String[]{"a", "b", "t", "p1"},
+// true));
+// Assert.assertEquals(AuthzPathCacheOld.EntryType.DIR, entry.getType());
+// Assert.assertNull(entry.getAuthzObj());
+//
+// Assert.assertNotNull(root.find(new String[]{"a", "b", "t", "p1"}, false));
+// Assert.assertNotNull(root.find(new String[]{"a", "b", "t"}, false));
+// Assert.assertNotNull(root.find(new String[]{"a", "b"}, false));
+// Assert.assertEquals(prefix, root.findPrefixEntry(
+// new String[]{"a", "b", "t", "p1"}));
+//
+// root.find(new String[]{"a", "b", "t", "p1", "p2"}, false).delete();
+// Assert.assertNull(root.find(new String[]{"a", "b", "t", "p1"}, false));
+// Assert.assertNull(root.find(new String[]{"a", "b", "t"}, false));
+// Assert.assertNotNull(root.find(new String[]{"a", "b"}, false));
+// Assert.assertEquals(prefix, root.findPrefixEntry(
+// new String[]{"a", "b", "t", "p1"}));
+//
+// }
+//
+// @Test
+// public void testMultipleAuthzEntry() {
+// AuthzPathCacheOld.Entry root = AuthzPathCacheOld.Entry.createRoot(false);
+// AuthzPathCacheOld.Entry prefix = root.createPrefix(new String[]{"a", "b"});
+//
+// AuthzPathCacheOld.Entry e1 = root.createAuthzObjPath(
+// new String[]{"a", "b", "t", "p1"}, "A");
+// AuthzPathCacheOld.Entry e2 = root.createAuthzObjPath(
+// new String[]{"a", "b", "t", "p2"}, "A");
+//
+//
+// Assert.assertEquals(e1, root.find(new String[]{"a", "b", "t", "p1"}, true));
+// Assert.assertEquals(e1, root.find(new String[]{"a", "b", "t", "p1"},
+// false));
+// Assert.assertEquals(e1, root.find(new String[]{"a", "b", "t", "p1", "c"},
+// true));
+// Assert.assertNull(root.find(new String[]{"a", "b", "t", "p1", "c"}, false));
+// Assert.assertEquals(prefix, root.findPrefixEntry(
+// new String[]{"a", "b", "t", "p1"}));
+//
+// Assert.assertEquals(e2, root.find(new String[]{"a", "b", "t", "p2"}, true));
+// Assert.assertEquals(e2, root.find(new String[]{"a", "b", "t", "p2"},
+// false));
+// Assert.assertEquals(e2, root.find(new String[]{"a", "b", "t", "p2", "c"},
+// true));
+// Assert.assertNull(root.find(new String[]{"a", "b", "t", "p2", "c"}, false));
+// Assert.assertEquals(prefix, root.findPrefixEntry(
+// new String[]{"a", "b", "t", "p2"}));
+//
+// root.find(new String[]{"a", "b", "t", "p1"}, true).delete();
+// Assert.assertNull(root.find(new String[]{"a", "b", "t", "p1"}, false));
+// Assert.assertNotNull(root.find(new String[]{"a", "b", "t"}, false));
+//
+// root.find(new String[]{"a", "b", "t", "p2"}, true).delete();
+// Assert.assertNull(root.find(new String[]{"a", "b", "t", "p2"}, false));
+// Assert.assertNull(root.find(new String[]{"a", "b", "t"}, false));
+// Assert.assertNotNull(root.find(new String[]{"a", "b"}, false));
+//
+// Assert.assertEquals(prefix, root.findPrefixEntry(
+// new String[]{"a", "b", "t", "p3"}));
+// }
+//
+// @Test
+// public void testUpdateHandling() throws Exception {
+// DummyHMSClient mock = new DummyHMSClient();
+// Database db1 = mock.addDb("db1", "/db1");
+// Table tbl11 = mock.addTable(db1, "tbl11", "/db1/tbl11");
+// mock.addPartition(db1, tbl11, "/db1/tbl11/part111");
+// mock.addPartition(db1, tbl11, "/db1/tbl11/part112");
+// AuthzPathCacheOld AuthzPathUpdater = new AuthzPathCacheOld(mock, new String[]{"/db1"}, 10000);
+//
+// // Trigger Initial refresh (full dump)
+// AuthzPathUpdater.handleUpdateNotification(new PathsUpdate(10, null));
+// waitToCommit(AuthzPathUpdater);
+// assertEquals("db1.tbl11", AuthzPathUpdater.findAuthzObject("/db1/tbl11/part111".split("^/")[1].split("/")));
+// assertEquals("db1.tbl11", AuthzPathUpdater.findAuthzObject("/db1/tbl11/part112".split("^/")[1].split("/")));
+//
+// // Handle preUpdate from HMS plugin
+// PathsUpdate update = new PathsUpdate(11, null);
+// update.addPathUpdate("db1.tbl12").addPath("/db1/tbl12").addPath("/db1/tbl12/part121");
+// update.addPathUpdate("db1.tbl11").delPath("/db1/tbl11/part112");
+//
+// // Ensure JSON serialization is working :
+// assertEquals(PathsUpdate.toJsonString(update),
+// PathsUpdate.toJsonString(
+// PathsUpdate.fromJsonString(
+// PathsUpdate.toJsonString(update))));
+//
+// AuthzPathUpdater.handleUpdateNotification(update);
+// waitToCommit(AuthzPathUpdater);
+// assertNull(AuthzPathUpdater.findAuthzObject("/db1/tbl11/part112".split("^/")[1].split("/"), false));
+// assertEquals("db1.tbl12", AuthzPathUpdater.findAuthzObject("/db1/tbl12/part121".split("^/")[1].split("/")));
+//
+// // Add more entries to HMS
+// Table tbl13 = mock.addTable(db1, "tbl13", "/db1/tbl13");
+// mock.addPartition(db1, tbl13, "/db1/tbl13/part131");
+//
+// // Simulate missed preUpdate (Send empty preUpdate with seqNum 13)
+// // On missed preUpdate, refresh again
+// AuthzPathUpdater.handleUpdateNotification(new PathsUpdate(13, null));
+// waitToCommit(AuthzPathUpdater);
+// assertEquals("db1.tbl13", AuthzPathUpdater.findAuthzObject("/db1/tbl13/part131".split("^/")[1].split("/")));
+// }
+//
+// @Test
+// public void testGetUpdatesFromSrcCache() throws InterruptedException {
+// DummyHMSClient mock = new DummyHMSClient();
+// Database db1 = mock.addDb("db1", "/db1");
+// Table tbl11 = mock.addTable(db1, "tbl11", "/db1/tbl11");
+// mock.addPartition(db1, tbl11, "/db1/tbl11/part111");
+// mock.addPartition(db1, tbl11, "/db1/tbl11/part112");
+//
+// // This would live in the Sentry Service
+// AuthzPathCacheOld srcCache = new AuthzPathCacheOld(mock, new String[]{"/db1"}, 10000);
+//
+// // Trigger Initial full Image fetch
+// srcCache.handleUpdateNotification(new PathsUpdate(10, null));
+// waitToCommit(srcCache);
+//
+// // This entity would live in the NN plugin : a downstream cache with no updateLog
+// AuthzPathCacheOld destCache = new AuthzPathCacheOld(null, new String[]{"/db1"}, 0);
+//
+// // Adapter to pull updates from upstream cache to downstream Cache
+// DummyAdapter<PathsUpdate> adapter = new DummyAdapter<PathsUpdate>(destCache, srcCache);
+// adapter.getDestToPullUpdatesFromSrc();
+// waitToCommit(destCache);
+// // Check if NN plugin received the updates from Sentry Cache
+// assertEquals("db1.tbl11", destCache.findAuthzObject("/db1/tbl11/part111".split("^/")[1].split("/")));
+// assertEquals("db1.tbl11", destCache.findAuthzObject("/db1/tbl11/part112".split("^/")[1].split("/")));
+//
+// // Create Upsteram HMS preUpdate
+// PathsUpdate update = new PathsUpdate(11, null);
+// update.addPathUpdate("db1.tbl12").addPath("/db1/tbl12").addPath("/db1/tbl12/part121");
+// update.addPathUpdate("db1.tbl11").delPath("/db1/tbl11/part112");
+//
+// // Send Update to Upstream Cache
+// srcCache.handleUpdateNotification(update);
+// waitToCommit(srcCache);
+// // Pull preUpdate to downstream Cache
+// adapter.getDestToPullUpdatesFromSrc();
+// waitToCommit(destCache);
+//
+// assertNull(srcCache.findAuthzObject("/db1/tbl11/part112".split("^/")[1].split("/"), false));
+// assertNull(destCache.findAuthzObject("/db1/tbl11/part112".split("^/")[1].split("/"), false));
+// assertEquals("db1.tbl11", destCache.findAuthzObject("/db1/tbl11/part112".split("^/")[1].split("/")));
+// assertEquals("db1.tbl12", destCache.findAuthzObject("/db1/tbl12/part121".split("^/")[1].split("/")));
+// }
+//
+//// @Test(expected = IllegalArgumentException.class)
+//// public void testAuthzPathUpdaterRootPrefix() {
+//// AuthzPathCacheOld cache = new AuthzPathCacheOld(new String[]{"/", "/b/c"});
+//// }
+//
+// @Test
+// public void testAuthzPathUpdater() {
+// AuthzPathCacheOld cache = new AuthzPathCacheOld(null, new String[] { "/a", "/b/c"}, 0);
+// Assert.assertTrue(cache.isUnderPrefix("/a".split("^/")[1].split("/")));
+// Assert.assertTrue(cache.isUnderPrefix("/a/x".split("^/")[1].split("/")));
+// Assert.assertTrue(cache.isUnderPrefix("/b/c/".split("^/")[1].split("/")));
+// Assert.assertFalse(cache.isUnderPrefix("/x".split("^/")[1].split("/")));
+//
+// Assert.assertNull((cache.findAuthzObject("/a/x".split("^/")[1].split("/"))));
+// Assert.assertNull((cache.findAuthzObject("/x".split("^/")[1].split("/"))));
+//
+// cache.addAuthzObject("T", Arrays.asList("/a/T/p1", "/a/T/p2"));
+// Assert.assertEquals("T", cache.findAuthzObject("/a/T/p1".split("^/")[1].split("/")));
+// Assert.assertEquals("T", cache.findAuthzObject("/a/T/p2".split("^/")[1].split("/")));
+// Assert.assertEquals("T", cache.findAuthzObject("/a/T/p1/x".split("^/")[1].split("/")));
+// Assert.assertEquals("T", cache.findAuthzObject("/a/T/p1/x/x".split("^/")[1].split("/")));
+// Assert.assertNull((cache.findAuthzObject("/a/T/p3".split("^/")[1].split("/"))));
+//
+// cache.addPathsToAuthzObject("T", Arrays.asList("/a/T/p3"));
+// Assert.assertEquals("T", cache.findAuthzObject("/a/T/p1".split("^/")[1].split("/")));
+// Assert.assertEquals("T", cache.findAuthzObject("/a/T/p2".split("^/")[1].split("/")));
+// Assert.assertEquals("T", cache.findAuthzObject("/a/T/p1/x".split("^/")[1].split("/")));
+// Assert.assertEquals("T", cache.findAuthzObject("/a/T/p1/x/x".split("^/")[1].split("/")));
+// Assert.assertEquals("T", cache.findAuthzObject("/a/T/p3".split("^/")[1].split("/")));
+//
+// cache.deletePathsFromAuthzObject("T", Arrays.asList("/a/T/p2"));
+// Assert.assertEquals("T", cache.findAuthzObject("/a/T/p1".split("^/")[1].split("/")));
+// Assert.assertNull((cache.findAuthzObject("/a/T/p2".split("^/")[1].split("/"))));
+// Assert.assertEquals("T", cache.findAuthzObject("/a/T/p1/x".split("^/")[1].split("/")));
+// Assert.assertEquals("T", cache.findAuthzObject("/a/T/p1/x/x".split("^/")[1].split("/")));
+// Assert.assertEquals("T", cache.findAuthzObject("/a/T/p3".split("^/")[1].split("/")));
+//
+// cache.deleteAuthzObject("T");
+// Assert.assertNull((cache.findAuthzObject("/a/T/p1".split("^/")[1].split("/"))));
+// Assert.assertNull((cache.findAuthzObject("/a/T/p2".split("^/")[1].split("/"))));
+// Assert.assertNull((cache.findAuthzObject("/a/T/p3".split("^/")[1].split("/"))));
+// }
+//
+// private void waitToCommit(AuthzPathCacheOld hmsCache) throws InterruptedException {
+// int counter = 0;
+// while(!hmsCache.areAllUpdatesCommited()) {
+// Thread.sleep(200);
+// counter++;
+// if (counter > 10000) {
+// fail("Updates taking too long to commit !!");
+// }
+// }
+// }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-hdfs/src/test/java/org/apache/sentry/hdfs/TestAuthzPermCache.java
----------------------------------------------------------------------
diff --git a/sentry-hdfs/src/test/java/org/apache/sentry/hdfs/TestAuthzPermCache.java b/sentry-hdfs/src/test/java/org/apache/sentry/hdfs/TestAuthzPermCache.java
new file mode 100644
index 0000000..f4e569f
--- /dev/null
+++ b/sentry-hdfs/src/test/java/org/apache/sentry/hdfs/TestAuthzPermCache.java
@@ -0,0 +1,64 @@
+/**
+ * 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.hdfs;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import org.apache.hadoop.fs.permission.FsAction;
+//import org.apache.sentry.hdfs.old.AuthzPermCache;
+//import org.apache.sentry.hdfs.old.AuthzPermCache.PrivilegeInfo;
+//import org.apache.sentry.hdfs.old.AuthzPermCache.RoleInfo;
+import org.junit.Test;
+
+public class TestAuthzPermCache {
+
+// @Test
+// public void testAuthzAddRemove() throws InterruptedException {
+// DummyAuthzSource src = new DummyAuthzSource();
+// AuthzPermCache authzCache = new AuthzPermCache(10000, src, 0);
+// src.privs.put("db1.tbl11", new PrivilegeInfo("db1.tbl11").setPermission("r1", FsAction.READ_WRITE));
+// src.privs.put("db1.tbl12", new PrivilegeInfo("db1.tbl12").setPermission("r1", FsAction.READ).setPermission("r2", FsAction.WRITE));
+// src.privs.put("db1.tbl13", new PrivilegeInfo("db1.tbl13").setPermission("r2", FsAction.READ).setPermission("r3", FsAction.WRITE));
+// src.roles.put("r1", new RoleInfo("r1").addGroup("g1"));
+// src.roles.put("r2", new RoleInfo("r2").addGroup("g2").addGroup("g1"));
+// src.roles.put("r3", new RoleInfo("r3").addGroup("g3").addGroup("g2").addGroup("g1"));
+// authzCache.handleUpdateNotification(new PermissionsUpdate(10, false));
+// waitToCommit(authzCache);
+//
+// assertEquals(FsAction.READ_WRITE, authzCache.getPermissions("db1.tbl11").get("g1"));
+// assertEquals(FsAction.READ_WRITE, authzCache.getPermissions("db1.tbl12").get("g1"));
+// assertEquals(FsAction.WRITE, authzCache.getPermissions("db1.tbl12").get("g2"));
+// assertEquals(FsAction.READ_WRITE, authzCache.getPermissions("db1.tbl13").get("g1"));
+// assertEquals(FsAction.READ_WRITE, authzCache.getPermissions("db1.tbl13").get("g2"));
+// assertEquals(FsAction.WRITE, authzCache.getPermissions("db1.tbl13").get("g3"));
+// }
+//
+// private void waitToCommit(AuthzPermCache authzCache) throws InterruptedException {
+// int counter = 0;
+// while(!authzCache.areAllUpdatesCommited()) {
+// Thread.sleep(200);
+// counter++;
+// if (counter > 10000) {
+// fail("Updates taking too long to commit !!");
+// }
+// }
+// }
+}
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-hdfs/src/test/java/org/apache/sentry/hdfs/TestHMSPaths.java
----------------------------------------------------------------------
diff --git a/sentry-hdfs/src/test/java/org/apache/sentry/hdfs/TestHMSPaths.java b/sentry-hdfs/src/test/java/org/apache/sentry/hdfs/TestHMSPaths.java
new file mode 100644
index 0000000..29868ae
--- /dev/null
+++ b/sentry-hdfs/src/test/java/org/apache/sentry/hdfs/TestHMSPaths.java
@@ -0,0 +1,357 @@
+/**
+ * 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.hdfs;
+
+import java.util.List;
+
+import org.apache.hadoop.fs.Path;
+import org.junit.Assert;
+import org.junit.Test;
+
+import com.google.common.collect.Lists;
+
+public class TestHMSPaths {
+
+ @Test
+ public void testGetPathElements() {
+ List<String> as2 = HMSPaths.getPathElements(new String("/a/b"));
+ List<String> as1 = HMSPaths.getPathElements(new String("/a/b"));
+ Assert.assertEquals(as1, as2);
+
+ List<String> as = HMSPaths.getPathElements(new String("/a/b"));
+ Assert.assertEquals(Lists.newArrayList("a", "b"), as);
+
+ as = HMSPaths.getPathElements(new String("//a/b"));
+ Assert.assertEquals(Lists.newArrayList("a", "b"), as);
+
+ as = HMSPaths.getPathElements(new String("/a//b"));
+ Assert.assertEquals(Lists.newArrayList("a", "b"), as);
+
+ as = HMSPaths.getPathElements(new String("/a/b/"));
+ Assert.assertEquals(Lists.newArrayList("a", "b"), as);
+
+ as = HMSPaths.getPathElements(new String("//a//b//"));
+ Assert.assertEquals(Lists.newArrayList("a", "b"), as);
+ }
+
+ @Test
+ public void testEntryType() {
+ Assert.assertTrue(HMSPaths.EntryType.DIR.isRemoveIfDangling());
+ Assert.assertFalse(HMSPaths.EntryType.PREFIX.isRemoveIfDangling());
+ Assert.assertFalse(
+ HMSPaths.EntryType.AUTHZ_OBJECT.isRemoveIfDangling());
+ }
+
+ @Test
+ public void testRootEntry() {
+ HMSPaths.Entry root = HMSPaths.Entry.createRoot(false);
+ root.toString();
+ Assert.assertNull(root.getParent());
+ Assert.assertEquals(HMSPaths.EntryType.DIR, root.getType());
+ Assert.assertNull(root.getAuthzObj());
+ Assert.assertEquals(Path.SEPARATOR, root.getFullPath());
+ Assert.assertTrue(root.getChildren().isEmpty());
+ root.delete();
+ try {
+ root.find(null, true);
+ Assert.fail();
+ } catch (IllegalArgumentException ex) {
+ //NOP
+ }
+ try {
+ root.find(new String[0], true);
+ Assert.fail();
+ } catch (IllegalArgumentException ex) {
+ //NOP
+ }
+ try {
+ root.find(null, false);
+ Assert.fail();
+ } catch (IllegalArgumentException ex) {
+ //NOP
+ }
+ try {
+ root.find(new String[0], false);
+ Assert.fail();
+ } catch (IllegalArgumentException ex) {
+ //NOP
+ }
+ Assert.assertNull(root.find(new String[]{"a"}, true));
+ Assert.assertNull(root.find(new String[]{"a"}, false));
+ Assert.assertNull(root.findPrefixEntry(Lists.newArrayList("a")));
+
+ root.delete();
+ }
+
+ @Test
+ public void testRootPrefixEntry() {
+ HMSPaths.Entry root = HMSPaths.Entry.createRoot(true);
+ root.toString();
+
+ Assert.assertNull(root.find(new String[]{"a"}, true));
+ Assert.assertNull(root.find(new String[]{"a"}, false));
+ Assert.assertEquals(root, root.findPrefixEntry(Lists.newArrayList("a")));
+ Assert.assertEquals(root, root.findPrefixEntry(Lists.newArrayList("a", "b")));
+
+ try {
+ root.createPrefix(Lists.newArrayList("a"));
+ Assert.fail();
+ } catch (IllegalArgumentException ex) {
+ //NOP
+ }
+ }
+
+ @Test
+ public void testImmediatePrefixEntry() {
+ HMSPaths.Entry root = HMSPaths.Entry.createRoot(false);
+ HMSPaths.Entry entry = root.createPrefix(Lists.newArrayList("a"));
+ entry.toString();
+
+ Assert.assertEquals(1, root.getChildren().size());
+
+ Assert.assertEquals(root, entry.getParent());
+ Assert.assertEquals(HMSPaths.EntryType.PREFIX, entry.getType());
+ Assert.assertEquals("a", entry.getPathElement());
+ Assert.assertNull(entry.getAuthzObj());
+ Assert.assertEquals(Path.SEPARATOR + "a", entry.getFullPath());
+ Assert.assertTrue(entry.getChildren().isEmpty());
+
+ Assert.assertEquals(entry, root.findPrefixEntry(Lists.newArrayList("a")));
+ Assert.assertEquals(entry, root.findPrefixEntry(Lists.newArrayList("a", "b")));
+
+ Assert.assertNull(root.find(new String[]{"a", "b"}, false));
+
+ Assert.assertNull(root.find(new String[]{"b"}, false));
+ Assert.assertNull(root.findPrefixEntry(Lists.newArrayList("b")));
+
+ try {
+ root.createPrefix(Lists.newArrayList("a", "b"));
+ Assert.fail();
+ } catch (IllegalArgumentException ex) {
+ //NOP
+ }
+
+ try {
+ root.createPrefix(Lists.newArrayList("a", "b", "c"));
+ Assert.fail();
+ } catch (IllegalArgumentException ex) {
+ //NOP
+ }
+
+ entry.delete();
+ Assert.assertTrue(root.getChildren().isEmpty());
+ }
+
+ @Test
+ public void testFurtherPrefixEntry() {
+ HMSPaths.Entry root = HMSPaths.Entry.createRoot(false);
+ HMSPaths.Entry entry = root.createPrefix(Lists.newArrayList("a", "b"));
+ entry.toString();
+
+ Assert.assertEquals(1, root.getChildren().size());
+
+ Assert.assertEquals(root, entry.getParent().getParent());
+ Assert.assertEquals(HMSPaths.EntryType.PREFIX, entry.getType());
+ Assert.assertEquals(HMSPaths.EntryType.DIR,
+ entry.getParent().getType());
+ Assert.assertEquals("b", entry.getPathElement());
+ Assert.assertEquals("a", entry.getParent().getPathElement());
+ Assert.assertNull(entry.getAuthzObj());
+ Assert.assertNull(entry.getParent().getAuthzObj());
+ Assert.assertEquals(Path.SEPARATOR + "a" + Path.SEPARATOR + "b",
+ entry.getFullPath());
+ Assert.assertEquals(Path.SEPARATOR + "a", entry.getParent().getFullPath());
+ Assert.assertTrue(entry.getChildren().isEmpty());
+ Assert.assertEquals(1, entry.getParent().getChildren().size());
+
+ Assert.assertEquals(entry, root.findPrefixEntry(Lists.newArrayList("a", "b")));
+ Assert.assertNull(root.findPrefixEntry(Lists.newArrayList("a")));
+
+ Assert.assertNull(root.find(new String[]{"a", "b", "c"}, false));
+
+ try {
+ root.createPrefix(Lists.newArrayList("a", "b"));
+ Assert.fail();
+ } catch (IllegalArgumentException ex) {
+ //NOP
+ }
+
+ try {
+ root.createPrefix(Lists.newArrayList("a", "b", "c"));
+ Assert.fail();
+ } catch (IllegalArgumentException ex) {
+ //NOP
+ }
+
+ entry.delete();
+ Assert.assertTrue(root.getChildren().isEmpty());
+ }
+
+ @Test
+ public void testImmediateAuthzEntry() {
+ HMSPaths.Entry root = HMSPaths.Entry.createRoot(false);
+ HMSPaths.Entry prefix = root.createPrefix(Lists.newArrayList("a", "b"));
+
+ HMSPaths.Entry entry = root.createAuthzObjPath(
+ Lists.newArrayList("a", "b", "p1"), "A");
+ Assert.assertEquals(prefix, entry.getParent());
+ Assert.assertEquals(HMSPaths.EntryType.AUTHZ_OBJECT, entry.getType());
+ Assert.assertEquals("p1", entry.getPathElement());
+ Assert.assertEquals("A", entry.getAuthzObj());
+ Assert.assertEquals(Path.SEPARATOR + "a" + Path.SEPARATOR + "b" +
+ Path.SEPARATOR + "p1", entry.getFullPath());
+
+ try {
+ root.createPrefix(Lists.newArrayList("a", "b", "p1", "c"));
+ Assert.fail();
+ } catch (IllegalArgumentException ex) {
+ //NOP
+ }
+
+ Assert.assertEquals(entry, root.find(new String[]{"a", "b", "p1"}, true));
+ Assert.assertEquals(entry, root.find(new String[]{"a", "b", "p1"}, false));
+ Assert.assertEquals(entry, root.find(new String[]{"a", "b", "p1", "c"},
+ true));
+ Assert.assertNull(root.find(new String[]{"a", "b", "p1", "c"}, false));
+ Assert.assertEquals(prefix, root.findPrefixEntry(
+ Lists.newArrayList("a", "b", "p1")));
+
+ root.find(new String[]{"a", "b", "p1"}, true).delete();
+ Assert.assertNull(root.find(new String[]{"a", "b", "p1"}, false));
+ Assert.assertNull(root.find(new String[]{"a", "b"}, false));
+ Assert.assertEquals(prefix, root.findPrefixEntry(
+ Lists.newArrayList("a", "b", "p1")));
+
+ }
+
+ @Test
+ public void testFurtherAuthzEntry() {
+ HMSPaths.Entry root = HMSPaths.Entry.createRoot(false);
+ HMSPaths.Entry prefix = root.createPrefix(Lists.newArrayList("a", "b"));
+
+ HMSPaths.Entry entry = root.createAuthzObjPath(
+ Lists.newArrayList("a", "b", "t", "p1"), "A");
+ Assert.assertEquals(prefix, entry.getParent().getParent());
+ Assert.assertEquals(HMSPaths.EntryType.AUTHZ_OBJECT, entry.getType());
+ Assert.assertEquals("p1", entry.getPathElement());
+ Assert.assertEquals("A", entry.getAuthzObj());
+ Assert.assertEquals(Path.SEPARATOR + "a" + Path.SEPARATOR + "b" +
+ Path.SEPARATOR + "t" + Path.SEPARATOR + "p1", entry.getFullPath());
+
+ try {
+ root.createPrefix(Lists.newArrayList("a", "b", "p1", "t", "c"));
+ Assert.fail();
+ } catch (IllegalArgumentException ex) {
+ //NOP
+ }
+
+ HMSPaths.Entry ep2 = root.createAuthzObjPath(
+ Lists.newArrayList("a", "b", "t", "p1", "p2"), "A");
+
+ Assert.assertEquals(HMSPaths.EntryType.AUTHZ_OBJECT, entry.getType());
+ Assert.assertEquals("p1", entry.getPathElement());
+ Assert.assertEquals("A", entry.getAuthzObj());
+
+ Assert.assertEquals(HMSPaths.EntryType.AUTHZ_OBJECT, ep2.getType());
+ Assert.assertEquals("p2", ep2.getPathElement());
+ Assert.assertEquals("A", entry.getAuthzObj());
+
+ Assert.assertEquals(entry, root.find(new String[]{"a", "b", "t", "p1"},
+ true));
+ Assert.assertEquals(entry, root.find(new String[]{"a", "b", "t", "p1"},
+ false));
+ Assert.assertEquals(entry, root.find(new String[]{"a", "b", "t", "p1", "c"},
+ true));
+ Assert.assertNull(root.find(new String[]{"a", "b", "t", "p1", "c"}, false));
+ Assert.assertEquals(prefix, root.findPrefixEntry(
+ Lists.newArrayList("a", "b", "t", "p1")));
+
+ Assert.assertEquals(ep2, root.find(new String[]{"a", "b", "t", "p1", "p2"},
+ true));
+ Assert.assertEquals(ep2, root.find(new String[]{"a", "b", "t", "p1", "p2"},
+ false));
+ Assert.assertEquals(ep2, root.find(new String[]{"a", "b", "t", "p1", "p2", "c"},
+ true));
+ Assert.assertNull(root.find(new String[]{"a", "b", "t", "p1", "p2", "c"}, false));
+ Assert.assertEquals(prefix, root.findPrefixEntry(
+ Lists.newArrayList("a", "b", "t", "p1", "p2")));
+
+ root.find(new String[]{"a", "b", "t", "p1"}, false).delete();
+
+ Assert.assertNull(root.find(new String[]{"a", "b", "t", "p1"},
+ true));
+ Assert.assertEquals(HMSPaths.EntryType.DIR, entry.getType());
+ Assert.assertNull(entry.getAuthzObj());
+
+ Assert.assertNull(root.find(new String[]{"a", "b", "t", "p1"}, false));
+ Assert.assertNull(root.find(new String[]{"a", "b", "t"}, false));
+ Assert.assertNull(root.find(new String[]{"a", "b"}, false));
+ Assert.assertEquals(prefix, root.findPrefixEntry(
+ Lists.newArrayList("a", "b", "t", "p1")));
+
+ Assert.assertNotNull(root.find(new String[]{"a", "b", "t", "p1", "p2"}, false));
+ root.find(new String[]{"a", "b", "t", "p1", "p2"}, false).delete();
+ Assert.assertNull(root.find(new String[]{"a", "b", "t", "p1"}, false));
+ Assert.assertNull(root.find(new String[]{"a", "b", "t"}, false));
+ Assert.assertNull(root.find(new String[]{"a", "b"}, false));
+ Assert.assertEquals(prefix, root.findPrefixEntry(
+ Lists.newArrayList("a", "b", "t", "p1")));
+
+ }
+
+ @Test
+ public void testMultipleAuthzEntry() {
+ HMSPaths.Entry root = HMSPaths.Entry.createRoot(false);
+ HMSPaths.Entry prefix = root.createPrefix(Lists.newArrayList("a", "b"));
+
+ HMSPaths.Entry e1 = root.createAuthzObjPath(
+ Lists.newArrayList("a", "b", "t", "p1"), "A");
+ HMSPaths.Entry e2 = root.createAuthzObjPath(
+ Lists.newArrayList("a", "b", "t", "p2"), "A");
+
+
+ Assert.assertEquals(e1, root.find(new String[]{"a", "b", "t", "p1"}, true));
+ Assert.assertEquals(e1, root.find(new String[]{"a", "b", "t", "p1"},
+ false));
+ Assert.assertEquals(e1, root.find(new String[]{"a", "b", "t", "p1", "c"},
+ true));
+ Assert.assertNull(root.find(new String[]{"a", "b", "t", "p1", "c"}, false));
+ Assert.assertEquals(prefix, root.findPrefixEntry(
+ Lists.newArrayList("a", "b", "t", "p1")));
+
+ Assert.assertEquals(e2, root.find(new String[]{"a", "b", "t", "p2"}, true));
+ Assert.assertEquals(e2, root.find(new String[]{"a", "b", "t", "p2"},
+ false));
+ Assert.assertEquals(e2, root.find(new String[]{"a", "b", "t", "p2", "c"},
+ true));
+ Assert.assertNull(root.find(new String[]{"a", "b", "t", "p2", "c"}, false));
+ Assert.assertEquals(prefix, root.findPrefixEntry(
+ Lists.newArrayList("a", "b", "t", "p2")));
+
+ root.find(new String[]{"a", "b", "t", "p1"}, true).delete();
+ Assert.assertNull(root.find(new String[]{"a", "b", "t", "p1"}, false));
+
+ root.find(new String[]{"a", "b", "t", "p2"}, true).delete();
+ Assert.assertNull(root.find(new String[]{"a", "b", "t", "p2"}, false));
+ Assert.assertNull(root.find(new String[]{"a", "b", "t"}, false));
+
+ Assert.assertEquals(prefix, root.findPrefixEntry(
+ Lists.newArrayList("a", "b", "t", "p3")));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-hdfs/src/test/java/org/apache/sentry/hdfs/TestHMSPathsFullDump.java
----------------------------------------------------------------------
diff --git a/sentry-hdfs/src/test/java/org/apache/sentry/hdfs/TestHMSPathsFullDump.java b/sentry-hdfs/src/test/java/org/apache/sentry/hdfs/TestHMSPathsFullDump.java
new file mode 100644
index 0000000..b7c7b6d
--- /dev/null
+++ b/sentry-hdfs/src/test/java/org/apache/sentry/hdfs/TestHMSPathsFullDump.java
@@ -0,0 +1,97 @@
+/**
+ * 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.hdfs;
+
+import junit.framework.Assert;
+
+import org.apache.sentry.provider.db.service.thrift.TPathsDump;
+import org.apache.thrift.TDeserializer;
+import org.apache.thrift.TException;
+import org.apache.thrift.TSerializer;
+import org.apache.thrift.protocol.TCompactProtocol;
+import org.junit.Test;
+
+import com.google.common.collect.Lists;
+
+public class TestHMSPathsFullDump {
+
+ @Test
+ public void testDumpAndInitialize() {
+ HMSPaths hmsPaths = new HMSPaths(new String[] {"/user/hive/warehouse"});
+ hmsPaths._addAuthzObject("db1", Lists.newArrayList("/user/hive/warehouse/db1"));
+ hmsPaths._addAuthzObject("db1.tbl11", Lists.newArrayList("/user/hive/warehouse/db1/tbl11"));
+ hmsPaths._addPathsToAuthzObject("db1.tbl11", Lists.newArrayList(
+ "/user/hive/warehouse/db1/tbl11/part111",
+ "/user/hive/warehouse/db1/tbl11/part112",
+ "/user/hive/warehouse/db1/tbl11/p1=1/p2=x"));
+
+ Assert.assertEquals("db1", hmsPaths.findAuthzObject(new String[]{"user", "hive", "warehouse", "db1"}, false));
+ Assert.assertEquals("db1.tbl11", hmsPaths.findAuthzObject(new String[]{"user", "hive", "warehouse", "db1", "tbl11"}, false));
+ Assert.assertEquals("db1.tbl11", hmsPaths.findAuthzObject(new String[]{"user", "hive", "warehouse", "db1", "tbl11", "part111"}, false));
+ Assert.assertEquals("db1.tbl11", hmsPaths.findAuthzObject(new String[]{"user", "hive", "warehouse", "db1", "tbl11", "part112"}, false));
+
+ Assert.assertEquals("db1.tbl11", hmsPaths.findAuthzObject(new String[]{"user", "hive", "warehouse", "db1", "tbl11", "p1=1", "p2=x"}, false));
+ Assert.assertEquals("db1.tbl11", hmsPaths.findAuthzObject(new String[]{"user", "hive", "warehouse", "db1", "tbl11", "p1=1"}, true));
+
+ HMSPathsSerDe serDe = hmsPaths.getPathsDump();
+ TPathsDump pathsDump = serDe.createPathsDump();
+ HMSPaths hmsPaths2 = serDe.initializeFromDump(pathsDump);
+
+ Assert.assertEquals("db1", hmsPaths2.findAuthzObject(new String[]{"user", "hive", "warehouse", "db1"}, false));
+ Assert.assertEquals("db1.tbl11", hmsPaths2.findAuthzObject(new String[]{"user", "hive", "warehouse", "db1", "tbl11"}, false));
+ Assert.assertEquals("db1.tbl11", hmsPaths2.findAuthzObject(new String[]{"user", "hive", "warehouse", "db1", "tbl11", "part111"}, false));
+ Assert.assertEquals("db1.tbl11", hmsPaths2.findAuthzObject(new String[]{"user", "hive", "warehouse", "db1", "tbl11", "part112"}, false));
+ }
+
+ @Test
+ public void testThrftSerialization() throws TException {
+ HMSPaths hmsPaths = new HMSPaths(new String[] {"/"});
+ String prefix = "/user/hive/warehouse/";
+ for (int dbNum = 0; dbNum < 1; dbNum++) {
+ String dbName = "db" + dbNum;
+ hmsPaths._addAuthzObject(dbName, Lists.newArrayList(prefix + dbName));
+ for (int tblNum = 0; tblNum < 1000000; tblNum++) {
+ String tblName = "tbl" + tblNum;
+ hmsPaths._addAuthzObject(dbName + "." + tblName, Lists.newArrayList(prefix + dbName + "/" + tblName));
+ for (int partNum = 0; partNum < 1; partNum++) {
+ String partName = "part" + partNum;
+ hmsPaths
+ ._addPathsToAuthzObject(
+ dbName + "." + tblName,
+ Lists.newArrayList(prefix + dbName + "/" + tblName + "/"
+ + partName));
+ }
+ }
+ }
+ HMSPathsSerDe serDe = hmsPaths.getPathsDump();
+ long t1 = System.currentTimeMillis();
+ TPathsDump pathsDump = serDe.createPathsDump();
+ byte[] ser = new TSerializer(new TCompactProtocol.Factory()).serialize(pathsDump);
+ long serTime = System.currentTimeMillis() - t1;
+ System.out.println("Serialization Time: " + serTime + ", " + ser.length);
+
+ t1 = System.currentTimeMillis();
+ TPathsDump tPathsDump = new TPathsDump();
+ new TDeserializer(new TCompactProtocol.Factory()).deserialize(tPathsDump, ser);
+ HMSPaths fromDump = serDe.initializeFromDump(tPathsDump);
+ System.out.println("Deserialization Time: " + (System.currentTimeMillis() - t1));
+ Assert.assertEquals("db9.tbl999", fromDump.findAuthzObject(new String[]{"user", "hive", "warehouse", "db0", "tbl999"}, false));
+ Assert.assertEquals("db9.tbl999", fromDump.findAuthzObject(new String[]{"user", "hive", "warehouse", "db0", "tbl999", "part5"}, false));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-hdfs/src/test/java/org/apache/sentry/hdfs/TestUpdateableAuthzPaths.java
----------------------------------------------------------------------
diff --git a/sentry-hdfs/src/test/java/org/apache/sentry/hdfs/TestUpdateableAuthzPaths.java b/sentry-hdfs/src/test/java/org/apache/sentry/hdfs/TestUpdateableAuthzPaths.java
new file mode 100644
index 0000000..76c849f
--- /dev/null
+++ b/sentry-hdfs/src/test/java/org/apache/sentry/hdfs/TestUpdateableAuthzPaths.java
@@ -0,0 +1,136 @@
+/**
+ * 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.hdfs;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+
+import java.util.concurrent.locks.ReentrantReadWriteLock;
+
+import org.apache.sentry.provider.db.service.thrift.TPathChanges;
+import org.junit.Test;
+
+import com.google.common.collect.Lists;
+
+public class TestUpdateableAuthzPaths {
+
+ @Test
+ public void testFullUpdate() {
+ HMSPaths hmsPaths = createBaseHMSPaths(1, 1);
+ assertEquals("db1", hmsPaths.findAuthzObjectExactMatch(new String[]{"db1"}));
+ assertEquals("db1.tbl11", hmsPaths.findAuthzObjectExactMatch(new String[]{"db1", "tbl11"}));
+ assertEquals("db1.tbl11", hmsPaths.findAuthzObjectExactMatch(new String[]{"db1", "tbl11", "part111"}));
+ assertEquals("db1.tbl11", hmsPaths.findAuthzObjectExactMatch(new String[]{"db1", "tbl11", "part112"}));
+
+ UpdateableAuthzPaths authzPaths = new UpdateableAuthzPaths(hmsPaths);
+ PathsUpdate update = new PathsUpdate(1, true);
+ update.getThriftObject().setPathsDump(authzPaths.getPathsDump().createPathsDump());
+
+ UpdateableAuthzPaths authzPaths2 = new UpdateableAuthzPaths(new String[] {"/"});
+ UpdateableAuthzPaths pre = authzPaths2.updateFull(update);
+ assertFalse(pre == authzPaths2);
+ authzPaths2 = pre;
+
+ assertEquals("db1", authzPaths2.findAuthzObjectExactMatch(new String[]{"db1"}));
+ assertEquals("db1.tbl11", authzPaths2.findAuthzObjectExactMatch(new String[]{"db1", "tbl11"}));
+ assertEquals("db1.tbl11", authzPaths2.findAuthzObjectExactMatch(new String[]{"db1", "tbl11", "part111"}));
+ assertEquals("db1.tbl11", authzPaths2.findAuthzObjectExactMatch(new String[]{"db1", "tbl11", "part112"}));
+
+ // Ensure Full Update wipes old stuff
+ UpdateableAuthzPaths authzPaths3 = new UpdateableAuthzPaths(createBaseHMSPaths(2, 1));
+ update = new PathsUpdate(2, true);
+ update.getThriftObject().setPathsDump(authzPaths3.getPathsDump().createPathsDump());
+ pre = authzPaths2.updateFull(update);
+ assertFalse(pre == authzPaths2);
+ authzPaths2 = pre;
+
+ assertNull(authzPaths2.findAuthzObjectExactMatch(new String[]{"db1"}));
+ assertNull(authzPaths2.findAuthzObjectExactMatch(new String[]{"db1", "tbl11"}));
+
+ assertEquals("db2", authzPaths2.findAuthzObjectExactMatch(new String[]{"db2"}));
+ assertEquals("db2.tbl21", authzPaths2.findAuthzObjectExactMatch(new String[]{"db2", "tbl21"}));
+ assertEquals("db2.tbl21", authzPaths2.findAuthzObjectExactMatch(new String[]{"db2", "tbl21", "part211"}));
+ assertEquals("db2.tbl21", authzPaths2.findAuthzObjectExactMatch(new String[]{"db2", "tbl21", "part212"}));
+ }
+
+ @Test
+ public void testPartialUpdateAddPath() {
+ HMSPaths hmsPaths = createBaseHMSPaths(1, 1);
+ UpdateableAuthzPaths authzPaths = new UpdateableAuthzPaths(hmsPaths);
+ ReentrantReadWriteLock lock = new ReentrantReadWriteLock();
+ // Create table
+ PathsUpdate update = new PathsUpdate(2, false);
+ TPathChanges pathChange = update.newPathChange("db1.tbl12");
+ pathChange.addToAddPaths(PathsUpdate.cleanPath("file:///db1/tbl12"));
+ authzPaths.updatePartial(Lists.newArrayList(update), lock);
+
+ // Add partition
+ update = new PathsUpdate(3, false);
+ pathChange = update.newPathChange("db1.tbl12");
+ pathChange.addToAddPaths(PathsUpdate.cleanPath("file:///db1/tbl12/part121"));
+ authzPaths.updatePartial(Lists.newArrayList(update), lock);
+
+ // Ensure no change in existing Paths
+ assertEquals("db1", authzPaths.findAuthzObjectExactMatch(new String[]{"db1"}));
+ assertEquals("db1.tbl11", authzPaths.findAuthzObjectExactMatch(new String[]{"db1", "tbl11"}));
+ assertEquals("db1.tbl11", authzPaths.findAuthzObjectExactMatch(new String[]{"db1", "tbl11", "part111"}));
+ assertEquals("db1.tbl11", authzPaths.findAuthzObjectExactMatch(new String[]{"db1", "tbl11", "part112"}));
+
+ // Verify new Paths
+ assertEquals("db1.tbl12", authzPaths.findAuthzObjectExactMatch(new String[]{"db1", "tbl12"}));
+ assertEquals("db1.tbl12", authzPaths.findAuthzObjectExactMatch(new String[]{"db1", "tbl12", "part121"}));
+ }
+
+ @Test
+ public void testPartialUpdateDelPath() {
+ HMSPaths hmsPaths = createBaseHMSPaths(1, 1);
+ UpdateableAuthzPaths authzPaths = new UpdateableAuthzPaths(hmsPaths);
+ ReentrantReadWriteLock lock = new ReentrantReadWriteLock();
+ assertEquals("db1.tbl11", authzPaths.findAuthzObjectExactMatch(new String[]{"db1", "tbl11"}));
+ assertEquals("db1.tbl11", authzPaths.findAuthzObjectExactMatch(new String[]{"db1", "tbl11", "part111"}));
+
+ // Drop partition
+ PathsUpdate update = new PathsUpdate(2, false);
+ TPathChanges pathChange = update.newPathChange("db1.tbl11");
+ pathChange.addToDelPaths(PathsUpdate.cleanPath("file:///db1/tbl11/part111"));
+ authzPaths.updatePartial(Lists.newArrayList(update), lock);
+
+ // Verify Paths deleted
+ assertNull(authzPaths.findAuthzObjectExactMatch(new String[]{"db1", "tbl11", "part111"}));
+
+ // Verify rest ok
+ assertEquals("db1.tbl11", authzPaths.findAuthzObjectExactMatch(new String[]{"db1", "tbl11", "part112"}));
+ }
+
+ private HMSPaths createBaseHMSPaths(int dbNum, int tblNum) {
+ String db = "db" + dbNum;
+ String tbl = "tbl" + dbNum + "" + tblNum;
+ String fullTbl = db + "." + tbl;
+ String dbPath = "/" + db;
+ String tblPath = "/" + db + "/" + tbl;
+ String partPath = tblPath + "/part" + dbNum + "" + tblNum;
+ HMSPaths hmsPaths = new HMSPaths(new String[] {"/"});
+ hmsPaths._addAuthzObject(db, Lists.newArrayList(dbPath));
+ hmsPaths._addAuthzObject(fullTbl, Lists.newArrayList(tblPath));
+ hmsPaths._addPathsToAuthzObject(fullTbl, Lists.newArrayList(
+ partPath + "1", partPath + "2" ));
+ return hmsPaths;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-hdfs/src/test/resources/hdfs-sentry.xml
----------------------------------------------------------------------
diff --git a/sentry-hdfs/src/test/resources/hdfs-sentry.xml b/sentry-hdfs/src/test/resources/hdfs-sentry.xml
new file mode 100644
index 0000000..c23a431
--- /dev/null
+++ b/sentry-hdfs/src/test/resources/hdfs-sentry.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
+<!--
+ 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.
+-->
+
+<configuration>
+ <!-- dummy file that gets rewritten by testcases in target test classpath -->
+</configuration>
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-provider/sentry-provider-db/pom.xml
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/pom.xml b/sentry-provider/sentry-provider-db/pom.xml
index b4167e4..b8da31b 100644
--- a/sentry-provider/sentry-provider-db/pom.xml
+++ b/sentry-provider/sentry-provider-db/pom.xml
@@ -42,6 +42,11 @@ limitations under the License.
<scope>provided</scope>
</dependency>
<dependency>
+ <groupId>org.apache.hadoop</groupId>
+ <artifactId>hadoop-mapreduce-client-jobclient</artifactId>
+ <version>2.5.0</version>
+ </dependency>
+ <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
@@ -72,6 +77,10 @@ limitations under the License.
</dependency>
<dependency>
<groupId>org.apache.sentry</groupId>
+ <artifactId>sentry-hdfs</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.sentry</groupId>
<artifactId>sentry-core-common</artifactId>
</dependency>
<dependency>
@@ -80,6 +89,10 @@ limitations under the License.
</dependency>
<dependency>
<groupId>org.apache.sentry</groupId>
+ <artifactId>sentry-service-client</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.sentry</groupId>
<artifactId>sentry-provider-common</artifactId>
</dependency>
<dependency>
@@ -89,6 +102,11 @@ limitations under the License.
</dependency>
<dependency>
<groupId>org.apache.hive</groupId>
+ <artifactId>hive-exec</artifactId>
+ <version>0.13.1-cdh5.2.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hive</groupId>
<artifactId>hive-shims</artifactId>
<scope>provided</scope>
</dependency>
@@ -109,6 +127,11 @@ limitations under the License.
<artifactId>ant-contrib</artifactId>
</dependency>
<dependency>
+ <groupId>org.apache.sentry</groupId>
+ <artifactId>sentry-hdfs-int</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-minikdc</artifactId>
<scope>test</scope>
@@ -138,6 +161,11 @@ limitations under the License.
<artifactId>mockito-all</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.apache.hive</groupId>
+ <artifactId>hive-metastore</artifactId>
+ <version>${hive.version}</version>
+ </dependency>
</dependencies>
<build>
@@ -189,68 +217,5 @@ limitations under the License.
</plugin>
</plugins>
</build>
- <profiles>
- <profile>
- <id>thriftif</id>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-antrun-plugin</artifactId>
- <executions>
- <execution>
- <id>generate-thrift-sources</id>
- <phase>generate-sources</phase>
- <configuration>
- <target>
- <taskdef name="for" classname="net.sf.antcontrib.logic.ForTask"
- classpathref="maven.plugin.classpath" />
- <property name="thrift.args" value="-I ${thrift.home} --gen java:beans,hashcode"/>
- <property name="thrift.gen.dir" value="${basedir}/src/gen/thrift"/>
- <delete dir="${thrift.gen.dir}"/>
- <mkdir dir="${thrift.gen.dir}"/>
- <for param="thrift.file">
- <path>
- <fileset dir="${basedir}/src/main/resources/" includes="**/*.thrift" />
- </path>
- <sequential>
- <echo message="Generating Thrift code for @{thrift.file}"/>
- <exec executable="${thrift.home}/bin/thrift" failonerror="true" dir=".">
- <arg line="${thrift.args} -I ${basedir}/src/main/resources/ -o ${thrift.gen.dir} @{thrift.file} " />
- </exec>
- </sequential>
- </for>
- </target>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-enforcer-plugin</artifactId>
- <executions>
- <execution>
- <id>enforce-property</id>
- <goals>
- <goal>enforce</goal>
- </goals>
- <configuration>
- <rules>
- <requireProperty>
- <property>thrift.home</property>
- </requireProperty>
- </rules>
- <fail>true</fail>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
</project>
[02/25] SENTRY-432. HDFS ingration. Initial patch
Posted by pr...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryRole.java
----------------------------------------------------------------------
diff --git a/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryRole.java b/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryRole.java
new file mode 100644
index 0000000..f43a6d5
--- /dev/null
+++ b/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryRole.java
@@ -0,0 +1,641 @@
+/**
+ * Autogenerated by Thrift Compiler (0.9.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+package org.apache.sentry.provider.db.service.thrift;
+
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EnumMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.EnumSet;
+import java.util.Collections;
+import java.util.BitSet;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class TSentryRole implements org.apache.thrift.TBase<TSentryRole, TSentryRole._Fields>, java.io.Serializable, Cloneable {
+ 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>();
+ 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() {
+ HashCodeBuilder builder = new HashCodeBuilder();
+
+ boolean present_roleName = true && (isSetRoleName());
+ builder.append(present_roleName);
+ if (present_roleName)
+ builder.append(roleName);
+
+ boolean present_groups = true && (isSetGroups());
+ builder.append(present_groups);
+ if (present_groups)
+ builder.append(groups);
+
+ boolean present_grantorPrincipal = true && (isSetGrantorPrincipal());
+ builder.append(present_grantorPrincipal);
+ if (present_grantorPrincipal)
+ builder.append(grantorPrincipal);
+
+ return builder.toHashCode();
+ }
+
+ public int compareTo(TSentryRole other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+ TSentryRole typedOther = (TSentryRole)other;
+
+ lastComparison = Boolean.valueOf(isSetRoleName()).compareTo(typedOther.isSetRoleName());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetRoleName()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.roleName, typedOther.roleName);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetGroups()).compareTo(typedOther.isSetGroups());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetGroups()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.groups, typedOther.groups);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetGrantorPrincipal()).compareTo(typedOther.isSetGrantorPrincipal());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetGrantorPrincipal()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.grantorPrincipal, typedOther.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 _set16 = iprot.readSetBegin();
+ struct.groups = new HashSet<TSentryGroup>(2*_set16.size);
+ for (int _i17 = 0; _i17 < _set16.size; ++_i17)
+ {
+ TSentryGroup _elem18; // required
+ _elem18 = new TSentryGroup();
+ _elem18.read(iprot);
+ struct.groups.add(_elem18);
+ }
+ 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 _iter19 : struct.groups)
+ {
+ _iter19.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 _iter20 : struct.groups)
+ {
+ _iter20.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 _set21 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
+ struct.groups = new HashSet<TSentryGroup>(2*_set21.size);
+ for (int _i22 = 0; _i22 < _set21.size; ++_i22)
+ {
+ TSentryGroup _elem23; // required
+ _elem23 = new TSentryGroup();
+ _elem23.read(iprot);
+ struct.groups.add(_elem23);
+ }
+ }
+ struct.setGroupsIsSet(true);
+ struct.grantorPrincipal = iprot.readString();
+ struct.setGrantorPrincipalIsSet(true);
+ }
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/service/thrift/TSentryResponseStatus.java
----------------------------------------------------------------------
diff --git a/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/service/thrift/TSentryResponseStatus.java b/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/service/thrift/TSentryResponseStatus.java
new file mode 100644
index 0000000..81abd90
--- /dev/null
+++ b/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/service/thrift/TSentryResponseStatus.java
@@ -0,0 +1,594 @@
+/**
+ * Autogenerated by Thrift Compiler (0.9.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+package org.apache.sentry.service.thrift;
+
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EnumMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.EnumSet;
+import java.util.Collections;
+import java.util.BitSet;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class TSentryResponseStatus implements org.apache.thrift.TBase<TSentryResponseStatus, TSentryResponseStatus._Fields>, java.io.Serializable, Cloneable {
+ 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 _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 Integer.valueOf(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() {
+ HashCodeBuilder builder = new HashCodeBuilder();
+
+ boolean present_value = true;
+ builder.append(present_value);
+ if (present_value)
+ builder.append(value);
+
+ boolean present_message = true && (isSetMessage());
+ builder.append(present_message);
+ if (present_message)
+ builder.append(message);
+
+ boolean present_stack = true && (isSetStack());
+ builder.append(present_stack);
+ if (present_stack)
+ builder.append(stack);
+
+ return builder.toHashCode();
+ }
+
+ public int compareTo(TSentryResponseStatus other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+ TSentryResponseStatus typedOther = (TSentryResponseStatus)other;
+
+ lastComparison = Boolean.valueOf(isSetValue()).compareTo(typedOther.isSetValue());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetValue()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.value, typedOther.value);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetMessage()).compareTo(typedOther.isSetMessage());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetMessage()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.message, typedOther.message);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetStack()).compareTo(typedOther.isSetStack());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetStack()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.stack, typedOther.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/incubator-sentry/blob/0eb6645e/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/service/thrift/sentry_common_serviceConstants.java
----------------------------------------------------------------------
diff --git a/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/service/thrift/sentry_common_serviceConstants.java b/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/service/thrift/sentry_common_serviceConstants.java
new file mode 100644
index 0000000..4fdeaeb
--- /dev/null
+++ b/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/service/thrift/sentry_common_serviceConstants.java
@@ -0,0 +1,50 @@
+/**
+ * Autogenerated by Thrift Compiler (0.9.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+package org.apache.sentry.service.thrift;
+
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EnumMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.EnumSet;
+import java.util.Collections;
+import java.util.BitSet;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class sentry_common_serviceConstants {
+
+ public static final int TSENTRY_SERVICE_V1 = 1;
+
+ 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;
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-service-client/src/main/java/org/apache/sentry/service/thrift/ServiceConstants.java
----------------------------------------------------------------------
diff --git a/sentry-service-client/src/main/java/org/apache/sentry/service/thrift/ServiceConstants.java b/sentry-service-client/src/main/java/org/apache/sentry/service/thrift/ServiceConstants.java
new file mode 100644
index 0000000..ccb21ee
--- /dev/null
+++ b/sentry-service-client/src/main/java/org/apache/sentry/service/thrift/ServiceConstants.java
@@ -0,0 +1,153 @@
+/**
+ * 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 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";
+ 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 PROCESSOR_FACTORIES = "sentry.service.processor.factories";
+ public static final String PROCESSOR_FACTORIES_DEFAULT =
+ "org.apache.sentry.provider.db.service.thrift.SentryPolicyStoreProcessorFactory";
+ 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_PASS_DEFAULT = "Sentry";
+ 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_HDFS_INTEGRATION_ENABLE = "sentry.hdfs.integration.enable";
+ public static final String SENTRY_HDFS_INTEGRATION_PATH_PREFIXES = "sentry.hdfs.integration.path.prefixes";
+
+ 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.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 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;
+ }
+
+ /**
+ * 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_V1;
+ }
+
+ /* Privilege operation scope */
+ public static enum PrivilegeScope {
+ SERVER,
+ URI,
+ DATABASE,
+ TABLE,
+ COLUMN
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-service-client/src/main/resources/sentry_common_service.thrift
----------------------------------------------------------------------
diff --git a/sentry-service-client/src/main/resources/sentry_common_service.thrift b/sentry-service-client/src/main/resources/sentry_common_service.thrift
new file mode 100644
index 0000000..9456274
--- /dev/null
+++ b/sentry-service-client/src/main/resources/sentry_common_service.thrift
@@ -0,0 +1,42 @@
+#!/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;
+
+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;
+
+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
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-service-client/src/main/resources/sentry_policy_service.thrift
----------------------------------------------------------------------
diff --git a/sentry-service-client/src/main/resources/sentry_policy_service.thrift b/sentry-service-client/src/main/resources/sentry_policy_service.thrift
new file mode 100644
index 0000000..925c402
--- /dev/null
+++ b/sentry-service-client/src/main/resources/sentry_policy_service.thrift
@@ -0,0 +1,266 @@
+#!/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.
+ */
+
+#
+# Thrift Service that the MetaStore is built on
+#
+
+include "share/fb303/if/fb303.thrift"
+include "sentry_common_service.thrift"
+
+namespace java org.apache.sentry.provider.db.service.thrift
+namespace php sentry.provider.db.service.thrift
+namespace cpp Apache.Sentry.Provider.Db.Service.Thrift
+
+enum TSentryGrantOption {
+ TRUE = 1,
+ FALSE = 0,
+ # UNSET is used for revoke privilege, the component like 'hive'
+ # didn't support getting grant option, so use UNSET is stand
+ # for revoke both privileges with grant option and without grant
+ # option.
+ UNSET = -1
+}
+
+# Represents a Privilege in transport from the client to the server
+struct TSentryPrivilege {
+1: required string privilegeScope, # Valid values are SERVER, DATABASE, TABLE
+3: required string serverName,
+4: optional string dbName = "",
+5: optional string tableName = "",
+6: optional string URI = "",
+7: required string action = "",
+8: optional i64 createTime, # Set on server side
+9: optional string grantorPrincipal, # Set on server side
+10: optional TSentryGrantOption grantOption = TSentryGrantOption.FALSE
+}
+
+# TODO can this be deleted? it's not adding value to TAlterSentryRoleAddGroupsRequest
+struct TSentryGroup {
+1: required string groupName
+}
+
+# CREATE ROLE r1
+struct TCreateSentryRoleRequest {
+1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V1,
+2: required string requestorUserName, # user on whose behalf the request is issued
+3: required string roleName, # TSentryRole is not required for this request
+}
+struct TCreateSentryRoleResponse {
+1: required sentry_common_service.TSentryResponseStatus status
+}
+
+# DROP ROLE r1
+struct TDropSentryRoleRequest {
+1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V1,
+2: required string requestorUserName, # user on whose behalf the request is issued
+3: required string roleName # role to drop
+}
+struct TDropSentryRoleResponse {
+1: required sentry_common_service.TSentryResponseStatus status
+}
+
+# GRANT ROLE r1 TO GROUP g1
+struct TAlterSentryRoleAddGroupsRequest {
+1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V1,
+2: required string requestorUserName, # user on whose behalf the request is issued
+3: required string roleName,
+5: required set<TSentryGroup> groups
+}
+
+struct TAlterSentryRoleAddGroupsResponse {
+1: required sentry_common_service.TSentryResponseStatus status
+}
+
+# REVOLE ROLE r1 FROM GROUP g1
+struct TAlterSentryRoleDeleteGroupsRequest {
+1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V1,
+2: required string requestorUserName, # user on whose behalf the request is issued
+3: required string roleName,
+5: required set<TSentryGroup> groups
+}
+struct TAlterSentryRoleDeleteGroupsResponse {
+1: required sentry_common_service.TSentryResponseStatus status
+}
+
+# GRANT ... ON ... TO ROLE ...
+struct TAlterSentryRoleGrantPrivilegeRequest {
+1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V1,
+2: required string requestorUserName, # user on whose behalf the request is issued
+3: required string roleName,
+5: required TSentryPrivilege privilege
+}
+struct TAlterSentryRoleGrantPrivilegeResponse {
+1: required sentry_common_service.TSentryResponseStatus status
+}
+
+# REVOKE ... ON ... FROM ROLE ...
+struct TAlterSentryRoleRevokePrivilegeRequest {
+1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V1,
+2: required string requestorUserName, # user on whose behalf the request is issued
+3: required string roleName,
+5: required TSentryPrivilege privilege
+}
+struct TAlterSentryRoleRevokePrivilegeResponse {
+1: required sentry_common_service.TSentryResponseStatus status
+}
+
+# SHOW ROLE GRANT
+struct TListSentryRolesRequest {
+1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V1,
+2: required string requestorUserName, # user on whose behalf the request is issued
+3: optional string groupName # for this group, or all roles for all groups if null
+}
+# used only for TListSentryRolesResponse
+struct TSentryRole {
+1: required string roleName,
+2: required set<TSentryGroup> groups,
+3: required string grantorPrincipal
+}
+struct TListSentryRolesResponse {
+1: required sentry_common_service.TSentryResponseStatus status
+2: optional set<TSentryRole> roles
+}
+
+struct TSentryAuthorizable {
+1: required string server,
+2: optional string uri,
+3: optional string db,
+4: optional string table,
+}
+
+# SHOW GRANT
+struct TListSentryPrivilegesRequest {
+1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V1,
+2: required string requestorUserName, # user on whose behalf the request is issued
+4: required string roleName, # get privileges assigned for this role
+5: optional TSentryAuthorizable authorizableHierarchy # get privileges assigned for this role
+}
+struct TListSentryPrivilegesResponse {
+1: required sentry_common_service.TSentryResponseStatus status
+2: optional set<TSentryPrivilege> privileges
+}
+
+# Drop privilege
+struct TDropPrivilegesRequest {
+1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V1,
+2: required string requestorUserName, # user on whose behalf the request is issued
+3: required TSentryAuthorizable authorizable
+}
+
+struct TDropPrivilegesResponse {
+1: required sentry_common_service.TSentryResponseStatus status
+}
+
+struct TRenamePrivilegesRequest {
+1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V1,
+2: required string requestorUserName, # user on whose behalf the request is issued
+3: required TSentryAuthorizable oldAuthorizable
+4: required TSentryAuthorizable newAuthorizable
+}
+
+struct TRenamePrivilegesResponse {
+1: required sentry_common_service.TSentryResponseStatus status
+}
+
+# This API was created specifically for ProviderBackend.getPrivileges
+# and is not mean for general purpose privilege retrieval.
+# This request/response pair are created specifically so we can
+# efficiently obtain the specific privilges for a user query
+struct TSentryActiveRoleSet {
+1: required bool all,
+2: required set<string> roles,
+}
+struct TListSentryPrivilegesForProviderRequest {
+1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V1,
+2: required set<string> groups,
+3: required TSentryActiveRoleSet roleSet,
+4: optional TSentryAuthorizable authorizableHierarchy,
+}
+struct TListSentryPrivilegesForProviderResponse {
+1: required sentry_common_service.TSentryResponseStatus status
+2: required set<string> privileges
+}
+
+struct TPathChanges {
+1: required string authzObj;
+2: required list<string> addPaths;
+3: required list<string> delPaths;
+}
+
+struct TPathsUpdate {
+1: required bool hasFullImage;
+2: optional string pathDump;
+3: required i64 seqNum;
+4: optional list<TPathChanges> pathChanges;
+}
+
+struct TPrivilegeChanges {
+1: required string authzObj;
+2: required map<string, string> addPrivileges;
+3: required map<string, string> delPrivileges;
+}
+
+struct TRoleChanges {
+1: required string role;
+2: required list<string> addGroups;
+3: required list<string> delGroups;
+}
+
+struct TPermissionsUpdate {
+1: required bool hasfullImage;
+2: required i64 seqNum;
+3: required map<string, TPrivilegeChanges> privilegeChanges;
+4: required map<string, TRoleChanges> roleChanges;
+}
+
+struct TAuthzUpdateResponse {
+1: optional list<TPathsUpdate> authzPathUpdate,
+2: optional list<TPermissionsUpdate> authzPermUpdate,
+}
+
+service SentryPolicyService
+{
+ TCreateSentryRoleResponse create_sentry_role(1:TCreateSentryRoleRequest request)
+ TDropSentryRoleResponse drop_sentry_role(1:TDropSentryRoleRequest request)
+
+ TAlterSentryRoleGrantPrivilegeResponse alter_sentry_role_grant_privilege(1:TAlterSentryRoleGrantPrivilegeRequest request)
+ TAlterSentryRoleRevokePrivilegeResponse alter_sentry_role_revoke_privilege(1:TAlterSentryRoleRevokePrivilegeRequest request)
+
+ TAlterSentryRoleAddGroupsResponse alter_sentry_role_add_groups(1:TAlterSentryRoleAddGroupsRequest request)
+ TAlterSentryRoleDeleteGroupsResponse alter_sentry_role_delete_groups(1:TAlterSentryRoleDeleteGroupsRequest request)
+
+ TListSentryRolesResponse list_sentry_roles_by_group(1:TListSentryRolesRequest request)
+
+ TListSentryPrivilegesResponse list_sentry_privileges_by_role(1:TListSentryPrivilegesRequest request)
+
+ # For use with ProviderBackend.getPrivileges only
+ TListSentryPrivilegesForProviderResponse list_sentry_privileges_for_provider(1:TListSentryPrivilegesForProviderRequest request)
+
+ TDropPrivilegesResponse drop_sentry_privilege(1:TDropPrivilegesRequest request);
+
+ TRenamePrivilegesResponse rename_sentry_privilege(1:TRenamePrivilegesRequest request);
+
+ # HMS Path cache
+ void handle_hms_notification(1:TPathsUpdate pathsUpdate);
+
+ TAuthzUpdateResponse get_all_authz_updates_from(1:i64 permSeqNum, 2:i64 pathSeqNum);
+ map<string, list<string>> get_all_related_paths(1:string path, 2:bool exactMatch);
+}
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-tests/sentry-tests-hive/pom.xml
----------------------------------------------------------------------
diff --git a/sentry-tests/sentry-tests-hive/pom.xml b/sentry-tests/sentry-tests-hive/pom.xml
index 067d1ab..b4eac58 100644
--- a/sentry-tests/sentry-tests-hive/pom.xml
+++ b/sentry-tests/sentry-tests-hive/pom.xml
@@ -212,6 +212,11 @@ limitations under the License.
</dependency>
<dependency>
<groupId>org.apache.sentry</groupId>
+ <artifactId>sentry-service-client</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.sentry</groupId>
<artifactId>sentry-provider-db</artifactId>
<scope>test</scope>
</dependency>
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/metastore/AbstractMetastoreTestWithStaticConfiguration.java
----------------------------------------------------------------------
diff --git a/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/metastore/AbstractMetastoreTestWithStaticConfiguration.java b/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/metastore/AbstractMetastoreTestWithStaticConfiguration.java
index 45d24f9..c759620 100644
--- a/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/metastore/AbstractMetastoreTestWithStaticConfiguration.java
+++ b/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/metastore/AbstractMetastoreTestWithStaticConfiguration.java
@@ -38,7 +38,9 @@ import org.apache.hadoop.hive.serde.serdeConstants;
import org.apache.hadoop.hive.shims.ShimLoader;
import org.apache.hadoop.security.UserGroupInformation;
import org.apache.pig.PigServer;
+import org.apache.sentry.provider.db.service.thrift.SentryPolicyServiceClient;
import org.apache.sentry.provider.file.PolicyFile;
+import org.apache.sentry.service.thrift.SentryServiceClientFactory;
import org.apache.sentry.tests.e2e.hive.AbstractTestWithStaticConfiguration;
import org.apache.sentry.tests.e2e.hive.hiveserver.HiveServerFactory.HiveServer2Type;
import org.junit.After;
@@ -50,6 +52,7 @@ public abstract class AbstractMetastoreTestWithStaticConfiguration extends
@BeforeClass
public static void setupTestStaticConfiguration() throws Exception {
useSentryService = true;
+ setMetastoreListener = true;
testServerType = HiveServer2Type.InternalMetastore.name();
AbstractTestWithStaticConfiguration.setupTestStaticConfiguration();
}
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/metastore/TestMetastoreEndToEnd.java
----------------------------------------------------------------------
diff --git a/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/metastore/TestMetastoreEndToEnd.java b/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/metastore/TestMetastoreEndToEnd.java
index 8ce78bc..90428cb 100644
--- a/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/metastore/TestMetastoreEndToEnd.java
+++ b/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/metastore/TestMetastoreEndToEnd.java
@@ -105,19 +105,42 @@ public class TestMetastoreEndToEnd extends
* Setup admin privileges for user ADMIN1 verify user can create DB and tables
* @throws Exception
*/
- @Test
- public void testServerPrivileges() throws Exception {
- String tabName = "tab1";
- HiveMetaStoreClient client = context.getMetaStoreClient(ADMIN1);
- client.dropDatabase(dbName, true, true, true);
-
- createMetastoreDB(client, dbName);
- createMetastoreTable(client, dbName, tabName,
- Lists.newArrayList(new FieldSchema("col1", "int", "")));
- assertEquals(1, client.getTables(dbName, tabName).size());
- client.dropTable(dbName, tabName);
- client.dropDatabase(dbName, true, true, true);
- }
+// @Test
+// public void testServerPrivileges() throws Exception {
+// String tabName = "tab1";
+// HiveMetaStoreClient client = context.getMetaStoreClient(ADMIN1);
+// client.dropDatabase(dbName, true, true, true);
+//
+// createMetastoreDB(client, dbName);
+// createMetastoreTable(client, dbName, tabName,
+// Lists.newArrayList(new FieldSchema("col1", "int", "")));
+// assertEquals(1, client.getTables(dbName, tabName).size());
+//
+// AuthzPathsCache authzPathCache = new AuthzPathsCache(null, new String[]{"/"}, 0);
+// SentryPolicyServiceClient sentryClient = new SentryServiceClientFactory().create(sentryConf);
+// waitToCommit(authzPathCache, sentryClient);
+// assertEquals("/%PREFIX[data%DIR[db_1.db%AUTHZ_OBJECT#db_1[tab1%AUTHZ_OBJECT#db_1.tab1[]]]]", authzPathCache.serializeAllPaths());
+// client.dropTable(dbName, tabName);
+// client.dropDatabase(dbName, true, true, true);
+// waitToCommit(authzPathCache, sentryClient);
+// assertEquals("/%PREFIX[]", authzPathCache.serializeAllPaths());
+// }
+//
+// private void waitToCommit(AuthzPathsCache authzPathCache, SentryPolicyServiceClient sentryClient)
+// throws Exception {
+// SentryAuthzUpdate allUpdates = sentryClient.getAllUpdatesFrom(0, 0);
+// for (HMSUpdate update : allUpdates.pathUpdates) {
+// authzPathCache.handleUpdateNotification(update);
+// }
+// int counter = 0;
+// while(!authzPathCache.areAllUpdatesCommited()) {
+// Thread.sleep(200);
+// counter++;
+// if (counter > 10000) {
+// fail("Updates taking too long to commit !!");
+// }
+// }
+// }
/**
* verify non-admin user can not create or drop DB
[09/25] SENTRY-432. HDFS ingration. Initial patch
Posted by pr...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAuthzUpdateResponse.java
----------------------------------------------------------------------
diff --git a/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAuthzUpdateResponse.java b/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAuthzUpdateResponse.java
new file mode 100644
index 0000000..c52e07d
--- /dev/null
+++ b/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TAuthzUpdateResponse.java
@@ -0,0 +1,603 @@
+/**
+ * Autogenerated by Thrift Compiler (0.9.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+package org.apache.sentry.provider.db.service.thrift;
+
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EnumMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.EnumSet;
+import java.util.Collections;
+import java.util.BitSet;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class TAuthzUpdateResponse implements org.apache.thrift.TBase<TAuthzUpdateResponse, TAuthzUpdateResponse._Fields>, java.io.Serializable, Cloneable {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TAuthzUpdateResponse");
+
+ private static final org.apache.thrift.protocol.TField AUTHZ_PATH_UPDATE_FIELD_DESC = new org.apache.thrift.protocol.TField("authzPathUpdate", org.apache.thrift.protocol.TType.LIST, (short)1);
+ private static final org.apache.thrift.protocol.TField AUTHZ_PERM_UPDATE_FIELD_DESC = new org.apache.thrift.protocol.TField("authzPermUpdate", org.apache.thrift.protocol.TType.LIST, (short)2);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new TAuthzUpdateResponseStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new TAuthzUpdateResponseTupleSchemeFactory());
+ }
+
+ private List<TPathsUpdate> authzPathUpdate; // optional
+ private List<TPermissionsUpdate> authzPermUpdate; // 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 {
+ AUTHZ_PATH_UPDATE((short)1, "authzPathUpdate"),
+ AUTHZ_PERM_UPDATE((short)2, "authzPermUpdate");
+
+ 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: // AUTHZ_PATH_UPDATE
+ return AUTHZ_PATH_UPDATE;
+ case 2: // AUTHZ_PERM_UPDATE
+ return AUTHZ_PERM_UPDATE;
+ 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 _Fields optionals[] = {_Fields.AUTHZ_PATH_UPDATE,_Fields.AUTHZ_PERM_UPDATE};
+ 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.AUTHZ_PATH_UPDATE, new org.apache.thrift.meta_data.FieldMetaData("authzPathUpdate", org.apache.thrift.TFieldRequirementType.OPTIONAL,
+ new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TPathsUpdate.class))));
+ tmpMap.put(_Fields.AUTHZ_PERM_UPDATE, new org.apache.thrift.meta_data.FieldMetaData("authzPermUpdate", org.apache.thrift.TFieldRequirementType.OPTIONAL,
+ new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TPermissionsUpdate.class))));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TAuthzUpdateResponse.class, metaDataMap);
+ }
+
+ public TAuthzUpdateResponse() {
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public TAuthzUpdateResponse(TAuthzUpdateResponse other) {
+ if (other.isSetAuthzPathUpdate()) {
+ List<TPathsUpdate> __this__authzPathUpdate = new ArrayList<TPathsUpdate>();
+ for (TPathsUpdate other_element : other.authzPathUpdate) {
+ __this__authzPathUpdate.add(new TPathsUpdate(other_element));
+ }
+ this.authzPathUpdate = __this__authzPathUpdate;
+ }
+ if (other.isSetAuthzPermUpdate()) {
+ List<TPermissionsUpdate> __this__authzPermUpdate = new ArrayList<TPermissionsUpdate>();
+ for (TPermissionsUpdate other_element : other.authzPermUpdate) {
+ __this__authzPermUpdate.add(new TPermissionsUpdate(other_element));
+ }
+ this.authzPermUpdate = __this__authzPermUpdate;
+ }
+ }
+
+ public TAuthzUpdateResponse deepCopy() {
+ return new TAuthzUpdateResponse(this);
+ }
+
+ @Override
+ public void clear() {
+ this.authzPathUpdate = null;
+ this.authzPermUpdate = null;
+ }
+
+ public int getAuthzPathUpdateSize() {
+ return (this.authzPathUpdate == null) ? 0 : this.authzPathUpdate.size();
+ }
+
+ public java.util.Iterator<TPathsUpdate> getAuthzPathUpdateIterator() {
+ return (this.authzPathUpdate == null) ? null : this.authzPathUpdate.iterator();
+ }
+
+ public void addToAuthzPathUpdate(TPathsUpdate elem) {
+ if (this.authzPathUpdate == null) {
+ this.authzPathUpdate = new ArrayList<TPathsUpdate>();
+ }
+ this.authzPathUpdate.add(elem);
+ }
+
+ public List<TPathsUpdate> getAuthzPathUpdate() {
+ return this.authzPathUpdate;
+ }
+
+ public void setAuthzPathUpdate(List<TPathsUpdate> authzPathUpdate) {
+ this.authzPathUpdate = authzPathUpdate;
+ }
+
+ public void unsetAuthzPathUpdate() {
+ this.authzPathUpdate = null;
+ }
+
+ /** Returns true if field authzPathUpdate is set (has been assigned a value) and false otherwise */
+ public boolean isSetAuthzPathUpdate() {
+ return this.authzPathUpdate != null;
+ }
+
+ public void setAuthzPathUpdateIsSet(boolean value) {
+ if (!value) {
+ this.authzPathUpdate = null;
+ }
+ }
+
+ public int getAuthzPermUpdateSize() {
+ return (this.authzPermUpdate == null) ? 0 : this.authzPermUpdate.size();
+ }
+
+ public java.util.Iterator<TPermissionsUpdate> getAuthzPermUpdateIterator() {
+ return (this.authzPermUpdate == null) ? null : this.authzPermUpdate.iterator();
+ }
+
+ public void addToAuthzPermUpdate(TPermissionsUpdate elem) {
+ if (this.authzPermUpdate == null) {
+ this.authzPermUpdate = new ArrayList<TPermissionsUpdate>();
+ }
+ this.authzPermUpdate.add(elem);
+ }
+
+ public List<TPermissionsUpdate> getAuthzPermUpdate() {
+ return this.authzPermUpdate;
+ }
+
+ public void setAuthzPermUpdate(List<TPermissionsUpdate> authzPermUpdate) {
+ this.authzPermUpdate = authzPermUpdate;
+ }
+
+ public void unsetAuthzPermUpdate() {
+ this.authzPermUpdate = null;
+ }
+
+ /** Returns true if field authzPermUpdate is set (has been assigned a value) and false otherwise */
+ public boolean isSetAuthzPermUpdate() {
+ return this.authzPermUpdate != null;
+ }
+
+ public void setAuthzPermUpdateIsSet(boolean value) {
+ if (!value) {
+ this.authzPermUpdate = null;
+ }
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case AUTHZ_PATH_UPDATE:
+ if (value == null) {
+ unsetAuthzPathUpdate();
+ } else {
+ setAuthzPathUpdate((List<TPathsUpdate>)value);
+ }
+ break;
+
+ case AUTHZ_PERM_UPDATE:
+ if (value == null) {
+ unsetAuthzPermUpdate();
+ } else {
+ setAuthzPermUpdate((List<TPermissionsUpdate>)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case AUTHZ_PATH_UPDATE:
+ return getAuthzPathUpdate();
+
+ case AUTHZ_PERM_UPDATE:
+ return getAuthzPermUpdate();
+
+ }
+ 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 AUTHZ_PATH_UPDATE:
+ return isSetAuthzPathUpdate();
+ case AUTHZ_PERM_UPDATE:
+ return isSetAuthzPermUpdate();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof TAuthzUpdateResponse)
+ return this.equals((TAuthzUpdateResponse)that);
+ return false;
+ }
+
+ public boolean equals(TAuthzUpdateResponse that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_authzPathUpdate = true && this.isSetAuthzPathUpdate();
+ boolean that_present_authzPathUpdate = true && that.isSetAuthzPathUpdate();
+ if (this_present_authzPathUpdate || that_present_authzPathUpdate) {
+ if (!(this_present_authzPathUpdate && that_present_authzPathUpdate))
+ return false;
+ if (!this.authzPathUpdate.equals(that.authzPathUpdate))
+ return false;
+ }
+
+ boolean this_present_authzPermUpdate = true && this.isSetAuthzPermUpdate();
+ boolean that_present_authzPermUpdate = true && that.isSetAuthzPermUpdate();
+ if (this_present_authzPermUpdate || that_present_authzPermUpdate) {
+ if (!(this_present_authzPermUpdate && that_present_authzPermUpdate))
+ return false;
+ if (!this.authzPermUpdate.equals(that.authzPermUpdate))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ HashCodeBuilder builder = new HashCodeBuilder();
+
+ boolean present_authzPathUpdate = true && (isSetAuthzPathUpdate());
+ builder.append(present_authzPathUpdate);
+ if (present_authzPathUpdate)
+ builder.append(authzPathUpdate);
+
+ boolean present_authzPermUpdate = true && (isSetAuthzPermUpdate());
+ builder.append(present_authzPermUpdate);
+ if (present_authzPermUpdate)
+ builder.append(authzPermUpdate);
+
+ return builder.toHashCode();
+ }
+
+ public int compareTo(TAuthzUpdateResponse other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+ TAuthzUpdateResponse typedOther = (TAuthzUpdateResponse)other;
+
+ lastComparison = Boolean.valueOf(isSetAuthzPathUpdate()).compareTo(typedOther.isSetAuthzPathUpdate());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetAuthzPathUpdate()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.authzPathUpdate, typedOther.authzPathUpdate);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetAuthzPermUpdate()).compareTo(typedOther.isSetAuthzPermUpdate());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetAuthzPermUpdate()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.authzPermUpdate, typedOther.authzPermUpdate);
+ 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("TAuthzUpdateResponse(");
+ boolean first = true;
+
+ if (isSetAuthzPathUpdate()) {
+ sb.append("authzPathUpdate:");
+ if (this.authzPathUpdate == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.authzPathUpdate);
+ }
+ first = false;
+ }
+ if (isSetAuthzPermUpdate()) {
+ if (!first) sb.append(", ");
+ sb.append("authzPermUpdate:");
+ if (this.authzPermUpdate == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.authzPermUpdate);
+ }
+ first = false;
+ }
+ sb.append(")");
+ return sb.toString();
+ }
+
+ public void validate() throws org.apache.thrift.TException {
+ // check for required fields
+ // 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 TAuthzUpdateResponseStandardSchemeFactory implements SchemeFactory {
+ public TAuthzUpdateResponseStandardScheme getScheme() {
+ return new TAuthzUpdateResponseStandardScheme();
+ }
+ }
+
+ private static class TAuthzUpdateResponseStandardScheme extends StandardScheme<TAuthzUpdateResponse> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, TAuthzUpdateResponse 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: // AUTHZ_PATH_UPDATE
+ if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
+ {
+ org.apache.thrift.protocol.TList _list178 = iprot.readListBegin();
+ struct.authzPathUpdate = new ArrayList<TPathsUpdate>(_list178.size);
+ for (int _i179 = 0; _i179 < _list178.size; ++_i179)
+ {
+ TPathsUpdate _elem180; // required
+ _elem180 = new TPathsUpdate();
+ _elem180.read(iprot);
+ struct.authzPathUpdate.add(_elem180);
+ }
+ iprot.readListEnd();
+ }
+ struct.setAuthzPathUpdateIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 2: // AUTHZ_PERM_UPDATE
+ if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
+ {
+ org.apache.thrift.protocol.TList _list181 = iprot.readListBegin();
+ struct.authzPermUpdate = new ArrayList<TPermissionsUpdate>(_list181.size);
+ for (int _i182 = 0; _i182 < _list181.size; ++_i182)
+ {
+ TPermissionsUpdate _elem183; // required
+ _elem183 = new TPermissionsUpdate();
+ _elem183.read(iprot);
+ struct.authzPermUpdate.add(_elem183);
+ }
+ iprot.readListEnd();
+ }
+ struct.setAuthzPermUpdateIsSet(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, TAuthzUpdateResponse struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.authzPathUpdate != null) {
+ if (struct.isSetAuthzPathUpdate()) {
+ oprot.writeFieldBegin(AUTHZ_PATH_UPDATE_FIELD_DESC);
+ {
+ oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.authzPathUpdate.size()));
+ for (TPathsUpdate _iter184 : struct.authzPathUpdate)
+ {
+ _iter184.write(oprot);
+ }
+ oprot.writeListEnd();
+ }
+ oprot.writeFieldEnd();
+ }
+ }
+ if (struct.authzPermUpdate != null) {
+ if (struct.isSetAuthzPermUpdate()) {
+ oprot.writeFieldBegin(AUTHZ_PERM_UPDATE_FIELD_DESC);
+ {
+ oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.authzPermUpdate.size()));
+ for (TPermissionsUpdate _iter185 : struct.authzPermUpdate)
+ {
+ _iter185.write(oprot);
+ }
+ oprot.writeListEnd();
+ }
+ oprot.writeFieldEnd();
+ }
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class TAuthzUpdateResponseTupleSchemeFactory implements SchemeFactory {
+ public TAuthzUpdateResponseTupleScheme getScheme() {
+ return new TAuthzUpdateResponseTupleScheme();
+ }
+ }
+
+ private static class TAuthzUpdateResponseTupleScheme extends TupleScheme<TAuthzUpdateResponse> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, TAuthzUpdateResponse struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ BitSet optionals = new BitSet();
+ if (struct.isSetAuthzPathUpdate()) {
+ optionals.set(0);
+ }
+ if (struct.isSetAuthzPermUpdate()) {
+ optionals.set(1);
+ }
+ oprot.writeBitSet(optionals, 2);
+ if (struct.isSetAuthzPathUpdate()) {
+ {
+ oprot.writeI32(struct.authzPathUpdate.size());
+ for (TPathsUpdate _iter186 : struct.authzPathUpdate)
+ {
+ _iter186.write(oprot);
+ }
+ }
+ }
+ if (struct.isSetAuthzPermUpdate()) {
+ {
+ oprot.writeI32(struct.authzPermUpdate.size());
+ for (TPermissionsUpdate _iter187 : struct.authzPermUpdate)
+ {
+ _iter187.write(oprot);
+ }
+ }
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, TAuthzUpdateResponse struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ BitSet incoming = iprot.readBitSet(2);
+ if (incoming.get(0)) {
+ {
+ org.apache.thrift.protocol.TList _list188 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
+ struct.authzPathUpdate = new ArrayList<TPathsUpdate>(_list188.size);
+ for (int _i189 = 0; _i189 < _list188.size; ++_i189)
+ {
+ TPathsUpdate _elem190; // required
+ _elem190 = new TPathsUpdate();
+ _elem190.read(iprot);
+ struct.authzPathUpdate.add(_elem190);
+ }
+ }
+ struct.setAuthzPathUpdateIsSet(true);
+ }
+ if (incoming.get(1)) {
+ {
+ org.apache.thrift.protocol.TList _list191 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
+ struct.authzPermUpdate = new ArrayList<TPermissionsUpdate>(_list191.size);
+ for (int _i192 = 0; _i192 < _list191.size; ++_i192)
+ {
+ TPermissionsUpdate _elem193; // required
+ _elem193 = new TPermissionsUpdate();
+ _elem193.read(iprot);
+ struct.authzPermUpdate.add(_elem193);
+ }
+ }
+ struct.setAuthzPermUpdateIsSet(true);
+ }
+ }
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TCreateSentryRoleRequest.java
----------------------------------------------------------------------
diff --git a/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TCreateSentryRoleRequest.java b/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TCreateSentryRoleRequest.java
new file mode 100644
index 0000000..fc7c5dd
--- /dev/null
+++ b/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TCreateSentryRoleRequest.java
@@ -0,0 +1,587 @@
+/**
+ * Autogenerated by Thrift Compiler (0.9.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+package org.apache.sentry.provider.db.service.thrift;
+
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EnumMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.EnumSet;
+import java.util.Collections;
+import java.util.BitSet;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class TCreateSentryRoleRequest implements org.apache.thrift.TBase<TCreateSentryRoleRequest, TCreateSentryRoleRequest._Fields>, java.io.Serializable, Cloneable {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TCreateSentryRoleRequest");
+
+ private static final org.apache.thrift.protocol.TField PROTOCOL_VERSION_FIELD_DESC = new org.apache.thrift.protocol.TField("protocol_version", org.apache.thrift.protocol.TType.I32, (short)1);
+ private static final org.apache.thrift.protocol.TField REQUESTOR_USER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("requestorUserName", org.apache.thrift.protocol.TType.STRING, (short)2);
+ private static final org.apache.thrift.protocol.TField ROLE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("roleName", 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 TCreateSentryRoleRequestStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new TCreateSentryRoleRequestTupleSchemeFactory());
+ }
+
+ private int protocol_version; // required
+ private String requestorUserName; // required
+ private String roleName; // required
+
+ /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+ public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+ PROTOCOL_VERSION((short)1, "protocol_version"),
+ REQUESTOR_USER_NAME((short)2, "requestorUserName"),
+ ROLE_NAME((short)3, "roleName");
+
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+ static {
+ for (_Fields field : EnumSet.allOf(_Fields.class)) {
+ byName.put(field.getFieldName(), field);
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, or null if its not found.
+ */
+ public static _Fields findByThriftId(int fieldId) {
+ switch(fieldId) {
+ case 1: // PROTOCOL_VERSION
+ return PROTOCOL_VERSION;
+ case 2: // REQUESTOR_USER_NAME
+ return REQUESTOR_USER_NAME;
+ case 3: // ROLE_NAME
+ return ROLE_NAME;
+ default:
+ return null;
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, throwing an exception
+ * if it is not found.
+ */
+ public static _Fields findByThriftIdOrThrow(int fieldId) {
+ _Fields fields = findByThriftId(fieldId);
+ if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+ return fields;
+ }
+
+ /**
+ * Find the _Fields constant that matches name, or null if its not found.
+ */
+ public static _Fields findByName(String name) {
+ return byName.get(name);
+ }
+
+ private final short _thriftId;
+ private final String _fieldName;
+
+ _Fields(short thriftId, String fieldName) {
+ _thriftId = thriftId;
+ _fieldName = fieldName;
+ }
+
+ public short getThriftFieldId() {
+ return _thriftId;
+ }
+
+ public String getFieldName() {
+ return _fieldName;
+ }
+ }
+
+ // isset id assignments
+ private static final int __PROTOCOL_VERSION_ISSET_ID = 0;
+ private byte __isset_bitfield = 0;
+ public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+ static {
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+ tmpMap.put(_Fields.PROTOCOL_VERSION, new org.apache.thrift.meta_data.FieldMetaData("protocol_version", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
+ tmpMap.put(_Fields.REQUESTOR_USER_NAME, new org.apache.thrift.meta_data.FieldMetaData("requestorUserName", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields.ROLE_NAME, new org.apache.thrift.meta_data.FieldMetaData("roleName", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TCreateSentryRoleRequest.class, metaDataMap);
+ }
+
+ public TCreateSentryRoleRequest() {
+ this.protocol_version = 1;
+
+ }
+
+ public TCreateSentryRoleRequest(
+ int protocol_version,
+ String requestorUserName,
+ String roleName)
+ {
+ this();
+ this.protocol_version = protocol_version;
+ setProtocol_versionIsSet(true);
+ this.requestorUserName = requestorUserName;
+ this.roleName = roleName;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public TCreateSentryRoleRequest(TCreateSentryRoleRequest other) {
+ __isset_bitfield = other.__isset_bitfield;
+ this.protocol_version = other.protocol_version;
+ if (other.isSetRequestorUserName()) {
+ this.requestorUserName = other.requestorUserName;
+ }
+ if (other.isSetRoleName()) {
+ this.roleName = other.roleName;
+ }
+ }
+
+ public TCreateSentryRoleRequest deepCopy() {
+ return new TCreateSentryRoleRequest(this);
+ }
+
+ @Override
+ public void clear() {
+ this.protocol_version = 1;
+
+ this.requestorUserName = null;
+ this.roleName = null;
+ }
+
+ public int getProtocol_version() {
+ return this.protocol_version;
+ }
+
+ public void setProtocol_version(int protocol_version) {
+ this.protocol_version = protocol_version;
+ setProtocol_versionIsSet(true);
+ }
+
+ public void unsetProtocol_version() {
+ __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __PROTOCOL_VERSION_ISSET_ID);
+ }
+
+ /** Returns true if field protocol_version is set (has been assigned a value) and false otherwise */
+ public boolean isSetProtocol_version() {
+ return EncodingUtils.testBit(__isset_bitfield, __PROTOCOL_VERSION_ISSET_ID);
+ }
+
+ public void setProtocol_versionIsSet(boolean value) {
+ __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __PROTOCOL_VERSION_ISSET_ID, value);
+ }
+
+ public String getRequestorUserName() {
+ return this.requestorUserName;
+ }
+
+ public void setRequestorUserName(String requestorUserName) {
+ this.requestorUserName = requestorUserName;
+ }
+
+ public void unsetRequestorUserName() {
+ this.requestorUserName = null;
+ }
+
+ /** Returns true if field requestorUserName is set (has been assigned a value) and false otherwise */
+ public boolean isSetRequestorUserName() {
+ return this.requestorUserName != null;
+ }
+
+ public void setRequestorUserNameIsSet(boolean value) {
+ if (!value) {
+ this.requestorUserName = null;
+ }
+ }
+
+ public String getRoleName() {
+ return this.roleName;
+ }
+
+ public void setRoleName(String roleName) {
+ this.roleName = roleName;
+ }
+
+ public void unsetRoleName() {
+ this.roleName = null;
+ }
+
+ /** Returns true if field roleName is set (has been assigned a value) and false otherwise */
+ public boolean isSetRoleName() {
+ return this.roleName != null;
+ }
+
+ public void setRoleNameIsSet(boolean value) {
+ if (!value) {
+ this.roleName = null;
+ }
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case PROTOCOL_VERSION:
+ if (value == null) {
+ unsetProtocol_version();
+ } else {
+ setProtocol_version((Integer)value);
+ }
+ break;
+
+ case REQUESTOR_USER_NAME:
+ if (value == null) {
+ unsetRequestorUserName();
+ } else {
+ setRequestorUserName((String)value);
+ }
+ break;
+
+ case ROLE_NAME:
+ if (value == null) {
+ unsetRoleName();
+ } else {
+ setRoleName((String)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case PROTOCOL_VERSION:
+ return Integer.valueOf(getProtocol_version());
+
+ case REQUESTOR_USER_NAME:
+ return getRequestorUserName();
+
+ case ROLE_NAME:
+ return getRoleName();
+
+ }
+ throw new IllegalStateException();
+ }
+
+ /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+ public boolean isSet(_Fields field) {
+ if (field == null) {
+ throw new IllegalArgumentException();
+ }
+
+ switch (field) {
+ case PROTOCOL_VERSION:
+ return isSetProtocol_version();
+ case REQUESTOR_USER_NAME:
+ return isSetRequestorUserName();
+ case ROLE_NAME:
+ return isSetRoleName();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof TCreateSentryRoleRequest)
+ return this.equals((TCreateSentryRoleRequest)that);
+ return false;
+ }
+
+ public boolean equals(TCreateSentryRoleRequest that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_protocol_version = true;
+ boolean that_present_protocol_version = true;
+ if (this_present_protocol_version || that_present_protocol_version) {
+ if (!(this_present_protocol_version && that_present_protocol_version))
+ return false;
+ if (this.protocol_version != that.protocol_version)
+ return false;
+ }
+
+ boolean this_present_requestorUserName = true && this.isSetRequestorUserName();
+ boolean that_present_requestorUserName = true && that.isSetRequestorUserName();
+ if (this_present_requestorUserName || that_present_requestorUserName) {
+ if (!(this_present_requestorUserName && that_present_requestorUserName))
+ return false;
+ if (!this.requestorUserName.equals(that.requestorUserName))
+ return false;
+ }
+
+ boolean this_present_roleName = true && this.isSetRoleName();
+ boolean that_present_roleName = true && that.isSetRoleName();
+ if (this_present_roleName || that_present_roleName) {
+ if (!(this_present_roleName && that_present_roleName))
+ return false;
+ if (!this.roleName.equals(that.roleName))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ HashCodeBuilder builder = new HashCodeBuilder();
+
+ boolean present_protocol_version = true;
+ builder.append(present_protocol_version);
+ if (present_protocol_version)
+ builder.append(protocol_version);
+
+ boolean present_requestorUserName = true && (isSetRequestorUserName());
+ builder.append(present_requestorUserName);
+ if (present_requestorUserName)
+ builder.append(requestorUserName);
+
+ boolean present_roleName = true && (isSetRoleName());
+ builder.append(present_roleName);
+ if (present_roleName)
+ builder.append(roleName);
+
+ return builder.toHashCode();
+ }
+
+ public int compareTo(TCreateSentryRoleRequest other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+ TCreateSentryRoleRequest typedOther = (TCreateSentryRoleRequest)other;
+
+ lastComparison = Boolean.valueOf(isSetProtocol_version()).compareTo(typedOther.isSetProtocol_version());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetProtocol_version()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.protocol_version, typedOther.protocol_version);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetRequestorUserName()).compareTo(typedOther.isSetRequestorUserName());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetRequestorUserName()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.requestorUserName, typedOther.requestorUserName);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetRoleName()).compareTo(typedOther.isSetRoleName());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetRoleName()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.roleName, typedOther.roleName);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ return 0;
+ }
+
+ public _Fields fieldForId(int fieldId) {
+ return _Fields.findByThriftId(fieldId);
+ }
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
+ schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
+ }
+
+ public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
+ schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder("TCreateSentryRoleRequest(");
+ boolean first = true;
+
+ sb.append("protocol_version:");
+ sb.append(this.protocol_version);
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("requestorUserName:");
+ if (this.requestorUserName == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.requestorUserName);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("roleName:");
+ if (this.roleName == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.roleName);
+ }
+ first = false;
+ sb.append(")");
+ return sb.toString();
+ }
+
+ public void validate() throws org.apache.thrift.TException {
+ // check for required fields
+ if (!isSetProtocol_version()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'protocol_version' is unset! Struct:" + toString());
+ }
+
+ if (!isSetRequestorUserName()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'requestorUserName' is unset! Struct:" + toString());
+ }
+
+ if (!isSetRoleName()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'roleName' is unset! Struct:" + toString());
+ }
+
+ // check for sub-struct validity
+ }
+
+ private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+ try {
+ write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+ try {
+ // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
+ __isset_bitfield = 0;
+ read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private static class TCreateSentryRoleRequestStandardSchemeFactory implements SchemeFactory {
+ public TCreateSentryRoleRequestStandardScheme getScheme() {
+ return new TCreateSentryRoleRequestStandardScheme();
+ }
+ }
+
+ private static class TCreateSentryRoleRequestStandardScheme extends StandardScheme<TCreateSentryRoleRequest> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, TCreateSentryRoleRequest struct) throws org.apache.thrift.TException {
+ org.apache.thrift.protocol.TField schemeField;
+ iprot.readStructBegin();
+ while (true)
+ {
+ schemeField = iprot.readFieldBegin();
+ if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
+ break;
+ }
+ switch (schemeField.id) {
+ case 1: // PROTOCOL_VERSION
+ if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
+ struct.protocol_version = iprot.readI32();
+ struct.setProtocol_versionIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 2: // REQUESTOR_USER_NAME
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.requestorUserName = iprot.readString();
+ struct.setRequestorUserNameIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 3: // ROLE_NAME
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.roleName = iprot.readString();
+ struct.setRoleNameIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ default:
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+ struct.validate();
+ }
+
+ public void write(org.apache.thrift.protocol.TProtocol oprot, TCreateSentryRoleRequest struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ oprot.writeFieldBegin(PROTOCOL_VERSION_FIELD_DESC);
+ oprot.writeI32(struct.protocol_version);
+ oprot.writeFieldEnd();
+ if (struct.requestorUserName != null) {
+ oprot.writeFieldBegin(REQUESTOR_USER_NAME_FIELD_DESC);
+ oprot.writeString(struct.requestorUserName);
+ oprot.writeFieldEnd();
+ }
+ if (struct.roleName != null) {
+ oprot.writeFieldBegin(ROLE_NAME_FIELD_DESC);
+ oprot.writeString(struct.roleName);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class TCreateSentryRoleRequestTupleSchemeFactory implements SchemeFactory {
+ public TCreateSentryRoleRequestTupleScheme getScheme() {
+ return new TCreateSentryRoleRequestTupleScheme();
+ }
+ }
+
+ private static class TCreateSentryRoleRequestTupleScheme extends TupleScheme<TCreateSentryRoleRequest> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, TCreateSentryRoleRequest struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ oprot.writeI32(struct.protocol_version);
+ oprot.writeString(struct.requestorUserName);
+ oprot.writeString(struct.roleName);
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, TCreateSentryRoleRequest struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ struct.protocol_version = iprot.readI32();
+ struct.setProtocol_versionIsSet(true);
+ struct.requestorUserName = iprot.readString();
+ struct.setRequestorUserNameIsSet(true);
+ struct.roleName = iprot.readString();
+ struct.setRoleNameIsSet(true);
+ }
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TCreateSentryRoleResponse.java
----------------------------------------------------------------------
diff --git a/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TCreateSentryRoleResponse.java b/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TCreateSentryRoleResponse.java
new file mode 100644
index 0000000..fcb3f41
--- /dev/null
+++ b/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TCreateSentryRoleResponse.java
@@ -0,0 +1,390 @@
+/**
+ * Autogenerated by Thrift Compiler (0.9.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+package org.apache.sentry.provider.db.service.thrift;
+
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EnumMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.EnumSet;
+import java.util.Collections;
+import java.util.BitSet;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class TCreateSentryRoleResponse implements org.apache.thrift.TBase<TCreateSentryRoleResponse, TCreateSentryRoleResponse._Fields>, java.io.Serializable, Cloneable {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TCreateSentryRoleResponse");
+
+ private static final org.apache.thrift.protocol.TField STATUS_FIELD_DESC = new org.apache.thrift.protocol.TField("status", org.apache.thrift.protocol.TType.STRUCT, (short)1);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new TCreateSentryRoleResponseStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new TCreateSentryRoleResponseTupleSchemeFactory());
+ }
+
+ private org.apache.sentry.service.thrift.TSentryResponseStatus status; // required
+
+ /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+ public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+ STATUS((short)1, "status");
+
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+ static {
+ for (_Fields field : EnumSet.allOf(_Fields.class)) {
+ byName.put(field.getFieldName(), field);
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, or null if its not found.
+ */
+ public static _Fields findByThriftId(int fieldId) {
+ switch(fieldId) {
+ case 1: // STATUS
+ return STATUS;
+ default:
+ return null;
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, throwing an exception
+ * if it is not found.
+ */
+ public static _Fields findByThriftIdOrThrow(int fieldId) {
+ _Fields fields = findByThriftId(fieldId);
+ if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+ return fields;
+ }
+
+ /**
+ * Find the _Fields constant that matches name, or null if its not found.
+ */
+ public static _Fields findByName(String name) {
+ return byName.get(name);
+ }
+
+ private final short _thriftId;
+ private final String _fieldName;
+
+ _Fields(short thriftId, String fieldName) {
+ _thriftId = thriftId;
+ _fieldName = fieldName;
+ }
+
+ public short getThriftFieldId() {
+ return _thriftId;
+ }
+
+ public String getFieldName() {
+ return _fieldName;
+ }
+ }
+
+ // isset id assignments
+ public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+ static {
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+ tmpMap.put(_Fields.STATUS, new org.apache.thrift.meta_data.FieldMetaData("status", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.sentry.service.thrift.TSentryResponseStatus.class)));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TCreateSentryRoleResponse.class, metaDataMap);
+ }
+
+ public TCreateSentryRoleResponse() {
+ }
+
+ public TCreateSentryRoleResponse(
+ org.apache.sentry.service.thrift.TSentryResponseStatus status)
+ {
+ this();
+ this.status = status;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public TCreateSentryRoleResponse(TCreateSentryRoleResponse other) {
+ if (other.isSetStatus()) {
+ this.status = new org.apache.sentry.service.thrift.TSentryResponseStatus(other.status);
+ }
+ }
+
+ public TCreateSentryRoleResponse deepCopy() {
+ return new TCreateSentryRoleResponse(this);
+ }
+
+ @Override
+ public void clear() {
+ this.status = null;
+ }
+
+ public org.apache.sentry.service.thrift.TSentryResponseStatus getStatus() {
+ return this.status;
+ }
+
+ public void setStatus(org.apache.sentry.service.thrift.TSentryResponseStatus status) {
+ this.status = status;
+ }
+
+ public void unsetStatus() {
+ this.status = null;
+ }
+
+ /** Returns true if field status is set (has been assigned a value) and false otherwise */
+ public boolean isSetStatus() {
+ return this.status != null;
+ }
+
+ public void setStatusIsSet(boolean value) {
+ if (!value) {
+ this.status = null;
+ }
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case STATUS:
+ if (value == null) {
+ unsetStatus();
+ } else {
+ setStatus((org.apache.sentry.service.thrift.TSentryResponseStatus)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case STATUS:
+ return getStatus();
+
+ }
+ throw new IllegalStateException();
+ }
+
+ /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+ public boolean isSet(_Fields field) {
+ if (field == null) {
+ throw new IllegalArgumentException();
+ }
+
+ switch (field) {
+ case STATUS:
+ return isSetStatus();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof TCreateSentryRoleResponse)
+ return this.equals((TCreateSentryRoleResponse)that);
+ return false;
+ }
+
+ public boolean equals(TCreateSentryRoleResponse that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_status = true && this.isSetStatus();
+ boolean that_present_status = true && that.isSetStatus();
+ if (this_present_status || that_present_status) {
+ if (!(this_present_status && that_present_status))
+ return false;
+ if (!this.status.equals(that.status))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ HashCodeBuilder builder = new HashCodeBuilder();
+
+ boolean present_status = true && (isSetStatus());
+ builder.append(present_status);
+ if (present_status)
+ builder.append(status);
+
+ return builder.toHashCode();
+ }
+
+ public int compareTo(TCreateSentryRoleResponse other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+ TCreateSentryRoleResponse typedOther = (TCreateSentryRoleResponse)other;
+
+ lastComparison = Boolean.valueOf(isSetStatus()).compareTo(typedOther.isSetStatus());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetStatus()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.status, typedOther.status);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ 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("TCreateSentryRoleResponse(");
+ boolean first = true;
+
+ sb.append("status:");
+ if (this.status == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.status);
+ }
+ first = false;
+ sb.append(")");
+ return sb.toString();
+ }
+
+ public void validate() throws org.apache.thrift.TException {
+ // check for required fields
+ if (!isSetStatus()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'status' is unset! Struct:" + toString());
+ }
+
+ // check for sub-struct validity
+ if (status != null) {
+ status.validate();
+ }
+ }
+
+ private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+ try {
+ write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+ try {
+ read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private static class TCreateSentryRoleResponseStandardSchemeFactory implements SchemeFactory {
+ public TCreateSentryRoleResponseStandardScheme getScheme() {
+ return new TCreateSentryRoleResponseStandardScheme();
+ }
+ }
+
+ private static class TCreateSentryRoleResponseStandardScheme extends StandardScheme<TCreateSentryRoleResponse> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, TCreateSentryRoleResponse struct) throws org.apache.thrift.TException {
+ org.apache.thrift.protocol.TField schemeField;
+ iprot.readStructBegin();
+ while (true)
+ {
+ schemeField = iprot.readFieldBegin();
+ if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
+ break;
+ }
+ switch (schemeField.id) {
+ case 1: // STATUS
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+ struct.status = new org.apache.sentry.service.thrift.TSentryResponseStatus();
+ struct.status.read(iprot);
+ struct.setStatusIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ 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, TCreateSentryRoleResponse struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.status != null) {
+ oprot.writeFieldBegin(STATUS_FIELD_DESC);
+ struct.status.write(oprot);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class TCreateSentryRoleResponseTupleSchemeFactory implements SchemeFactory {
+ public TCreateSentryRoleResponseTupleScheme getScheme() {
+ return new TCreateSentryRoleResponseTupleScheme();
+ }
+ }
+
+ private static class TCreateSentryRoleResponseTupleScheme extends TupleScheme<TCreateSentryRoleResponse> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, TCreateSentryRoleResponse struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ struct.status.write(oprot);
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, TCreateSentryRoleResponse struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ struct.status = new org.apache.sentry.service.thrift.TSentryResponseStatus();
+ struct.status.read(iprot);
+ struct.setStatusIsSet(true);
+ }
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TDropPrivilegesRequest.java
----------------------------------------------------------------------
diff --git a/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TDropPrivilegesRequest.java b/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TDropPrivilegesRequest.java
new file mode 100644
index 0000000..3df9235
--- /dev/null
+++ b/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TDropPrivilegesRequest.java
@@ -0,0 +1,592 @@
+/**
+ * Autogenerated by Thrift Compiler (0.9.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+package org.apache.sentry.provider.db.service.thrift;
+
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EnumMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.EnumSet;
+import java.util.Collections;
+import java.util.BitSet;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class TDropPrivilegesRequest implements org.apache.thrift.TBase<TDropPrivilegesRequest, TDropPrivilegesRequest._Fields>, java.io.Serializable, Cloneable {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TDropPrivilegesRequest");
+
+ private static final org.apache.thrift.protocol.TField PROTOCOL_VERSION_FIELD_DESC = new org.apache.thrift.protocol.TField("protocol_version", org.apache.thrift.protocol.TType.I32, (short)1);
+ private static final org.apache.thrift.protocol.TField REQUESTOR_USER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("requestorUserName", org.apache.thrift.protocol.TType.STRING, (short)2);
+ private static final org.apache.thrift.protocol.TField AUTHORIZABLE_FIELD_DESC = new org.apache.thrift.protocol.TField("authorizable", org.apache.thrift.protocol.TType.STRUCT, (short)3);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new TDropPrivilegesRequestStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new TDropPrivilegesRequestTupleSchemeFactory());
+ }
+
+ private int protocol_version; // required
+ private String requestorUserName; // required
+ private TSentryAuthorizable authorizable; // required
+
+ /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+ public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+ PROTOCOL_VERSION((short)1, "protocol_version"),
+ REQUESTOR_USER_NAME((short)2, "requestorUserName"),
+ AUTHORIZABLE((short)3, "authorizable");
+
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+ static {
+ for (_Fields field : EnumSet.allOf(_Fields.class)) {
+ byName.put(field.getFieldName(), field);
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, or null if its not found.
+ */
+ public static _Fields findByThriftId(int fieldId) {
+ switch(fieldId) {
+ case 1: // PROTOCOL_VERSION
+ return PROTOCOL_VERSION;
+ case 2: // REQUESTOR_USER_NAME
+ return REQUESTOR_USER_NAME;
+ case 3: // AUTHORIZABLE
+ return AUTHORIZABLE;
+ default:
+ return null;
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, throwing an exception
+ * if it is not found.
+ */
+ public static _Fields findByThriftIdOrThrow(int fieldId) {
+ _Fields fields = findByThriftId(fieldId);
+ if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+ return fields;
+ }
+
+ /**
+ * Find the _Fields constant that matches name, or null if its not found.
+ */
+ public static _Fields findByName(String name) {
+ return byName.get(name);
+ }
+
+ private final short _thriftId;
+ private final String _fieldName;
+
+ _Fields(short thriftId, String fieldName) {
+ _thriftId = thriftId;
+ _fieldName = fieldName;
+ }
+
+ public short getThriftFieldId() {
+ return _thriftId;
+ }
+
+ public String getFieldName() {
+ return _fieldName;
+ }
+ }
+
+ // isset id assignments
+ private static final int __PROTOCOL_VERSION_ISSET_ID = 0;
+ private byte __isset_bitfield = 0;
+ public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+ static {
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+ tmpMap.put(_Fields.PROTOCOL_VERSION, new org.apache.thrift.meta_data.FieldMetaData("protocol_version", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
+ tmpMap.put(_Fields.REQUESTOR_USER_NAME, new org.apache.thrift.meta_data.FieldMetaData("requestorUserName", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields.AUTHORIZABLE, new org.apache.thrift.meta_data.FieldMetaData("authorizable", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TSentryAuthorizable.class)));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TDropPrivilegesRequest.class, metaDataMap);
+ }
+
+ public TDropPrivilegesRequest() {
+ this.protocol_version = 1;
+
+ }
+
+ public TDropPrivilegesRequest(
+ int protocol_version,
+ String requestorUserName,
+ TSentryAuthorizable authorizable)
+ {
+ this();
+ this.protocol_version = protocol_version;
+ setProtocol_versionIsSet(true);
+ this.requestorUserName = requestorUserName;
+ this.authorizable = authorizable;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public TDropPrivilegesRequest(TDropPrivilegesRequest other) {
+ __isset_bitfield = other.__isset_bitfield;
+ this.protocol_version = other.protocol_version;
+ if (other.isSetRequestorUserName()) {
+ this.requestorUserName = other.requestorUserName;
+ }
+ if (other.isSetAuthorizable()) {
+ this.authorizable = new TSentryAuthorizable(other.authorizable);
+ }
+ }
+
+ public TDropPrivilegesRequest deepCopy() {
+ return new TDropPrivilegesRequest(this);
+ }
+
+ @Override
+ public void clear() {
+ this.protocol_version = 1;
+
+ this.requestorUserName = null;
+ this.authorizable = null;
+ }
+
+ public int getProtocol_version() {
+ return this.protocol_version;
+ }
+
+ public void setProtocol_version(int protocol_version) {
+ this.protocol_version = protocol_version;
+ setProtocol_versionIsSet(true);
+ }
+
+ public void unsetProtocol_version() {
+ __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __PROTOCOL_VERSION_ISSET_ID);
+ }
+
+ /** Returns true if field protocol_version is set (has been assigned a value) and false otherwise */
+ public boolean isSetProtocol_version() {
+ return EncodingUtils.testBit(__isset_bitfield, __PROTOCOL_VERSION_ISSET_ID);
+ }
+
+ public void setProtocol_versionIsSet(boolean value) {
+ __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __PROTOCOL_VERSION_ISSET_ID, value);
+ }
+
+ public String getRequestorUserName() {
+ return this.requestorUserName;
+ }
+
+ public void setRequestorUserName(String requestorUserName) {
+ this.requestorUserName = requestorUserName;
+ }
+
+ public void unsetRequestorUserName() {
+ this.requestorUserName = null;
+ }
+
+ /** Returns true if field requestorUserName is set (has been assigned a value) and false otherwise */
+ public boolean isSetRequestorUserName() {
+ return this.requestorUserName != null;
+ }
+
+ public void setRequestorUserNameIsSet(boolean value) {
+ if (!value) {
+ this.requestorUserName = null;
+ }
+ }
+
+ public TSentryAuthorizable getAuthorizable() {
+ return this.authorizable;
+ }
+
+ public void setAuthorizable(TSentryAuthorizable authorizable) {
+ this.authorizable = authorizable;
+ }
+
+ public void unsetAuthorizable() {
+ this.authorizable = null;
+ }
+
+ /** Returns true if field authorizable is set (has been assigned a value) and false otherwise */
+ public boolean isSetAuthorizable() {
+ return this.authorizable != null;
+ }
+
+ public void setAuthorizableIsSet(boolean value) {
+ if (!value) {
+ this.authorizable = null;
+ }
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case PROTOCOL_VERSION:
+ if (value == null) {
+ unsetProtocol_version();
+ } else {
+ setProtocol_version((Integer)value);
+ }
+ break;
+
+ case REQUESTOR_USER_NAME:
+ if (value == null) {
+ unsetRequestorUserName();
+ } else {
+ setRequestorUserName((String)value);
+ }
+ break;
+
+ case AUTHORIZABLE:
+ if (value == null) {
+ unsetAuthorizable();
+ } else {
+ setAuthorizable((TSentryAuthorizable)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case PROTOCOL_VERSION:
+ return Integer.valueOf(getProtocol_version());
+
+ case REQUESTOR_USER_NAME:
+ return getRequestorUserName();
+
+ case AUTHORIZABLE:
+ return getAuthorizable();
+
+ }
+ throw new IllegalStateException();
+ }
+
+ /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+ public boolean isSet(_Fields field) {
+ if (field == null) {
+ throw new IllegalArgumentException();
+ }
+
+ switch (field) {
+ case PROTOCOL_VERSION:
+ return isSetProtocol_version();
+ case REQUESTOR_USER_NAME:
+ return isSetRequestorUserName();
+ case AUTHORIZABLE:
+ return isSetAuthorizable();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof TDropPrivilegesRequest)
+ return this.equals((TDropPrivilegesRequest)that);
+ return false;
+ }
+
+ public boolean equals(TDropPrivilegesRequest that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_protocol_version = true;
+ boolean that_present_protocol_version = true;
+ if (this_present_protocol_version || that_present_protocol_version) {
+ if (!(this_present_protocol_version && that_present_protocol_version))
+ return false;
+ if (this.protocol_version != that.protocol_version)
+ return false;
+ }
+
+ boolean this_present_requestorUserName = true && this.isSetRequestorUserName();
+ boolean that_present_requestorUserName = true && that.isSetRequestorUserName();
+ if (this_present_requestorUserName || that_present_requestorUserName) {
+ if (!(this_present_requestorUserName && that_present_requestorUserName))
+ return false;
+ if (!this.requestorUserName.equals(that.requestorUserName))
+ return false;
+ }
+
+ boolean this_present_authorizable = true && this.isSetAuthorizable();
+ boolean that_present_authorizable = true && that.isSetAuthorizable();
+ if (this_present_authorizable || that_present_authorizable) {
+ if (!(this_present_authorizable && that_present_authorizable))
+ return false;
+ if (!this.authorizable.equals(that.authorizable))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ HashCodeBuilder builder = new HashCodeBuilder();
+
+ boolean present_protocol_version = true;
+ builder.append(present_protocol_version);
+ if (present_protocol_version)
+ builder.append(protocol_version);
+
+ boolean present_requestorUserName = true && (isSetRequestorUserName());
+ builder.append(present_requestorUserName);
+ if (present_requestorUserName)
+ builder.append(requestorUserName);
+
+ boolean present_authorizable = true && (isSetAuthorizable());
+ builder.append(present_authorizable);
+ if (present_authorizable)
+ builder.append(authorizable);
+
+ return builder.toHashCode();
+ }
+
+ public int compareTo(TDropPrivilegesRequest other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+ TDropPrivilegesRequest typedOther = (TDropPrivilegesRequest)other;
+
+ lastComparison = Boolean.valueOf(isSetProtocol_version()).compareTo(typedOther.isSetProtocol_version());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetProtocol_version()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.protocol_version, typedOther.protocol_version);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetRequestorUserName()).compareTo(typedOther.isSetRequestorUserName());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetRequestorUserName()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.requestorUserName, typedOther.requestorUserName);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetAuthorizable()).compareTo(typedOther.isSetAuthorizable());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetAuthorizable()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.authorizable, typedOther.authorizable);
+ 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("TDropPrivilegesRequest(");
+ boolean first = true;
+
+ sb.append("protocol_version:");
+ sb.append(this.protocol_version);
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("requestorUserName:");
+ if (this.requestorUserName == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.requestorUserName);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("authorizable:");
+ if (this.authorizable == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.authorizable);
+ }
+ first = false;
+ sb.append(")");
+ return sb.toString();
+ }
+
+ public void validate() throws org.apache.thrift.TException {
+ // check for required fields
+ if (!isSetProtocol_version()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'protocol_version' is unset! Struct:" + toString());
+ }
+
+ if (!isSetRequestorUserName()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'requestorUserName' is unset! Struct:" + toString());
+ }
+
+ if (!isSetAuthorizable()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'authorizable' is unset! Struct:" + toString());
+ }
+
+ // check for sub-struct validity
+ if (authorizable != null) {
+ authorizable.validate();
+ }
+ }
+
+ private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+ try {
+ write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+ try {
+ // 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 TDropPrivilegesRequestStandardSchemeFactory implements SchemeFactory {
+ public TDropPrivilegesRequestStandardScheme getScheme() {
+ return new TDropPrivilegesRequestStandardScheme();
+ }
+ }
+
+ private static class TDropPrivilegesRequestStandardScheme extends StandardScheme<TDropPrivilegesRequest> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, TDropPrivilegesRequest struct) throws org.apache.thrift.TException {
+ org.apache.thrift.protocol.TField schemeField;
+ iprot.readStructBegin();
+ while (true)
+ {
+ schemeField = iprot.readFieldBegin();
+ if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
+ break;
+ }
+ switch (schemeField.id) {
+ case 1: // PROTOCOL_VERSION
+ if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
+ struct.protocol_version = iprot.readI32();
+ struct.setProtocol_versionIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 2: // REQUESTOR_USER_NAME
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.requestorUserName = iprot.readString();
+ struct.setRequestorUserNameIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 3: // AUTHORIZABLE
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+ struct.authorizable = new TSentryAuthorizable();
+ struct.authorizable.read(iprot);
+ struct.setAuthorizableIsSet(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, TDropPrivilegesRequest struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ oprot.writeFieldBegin(PROTOCOL_VERSION_FIELD_DESC);
+ oprot.writeI32(struct.protocol_version);
+ oprot.writeFieldEnd();
+ if (struct.requestorUserName != null) {
+ oprot.writeFieldBegin(REQUESTOR_USER_NAME_FIELD_DESC);
+ oprot.writeString(struct.requestorUserName);
+ oprot.writeFieldEnd();
+ }
+ if (struct.authorizable != null) {
+ oprot.writeFieldBegin(AUTHORIZABLE_FIELD_DESC);
+ struct.authorizable.write(oprot);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class TDropPrivilegesRequestTupleSchemeFactory implements SchemeFactory {
+ public TDropPrivilegesRequestTupleScheme getScheme() {
+ return new TDropPrivilegesRequestTupleScheme();
+ }
+ }
+
+ private static class TDropPrivilegesRequestTupleScheme extends TupleScheme<TDropPrivilegesRequest> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, TDropPrivilegesRequest struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ oprot.writeI32(struct.protocol_version);
+ oprot.writeString(struct.requestorUserName);
+ struct.authorizable.write(oprot);
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, TDropPrivilegesRequest struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ struct.protocol_version = iprot.readI32();
+ struct.setProtocol_versionIsSet(true);
+ struct.requestorUserName = iprot.readString();
+ struct.setRequestorUserNameIsSet(true);
+ struct.authorizable = new TSentryAuthorizable();
+ struct.authorizable.read(iprot);
+ struct.setAuthorizableIsSet(true);
+ }
+ }
+
+}
+
[16/25] SENTRY-432. HDFS ingration. Initial patch
Posted by pr...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TRenamePrivilegesRequest.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TRenamePrivilegesRequest.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TRenamePrivilegesRequest.java
deleted file mode 100644
index a2bc805..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TRenamePrivilegesRequest.java
+++ /dev/null
@@ -1,698 +0,0 @@
-/**
- * Autogenerated by Thrift Compiler (0.9.0)
- *
- * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
- * @generated
- */
-package org.apache.sentry.provider.db.service.thrift;
-
-import org.apache.commons.lang.builder.HashCodeBuilder;
-import org.apache.thrift.scheme.IScheme;
-import org.apache.thrift.scheme.SchemeFactory;
-import org.apache.thrift.scheme.StandardScheme;
-
-import org.apache.thrift.scheme.TupleScheme;
-import org.apache.thrift.protocol.TTupleProtocol;
-import org.apache.thrift.protocol.TProtocolException;
-import org.apache.thrift.EncodingUtils;
-import org.apache.thrift.TException;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.EnumMap;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.EnumSet;
-import java.util.Collections;
-import java.util.BitSet;
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class TRenamePrivilegesRequest implements org.apache.thrift.TBase<TRenamePrivilegesRequest, TRenamePrivilegesRequest._Fields>, java.io.Serializable, Cloneable {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TRenamePrivilegesRequest");
-
- private static final org.apache.thrift.protocol.TField PROTOCOL_VERSION_FIELD_DESC = new org.apache.thrift.protocol.TField("protocol_version", org.apache.thrift.protocol.TType.I32, (short)1);
- private static final org.apache.thrift.protocol.TField REQUESTOR_USER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("requestorUserName", org.apache.thrift.protocol.TType.STRING, (short)2);
- private static final org.apache.thrift.protocol.TField OLD_AUTHORIZABLE_FIELD_DESC = new org.apache.thrift.protocol.TField("oldAuthorizable", org.apache.thrift.protocol.TType.STRUCT, (short)3);
- private static final org.apache.thrift.protocol.TField NEW_AUTHORIZABLE_FIELD_DESC = new org.apache.thrift.protocol.TField("newAuthorizable", org.apache.thrift.protocol.TType.STRUCT, (short)4);
-
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TRenamePrivilegesRequestStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TRenamePrivilegesRequestTupleSchemeFactory());
- }
-
- private int protocol_version; // required
- private String requestorUserName; // required
- private TSentryAuthorizable oldAuthorizable; // required
- private TSentryAuthorizable newAuthorizable; // required
-
- /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
- public enum _Fields implements org.apache.thrift.TFieldIdEnum {
- PROTOCOL_VERSION((short)1, "protocol_version"),
- REQUESTOR_USER_NAME((short)2, "requestorUserName"),
- OLD_AUTHORIZABLE((short)3, "oldAuthorizable"),
- NEW_AUTHORIZABLE((short)4, "newAuthorizable");
-
- private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
-
- static {
- for (_Fields field : EnumSet.allOf(_Fields.class)) {
- byName.put(field.getFieldName(), field);
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, or null if its not found.
- */
- public static _Fields findByThriftId(int fieldId) {
- switch(fieldId) {
- case 1: // PROTOCOL_VERSION
- return PROTOCOL_VERSION;
- case 2: // REQUESTOR_USER_NAME
- return REQUESTOR_USER_NAME;
- case 3: // OLD_AUTHORIZABLE
- return OLD_AUTHORIZABLE;
- case 4: // NEW_AUTHORIZABLE
- return NEW_AUTHORIZABLE;
- default:
- return null;
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, throwing an exception
- * if it is not found.
- */
- public static _Fields findByThriftIdOrThrow(int fieldId) {
- _Fields fields = findByThriftId(fieldId);
- if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
- return fields;
- }
-
- /**
- * Find the _Fields constant that matches name, or null if its not found.
- */
- public static _Fields findByName(String name) {
- return byName.get(name);
- }
-
- private final short _thriftId;
- private final String _fieldName;
-
- _Fields(short thriftId, String fieldName) {
- _thriftId = thriftId;
- _fieldName = fieldName;
- }
-
- public short getThriftFieldId() {
- return _thriftId;
- }
-
- public String getFieldName() {
- return _fieldName;
- }
- }
-
- // isset id assignments
- private static final int __PROTOCOL_VERSION_ISSET_ID = 0;
- private byte __isset_bitfield = 0;
- public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
- static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
- tmpMap.put(_Fields.PROTOCOL_VERSION, new org.apache.thrift.meta_data.FieldMetaData("protocol_version", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
- tmpMap.put(_Fields.REQUESTOR_USER_NAME, new org.apache.thrift.meta_data.FieldMetaData("requestorUserName", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.OLD_AUTHORIZABLE, new org.apache.thrift.meta_data.FieldMetaData("oldAuthorizable", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TSentryAuthorizable.class)));
- tmpMap.put(_Fields.NEW_AUTHORIZABLE, new org.apache.thrift.meta_data.FieldMetaData("newAuthorizable", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TSentryAuthorizable.class)));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TRenamePrivilegesRequest.class, metaDataMap);
- }
-
- public TRenamePrivilegesRequest() {
- this.protocol_version = 1;
-
- }
-
- public TRenamePrivilegesRequest(
- int protocol_version,
- String requestorUserName,
- TSentryAuthorizable oldAuthorizable,
- TSentryAuthorizable newAuthorizable)
- {
- this();
- this.protocol_version = protocol_version;
- setProtocol_versionIsSet(true);
- this.requestorUserName = requestorUserName;
- this.oldAuthorizable = oldAuthorizable;
- this.newAuthorizable = newAuthorizable;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TRenamePrivilegesRequest(TRenamePrivilegesRequest other) {
- __isset_bitfield = other.__isset_bitfield;
- this.protocol_version = other.protocol_version;
- if (other.isSetRequestorUserName()) {
- this.requestorUserName = other.requestorUserName;
- }
- if (other.isSetOldAuthorizable()) {
- this.oldAuthorizable = new TSentryAuthorizable(other.oldAuthorizable);
- }
- if (other.isSetNewAuthorizable()) {
- this.newAuthorizable = new TSentryAuthorizable(other.newAuthorizable);
- }
- }
-
- public TRenamePrivilegesRequest deepCopy() {
- return new TRenamePrivilegesRequest(this);
- }
-
- @Override
- public void clear() {
- this.protocol_version = 1;
-
- this.requestorUserName = null;
- this.oldAuthorizable = null;
- this.newAuthorizable = null;
- }
-
- public int getProtocol_version() {
- return this.protocol_version;
- }
-
- public void setProtocol_version(int protocol_version) {
- this.protocol_version = protocol_version;
- setProtocol_versionIsSet(true);
- }
-
- public void unsetProtocol_version() {
- __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __PROTOCOL_VERSION_ISSET_ID);
- }
-
- /** Returns true if field protocol_version is set (has been assigned a value) and false otherwise */
- public boolean isSetProtocol_version() {
- return EncodingUtils.testBit(__isset_bitfield, __PROTOCOL_VERSION_ISSET_ID);
- }
-
- public void setProtocol_versionIsSet(boolean value) {
- __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __PROTOCOL_VERSION_ISSET_ID, value);
- }
-
- public String getRequestorUserName() {
- return this.requestorUserName;
- }
-
- public void setRequestorUserName(String requestorUserName) {
- this.requestorUserName = requestorUserName;
- }
-
- public void unsetRequestorUserName() {
- this.requestorUserName = null;
- }
-
- /** Returns true if field requestorUserName is set (has been assigned a value) and false otherwise */
- public boolean isSetRequestorUserName() {
- return this.requestorUserName != null;
- }
-
- public void setRequestorUserNameIsSet(boolean value) {
- if (!value) {
- this.requestorUserName = null;
- }
- }
-
- public TSentryAuthorizable getOldAuthorizable() {
- return this.oldAuthorizable;
- }
-
- public void setOldAuthorizable(TSentryAuthorizable oldAuthorizable) {
- this.oldAuthorizable = oldAuthorizable;
- }
-
- public void unsetOldAuthorizable() {
- this.oldAuthorizable = null;
- }
-
- /** Returns true if field oldAuthorizable is set (has been assigned a value) and false otherwise */
- public boolean isSetOldAuthorizable() {
- return this.oldAuthorizable != null;
- }
-
- public void setOldAuthorizableIsSet(boolean value) {
- if (!value) {
- this.oldAuthorizable = null;
- }
- }
-
- public TSentryAuthorizable getNewAuthorizable() {
- return this.newAuthorizable;
- }
-
- public void setNewAuthorizable(TSentryAuthorizable newAuthorizable) {
- this.newAuthorizable = newAuthorizable;
- }
-
- public void unsetNewAuthorizable() {
- this.newAuthorizable = null;
- }
-
- /** Returns true if field newAuthorizable is set (has been assigned a value) and false otherwise */
- public boolean isSetNewAuthorizable() {
- return this.newAuthorizable != null;
- }
-
- public void setNewAuthorizableIsSet(boolean value) {
- if (!value) {
- this.newAuthorizable = null;
- }
- }
-
- public void setFieldValue(_Fields field, Object value) {
- switch (field) {
- case PROTOCOL_VERSION:
- if (value == null) {
- unsetProtocol_version();
- } else {
- setProtocol_version((Integer)value);
- }
- break;
-
- case REQUESTOR_USER_NAME:
- if (value == null) {
- unsetRequestorUserName();
- } else {
- setRequestorUserName((String)value);
- }
- break;
-
- case OLD_AUTHORIZABLE:
- if (value == null) {
- unsetOldAuthorizable();
- } else {
- setOldAuthorizable((TSentryAuthorizable)value);
- }
- break;
-
- case NEW_AUTHORIZABLE:
- if (value == null) {
- unsetNewAuthorizable();
- } else {
- setNewAuthorizable((TSentryAuthorizable)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case PROTOCOL_VERSION:
- return Integer.valueOf(getProtocol_version());
-
- case REQUESTOR_USER_NAME:
- return getRequestorUserName();
-
- case OLD_AUTHORIZABLE:
- return getOldAuthorizable();
-
- case NEW_AUTHORIZABLE:
- return getNewAuthorizable();
-
- }
- throw new IllegalStateException();
- }
-
- /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
- public boolean isSet(_Fields field) {
- if (field == null) {
- throw new IllegalArgumentException();
- }
-
- switch (field) {
- case PROTOCOL_VERSION:
- return isSetProtocol_version();
- case REQUESTOR_USER_NAME:
- return isSetRequestorUserName();
- case OLD_AUTHORIZABLE:
- return isSetOldAuthorizable();
- case NEW_AUTHORIZABLE:
- return isSetNewAuthorizable();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TRenamePrivilegesRequest)
- return this.equals((TRenamePrivilegesRequest)that);
- return false;
- }
-
- public boolean equals(TRenamePrivilegesRequest that) {
- if (that == null)
- return false;
-
- boolean this_present_protocol_version = true;
- boolean that_present_protocol_version = true;
- if (this_present_protocol_version || that_present_protocol_version) {
- if (!(this_present_protocol_version && that_present_protocol_version))
- return false;
- if (this.protocol_version != that.protocol_version)
- return false;
- }
-
- boolean this_present_requestorUserName = true && this.isSetRequestorUserName();
- boolean that_present_requestorUserName = true && that.isSetRequestorUserName();
- if (this_present_requestorUserName || that_present_requestorUserName) {
- if (!(this_present_requestorUserName && that_present_requestorUserName))
- return false;
- if (!this.requestorUserName.equals(that.requestorUserName))
- return false;
- }
-
- boolean this_present_oldAuthorizable = true && this.isSetOldAuthorizable();
- boolean that_present_oldAuthorizable = true && that.isSetOldAuthorizable();
- if (this_present_oldAuthorizable || that_present_oldAuthorizable) {
- if (!(this_present_oldAuthorizable && that_present_oldAuthorizable))
- return false;
- if (!this.oldAuthorizable.equals(that.oldAuthorizable))
- return false;
- }
-
- boolean this_present_newAuthorizable = true && this.isSetNewAuthorizable();
- boolean that_present_newAuthorizable = true && that.isSetNewAuthorizable();
- if (this_present_newAuthorizable || that_present_newAuthorizable) {
- if (!(this_present_newAuthorizable && that_present_newAuthorizable))
- return false;
- if (!this.newAuthorizable.equals(that.newAuthorizable))
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode() {
- HashCodeBuilder builder = new HashCodeBuilder();
-
- boolean present_protocol_version = true;
- builder.append(present_protocol_version);
- if (present_protocol_version)
- builder.append(protocol_version);
-
- boolean present_requestorUserName = true && (isSetRequestorUserName());
- builder.append(present_requestorUserName);
- if (present_requestorUserName)
- builder.append(requestorUserName);
-
- boolean present_oldAuthorizable = true && (isSetOldAuthorizable());
- builder.append(present_oldAuthorizable);
- if (present_oldAuthorizable)
- builder.append(oldAuthorizable);
-
- boolean present_newAuthorizable = true && (isSetNewAuthorizable());
- builder.append(present_newAuthorizable);
- if (present_newAuthorizable)
- builder.append(newAuthorizable);
-
- return builder.toHashCode();
- }
-
- public int compareTo(TRenamePrivilegesRequest other) {
- if (!getClass().equals(other.getClass())) {
- return getClass().getName().compareTo(other.getClass().getName());
- }
-
- int lastComparison = 0;
- TRenamePrivilegesRequest typedOther = (TRenamePrivilegesRequest)other;
-
- lastComparison = Boolean.valueOf(isSetProtocol_version()).compareTo(typedOther.isSetProtocol_version());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetProtocol_version()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.protocol_version, typedOther.protocol_version);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetRequestorUserName()).compareTo(typedOther.isSetRequestorUserName());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetRequestorUserName()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.requestorUserName, typedOther.requestorUserName);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetOldAuthorizable()).compareTo(typedOther.isSetOldAuthorizable());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetOldAuthorizable()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.oldAuthorizable, typedOther.oldAuthorizable);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetNewAuthorizable()).compareTo(typedOther.isSetNewAuthorizable());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetNewAuthorizable()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.newAuthorizable, typedOther.newAuthorizable);
- 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("TRenamePrivilegesRequest(");
- boolean first = true;
-
- sb.append("protocol_version:");
- sb.append(this.protocol_version);
- first = false;
- if (!first) sb.append(", ");
- sb.append("requestorUserName:");
- if (this.requestorUserName == null) {
- sb.append("null");
- } else {
- sb.append(this.requestorUserName);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("oldAuthorizable:");
- if (this.oldAuthorizable == null) {
- sb.append("null");
- } else {
- sb.append(this.oldAuthorizable);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("newAuthorizable:");
- if (this.newAuthorizable == null) {
- sb.append("null");
- } else {
- sb.append(this.newAuthorizable);
- }
- first = false;
- sb.append(")");
- return sb.toString();
- }
-
- public void validate() throws org.apache.thrift.TException {
- // check for required fields
- if (!isSetProtocol_version()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'protocol_version' is unset! Struct:" + toString());
- }
-
- if (!isSetRequestorUserName()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'requestorUserName' is unset! Struct:" + toString());
- }
-
- if (!isSetOldAuthorizable()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'oldAuthorizable' is unset! Struct:" + toString());
- }
-
- if (!isSetNewAuthorizable()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'newAuthorizable' is unset! Struct:" + toString());
- }
-
- // check for sub-struct validity
- if (oldAuthorizable != null) {
- oldAuthorizable.validate();
- }
- if (newAuthorizable != null) {
- newAuthorizable.validate();
- }
- }
-
- private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
- try {
- write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
- try {
- // 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 TRenamePrivilegesRequestStandardSchemeFactory implements SchemeFactory {
- public TRenamePrivilegesRequestStandardScheme getScheme() {
- return new TRenamePrivilegesRequestStandardScheme();
- }
- }
-
- private static class TRenamePrivilegesRequestStandardScheme extends StandardScheme<TRenamePrivilegesRequest> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TRenamePrivilegesRequest struct) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TField schemeField;
- iprot.readStructBegin();
- while (true)
- {
- schemeField = iprot.readFieldBegin();
- if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
- break;
- }
- switch (schemeField.id) {
- case 1: // PROTOCOL_VERSION
- if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
- struct.protocol_version = iprot.readI32();
- struct.setProtocol_versionIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 2: // REQUESTOR_USER_NAME
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.requestorUserName = iprot.readString();
- struct.setRequestorUserNameIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 3: // OLD_AUTHORIZABLE
- if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
- struct.oldAuthorizable = new TSentryAuthorizable();
- struct.oldAuthorizable.read(iprot);
- struct.setOldAuthorizableIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 4: // NEW_AUTHORIZABLE
- if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
- struct.newAuthorizable = new TSentryAuthorizable();
- struct.newAuthorizable.read(iprot);
- struct.setNewAuthorizableIsSet(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, TRenamePrivilegesRequest struct) throws org.apache.thrift.TException {
- struct.validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- oprot.writeFieldBegin(PROTOCOL_VERSION_FIELD_DESC);
- oprot.writeI32(struct.protocol_version);
- oprot.writeFieldEnd();
- if (struct.requestorUserName != null) {
- oprot.writeFieldBegin(REQUESTOR_USER_NAME_FIELD_DESC);
- oprot.writeString(struct.requestorUserName);
- oprot.writeFieldEnd();
- }
- if (struct.oldAuthorizable != null) {
- oprot.writeFieldBegin(OLD_AUTHORIZABLE_FIELD_DESC);
- struct.oldAuthorizable.write(oprot);
- oprot.writeFieldEnd();
- }
- if (struct.newAuthorizable != null) {
- oprot.writeFieldBegin(NEW_AUTHORIZABLE_FIELD_DESC);
- struct.newAuthorizable.write(oprot);
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TRenamePrivilegesRequestTupleSchemeFactory implements SchemeFactory {
- public TRenamePrivilegesRequestTupleScheme getScheme() {
- return new TRenamePrivilegesRequestTupleScheme();
- }
- }
-
- private static class TRenamePrivilegesRequestTupleScheme extends TupleScheme<TRenamePrivilegesRequest> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, TRenamePrivilegesRequest struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- oprot.writeI32(struct.protocol_version);
- oprot.writeString(struct.requestorUserName);
- struct.oldAuthorizable.write(oprot);
- struct.newAuthorizable.write(oprot);
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TRenamePrivilegesRequest struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- struct.protocol_version = iprot.readI32();
- struct.setProtocol_versionIsSet(true);
- struct.requestorUserName = iprot.readString();
- struct.setRequestorUserNameIsSet(true);
- struct.oldAuthorizable = new TSentryAuthorizable();
- struct.oldAuthorizable.read(iprot);
- struct.setOldAuthorizableIsSet(true);
- struct.newAuthorizable = new TSentryAuthorizable();
- struct.newAuthorizable.read(iprot);
- struct.setNewAuthorizableIsSet(true);
- }
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TRenamePrivilegesResponse.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TRenamePrivilegesResponse.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TRenamePrivilegesResponse.java
deleted file mode 100644
index 39e7f07..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TRenamePrivilegesResponse.java
+++ /dev/null
@@ -1,390 +0,0 @@
-/**
- * Autogenerated by Thrift Compiler (0.9.0)
- *
- * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
- * @generated
- */
-package org.apache.sentry.provider.db.service.thrift;
-
-import org.apache.commons.lang.builder.HashCodeBuilder;
-import org.apache.thrift.scheme.IScheme;
-import org.apache.thrift.scheme.SchemeFactory;
-import org.apache.thrift.scheme.StandardScheme;
-
-import org.apache.thrift.scheme.TupleScheme;
-import org.apache.thrift.protocol.TTupleProtocol;
-import org.apache.thrift.protocol.TProtocolException;
-import org.apache.thrift.EncodingUtils;
-import org.apache.thrift.TException;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.EnumMap;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.EnumSet;
-import java.util.Collections;
-import java.util.BitSet;
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class TRenamePrivilegesResponse implements org.apache.thrift.TBase<TRenamePrivilegesResponse, TRenamePrivilegesResponse._Fields>, java.io.Serializable, Cloneable {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TRenamePrivilegesResponse");
-
- private static final org.apache.thrift.protocol.TField STATUS_FIELD_DESC = new org.apache.thrift.protocol.TField("status", org.apache.thrift.protocol.TType.STRUCT, (short)1);
-
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TRenamePrivilegesResponseStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TRenamePrivilegesResponseTupleSchemeFactory());
- }
-
- private org.apache.sentry.service.thrift.TSentryResponseStatus status; // required
-
- /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
- public enum _Fields implements org.apache.thrift.TFieldIdEnum {
- STATUS((short)1, "status");
-
- private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
-
- static {
- for (_Fields field : EnumSet.allOf(_Fields.class)) {
- byName.put(field.getFieldName(), field);
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, or null if its not found.
- */
- public static _Fields findByThriftId(int fieldId) {
- switch(fieldId) {
- case 1: // STATUS
- return STATUS;
- default:
- return null;
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, throwing an exception
- * if it is not found.
- */
- public static _Fields findByThriftIdOrThrow(int fieldId) {
- _Fields fields = findByThriftId(fieldId);
- if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
- return fields;
- }
-
- /**
- * Find the _Fields constant that matches name, or null if its not found.
- */
- public static _Fields findByName(String name) {
- return byName.get(name);
- }
-
- private final short _thriftId;
- private final String _fieldName;
-
- _Fields(short thriftId, String fieldName) {
- _thriftId = thriftId;
- _fieldName = fieldName;
- }
-
- public short getThriftFieldId() {
- return _thriftId;
- }
-
- public String getFieldName() {
- return _fieldName;
- }
- }
-
- // isset id assignments
- public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
- static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
- tmpMap.put(_Fields.STATUS, new org.apache.thrift.meta_data.FieldMetaData("status", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.sentry.service.thrift.TSentryResponseStatus.class)));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TRenamePrivilegesResponse.class, metaDataMap);
- }
-
- public TRenamePrivilegesResponse() {
- }
-
- public TRenamePrivilegesResponse(
- org.apache.sentry.service.thrift.TSentryResponseStatus status)
- {
- this();
- this.status = status;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TRenamePrivilegesResponse(TRenamePrivilegesResponse other) {
- if (other.isSetStatus()) {
- this.status = new org.apache.sentry.service.thrift.TSentryResponseStatus(other.status);
- }
- }
-
- public TRenamePrivilegesResponse deepCopy() {
- return new TRenamePrivilegesResponse(this);
- }
-
- @Override
- public void clear() {
- this.status = null;
- }
-
- public org.apache.sentry.service.thrift.TSentryResponseStatus getStatus() {
- return this.status;
- }
-
- public void setStatus(org.apache.sentry.service.thrift.TSentryResponseStatus status) {
- this.status = status;
- }
-
- public void unsetStatus() {
- this.status = null;
- }
-
- /** Returns true if field status is set (has been assigned a value) and false otherwise */
- public boolean isSetStatus() {
- return this.status != null;
- }
-
- public void setStatusIsSet(boolean value) {
- if (!value) {
- this.status = null;
- }
- }
-
- public void setFieldValue(_Fields field, Object value) {
- switch (field) {
- case STATUS:
- if (value == null) {
- unsetStatus();
- } else {
- setStatus((org.apache.sentry.service.thrift.TSentryResponseStatus)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case STATUS:
- return getStatus();
-
- }
- throw new IllegalStateException();
- }
-
- /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
- public boolean isSet(_Fields field) {
- if (field == null) {
- throw new IllegalArgumentException();
- }
-
- switch (field) {
- case STATUS:
- return isSetStatus();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TRenamePrivilegesResponse)
- return this.equals((TRenamePrivilegesResponse)that);
- return false;
- }
-
- public boolean equals(TRenamePrivilegesResponse that) {
- if (that == null)
- return false;
-
- boolean this_present_status = true && this.isSetStatus();
- boolean that_present_status = true && that.isSetStatus();
- if (this_present_status || that_present_status) {
- if (!(this_present_status && that_present_status))
- return false;
- if (!this.status.equals(that.status))
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode() {
- HashCodeBuilder builder = new HashCodeBuilder();
-
- boolean present_status = true && (isSetStatus());
- builder.append(present_status);
- if (present_status)
- builder.append(status);
-
- return builder.toHashCode();
- }
-
- public int compareTo(TRenamePrivilegesResponse other) {
- if (!getClass().equals(other.getClass())) {
- return getClass().getName().compareTo(other.getClass().getName());
- }
-
- int lastComparison = 0;
- TRenamePrivilegesResponse typedOther = (TRenamePrivilegesResponse)other;
-
- lastComparison = Boolean.valueOf(isSetStatus()).compareTo(typedOther.isSetStatus());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetStatus()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.status, typedOther.status);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- 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("TRenamePrivilegesResponse(");
- boolean first = true;
-
- sb.append("status:");
- if (this.status == null) {
- sb.append("null");
- } else {
- sb.append(this.status);
- }
- first = false;
- sb.append(")");
- return sb.toString();
- }
-
- public void validate() throws org.apache.thrift.TException {
- // check for required fields
- if (!isSetStatus()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'status' is unset! Struct:" + toString());
- }
-
- // check for sub-struct validity
- if (status != null) {
- status.validate();
- }
- }
-
- private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
- try {
- write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
- try {
- read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private static class TRenamePrivilegesResponseStandardSchemeFactory implements SchemeFactory {
- public TRenamePrivilegesResponseStandardScheme getScheme() {
- return new TRenamePrivilegesResponseStandardScheme();
- }
- }
-
- private static class TRenamePrivilegesResponseStandardScheme extends StandardScheme<TRenamePrivilegesResponse> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TRenamePrivilegesResponse struct) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TField schemeField;
- iprot.readStructBegin();
- while (true)
- {
- schemeField = iprot.readFieldBegin();
- if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
- break;
- }
- switch (schemeField.id) {
- case 1: // STATUS
- if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
- struct.status = new org.apache.sentry.service.thrift.TSentryResponseStatus();
- struct.status.read(iprot);
- struct.setStatusIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- 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, TRenamePrivilegesResponse struct) throws org.apache.thrift.TException {
- struct.validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- if (struct.status != null) {
- oprot.writeFieldBegin(STATUS_FIELD_DESC);
- struct.status.write(oprot);
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TRenamePrivilegesResponseTupleSchemeFactory implements SchemeFactory {
- public TRenamePrivilegesResponseTupleScheme getScheme() {
- return new TRenamePrivilegesResponseTupleScheme();
- }
- }
-
- private static class TRenamePrivilegesResponseTupleScheme extends TupleScheme<TRenamePrivilegesResponse> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, TRenamePrivilegesResponse struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- struct.status.write(oprot);
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TRenamePrivilegesResponse struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- struct.status = new org.apache.sentry.service.thrift.TSentryResponseStatus();
- struct.status.read(iprot);
- struct.setStatusIsSet(true);
- }
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryActiveRoleSet.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryActiveRoleSet.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryActiveRoleSet.java
deleted file mode 100644
index 573dc26..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryActiveRoleSet.java
+++ /dev/null
@@ -1,536 +0,0 @@
-/**
- * Autogenerated by Thrift Compiler (0.9.0)
- *
- * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
- * @generated
- */
-package org.apache.sentry.provider.db.service.thrift;
-
-import org.apache.commons.lang.builder.HashCodeBuilder;
-import org.apache.thrift.scheme.IScheme;
-import org.apache.thrift.scheme.SchemeFactory;
-import org.apache.thrift.scheme.StandardScheme;
-
-import org.apache.thrift.scheme.TupleScheme;
-import org.apache.thrift.protocol.TTupleProtocol;
-import org.apache.thrift.protocol.TProtocolException;
-import org.apache.thrift.EncodingUtils;
-import org.apache.thrift.TException;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.EnumMap;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.EnumSet;
-import java.util.Collections;
-import java.util.BitSet;
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class TSentryActiveRoleSet implements org.apache.thrift.TBase<TSentryActiveRoleSet, TSentryActiveRoleSet._Fields>, java.io.Serializable, Cloneable {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TSentryActiveRoleSet");
-
- private static final org.apache.thrift.protocol.TField ALL_FIELD_DESC = new org.apache.thrift.protocol.TField("all", org.apache.thrift.protocol.TType.BOOL, (short)1);
- private static final org.apache.thrift.protocol.TField ROLES_FIELD_DESC = new org.apache.thrift.protocol.TField("roles", org.apache.thrift.protocol.TType.SET, (short)2);
-
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TSentryActiveRoleSetStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TSentryActiveRoleSetTupleSchemeFactory());
- }
-
- private boolean all; // required
- private Set<String> roles; // 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 {
- ALL((short)1, "all"),
- ROLES((short)2, "roles");
-
- 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: // ALL
- return ALL;
- case 2: // ROLES
- return ROLES;
- 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 __ALL_ISSET_ID = 0;
- private byte __isset_bitfield = 0;
- public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
- static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
- tmpMap.put(_Fields.ALL, new org.apache.thrift.meta_data.FieldMetaData("all", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
- tmpMap.put(_Fields.ROLES, new org.apache.thrift.meta_data.FieldMetaData("roles", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TSentryActiveRoleSet.class, metaDataMap);
- }
-
- public TSentryActiveRoleSet() {
- }
-
- public TSentryActiveRoleSet(
- boolean all,
- Set<String> roles)
- {
- this();
- this.all = all;
- setAllIsSet(true);
- this.roles = roles;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TSentryActiveRoleSet(TSentryActiveRoleSet other) {
- __isset_bitfield = other.__isset_bitfield;
- this.all = other.all;
- if (other.isSetRoles()) {
- Set<String> __this__roles = new HashSet<String>();
- for (String other_element : other.roles) {
- __this__roles.add(other_element);
- }
- this.roles = __this__roles;
- }
- }
-
- public TSentryActiveRoleSet deepCopy() {
- return new TSentryActiveRoleSet(this);
- }
-
- @Override
- public void clear() {
- setAllIsSet(false);
- this.all = false;
- this.roles = null;
- }
-
- public boolean isAll() {
- return this.all;
- }
-
- public void setAll(boolean all) {
- this.all = all;
- setAllIsSet(true);
- }
-
- public void unsetAll() {
- __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __ALL_ISSET_ID);
- }
-
- /** Returns true if field all is set (has been assigned a value) and false otherwise */
- public boolean isSetAll() {
- return EncodingUtils.testBit(__isset_bitfield, __ALL_ISSET_ID);
- }
-
- public void setAllIsSet(boolean value) {
- __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __ALL_ISSET_ID, value);
- }
-
- public int getRolesSize() {
- return (this.roles == null) ? 0 : this.roles.size();
- }
-
- public java.util.Iterator<String> getRolesIterator() {
- return (this.roles == null) ? null : this.roles.iterator();
- }
-
- public void addToRoles(String elem) {
- if (this.roles == null) {
- this.roles = new HashSet<String>();
- }
- this.roles.add(elem);
- }
-
- public Set<String> getRoles() {
- return this.roles;
- }
-
- public void setRoles(Set<String> roles) {
- this.roles = roles;
- }
-
- public void unsetRoles() {
- this.roles = null;
- }
-
- /** Returns true if field roles is set (has been assigned a value) and false otherwise */
- public boolean isSetRoles() {
- return this.roles != null;
- }
-
- public void setRolesIsSet(boolean value) {
- if (!value) {
- this.roles = null;
- }
- }
-
- public void setFieldValue(_Fields field, Object value) {
- switch (field) {
- case ALL:
- if (value == null) {
- unsetAll();
- } else {
- setAll((Boolean)value);
- }
- break;
-
- case ROLES:
- if (value == null) {
- unsetRoles();
- } else {
- setRoles((Set<String>)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case ALL:
- return Boolean.valueOf(isAll());
-
- case ROLES:
- return getRoles();
-
- }
- 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 ALL:
- return isSetAll();
- case ROLES:
- return isSetRoles();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TSentryActiveRoleSet)
- return this.equals((TSentryActiveRoleSet)that);
- return false;
- }
-
- public boolean equals(TSentryActiveRoleSet that) {
- if (that == null)
- return false;
-
- boolean this_present_all = true;
- boolean that_present_all = true;
- if (this_present_all || that_present_all) {
- if (!(this_present_all && that_present_all))
- return false;
- if (this.all != that.all)
- return false;
- }
-
- boolean this_present_roles = true && this.isSetRoles();
- boolean that_present_roles = true && that.isSetRoles();
- if (this_present_roles || that_present_roles) {
- if (!(this_present_roles && that_present_roles))
- return false;
- if (!this.roles.equals(that.roles))
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode() {
- HashCodeBuilder builder = new HashCodeBuilder();
-
- boolean present_all = true;
- builder.append(present_all);
- if (present_all)
- builder.append(all);
-
- boolean present_roles = true && (isSetRoles());
- builder.append(present_roles);
- if (present_roles)
- builder.append(roles);
-
- return builder.toHashCode();
- }
-
- public int compareTo(TSentryActiveRoleSet other) {
- if (!getClass().equals(other.getClass())) {
- return getClass().getName().compareTo(other.getClass().getName());
- }
-
- int lastComparison = 0;
- TSentryActiveRoleSet typedOther = (TSentryActiveRoleSet)other;
-
- lastComparison = Boolean.valueOf(isSetAll()).compareTo(typedOther.isSetAll());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetAll()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.all, typedOther.all);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetRoles()).compareTo(typedOther.isSetRoles());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetRoles()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.roles, typedOther.roles);
- 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("TSentryActiveRoleSet(");
- boolean first = true;
-
- sb.append("all:");
- sb.append(this.all);
- first = false;
- if (!first) sb.append(", ");
- sb.append("roles:");
- if (this.roles == null) {
- sb.append("null");
- } else {
- sb.append(this.roles);
- }
- first = false;
- sb.append(")");
- return sb.toString();
- }
-
- public void validate() throws org.apache.thrift.TException {
- // check for required fields
- if (!isSetAll()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'all' is unset! Struct:" + toString());
- }
-
- if (!isSetRoles()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'roles' 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 TSentryActiveRoleSetStandardSchemeFactory implements SchemeFactory {
- public TSentryActiveRoleSetStandardScheme getScheme() {
- return new TSentryActiveRoleSetStandardScheme();
- }
- }
-
- private static class TSentryActiveRoleSetStandardScheme extends StandardScheme<TSentryActiveRoleSet> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TSentryActiveRoleSet 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: // ALL
- if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
- struct.all = iprot.readBool();
- struct.setAllIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 2: // ROLES
- if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
- {
- org.apache.thrift.protocol.TSet _set40 = iprot.readSetBegin();
- struct.roles = new HashSet<String>(2*_set40.size);
- for (int _i41 = 0; _i41 < _set40.size; ++_i41)
- {
- String _elem42; // required
- _elem42 = iprot.readString();
- struct.roles.add(_elem42);
- }
- iprot.readSetEnd();
- }
- struct.setRolesIsSet(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, TSentryActiveRoleSet struct) throws org.apache.thrift.TException {
- struct.validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- oprot.writeFieldBegin(ALL_FIELD_DESC);
- oprot.writeBool(struct.all);
- oprot.writeFieldEnd();
- if (struct.roles != null) {
- oprot.writeFieldBegin(ROLES_FIELD_DESC);
- {
- oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, struct.roles.size()));
- for (String _iter43 : struct.roles)
- {
- oprot.writeString(_iter43);
- }
- oprot.writeSetEnd();
- }
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TSentryActiveRoleSetTupleSchemeFactory implements SchemeFactory {
- public TSentryActiveRoleSetTupleScheme getScheme() {
- return new TSentryActiveRoleSetTupleScheme();
- }
- }
-
- private static class TSentryActiveRoleSetTupleScheme extends TupleScheme<TSentryActiveRoleSet> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, TSentryActiveRoleSet struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- oprot.writeBool(struct.all);
- {
- oprot.writeI32(struct.roles.size());
- for (String _iter44 : struct.roles)
- {
- oprot.writeString(_iter44);
- }
- }
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TSentryActiveRoleSet struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- struct.all = iprot.readBool();
- struct.setAllIsSet(true);
- {
- org.apache.thrift.protocol.TSet _set45 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
- struct.roles = new HashSet<String>(2*_set45.size);
- for (int _i46 = 0; _i46 < _set45.size; ++_i46)
- {
- String _elem47; // required
- _elem47 = iprot.readString();
- struct.roles.add(_elem47);
- }
- }
- struct.setRolesIsSet(true);
- }
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryAuthorizable.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryAuthorizable.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryAuthorizable.java
deleted file mode 100644
index 59418a3..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryAuthorizable.java
+++ /dev/null
@@ -1,707 +0,0 @@
-/**
- * Autogenerated by Thrift Compiler (0.9.0)
- *
- * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
- * @generated
- */
-package org.apache.sentry.provider.db.service.thrift;
-
-import org.apache.commons.lang.builder.HashCodeBuilder;
-import org.apache.thrift.scheme.IScheme;
-import org.apache.thrift.scheme.SchemeFactory;
-import org.apache.thrift.scheme.StandardScheme;
-
-import org.apache.thrift.scheme.TupleScheme;
-import org.apache.thrift.protocol.TTupleProtocol;
-import org.apache.thrift.protocol.TProtocolException;
-import org.apache.thrift.EncodingUtils;
-import org.apache.thrift.TException;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.EnumMap;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.EnumSet;
-import java.util.Collections;
-import java.util.BitSet;
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class TSentryAuthorizable implements org.apache.thrift.TBase<TSentryAuthorizable, TSentryAuthorizable._Fields>, java.io.Serializable, Cloneable {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TSentryAuthorizable");
-
- private static final org.apache.thrift.protocol.TField SERVER_FIELD_DESC = new org.apache.thrift.protocol.TField("server", org.apache.thrift.protocol.TType.STRING, (short)1);
- private static final org.apache.thrift.protocol.TField URI_FIELD_DESC = new org.apache.thrift.protocol.TField("uri", org.apache.thrift.protocol.TType.STRING, (short)2);
- private static final org.apache.thrift.protocol.TField DB_FIELD_DESC = new org.apache.thrift.protocol.TField("db", org.apache.thrift.protocol.TType.STRING, (short)3);
- private static final org.apache.thrift.protocol.TField TABLE_FIELD_DESC = new org.apache.thrift.protocol.TField("table", org.apache.thrift.protocol.TType.STRING, (short)4);
-
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new TSentryAuthorizableStandardSchemeFactory());
- schemes.put(TupleScheme.class, new TSentryAuthorizableTupleSchemeFactory());
- }
-
- private String server; // required
- private String uri; // optional
- private String db; // optional
- private String table; // 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 {
- SERVER((short)1, "server"),
- URI((short)2, "uri"),
- DB((short)3, "db"),
- TABLE((short)4, "table");
-
- 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: // SERVER
- return SERVER;
- case 2: // URI
- return URI;
- case 3: // DB
- return DB;
- case 4: // TABLE
- return TABLE;
- 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 _Fields optionals[] = {_Fields.URI,_Fields.DB,_Fields.TABLE};
- 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.SERVER, new org.apache.thrift.meta_data.FieldMetaData("server", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.URI, new org.apache.thrift.meta_data.FieldMetaData("uri", org.apache.thrift.TFieldRequirementType.OPTIONAL,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.DB, new org.apache.thrift.meta_data.FieldMetaData("db", org.apache.thrift.TFieldRequirementType.OPTIONAL,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- tmpMap.put(_Fields.TABLE, new org.apache.thrift.meta_data.FieldMetaData("table", 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(TSentryAuthorizable.class, metaDataMap);
- }
-
- public TSentryAuthorizable() {
- }
-
- public TSentryAuthorizable(
- String server)
- {
- this();
- this.server = server;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public TSentryAuthorizable(TSentryAuthorizable other) {
- if (other.isSetServer()) {
- this.server = other.server;
- }
- if (other.isSetUri()) {
- this.uri = other.uri;
- }
- if (other.isSetDb()) {
- this.db = other.db;
- }
- if (other.isSetTable()) {
- this.table = other.table;
- }
- }
-
- public TSentryAuthorizable deepCopy() {
- return new TSentryAuthorizable(this);
- }
-
- @Override
- public void clear() {
- this.server = null;
- this.uri = null;
- this.db = null;
- this.table = null;
- }
-
- public String getServer() {
- return this.server;
- }
-
- public void setServer(String server) {
- this.server = server;
- }
-
- public void unsetServer() {
- this.server = null;
- }
-
- /** Returns true if field server is set (has been assigned a value) and false otherwise */
- public boolean isSetServer() {
- return this.server != null;
- }
-
- public void setServerIsSet(boolean value) {
- if (!value) {
- this.server = null;
- }
- }
-
- public String getUri() {
- return this.uri;
- }
-
- public void setUri(String uri) {
- this.uri = uri;
- }
-
- public void unsetUri() {
- this.uri = null;
- }
-
- /** Returns true if field uri is set (has been assigned a value) and false otherwise */
- public boolean isSetUri() {
- return this.uri != null;
- }
-
- public void setUriIsSet(boolean value) {
- if (!value) {
- this.uri = null;
- }
- }
-
- public String getDb() {
- return this.db;
- }
-
- public void setDb(String db) {
- this.db = db;
- }
-
- public void unsetDb() {
- this.db = null;
- }
-
- /** Returns true if field db is set (has been assigned a value) and false otherwise */
- public boolean isSetDb() {
- return this.db != null;
- }
-
- public void setDbIsSet(boolean value) {
- if (!value) {
- this.db = null;
- }
- }
-
- public String getTable() {
- return this.table;
- }
-
- public void setTable(String table) {
- this.table = table;
- }
-
- public void unsetTable() {
- this.table = null;
- }
-
- /** Returns true if field table is set (has been assigned a value) and false otherwise */
- public boolean isSetTable() {
- return this.table != null;
- }
-
- public void setTableIsSet(boolean value) {
- if (!value) {
- this.table = null;
- }
- }
-
- public void setFieldValue(_Fields field, Object value) {
- switch (field) {
- case SERVER:
- if (value == null) {
- unsetServer();
- } else {
- setServer((String)value);
- }
- break;
-
- case URI:
- if (value == null) {
- unsetUri();
- } else {
- setUri((String)value);
- }
- break;
-
- case DB:
- if (value == null) {
- unsetDb();
- } else {
- setDb((String)value);
- }
- break;
-
- case TABLE:
- if (value == null) {
- unsetTable();
- } else {
- setTable((String)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case SERVER:
- return getServer();
-
- case URI:
- return getUri();
-
- case DB:
- return getDb();
-
- case TABLE:
- return getTable();
-
- }
- 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 SERVER:
- return isSetServer();
- case URI:
- return isSetUri();
- case DB:
- return isSetDb();
- case TABLE:
- return isSetTable();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof TSentryAuthorizable)
- return this.equals((TSentryAuthorizable)that);
- return false;
- }
-
- public boolean equals(TSentryAuthorizable that) {
- if (that == null)
- return false;
-
- boolean this_present_server = true && this.isSetServer();
- boolean that_present_server = true && that.isSetServer();
- if (this_present_server || that_present_server) {
- if (!(this_present_server && that_present_server))
- return false;
- if (!this.server.equals(that.server))
- return false;
- }
-
- boolean this_present_uri = true && this.isSetUri();
- boolean that_present_uri = true && that.isSetUri();
- if (this_present_uri || that_present_uri) {
- if (!(this_present_uri && that_present_uri))
- return false;
- if (!this.uri.equals(that.uri))
- return false;
- }
-
- boolean this_present_db = true && this.isSetDb();
- boolean that_present_db = true && that.isSetDb();
- if (this_present_db || that_present_db) {
- if (!(this_present_db && that_present_db))
- return false;
- if (!this.db.equals(that.db))
- return false;
- }
-
- boolean this_present_table = true && this.isSetTable();
- boolean that_present_table = true && that.isSetTable();
- if (this_present_table || that_present_table) {
- if (!(this_present_table && that_present_table))
- return false;
- if (!this.table.equals(that.table))
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode() {
- HashCodeBuilder builder = new HashCodeBuilder();
-
- boolean present_server = true && (isSetServer());
- builder.append(present_server);
- if (present_server)
- builder.append(server);
-
- boolean present_uri = true && (isSetUri());
- builder.append(present_uri);
- if (present_uri)
- builder.append(uri);
-
- boolean present_db = true && (isSetDb());
- builder.append(present_db);
- if (present_db)
- builder.append(db);
-
- boolean present_table = true && (isSetTable());
- builder.append(present_table);
- if (present_table)
- builder.append(table);
-
- return builder.toHashCode();
- }
-
- public int compareTo(TSentryAuthorizable other) {
- if (!getClass().equals(other.getClass())) {
- return getClass().getName().compareTo(other.getClass().getName());
- }
-
- int lastComparison = 0;
- TSentryAuthorizable typedOther = (TSentryAuthorizable)other;
-
- lastComparison = Boolean.valueOf(isSetServer()).compareTo(typedOther.isSetServer());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetServer()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.server, typedOther.server);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetUri()).compareTo(typedOther.isSetUri());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetUri()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.uri, typedOther.uri);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetDb()).compareTo(typedOther.isSetDb());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetDb()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.db, typedOther.db);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetTable()).compareTo(typedOther.isSetTable());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetTable()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.table, typedOther.table);
- 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("TSentryAuthorizable(");
- boolean first = true;
-
- sb.append("server:");
- if (this.server == null) {
- sb.append("null");
- } else {
- sb.append(this.server);
- }
- first = false;
- if (isSetUri()) {
- if (!first) sb.append(", ");
- sb.append("uri:");
- if (this.uri == null) {
- sb.append("null");
- } else {
- sb.append(this.uri);
- }
- first = false;
- }
- if (isSetDb()) {
- if (!first) sb.append(", ");
- sb.append("db:");
- if (this.db == null) {
- sb.append("null");
- } else {
- sb.append(this.db);
- }
- first = false;
- }
- if (isSetTable()) {
- if (!first) sb.append(", ");
- sb.append("table:");
- if (this.table == null) {
- sb.append("null");
- } else {
- sb.append(this.table);
- }
- first = false;
- }
- sb.append(")");
- return sb.toString();
- }
-
- public void validate() throws org.apache.thrift.TException {
- // check for required fields
- if (!isSetServer()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'server' 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 TSentryAuthorizableStandardSchemeFactory implements SchemeFactory {
- public TSentryAuthorizableStandardScheme getScheme() {
- return new TSentryAuthorizableStandardScheme();
- }
- }
-
- private static class TSentryAuthorizableStandardScheme extends StandardScheme<TSentryAuthorizable> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, TSentryAuthorizable 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: // SERVER
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.server = iprot.readString();
- struct.setServerIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 2: // URI
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.uri = iprot.readString();
- struct.setUriIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 3: // DB
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.db = iprot.readString();
- struct.setDbIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 4: // TABLE
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.table = iprot.readString();
- struct.setTableIsSet(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, TSentryAuthorizable struct) throws org.apache.thrift.TException {
- struct.validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- if (struct.server != null) {
- oprot.writeFieldBegin(SERVER_FIELD_DESC);
- oprot.writeString(struct.server);
- oprot.writeFieldEnd();
- }
- if (struct.uri != null) {
- if (struct.isSetUri()) {
- oprot.writeFieldBegin(URI_FIELD_DESC);
- oprot.writeString(struct.uri);
- oprot.writeFieldEnd();
- }
- }
- if (struct.db != null) {
- if (struct.isSetDb()) {
- oprot.writeFieldBegin(DB_FIELD_DESC);
- oprot.writeString(struct.db);
- oprot.writeFieldEnd();
- }
- }
- if (struct.table != null) {
- if (struct.isSetTable()) {
- oprot.writeFieldBegin(TABLE_FIELD_DESC);
- oprot.writeString(struct.table);
- oprot.writeFieldEnd();
- }
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class TSentryAuthorizableTupleSchemeFactory implements SchemeFactory {
- public TSentryAuthorizableTupleScheme getScheme() {
- return new TSentryAuthorizableTupleScheme();
- }
- }
-
- private static class TSentryAuthorizableTupleScheme extends TupleScheme<TSentryAuthorizable> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, TSentryAuthorizable struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- oprot.writeString(struct.server);
- BitSet optionals = new BitSet();
- if (struct.isSetUri()) {
- optionals.set(0);
- }
- if (struct.isSetDb()) {
- optionals.set(1);
- }
- if (struct.isSetTable()) {
- optionals.set(2);
- }
- oprot.writeBitSet(optionals, 3);
- if (struct.isSetUri()) {
- oprot.writeString(struct.uri);
- }
- if (struct.isSetDb()) {
- oprot.writeString(struct.db);
- }
- if (struct.isSetTable()) {
- oprot.writeString(struct.table);
- }
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, TSentryAuthorizable struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- struct.server = iprot.readString();
- struct.setServerIsSet(true);
- BitSet incoming = iprot.readBitSet(3);
- if (incoming.get(0)) {
- struct.uri = iprot.readString();
- struct.setUriIsSet(true);
- }
- if (incoming.get(1)) {
- struct.db = iprot.readString();
- struct.setDbIsSet(true);
- }
- if (incoming.get(2)) {
- struct.table = iprot.readString();
- struct.setTableIsSet(true);
- }
- }
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryGrantOption.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryGrantOption.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryGrantOption.java
deleted file mode 100644
index 856ac21..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryGrantOption.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- * Autogenerated by Thrift Compiler (0.9.0)
- *
- * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
- * @generated
- */
-package org.apache.sentry.provider.db.service.thrift;
-
-
-import java.util.Map;
-import java.util.HashMap;
-import org.apache.thrift.TEnum;
-
-public enum TSentryGrantOption implements org.apache.thrift.TEnum {
- TRUE(1),
- FALSE(0),
- UNSET(-1);
-
- private final int value;
-
- private TSentryGrantOption(int value) {
- this.value = value;
- }
-
- /**
- * Get the integer value of this enum value, as defined in the Thrift IDL.
- */
- public int getValue() {
- return value;
- }
-
- /**
- * Find a the enum type by its integer value, as defined in the Thrift IDL.
- * @return null if the value is not found.
- */
- public static TSentryGrantOption findByValue(int value) {
- switch (value) {
- case 1:
- return TRUE;
- case 0:
- return FALSE;
- case -1:
- return UNSET;
- default:
- return null;
- }
- }
-}
[22/25] SENTRY-432. HDFS ingration. Initial patch
Posted by pr...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/SentryPolicyService.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/SentryPolicyService.java b/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/SentryPolicyService.java
deleted file mode 100644
index 8a006aa..0000000
--- a/sentry-provider/sentry-provider-db/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/SentryPolicyService.java
+++ /dev/null
@@ -1,8966 +0,0 @@
-/**
- * Autogenerated by Thrift Compiler (0.9.0)
- *
- * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
- * @generated
- */
-package org.apache.sentry.provider.db.service.thrift;
-
-import org.apache.commons.lang.builder.HashCodeBuilder;
-import org.apache.thrift.scheme.IScheme;
-import org.apache.thrift.scheme.SchemeFactory;
-import org.apache.thrift.scheme.StandardScheme;
-
-import org.apache.thrift.scheme.TupleScheme;
-import org.apache.thrift.protocol.TTupleProtocol;
-import org.apache.thrift.protocol.TProtocolException;
-import org.apache.thrift.EncodingUtils;
-import org.apache.thrift.TException;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.EnumMap;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.EnumSet;
-import java.util.Collections;
-import java.util.BitSet;
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class SentryPolicyService {
-
- public interface Iface {
-
- public TCreateSentryRoleResponse create_sentry_role(TCreateSentryRoleRequest request) throws org.apache.thrift.TException;
-
- public TDropSentryRoleResponse drop_sentry_role(TDropSentryRoleRequest request) throws org.apache.thrift.TException;
-
- public TAlterSentryRoleGrantPrivilegeResponse alter_sentry_role_grant_privilege(TAlterSentryRoleGrantPrivilegeRequest request) throws org.apache.thrift.TException;
-
- public TAlterSentryRoleRevokePrivilegeResponse alter_sentry_role_revoke_privilege(TAlterSentryRoleRevokePrivilegeRequest request) throws org.apache.thrift.TException;
-
- public TAlterSentryRoleAddGroupsResponse alter_sentry_role_add_groups(TAlterSentryRoleAddGroupsRequest request) throws org.apache.thrift.TException;
-
- public TAlterSentryRoleDeleteGroupsResponse alter_sentry_role_delete_groups(TAlterSentryRoleDeleteGroupsRequest request) throws org.apache.thrift.TException;
-
- public TListSentryRolesResponse list_sentry_roles_by_group(TListSentryRolesRequest request) throws org.apache.thrift.TException;
-
- public TListSentryPrivilegesResponse list_sentry_privileges_by_role(TListSentryPrivilegesRequest request) throws org.apache.thrift.TException;
-
- public TListSentryPrivilegesForProviderResponse list_sentry_privileges_for_provider(TListSentryPrivilegesForProviderRequest request) throws org.apache.thrift.TException;
-
- public TDropPrivilegesResponse drop_sentry_privilege(TDropPrivilegesRequest request) throws org.apache.thrift.TException;
-
- public TRenamePrivilegesResponse rename_sentry_privilege(TRenamePrivilegesRequest request) throws org.apache.thrift.TException;
-
- }
-
- public interface AsyncIface {
-
- public void create_sentry_role(TCreateSentryRoleRequest request, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.create_sentry_role_call> resultHandler) throws org.apache.thrift.TException;
-
- public void drop_sentry_role(TDropSentryRoleRequest request, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.drop_sentry_role_call> resultHandler) throws org.apache.thrift.TException;
-
- public void alter_sentry_role_grant_privilege(TAlterSentryRoleGrantPrivilegeRequest request, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.alter_sentry_role_grant_privilege_call> resultHandler) throws org.apache.thrift.TException;
-
- public void alter_sentry_role_revoke_privilege(TAlterSentryRoleRevokePrivilegeRequest request, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.alter_sentry_role_revoke_privilege_call> resultHandler) throws org.apache.thrift.TException;
-
- public void alter_sentry_role_add_groups(TAlterSentryRoleAddGroupsRequest request, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.alter_sentry_role_add_groups_call> resultHandler) throws org.apache.thrift.TException;
-
- public void alter_sentry_role_delete_groups(TAlterSentryRoleDeleteGroupsRequest request, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.alter_sentry_role_delete_groups_call> resultHandler) throws org.apache.thrift.TException;
-
- public void list_sentry_roles_by_group(TListSentryRolesRequest request, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.list_sentry_roles_by_group_call> resultHandler) throws org.apache.thrift.TException;
-
- public void list_sentry_privileges_by_role(TListSentryPrivilegesRequest request, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.list_sentry_privileges_by_role_call> resultHandler) throws org.apache.thrift.TException;
-
- public void list_sentry_privileges_for_provider(TListSentryPrivilegesForProviderRequest request, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.list_sentry_privileges_for_provider_call> resultHandler) throws org.apache.thrift.TException;
-
- public void drop_sentry_privilege(TDropPrivilegesRequest request, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.drop_sentry_privilege_call> resultHandler) throws org.apache.thrift.TException;
-
- public void rename_sentry_privilege(TRenamePrivilegesRequest request, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.rename_sentry_privilege_call> resultHandler) throws org.apache.thrift.TException;
-
- }
-
- public static class Client extends org.apache.thrift.TServiceClient implements Iface {
- public static class Factory implements org.apache.thrift.TServiceClientFactory<Client> {
- public Factory() {}
- public Client getClient(org.apache.thrift.protocol.TProtocol prot) {
- return new Client(prot);
- }
- public Client getClient(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) {
- return new Client(iprot, oprot);
- }
- }
-
- public Client(org.apache.thrift.protocol.TProtocol prot)
- {
- super(prot, prot);
- }
-
- public Client(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) {
- super(iprot, oprot);
- }
-
- public TCreateSentryRoleResponse create_sentry_role(TCreateSentryRoleRequest request) throws org.apache.thrift.TException
- {
- send_create_sentry_role(request);
- return recv_create_sentry_role();
- }
-
- public void send_create_sentry_role(TCreateSentryRoleRequest request) throws org.apache.thrift.TException
- {
- create_sentry_role_args args = new create_sentry_role_args();
- args.setRequest(request);
- sendBase("create_sentry_role", args);
- }
-
- public TCreateSentryRoleResponse recv_create_sentry_role() throws org.apache.thrift.TException
- {
- create_sentry_role_result result = new create_sentry_role_result();
- receiveBase(result, "create_sentry_role");
- if (result.isSetSuccess()) {
- return result.success;
- }
- throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "create_sentry_role failed: unknown result");
- }
-
- public TDropSentryRoleResponse drop_sentry_role(TDropSentryRoleRequest request) throws org.apache.thrift.TException
- {
- send_drop_sentry_role(request);
- return recv_drop_sentry_role();
- }
-
- public void send_drop_sentry_role(TDropSentryRoleRequest request) throws org.apache.thrift.TException
- {
- drop_sentry_role_args args = new drop_sentry_role_args();
- args.setRequest(request);
- sendBase("drop_sentry_role", args);
- }
-
- public TDropSentryRoleResponse recv_drop_sentry_role() throws org.apache.thrift.TException
- {
- drop_sentry_role_result result = new drop_sentry_role_result();
- receiveBase(result, "drop_sentry_role");
- if (result.isSetSuccess()) {
- return result.success;
- }
- throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "drop_sentry_role failed: unknown result");
- }
-
- public TAlterSentryRoleGrantPrivilegeResponse alter_sentry_role_grant_privilege(TAlterSentryRoleGrantPrivilegeRequest request) throws org.apache.thrift.TException
- {
- send_alter_sentry_role_grant_privilege(request);
- return recv_alter_sentry_role_grant_privilege();
- }
-
- public void send_alter_sentry_role_grant_privilege(TAlterSentryRoleGrantPrivilegeRequest request) throws org.apache.thrift.TException
- {
- alter_sentry_role_grant_privilege_args args = new alter_sentry_role_grant_privilege_args();
- args.setRequest(request);
- sendBase("alter_sentry_role_grant_privilege", args);
- }
-
- public TAlterSentryRoleGrantPrivilegeResponse recv_alter_sentry_role_grant_privilege() throws org.apache.thrift.TException
- {
- alter_sentry_role_grant_privilege_result result = new alter_sentry_role_grant_privilege_result();
- receiveBase(result, "alter_sentry_role_grant_privilege");
- if (result.isSetSuccess()) {
- return result.success;
- }
- throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "alter_sentry_role_grant_privilege failed: unknown result");
- }
-
- public TAlterSentryRoleRevokePrivilegeResponse alter_sentry_role_revoke_privilege(TAlterSentryRoleRevokePrivilegeRequest request) throws org.apache.thrift.TException
- {
- send_alter_sentry_role_revoke_privilege(request);
- return recv_alter_sentry_role_revoke_privilege();
- }
-
- public void send_alter_sentry_role_revoke_privilege(TAlterSentryRoleRevokePrivilegeRequest request) throws org.apache.thrift.TException
- {
- alter_sentry_role_revoke_privilege_args args = new alter_sentry_role_revoke_privilege_args();
- args.setRequest(request);
- sendBase("alter_sentry_role_revoke_privilege", args);
- }
-
- public TAlterSentryRoleRevokePrivilegeResponse recv_alter_sentry_role_revoke_privilege() throws org.apache.thrift.TException
- {
- alter_sentry_role_revoke_privilege_result result = new alter_sentry_role_revoke_privilege_result();
- receiveBase(result, "alter_sentry_role_revoke_privilege");
- if (result.isSetSuccess()) {
- return result.success;
- }
- throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "alter_sentry_role_revoke_privilege failed: unknown result");
- }
-
- public TAlterSentryRoleAddGroupsResponse alter_sentry_role_add_groups(TAlterSentryRoleAddGroupsRequest request) throws org.apache.thrift.TException
- {
- send_alter_sentry_role_add_groups(request);
- return recv_alter_sentry_role_add_groups();
- }
-
- public void send_alter_sentry_role_add_groups(TAlterSentryRoleAddGroupsRequest request) throws org.apache.thrift.TException
- {
- alter_sentry_role_add_groups_args args = new alter_sentry_role_add_groups_args();
- args.setRequest(request);
- sendBase("alter_sentry_role_add_groups", args);
- }
-
- public TAlterSentryRoleAddGroupsResponse recv_alter_sentry_role_add_groups() throws org.apache.thrift.TException
- {
- alter_sentry_role_add_groups_result result = new alter_sentry_role_add_groups_result();
- receiveBase(result, "alter_sentry_role_add_groups");
- if (result.isSetSuccess()) {
- return result.success;
- }
- throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "alter_sentry_role_add_groups failed: unknown result");
- }
-
- public TAlterSentryRoleDeleteGroupsResponse alter_sentry_role_delete_groups(TAlterSentryRoleDeleteGroupsRequest request) throws org.apache.thrift.TException
- {
- send_alter_sentry_role_delete_groups(request);
- return recv_alter_sentry_role_delete_groups();
- }
-
- public void send_alter_sentry_role_delete_groups(TAlterSentryRoleDeleteGroupsRequest request) throws org.apache.thrift.TException
- {
- alter_sentry_role_delete_groups_args args = new alter_sentry_role_delete_groups_args();
- args.setRequest(request);
- sendBase("alter_sentry_role_delete_groups", args);
- }
-
- public TAlterSentryRoleDeleteGroupsResponse recv_alter_sentry_role_delete_groups() throws org.apache.thrift.TException
- {
- alter_sentry_role_delete_groups_result result = new alter_sentry_role_delete_groups_result();
- receiveBase(result, "alter_sentry_role_delete_groups");
- if (result.isSetSuccess()) {
- return result.success;
- }
- throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "alter_sentry_role_delete_groups failed: unknown result");
- }
-
- public TListSentryRolesResponse list_sentry_roles_by_group(TListSentryRolesRequest request) throws org.apache.thrift.TException
- {
- send_list_sentry_roles_by_group(request);
- return recv_list_sentry_roles_by_group();
- }
-
- public void send_list_sentry_roles_by_group(TListSentryRolesRequest request) throws org.apache.thrift.TException
- {
- list_sentry_roles_by_group_args args = new list_sentry_roles_by_group_args();
- args.setRequest(request);
- sendBase("list_sentry_roles_by_group", args);
- }
-
- public TListSentryRolesResponse recv_list_sentry_roles_by_group() throws org.apache.thrift.TException
- {
- list_sentry_roles_by_group_result result = new list_sentry_roles_by_group_result();
- receiveBase(result, "list_sentry_roles_by_group");
- if (result.isSetSuccess()) {
- return result.success;
- }
- throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "list_sentry_roles_by_group failed: unknown result");
- }
-
- public TListSentryPrivilegesResponse list_sentry_privileges_by_role(TListSentryPrivilegesRequest request) throws org.apache.thrift.TException
- {
- send_list_sentry_privileges_by_role(request);
- return recv_list_sentry_privileges_by_role();
- }
-
- public void send_list_sentry_privileges_by_role(TListSentryPrivilegesRequest request) throws org.apache.thrift.TException
- {
- list_sentry_privileges_by_role_args args = new list_sentry_privileges_by_role_args();
- args.setRequest(request);
- sendBase("list_sentry_privileges_by_role", args);
- }
-
- public TListSentryPrivilegesResponse recv_list_sentry_privileges_by_role() throws org.apache.thrift.TException
- {
- list_sentry_privileges_by_role_result result = new list_sentry_privileges_by_role_result();
- receiveBase(result, "list_sentry_privileges_by_role");
- if (result.isSetSuccess()) {
- return result.success;
- }
- throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "list_sentry_privileges_by_role failed: unknown result");
- }
-
- public TListSentryPrivilegesForProviderResponse list_sentry_privileges_for_provider(TListSentryPrivilegesForProviderRequest request) throws org.apache.thrift.TException
- {
- send_list_sentry_privileges_for_provider(request);
- return recv_list_sentry_privileges_for_provider();
- }
-
- public void send_list_sentry_privileges_for_provider(TListSentryPrivilegesForProviderRequest request) throws org.apache.thrift.TException
- {
- list_sentry_privileges_for_provider_args args = new list_sentry_privileges_for_provider_args();
- args.setRequest(request);
- sendBase("list_sentry_privileges_for_provider", args);
- }
-
- public TListSentryPrivilegesForProviderResponse recv_list_sentry_privileges_for_provider() throws org.apache.thrift.TException
- {
- list_sentry_privileges_for_provider_result result = new list_sentry_privileges_for_provider_result();
- receiveBase(result, "list_sentry_privileges_for_provider");
- if (result.isSetSuccess()) {
- return result.success;
- }
- throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "list_sentry_privileges_for_provider failed: unknown result");
- }
-
- public TDropPrivilegesResponse drop_sentry_privilege(TDropPrivilegesRequest request) throws org.apache.thrift.TException
- {
- send_drop_sentry_privilege(request);
- return recv_drop_sentry_privilege();
- }
-
- public void send_drop_sentry_privilege(TDropPrivilegesRequest request) throws org.apache.thrift.TException
- {
- drop_sentry_privilege_args args = new drop_sentry_privilege_args();
- args.setRequest(request);
- sendBase("drop_sentry_privilege", args);
- }
-
- public TDropPrivilegesResponse recv_drop_sentry_privilege() throws org.apache.thrift.TException
- {
- drop_sentry_privilege_result result = new drop_sentry_privilege_result();
- receiveBase(result, "drop_sentry_privilege");
- if (result.isSetSuccess()) {
- return result.success;
- }
- throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "drop_sentry_privilege failed: unknown result");
- }
-
- public TRenamePrivilegesResponse rename_sentry_privilege(TRenamePrivilegesRequest request) throws org.apache.thrift.TException
- {
- send_rename_sentry_privilege(request);
- return recv_rename_sentry_privilege();
- }
-
- public void send_rename_sentry_privilege(TRenamePrivilegesRequest request) throws org.apache.thrift.TException
- {
- rename_sentry_privilege_args args = new rename_sentry_privilege_args();
- args.setRequest(request);
- sendBase("rename_sentry_privilege", args);
- }
-
- public TRenamePrivilegesResponse recv_rename_sentry_privilege() throws org.apache.thrift.TException
- {
- rename_sentry_privilege_result result = new rename_sentry_privilege_result();
- receiveBase(result, "rename_sentry_privilege");
- if (result.isSetSuccess()) {
- return result.success;
- }
- throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "rename_sentry_privilege failed: unknown result");
- }
-
- }
- public static class AsyncClient extends org.apache.thrift.async.TAsyncClient implements AsyncIface {
- public static class Factory implements org.apache.thrift.async.TAsyncClientFactory<AsyncClient> {
- private org.apache.thrift.async.TAsyncClientManager clientManager;
- private org.apache.thrift.protocol.TProtocolFactory protocolFactory;
- public Factory(org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.protocol.TProtocolFactory protocolFactory) {
- this.clientManager = clientManager;
- this.protocolFactory = protocolFactory;
- }
- public AsyncClient getAsyncClient(org.apache.thrift.transport.TNonblockingTransport transport) {
- return new AsyncClient(protocolFactory, clientManager, transport);
- }
- }
-
- public AsyncClient(org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.transport.TNonblockingTransport transport) {
- super(protocolFactory, clientManager, transport);
- }
-
- public void create_sentry_role(TCreateSentryRoleRequest request, org.apache.thrift.async.AsyncMethodCallback<create_sentry_role_call> resultHandler) throws org.apache.thrift.TException {
- checkReady();
- create_sentry_role_call method_call = new create_sentry_role_call(request, resultHandler, this, ___protocolFactory, ___transport);
- this.___currentMethod = method_call;
- ___manager.call(method_call);
- }
-
- public static class create_sentry_role_call extends org.apache.thrift.async.TAsyncMethodCall {
- private TCreateSentryRoleRequest request;
- public create_sentry_role_call(TCreateSentryRoleRequest request, org.apache.thrift.async.AsyncMethodCallback<create_sentry_role_call> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
- super(client, protocolFactory, transport, resultHandler, false);
- this.request = request;
- }
-
- public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
- prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("create_sentry_role", org.apache.thrift.protocol.TMessageType.CALL, 0));
- create_sentry_role_args args = new create_sentry_role_args();
- args.setRequest(request);
- args.write(prot);
- prot.writeMessageEnd();
- }
-
- public TCreateSentryRoleResponse getResult() throws org.apache.thrift.TException {
- if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
- throw new IllegalStateException("Method call not finished!");
- }
- org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
- org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
- return (new Client(prot)).recv_create_sentry_role();
- }
- }
-
- public void drop_sentry_role(TDropSentryRoleRequest request, org.apache.thrift.async.AsyncMethodCallback<drop_sentry_role_call> resultHandler) throws org.apache.thrift.TException {
- checkReady();
- drop_sentry_role_call method_call = new drop_sentry_role_call(request, resultHandler, this, ___protocolFactory, ___transport);
- this.___currentMethod = method_call;
- ___manager.call(method_call);
- }
-
- public static class drop_sentry_role_call extends org.apache.thrift.async.TAsyncMethodCall {
- private TDropSentryRoleRequest request;
- public drop_sentry_role_call(TDropSentryRoleRequest request, org.apache.thrift.async.AsyncMethodCallback<drop_sentry_role_call> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
- super(client, protocolFactory, transport, resultHandler, false);
- this.request = request;
- }
-
- public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
- prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("drop_sentry_role", org.apache.thrift.protocol.TMessageType.CALL, 0));
- drop_sentry_role_args args = new drop_sentry_role_args();
- args.setRequest(request);
- args.write(prot);
- prot.writeMessageEnd();
- }
-
- public TDropSentryRoleResponse getResult() throws org.apache.thrift.TException {
- if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
- throw new IllegalStateException("Method call not finished!");
- }
- org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
- org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
- return (new Client(prot)).recv_drop_sentry_role();
- }
- }
-
- public void alter_sentry_role_grant_privilege(TAlterSentryRoleGrantPrivilegeRequest request, org.apache.thrift.async.AsyncMethodCallback<alter_sentry_role_grant_privilege_call> resultHandler) throws org.apache.thrift.TException {
- checkReady();
- alter_sentry_role_grant_privilege_call method_call = new alter_sentry_role_grant_privilege_call(request, resultHandler, this, ___protocolFactory, ___transport);
- this.___currentMethod = method_call;
- ___manager.call(method_call);
- }
-
- public static class alter_sentry_role_grant_privilege_call extends org.apache.thrift.async.TAsyncMethodCall {
- private TAlterSentryRoleGrantPrivilegeRequest request;
- public alter_sentry_role_grant_privilege_call(TAlterSentryRoleGrantPrivilegeRequest request, org.apache.thrift.async.AsyncMethodCallback<alter_sentry_role_grant_privilege_call> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
- super(client, protocolFactory, transport, resultHandler, false);
- this.request = request;
- }
-
- public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
- prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("alter_sentry_role_grant_privilege", org.apache.thrift.protocol.TMessageType.CALL, 0));
- alter_sentry_role_grant_privilege_args args = new alter_sentry_role_grant_privilege_args();
- args.setRequest(request);
- args.write(prot);
- prot.writeMessageEnd();
- }
-
- public TAlterSentryRoleGrantPrivilegeResponse getResult() throws org.apache.thrift.TException {
- if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
- throw new IllegalStateException("Method call not finished!");
- }
- org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
- org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
- return (new Client(prot)).recv_alter_sentry_role_grant_privilege();
- }
- }
-
- public void alter_sentry_role_revoke_privilege(TAlterSentryRoleRevokePrivilegeRequest request, org.apache.thrift.async.AsyncMethodCallback<alter_sentry_role_revoke_privilege_call> resultHandler) throws org.apache.thrift.TException {
- checkReady();
- alter_sentry_role_revoke_privilege_call method_call = new alter_sentry_role_revoke_privilege_call(request, resultHandler, this, ___protocolFactory, ___transport);
- this.___currentMethod = method_call;
- ___manager.call(method_call);
- }
-
- public static class alter_sentry_role_revoke_privilege_call extends org.apache.thrift.async.TAsyncMethodCall {
- private TAlterSentryRoleRevokePrivilegeRequest request;
- public alter_sentry_role_revoke_privilege_call(TAlterSentryRoleRevokePrivilegeRequest request, org.apache.thrift.async.AsyncMethodCallback<alter_sentry_role_revoke_privilege_call> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
- super(client, protocolFactory, transport, resultHandler, false);
- this.request = request;
- }
-
- public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
- prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("alter_sentry_role_revoke_privilege", org.apache.thrift.protocol.TMessageType.CALL, 0));
- alter_sentry_role_revoke_privilege_args args = new alter_sentry_role_revoke_privilege_args();
- args.setRequest(request);
- args.write(prot);
- prot.writeMessageEnd();
- }
-
- public TAlterSentryRoleRevokePrivilegeResponse getResult() throws org.apache.thrift.TException {
- if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
- throw new IllegalStateException("Method call not finished!");
- }
- org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
- org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
- return (new Client(prot)).recv_alter_sentry_role_revoke_privilege();
- }
- }
-
- public void alter_sentry_role_add_groups(TAlterSentryRoleAddGroupsRequest request, org.apache.thrift.async.AsyncMethodCallback<alter_sentry_role_add_groups_call> resultHandler) throws org.apache.thrift.TException {
- checkReady();
- alter_sentry_role_add_groups_call method_call = new alter_sentry_role_add_groups_call(request, resultHandler, this, ___protocolFactory, ___transport);
- this.___currentMethod = method_call;
- ___manager.call(method_call);
- }
-
- public static class alter_sentry_role_add_groups_call extends org.apache.thrift.async.TAsyncMethodCall {
- private TAlterSentryRoleAddGroupsRequest request;
- public alter_sentry_role_add_groups_call(TAlterSentryRoleAddGroupsRequest request, org.apache.thrift.async.AsyncMethodCallback<alter_sentry_role_add_groups_call> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
- super(client, protocolFactory, transport, resultHandler, false);
- this.request = request;
- }
-
- public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
- prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("alter_sentry_role_add_groups", org.apache.thrift.protocol.TMessageType.CALL, 0));
- alter_sentry_role_add_groups_args args = new alter_sentry_role_add_groups_args();
- args.setRequest(request);
- args.write(prot);
- prot.writeMessageEnd();
- }
-
- public TAlterSentryRoleAddGroupsResponse getResult() throws org.apache.thrift.TException {
- if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
- throw new IllegalStateException("Method call not finished!");
- }
- org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
- org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
- return (new Client(prot)).recv_alter_sentry_role_add_groups();
- }
- }
-
- public void alter_sentry_role_delete_groups(TAlterSentryRoleDeleteGroupsRequest request, org.apache.thrift.async.AsyncMethodCallback<alter_sentry_role_delete_groups_call> resultHandler) throws org.apache.thrift.TException {
- checkReady();
- alter_sentry_role_delete_groups_call method_call = new alter_sentry_role_delete_groups_call(request, resultHandler, this, ___protocolFactory, ___transport);
- this.___currentMethod = method_call;
- ___manager.call(method_call);
- }
-
- public static class alter_sentry_role_delete_groups_call extends org.apache.thrift.async.TAsyncMethodCall {
- private TAlterSentryRoleDeleteGroupsRequest request;
- public alter_sentry_role_delete_groups_call(TAlterSentryRoleDeleteGroupsRequest request, org.apache.thrift.async.AsyncMethodCallback<alter_sentry_role_delete_groups_call> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
- super(client, protocolFactory, transport, resultHandler, false);
- this.request = request;
- }
-
- public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
- prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("alter_sentry_role_delete_groups", org.apache.thrift.protocol.TMessageType.CALL, 0));
- alter_sentry_role_delete_groups_args args = new alter_sentry_role_delete_groups_args();
- args.setRequest(request);
- args.write(prot);
- prot.writeMessageEnd();
- }
-
- public TAlterSentryRoleDeleteGroupsResponse getResult() throws org.apache.thrift.TException {
- if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
- throw new IllegalStateException("Method call not finished!");
- }
- org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
- org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
- return (new Client(prot)).recv_alter_sentry_role_delete_groups();
- }
- }
-
- public void list_sentry_roles_by_group(TListSentryRolesRequest request, org.apache.thrift.async.AsyncMethodCallback<list_sentry_roles_by_group_call> resultHandler) throws org.apache.thrift.TException {
- checkReady();
- list_sentry_roles_by_group_call method_call = new list_sentry_roles_by_group_call(request, resultHandler, this, ___protocolFactory, ___transport);
- this.___currentMethod = method_call;
- ___manager.call(method_call);
- }
-
- public static class list_sentry_roles_by_group_call extends org.apache.thrift.async.TAsyncMethodCall {
- private TListSentryRolesRequest request;
- public list_sentry_roles_by_group_call(TListSentryRolesRequest request, org.apache.thrift.async.AsyncMethodCallback<list_sentry_roles_by_group_call> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
- super(client, protocolFactory, transport, resultHandler, false);
- this.request = request;
- }
-
- public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
- prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("list_sentry_roles_by_group", org.apache.thrift.protocol.TMessageType.CALL, 0));
- list_sentry_roles_by_group_args args = new list_sentry_roles_by_group_args();
- args.setRequest(request);
- args.write(prot);
- prot.writeMessageEnd();
- }
-
- public TListSentryRolesResponse getResult() throws org.apache.thrift.TException {
- if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
- throw new IllegalStateException("Method call not finished!");
- }
- org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
- org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
- return (new Client(prot)).recv_list_sentry_roles_by_group();
- }
- }
-
- public void list_sentry_privileges_by_role(TListSentryPrivilegesRequest request, org.apache.thrift.async.AsyncMethodCallback<list_sentry_privileges_by_role_call> resultHandler) throws org.apache.thrift.TException {
- checkReady();
- list_sentry_privileges_by_role_call method_call = new list_sentry_privileges_by_role_call(request, resultHandler, this, ___protocolFactory, ___transport);
- this.___currentMethod = method_call;
- ___manager.call(method_call);
- }
-
- public static class list_sentry_privileges_by_role_call extends org.apache.thrift.async.TAsyncMethodCall {
- private TListSentryPrivilegesRequest request;
- public list_sentry_privileges_by_role_call(TListSentryPrivilegesRequest request, org.apache.thrift.async.AsyncMethodCallback<list_sentry_privileges_by_role_call> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
- super(client, protocolFactory, transport, resultHandler, false);
- this.request = request;
- }
-
- public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
- prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("list_sentry_privileges_by_role", org.apache.thrift.protocol.TMessageType.CALL, 0));
- list_sentry_privileges_by_role_args args = new list_sentry_privileges_by_role_args();
- args.setRequest(request);
- args.write(prot);
- prot.writeMessageEnd();
- }
-
- public TListSentryPrivilegesResponse getResult() throws org.apache.thrift.TException {
- if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
- throw new IllegalStateException("Method call not finished!");
- }
- org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
- org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
- return (new Client(prot)).recv_list_sentry_privileges_by_role();
- }
- }
-
- public void list_sentry_privileges_for_provider(TListSentryPrivilegesForProviderRequest request, org.apache.thrift.async.AsyncMethodCallback<list_sentry_privileges_for_provider_call> resultHandler) throws org.apache.thrift.TException {
- checkReady();
- list_sentry_privileges_for_provider_call method_call = new list_sentry_privileges_for_provider_call(request, resultHandler, this, ___protocolFactory, ___transport);
- this.___currentMethod = method_call;
- ___manager.call(method_call);
- }
-
- public static class list_sentry_privileges_for_provider_call extends org.apache.thrift.async.TAsyncMethodCall {
- private TListSentryPrivilegesForProviderRequest request;
- public list_sentry_privileges_for_provider_call(TListSentryPrivilegesForProviderRequest request, org.apache.thrift.async.AsyncMethodCallback<list_sentry_privileges_for_provider_call> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
- super(client, protocolFactory, transport, resultHandler, false);
- this.request = request;
- }
-
- public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
- prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("list_sentry_privileges_for_provider", org.apache.thrift.protocol.TMessageType.CALL, 0));
- list_sentry_privileges_for_provider_args args = new list_sentry_privileges_for_provider_args();
- args.setRequest(request);
- args.write(prot);
- prot.writeMessageEnd();
- }
-
- public TListSentryPrivilegesForProviderResponse getResult() throws org.apache.thrift.TException {
- if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
- throw new IllegalStateException("Method call not finished!");
- }
- org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
- org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
- return (new Client(prot)).recv_list_sentry_privileges_for_provider();
- }
- }
-
- public void drop_sentry_privilege(TDropPrivilegesRequest request, org.apache.thrift.async.AsyncMethodCallback<drop_sentry_privilege_call> resultHandler) throws org.apache.thrift.TException {
- checkReady();
- drop_sentry_privilege_call method_call = new drop_sentry_privilege_call(request, resultHandler, this, ___protocolFactory, ___transport);
- this.___currentMethod = method_call;
- ___manager.call(method_call);
- }
-
- public static class drop_sentry_privilege_call extends org.apache.thrift.async.TAsyncMethodCall {
- private TDropPrivilegesRequest request;
- public drop_sentry_privilege_call(TDropPrivilegesRequest request, org.apache.thrift.async.AsyncMethodCallback<drop_sentry_privilege_call> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
- super(client, protocolFactory, transport, resultHandler, false);
- this.request = request;
- }
-
- public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
- prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("drop_sentry_privilege", org.apache.thrift.protocol.TMessageType.CALL, 0));
- drop_sentry_privilege_args args = new drop_sentry_privilege_args();
- args.setRequest(request);
- args.write(prot);
- prot.writeMessageEnd();
- }
-
- public TDropPrivilegesResponse getResult() throws org.apache.thrift.TException {
- if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
- throw new IllegalStateException("Method call not finished!");
- }
- org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
- org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
- return (new Client(prot)).recv_drop_sentry_privilege();
- }
- }
-
- public void rename_sentry_privilege(TRenamePrivilegesRequest request, org.apache.thrift.async.AsyncMethodCallback<rename_sentry_privilege_call> resultHandler) throws org.apache.thrift.TException {
- checkReady();
- rename_sentry_privilege_call method_call = new rename_sentry_privilege_call(request, resultHandler, this, ___protocolFactory, ___transport);
- this.___currentMethod = method_call;
- ___manager.call(method_call);
- }
-
- public static class rename_sentry_privilege_call extends org.apache.thrift.async.TAsyncMethodCall {
- private TRenamePrivilegesRequest request;
- public rename_sentry_privilege_call(TRenamePrivilegesRequest request, org.apache.thrift.async.AsyncMethodCallback<rename_sentry_privilege_call> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
- super(client, protocolFactory, transport, resultHandler, false);
- this.request = request;
- }
-
- public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
- prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("rename_sentry_privilege", org.apache.thrift.protocol.TMessageType.CALL, 0));
- rename_sentry_privilege_args args = new rename_sentry_privilege_args();
- args.setRequest(request);
- args.write(prot);
- prot.writeMessageEnd();
- }
-
- public TRenamePrivilegesResponse getResult() throws org.apache.thrift.TException {
- if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
- throw new IllegalStateException("Method call not finished!");
- }
- org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
- org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
- return (new Client(prot)).recv_rename_sentry_privilege();
- }
- }
-
- }
-
- public static class Processor<I extends Iface> extends org.apache.thrift.TBaseProcessor<I> implements org.apache.thrift.TProcessor {
- private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName());
- public Processor(I iface) {
- super(iface, getProcessMap(new HashMap<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>>()));
- }
-
- protected Processor(I iface, Map<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>> processMap) {
- super(iface, getProcessMap(processMap));
- }
-
- private static <I extends Iface> Map<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>> getProcessMap(Map<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>> processMap) {
- processMap.put("create_sentry_role", new create_sentry_role());
- processMap.put("drop_sentry_role", new drop_sentry_role());
- processMap.put("alter_sentry_role_grant_privilege", new alter_sentry_role_grant_privilege());
- processMap.put("alter_sentry_role_revoke_privilege", new alter_sentry_role_revoke_privilege());
- processMap.put("alter_sentry_role_add_groups", new alter_sentry_role_add_groups());
- processMap.put("alter_sentry_role_delete_groups", new alter_sentry_role_delete_groups());
- processMap.put("list_sentry_roles_by_group", new list_sentry_roles_by_group());
- processMap.put("list_sentry_privileges_by_role", new list_sentry_privileges_by_role());
- processMap.put("list_sentry_privileges_for_provider", new list_sentry_privileges_for_provider());
- processMap.put("drop_sentry_privilege", new drop_sentry_privilege());
- processMap.put("rename_sentry_privilege", new rename_sentry_privilege());
- return processMap;
- }
-
- public static class create_sentry_role<I extends Iface> extends org.apache.thrift.ProcessFunction<I, create_sentry_role_args> {
- public create_sentry_role() {
- super("create_sentry_role");
- }
-
- public create_sentry_role_args getEmptyArgsInstance() {
- return new create_sentry_role_args();
- }
-
- protected boolean isOneway() {
- return false;
- }
-
- public create_sentry_role_result getResult(I iface, create_sentry_role_args args) throws org.apache.thrift.TException {
- create_sentry_role_result result = new create_sentry_role_result();
- result.success = iface.create_sentry_role(args.request);
- return result;
- }
- }
-
- public static class drop_sentry_role<I extends Iface> extends org.apache.thrift.ProcessFunction<I, drop_sentry_role_args> {
- public drop_sentry_role() {
- super("drop_sentry_role");
- }
-
- public drop_sentry_role_args getEmptyArgsInstance() {
- return new drop_sentry_role_args();
- }
-
- protected boolean isOneway() {
- return false;
- }
-
- public drop_sentry_role_result getResult(I iface, drop_sentry_role_args args) throws org.apache.thrift.TException {
- drop_sentry_role_result result = new drop_sentry_role_result();
- result.success = iface.drop_sentry_role(args.request);
- return result;
- }
- }
-
- public static class alter_sentry_role_grant_privilege<I extends Iface> extends org.apache.thrift.ProcessFunction<I, alter_sentry_role_grant_privilege_args> {
- public alter_sentry_role_grant_privilege() {
- super("alter_sentry_role_grant_privilege");
- }
-
- public alter_sentry_role_grant_privilege_args getEmptyArgsInstance() {
- return new alter_sentry_role_grant_privilege_args();
- }
-
- protected boolean isOneway() {
- return false;
- }
-
- public alter_sentry_role_grant_privilege_result getResult(I iface, alter_sentry_role_grant_privilege_args args) throws org.apache.thrift.TException {
- alter_sentry_role_grant_privilege_result result = new alter_sentry_role_grant_privilege_result();
- result.success = iface.alter_sentry_role_grant_privilege(args.request);
- return result;
- }
- }
-
- public static class alter_sentry_role_revoke_privilege<I extends Iface> extends org.apache.thrift.ProcessFunction<I, alter_sentry_role_revoke_privilege_args> {
- public alter_sentry_role_revoke_privilege() {
- super("alter_sentry_role_revoke_privilege");
- }
-
- public alter_sentry_role_revoke_privilege_args getEmptyArgsInstance() {
- return new alter_sentry_role_revoke_privilege_args();
- }
-
- protected boolean isOneway() {
- return false;
- }
-
- public alter_sentry_role_revoke_privilege_result getResult(I iface, alter_sentry_role_revoke_privilege_args args) throws org.apache.thrift.TException {
- alter_sentry_role_revoke_privilege_result result = new alter_sentry_role_revoke_privilege_result();
- result.success = iface.alter_sentry_role_revoke_privilege(args.request);
- return result;
- }
- }
-
- public static class alter_sentry_role_add_groups<I extends Iface> extends org.apache.thrift.ProcessFunction<I, alter_sentry_role_add_groups_args> {
- public alter_sentry_role_add_groups() {
- super("alter_sentry_role_add_groups");
- }
-
- public alter_sentry_role_add_groups_args getEmptyArgsInstance() {
- return new alter_sentry_role_add_groups_args();
- }
-
- protected boolean isOneway() {
- return false;
- }
-
- public alter_sentry_role_add_groups_result getResult(I iface, alter_sentry_role_add_groups_args args) throws org.apache.thrift.TException {
- alter_sentry_role_add_groups_result result = new alter_sentry_role_add_groups_result();
- result.success = iface.alter_sentry_role_add_groups(args.request);
- return result;
- }
- }
-
- public static class alter_sentry_role_delete_groups<I extends Iface> extends org.apache.thrift.ProcessFunction<I, alter_sentry_role_delete_groups_args> {
- public alter_sentry_role_delete_groups() {
- super("alter_sentry_role_delete_groups");
- }
-
- public alter_sentry_role_delete_groups_args getEmptyArgsInstance() {
- return new alter_sentry_role_delete_groups_args();
- }
-
- protected boolean isOneway() {
- return false;
- }
-
- public alter_sentry_role_delete_groups_result getResult(I iface, alter_sentry_role_delete_groups_args args) throws org.apache.thrift.TException {
- alter_sentry_role_delete_groups_result result = new alter_sentry_role_delete_groups_result();
- result.success = iface.alter_sentry_role_delete_groups(args.request);
- return result;
- }
- }
-
- public static class list_sentry_roles_by_group<I extends Iface> extends org.apache.thrift.ProcessFunction<I, list_sentry_roles_by_group_args> {
- public list_sentry_roles_by_group() {
- super("list_sentry_roles_by_group");
- }
-
- public list_sentry_roles_by_group_args getEmptyArgsInstance() {
- return new list_sentry_roles_by_group_args();
- }
-
- protected boolean isOneway() {
- return false;
- }
-
- public list_sentry_roles_by_group_result getResult(I iface, list_sentry_roles_by_group_args args) throws org.apache.thrift.TException {
- list_sentry_roles_by_group_result result = new list_sentry_roles_by_group_result();
- result.success = iface.list_sentry_roles_by_group(args.request);
- return result;
- }
- }
-
- public static class list_sentry_privileges_by_role<I extends Iface> extends org.apache.thrift.ProcessFunction<I, list_sentry_privileges_by_role_args> {
- public list_sentry_privileges_by_role() {
- super("list_sentry_privileges_by_role");
- }
-
- public list_sentry_privileges_by_role_args getEmptyArgsInstance() {
- return new list_sentry_privileges_by_role_args();
- }
-
- protected boolean isOneway() {
- return false;
- }
-
- public list_sentry_privileges_by_role_result getResult(I iface, list_sentry_privileges_by_role_args args) throws org.apache.thrift.TException {
- list_sentry_privileges_by_role_result result = new list_sentry_privileges_by_role_result();
- result.success = iface.list_sentry_privileges_by_role(args.request);
- return result;
- }
- }
-
- public static class list_sentry_privileges_for_provider<I extends Iface> extends org.apache.thrift.ProcessFunction<I, list_sentry_privileges_for_provider_args> {
- public list_sentry_privileges_for_provider() {
- super("list_sentry_privileges_for_provider");
- }
-
- public list_sentry_privileges_for_provider_args getEmptyArgsInstance() {
- return new list_sentry_privileges_for_provider_args();
- }
-
- protected boolean isOneway() {
- return false;
- }
-
- public list_sentry_privileges_for_provider_result getResult(I iface, list_sentry_privileges_for_provider_args args) throws org.apache.thrift.TException {
- list_sentry_privileges_for_provider_result result = new list_sentry_privileges_for_provider_result();
- result.success = iface.list_sentry_privileges_for_provider(args.request);
- return result;
- }
- }
-
- public static class drop_sentry_privilege<I extends Iface> extends org.apache.thrift.ProcessFunction<I, drop_sentry_privilege_args> {
- public drop_sentry_privilege() {
- super("drop_sentry_privilege");
- }
-
- public drop_sentry_privilege_args getEmptyArgsInstance() {
- return new drop_sentry_privilege_args();
- }
-
- protected boolean isOneway() {
- return false;
- }
-
- public drop_sentry_privilege_result getResult(I iface, drop_sentry_privilege_args args) throws org.apache.thrift.TException {
- drop_sentry_privilege_result result = new drop_sentry_privilege_result();
- result.success = iface.drop_sentry_privilege(args.request);
- return result;
- }
- }
-
- public static class rename_sentry_privilege<I extends Iface> extends org.apache.thrift.ProcessFunction<I, rename_sentry_privilege_args> {
- public rename_sentry_privilege() {
- super("rename_sentry_privilege");
- }
-
- public rename_sentry_privilege_args getEmptyArgsInstance() {
- return new rename_sentry_privilege_args();
- }
-
- protected boolean isOneway() {
- return false;
- }
-
- public rename_sentry_privilege_result getResult(I iface, rename_sentry_privilege_args args) throws org.apache.thrift.TException {
- rename_sentry_privilege_result result = new rename_sentry_privilege_result();
- result.success = iface.rename_sentry_privilege(args.request);
- return result;
- }
- }
-
- }
-
- public static class create_sentry_role_args implements org.apache.thrift.TBase<create_sentry_role_args, create_sentry_role_args._Fields>, java.io.Serializable, Cloneable {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("create_sentry_role_args");
-
- private static final org.apache.thrift.protocol.TField REQUEST_FIELD_DESC = new org.apache.thrift.protocol.TField("request", org.apache.thrift.protocol.TType.STRUCT, (short)1);
-
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new create_sentry_role_argsStandardSchemeFactory());
- schemes.put(TupleScheme.class, new create_sentry_role_argsTupleSchemeFactory());
- }
-
- private TCreateSentryRoleRequest request; // required
-
- /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
- public enum _Fields implements org.apache.thrift.TFieldIdEnum {
- REQUEST((short)1, "request");
-
- 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: // REQUEST
- return REQUEST;
- 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.REQUEST, new org.apache.thrift.meta_data.FieldMetaData("request", org.apache.thrift.TFieldRequirementType.DEFAULT,
- new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TCreateSentryRoleRequest.class)));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(create_sentry_role_args.class, metaDataMap);
- }
-
- public create_sentry_role_args() {
- }
-
- public create_sentry_role_args(
- TCreateSentryRoleRequest request)
- {
- this();
- this.request = request;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public create_sentry_role_args(create_sentry_role_args other) {
- if (other.isSetRequest()) {
- this.request = new TCreateSentryRoleRequest(other.request);
- }
- }
-
- public create_sentry_role_args deepCopy() {
- return new create_sentry_role_args(this);
- }
-
- @Override
- public void clear() {
- this.request = null;
- }
-
- public TCreateSentryRoleRequest getRequest() {
- return this.request;
- }
-
- public void setRequest(TCreateSentryRoleRequest request) {
- this.request = request;
- }
-
- public void unsetRequest() {
- this.request = null;
- }
-
- /** Returns true if field request is set (has been assigned a value) and false otherwise */
- public boolean isSetRequest() {
- return this.request != null;
- }
-
- public void setRequestIsSet(boolean value) {
- if (!value) {
- this.request = null;
- }
- }
-
- public void setFieldValue(_Fields field, Object value) {
- switch (field) {
- case REQUEST:
- if (value == null) {
- unsetRequest();
- } else {
- setRequest((TCreateSentryRoleRequest)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case REQUEST:
- return getRequest();
-
- }
- 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 REQUEST:
- return isSetRequest();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof create_sentry_role_args)
- return this.equals((create_sentry_role_args)that);
- return false;
- }
-
- public boolean equals(create_sentry_role_args that) {
- if (that == null)
- return false;
-
- boolean this_present_request = true && this.isSetRequest();
- boolean that_present_request = true && that.isSetRequest();
- if (this_present_request || that_present_request) {
- if (!(this_present_request && that_present_request))
- return false;
- if (!this.request.equals(that.request))
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode() {
- HashCodeBuilder builder = new HashCodeBuilder();
-
- boolean present_request = true && (isSetRequest());
- builder.append(present_request);
- if (present_request)
- builder.append(request);
-
- return builder.toHashCode();
- }
-
- public int compareTo(create_sentry_role_args other) {
- if (!getClass().equals(other.getClass())) {
- return getClass().getName().compareTo(other.getClass().getName());
- }
-
- int lastComparison = 0;
- create_sentry_role_args typedOther = (create_sentry_role_args)other;
-
- lastComparison = Boolean.valueOf(isSetRequest()).compareTo(typedOther.isSetRequest());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetRequest()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.request, typedOther.request);
- 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("create_sentry_role_args(");
- boolean first = true;
-
- sb.append("request:");
- if (this.request == null) {
- sb.append("null");
- } else {
- sb.append(this.request);
- }
- first = false;
- sb.append(")");
- return sb.toString();
- }
-
- public void validate() throws org.apache.thrift.TException {
- // check for required fields
- // check for sub-struct validity
- if (request != null) {
- request.validate();
- }
- }
-
- private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
- try {
- write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
- try {
- read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private static class create_sentry_role_argsStandardSchemeFactory implements SchemeFactory {
- public create_sentry_role_argsStandardScheme getScheme() {
- return new create_sentry_role_argsStandardScheme();
- }
- }
-
- private static class create_sentry_role_argsStandardScheme extends StandardScheme<create_sentry_role_args> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, create_sentry_role_args 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: // REQUEST
- if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
- struct.request = new TCreateSentryRoleRequest();
- struct.request.read(iprot);
- struct.setRequestIsSet(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, create_sentry_role_args struct) throws org.apache.thrift.TException {
- struct.validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- if (struct.request != null) {
- oprot.writeFieldBegin(REQUEST_FIELD_DESC);
- struct.request.write(oprot);
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class create_sentry_role_argsTupleSchemeFactory implements SchemeFactory {
- public create_sentry_role_argsTupleScheme getScheme() {
- return new create_sentry_role_argsTupleScheme();
- }
- }
-
- private static class create_sentry_role_argsTupleScheme extends TupleScheme<create_sentry_role_args> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, create_sentry_role_args struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- BitSet optionals = new BitSet();
- if (struct.isSetRequest()) {
- optionals.set(0);
- }
- oprot.writeBitSet(optionals, 1);
- if (struct.isSetRequest()) {
- struct.request.write(oprot);
- }
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, create_sentry_role_args struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- BitSet incoming = iprot.readBitSet(1);
- if (incoming.get(0)) {
- struct.request = new TCreateSentryRoleRequest();
- struct.request.read(iprot);
- struct.setRequestIsSet(true);
- }
- }
- }
-
- }
-
- public static class create_sentry_role_result implements org.apache.thrift.TBase<create_sentry_role_result, create_sentry_role_result._Fields>, java.io.Serializable, Cloneable {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("create_sentry_role_result");
-
- private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRUCT, (short)0);
-
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new create_sentry_role_resultStandardSchemeFactory());
- schemes.put(TupleScheme.class, new create_sentry_role_resultTupleSchemeFactory());
- }
-
- private TCreateSentryRoleResponse success; // required
-
- /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
- public enum _Fields implements org.apache.thrift.TFieldIdEnum {
- SUCCESS((short)0, "success");
-
- 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 0: // SUCCESS
- return SUCCESS;
- 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.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT,
- new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TCreateSentryRoleResponse.class)));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(create_sentry_role_result.class, metaDataMap);
- }
-
- public create_sentry_role_result() {
- }
-
- public create_sentry_role_result(
- TCreateSentryRoleResponse success)
- {
- this();
- this.success = success;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public create_sentry_role_result(create_sentry_role_result other) {
- if (other.isSetSuccess()) {
- this.success = new TCreateSentryRoleResponse(other.success);
- }
- }
-
- public create_sentry_role_result deepCopy() {
- return new create_sentry_role_result(this);
- }
-
- @Override
- public void clear() {
- this.success = null;
- }
-
- public TCreateSentryRoleResponse getSuccess() {
- return this.success;
- }
-
- public void setSuccess(TCreateSentryRoleResponse success) {
- this.success = success;
- }
-
- public void unsetSuccess() {
- this.success = null;
- }
-
- /** Returns true if field success is set (has been assigned a value) and false otherwise */
- public boolean isSetSuccess() {
- return this.success != null;
- }
-
- public void setSuccessIsSet(boolean value) {
- if (!value) {
- this.success = null;
- }
- }
-
- public void setFieldValue(_Fields field, Object value) {
- switch (field) {
- case SUCCESS:
- if (value == null) {
- unsetSuccess();
- } else {
- setSuccess((TCreateSentryRoleResponse)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case SUCCESS:
- return getSuccess();
-
- }
- 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 SUCCESS:
- return isSetSuccess();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof create_sentry_role_result)
- return this.equals((create_sentry_role_result)that);
- return false;
- }
-
- public boolean equals(create_sentry_role_result that) {
- if (that == null)
- return false;
-
- boolean this_present_success = true && this.isSetSuccess();
- boolean that_present_success = true && that.isSetSuccess();
- if (this_present_success || that_present_success) {
- if (!(this_present_success && that_present_success))
- return false;
- if (!this.success.equals(that.success))
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode() {
- HashCodeBuilder builder = new HashCodeBuilder();
-
- boolean present_success = true && (isSetSuccess());
- builder.append(present_success);
- if (present_success)
- builder.append(success);
-
- return builder.toHashCode();
- }
-
- public int compareTo(create_sentry_role_result other) {
- if (!getClass().equals(other.getClass())) {
- return getClass().getName().compareTo(other.getClass().getName());
- }
-
- int lastComparison = 0;
- create_sentry_role_result typedOther = (create_sentry_role_result)other;
-
- lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetSuccess()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, typedOther.success);
- 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("create_sentry_role_result(");
- boolean first = true;
-
- sb.append("success:");
- if (this.success == null) {
- sb.append("null");
- } else {
- sb.append(this.success);
- }
- first = false;
- sb.append(")");
- return sb.toString();
- }
-
- public void validate() throws org.apache.thrift.TException {
- // check for required fields
- // check for sub-struct validity
- if (success != null) {
- success.validate();
- }
- }
-
- private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
- try {
- write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
- try {
- read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private static class create_sentry_role_resultStandardSchemeFactory implements SchemeFactory {
- public create_sentry_role_resultStandardScheme getScheme() {
- return new create_sentry_role_resultStandardScheme();
- }
- }
-
- private static class create_sentry_role_resultStandardScheme extends StandardScheme<create_sentry_role_result> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, create_sentry_role_result 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 0: // SUCCESS
- if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
- struct.success = new TCreateSentryRoleResponse();
- struct.success.read(iprot);
- struct.setSuccessIsSet(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, create_sentry_role_result struct) throws org.apache.thrift.TException {
- struct.validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- if (struct.success != null) {
- oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
- struct.success.write(oprot);
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class create_sentry_role_resultTupleSchemeFactory implements SchemeFactory {
- public create_sentry_role_resultTupleScheme getScheme() {
- return new create_sentry_role_resultTupleScheme();
- }
- }
-
- private static class create_sentry_role_resultTupleScheme extends TupleScheme<create_sentry_role_result> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, create_sentry_role_result struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- BitSet optionals = new BitSet();
- if (struct.isSetSuccess()) {
- optionals.set(0);
- }
- oprot.writeBitSet(optionals, 1);
- if (struct.isSetSuccess()) {
- struct.success.write(oprot);
- }
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, create_sentry_role_result struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- BitSet incoming = iprot.readBitSet(1);
- if (incoming.get(0)) {
- struct.success = new TCreateSentryRoleResponse();
- struct.success.read(iprot);
- struct.setSuccessIsSet(true);
- }
- }
- }
-
- }
-
- public static class drop_sentry_role_args implements org.apache.thrift.TBase<drop_sentry_role_args, drop_sentry_role_args._Fields>, java.io.Serializable, Cloneable {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("drop_sentry_role_args");
-
- private static final org.apache.thrift.protocol.TField REQUEST_FIELD_DESC = new org.apache.thrift.protocol.TField("request", org.apache.thrift.protocol.TType.STRUCT, (short)1);
-
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new drop_sentry_role_argsStandardSchemeFactory());
- schemes.put(TupleScheme.class, new drop_sentry_role_argsTupleSchemeFactory());
- }
-
- private TDropSentryRoleRequest request; // required
-
- /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
- public enum _Fields implements org.apache.thrift.TFieldIdEnum {
- REQUEST((short)1, "request");
-
- 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: // REQUEST
- return REQUEST;
- 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.REQUEST, new org.apache.thrift.meta_data.FieldMetaData("request", org.apache.thrift.TFieldRequirementType.DEFAULT,
- new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TDropSentryRoleRequest.class)));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(drop_sentry_role_args.class, metaDataMap);
- }
-
- public drop_sentry_role_args() {
- }
-
- public drop_sentry_role_args(
- TDropSentryRoleRequest request)
- {
- this();
- this.request = request;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public drop_sentry_role_args(drop_sentry_role_args other) {
- if (other.isSetRequest()) {
- this.request = new TDropSentryRoleRequest(other.request);
- }
- }
-
- public drop_sentry_role_args deepCopy() {
- return new drop_sentry_role_args(this);
- }
-
- @Override
- public void clear() {
- this.request = null;
- }
-
- public TDropSentryRoleRequest getRequest() {
- return this.request;
- }
-
- public void setRequest(TDropSentryRoleRequest request) {
- this.request = request;
- }
-
- public void unsetRequest() {
- this.request = null;
- }
-
- /** Returns true if field request is set (has been assigned a value) and false otherwise */
- public boolean isSetRequest() {
- return this.request != null;
- }
-
- public void setRequestIsSet(boolean value) {
- if (!value) {
- this.request = null;
- }
- }
-
- public void setFieldValue(_Fields field, Object value) {
- switch (field) {
- case REQUEST:
- if (value == null) {
- unsetRequest();
- } else {
- setRequest((TDropSentryRoleRequest)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case REQUEST:
- return getRequest();
-
- }
- 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 REQUEST:
- return isSetRequest();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof drop_sentry_role_args)
- return this.equals((drop_sentry_role_args)that);
- return false;
- }
-
- public boolean equals(drop_sentry_role_args that) {
- if (that == null)
- return false;
-
- boolean this_present_request = true && this.isSetRequest();
- boolean that_present_request = true && that.isSetRequest();
- if (this_present_request || that_present_request) {
- if (!(this_present_request && that_present_request))
- return false;
- if (!this.request.equals(that.request))
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode() {
- HashCodeBuilder builder = new HashCodeBuilder();
-
- boolean present_request = true && (isSetRequest());
- builder.append(present_request);
- if (present_request)
- builder.append(request);
-
- return builder.toHashCode();
- }
-
- public int compareTo(drop_sentry_role_args other) {
- if (!getClass().equals(other.getClass())) {
- return getClass().getName().compareTo(other.getClass().getName());
- }
-
- int lastComparison = 0;
- drop_sentry_role_args typedOther = (drop_sentry_role_args)other;
-
- lastComparison = Boolean.valueOf(isSetRequest()).compareTo(typedOther.isSetRequest());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetRequest()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.request, typedOther.request);
- 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("drop_sentry_role_args(");
- boolean first = true;
-
- sb.append("request:");
- if (this.request == null) {
- sb.append("null");
- } else {
- sb.append(this.request);
- }
- first = false;
- sb.append(")");
- return sb.toString();
- }
-
- public void validate() throws org.apache.thrift.TException {
- // check for required fields
- // check for sub-struct validity
- if (request != null) {
- request.validate();
- }
- }
-
- private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
- try {
- write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
- try {
- read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private static class drop_sentry_role_argsStandardSchemeFactory implements SchemeFactory {
- public drop_sentry_role_argsStandardScheme getScheme() {
- return new drop_sentry_role_argsStandardScheme();
- }
- }
-
- private static class drop_sentry_role_argsStandardScheme extends StandardScheme<drop_sentry_role_args> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, drop_sentry_role_args struct) throws org.apache.thrift.TE
<TRUNCATED>
[06/25] SENTRY-432. HDFS ingration. Initial patch
Posted by pr...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryRolesResponse.java
----------------------------------------------------------------------
diff --git a/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryRolesResponse.java b/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryRolesResponse.java
new file mode 100644
index 0000000..13f22ff
--- /dev/null
+++ b/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TListSentryRolesResponse.java
@@ -0,0 +1,554 @@
+/**
+ * Autogenerated by Thrift Compiler (0.9.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+package org.apache.sentry.provider.db.service.thrift;
+
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EnumMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.EnumSet;
+import java.util.Collections;
+import java.util.BitSet;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class TListSentryRolesResponse implements org.apache.thrift.TBase<TListSentryRolesResponse, TListSentryRolesResponse._Fields>, java.io.Serializable, Cloneable {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TListSentryRolesResponse");
+
+ private static final org.apache.thrift.protocol.TField STATUS_FIELD_DESC = new org.apache.thrift.protocol.TField("status", org.apache.thrift.protocol.TType.STRUCT, (short)1);
+ private static final org.apache.thrift.protocol.TField ROLES_FIELD_DESC = new org.apache.thrift.protocol.TField("roles", org.apache.thrift.protocol.TType.SET, (short)2);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new TListSentryRolesResponseStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new TListSentryRolesResponseTupleSchemeFactory());
+ }
+
+ private org.apache.sentry.service.thrift.TSentryResponseStatus status; // required
+ private Set<TSentryRole> roles; // 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 {
+ STATUS((short)1, "status"),
+ ROLES((short)2, "roles");
+
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+ static {
+ for (_Fields field : EnumSet.allOf(_Fields.class)) {
+ byName.put(field.getFieldName(), field);
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, or null if its not found.
+ */
+ public static _Fields findByThriftId(int fieldId) {
+ switch(fieldId) {
+ case 1: // STATUS
+ return STATUS;
+ case 2: // ROLES
+ return ROLES;
+ 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 _Fields optionals[] = {_Fields.ROLES};
+ public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+ static {
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+ tmpMap.put(_Fields.STATUS, new org.apache.thrift.meta_data.FieldMetaData("status", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.sentry.service.thrift.TSentryResponseStatus.class)));
+ tmpMap.put(_Fields.ROLES, new org.apache.thrift.meta_data.FieldMetaData("roles", org.apache.thrift.TFieldRequirementType.OPTIONAL,
+ 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, TSentryRole.class))));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TListSentryRolesResponse.class, metaDataMap);
+ }
+
+ public TListSentryRolesResponse() {
+ }
+
+ public TListSentryRolesResponse(
+ org.apache.sentry.service.thrift.TSentryResponseStatus status)
+ {
+ this();
+ this.status = status;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public TListSentryRolesResponse(TListSentryRolesResponse other) {
+ if (other.isSetStatus()) {
+ this.status = new org.apache.sentry.service.thrift.TSentryResponseStatus(other.status);
+ }
+ if (other.isSetRoles()) {
+ Set<TSentryRole> __this__roles = new HashSet<TSentryRole>();
+ for (TSentryRole other_element : other.roles) {
+ __this__roles.add(new TSentryRole(other_element));
+ }
+ this.roles = __this__roles;
+ }
+ }
+
+ public TListSentryRolesResponse deepCopy() {
+ return new TListSentryRolesResponse(this);
+ }
+
+ @Override
+ public void clear() {
+ this.status = null;
+ this.roles = null;
+ }
+
+ public org.apache.sentry.service.thrift.TSentryResponseStatus getStatus() {
+ return this.status;
+ }
+
+ public void setStatus(org.apache.sentry.service.thrift.TSentryResponseStatus status) {
+ this.status = status;
+ }
+
+ public void unsetStatus() {
+ this.status = null;
+ }
+
+ /** Returns true if field status is set (has been assigned a value) and false otherwise */
+ public boolean isSetStatus() {
+ return this.status != null;
+ }
+
+ public void setStatusIsSet(boolean value) {
+ if (!value) {
+ this.status = null;
+ }
+ }
+
+ public int getRolesSize() {
+ return (this.roles == null) ? 0 : this.roles.size();
+ }
+
+ public java.util.Iterator<TSentryRole> getRolesIterator() {
+ return (this.roles == null) ? null : this.roles.iterator();
+ }
+
+ public void addToRoles(TSentryRole elem) {
+ if (this.roles == null) {
+ this.roles = new HashSet<TSentryRole>();
+ }
+ this.roles.add(elem);
+ }
+
+ public Set<TSentryRole> getRoles() {
+ return this.roles;
+ }
+
+ public void setRoles(Set<TSentryRole> roles) {
+ this.roles = roles;
+ }
+
+ public void unsetRoles() {
+ this.roles = null;
+ }
+
+ /** Returns true if field roles is set (has been assigned a value) and false otherwise */
+ public boolean isSetRoles() {
+ return this.roles != null;
+ }
+
+ public void setRolesIsSet(boolean value) {
+ if (!value) {
+ this.roles = null;
+ }
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case STATUS:
+ if (value == null) {
+ unsetStatus();
+ } else {
+ setStatus((org.apache.sentry.service.thrift.TSentryResponseStatus)value);
+ }
+ break;
+
+ case ROLES:
+ if (value == null) {
+ unsetRoles();
+ } else {
+ setRoles((Set<TSentryRole>)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case STATUS:
+ return getStatus();
+
+ case ROLES:
+ return getRoles();
+
+ }
+ throw new IllegalStateException();
+ }
+
+ /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+ public boolean isSet(_Fields field) {
+ if (field == null) {
+ throw new IllegalArgumentException();
+ }
+
+ switch (field) {
+ case STATUS:
+ return isSetStatus();
+ case ROLES:
+ return isSetRoles();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof TListSentryRolesResponse)
+ return this.equals((TListSentryRolesResponse)that);
+ return false;
+ }
+
+ public boolean equals(TListSentryRolesResponse that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_status = true && this.isSetStatus();
+ boolean that_present_status = true && that.isSetStatus();
+ if (this_present_status || that_present_status) {
+ if (!(this_present_status && that_present_status))
+ return false;
+ if (!this.status.equals(that.status))
+ return false;
+ }
+
+ boolean this_present_roles = true && this.isSetRoles();
+ boolean that_present_roles = true && that.isSetRoles();
+ if (this_present_roles || that_present_roles) {
+ if (!(this_present_roles && that_present_roles))
+ return false;
+ if (!this.roles.equals(that.roles))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ HashCodeBuilder builder = new HashCodeBuilder();
+
+ boolean present_status = true && (isSetStatus());
+ builder.append(present_status);
+ if (present_status)
+ builder.append(status);
+
+ boolean present_roles = true && (isSetRoles());
+ builder.append(present_roles);
+ if (present_roles)
+ builder.append(roles);
+
+ return builder.toHashCode();
+ }
+
+ public int compareTo(TListSentryRolesResponse other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+ TListSentryRolesResponse typedOther = (TListSentryRolesResponse)other;
+
+ lastComparison = Boolean.valueOf(isSetStatus()).compareTo(typedOther.isSetStatus());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetStatus()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.status, typedOther.status);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetRoles()).compareTo(typedOther.isSetRoles());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetRoles()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.roles, typedOther.roles);
+ 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("TListSentryRolesResponse(");
+ boolean first = true;
+
+ sb.append("status:");
+ if (this.status == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.status);
+ }
+ first = false;
+ if (isSetRoles()) {
+ if (!first) sb.append(", ");
+ sb.append("roles:");
+ if (this.roles == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.roles);
+ }
+ first = false;
+ }
+ sb.append(")");
+ return sb.toString();
+ }
+
+ public void validate() throws org.apache.thrift.TException {
+ // check for required fields
+ if (!isSetStatus()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'status' is unset! Struct:" + toString());
+ }
+
+ // check for sub-struct validity
+ if (status != null) {
+ status.validate();
+ }
+ }
+
+ private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+ try {
+ write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+ try {
+ read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private static class TListSentryRolesResponseStandardSchemeFactory implements SchemeFactory {
+ public TListSentryRolesResponseStandardScheme getScheme() {
+ return new TListSentryRolesResponseStandardScheme();
+ }
+ }
+
+ private static class TListSentryRolesResponseStandardScheme extends StandardScheme<TListSentryRolesResponse> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, TListSentryRolesResponse struct) throws org.apache.thrift.TException {
+ org.apache.thrift.protocol.TField schemeField;
+ iprot.readStructBegin();
+ while (true)
+ {
+ schemeField = iprot.readFieldBegin();
+ if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
+ break;
+ }
+ switch (schemeField.id) {
+ case 1: // STATUS
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+ struct.status = new org.apache.sentry.service.thrift.TSentryResponseStatus();
+ struct.status.read(iprot);
+ struct.setStatusIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 2: // ROLES
+ if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
+ {
+ org.apache.thrift.protocol.TSet _set24 = iprot.readSetBegin();
+ struct.roles = new HashSet<TSentryRole>(2*_set24.size);
+ for (int _i25 = 0; _i25 < _set24.size; ++_i25)
+ {
+ TSentryRole _elem26; // required
+ _elem26 = new TSentryRole();
+ _elem26.read(iprot);
+ struct.roles.add(_elem26);
+ }
+ iprot.readSetEnd();
+ }
+ struct.setRolesIsSet(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, TListSentryRolesResponse struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.status != null) {
+ oprot.writeFieldBegin(STATUS_FIELD_DESC);
+ struct.status.write(oprot);
+ oprot.writeFieldEnd();
+ }
+ if (struct.roles != null) {
+ if (struct.isSetRoles()) {
+ oprot.writeFieldBegin(ROLES_FIELD_DESC);
+ {
+ oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, struct.roles.size()));
+ for (TSentryRole _iter27 : struct.roles)
+ {
+ _iter27.write(oprot);
+ }
+ oprot.writeSetEnd();
+ }
+ oprot.writeFieldEnd();
+ }
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class TListSentryRolesResponseTupleSchemeFactory implements SchemeFactory {
+ public TListSentryRolesResponseTupleScheme getScheme() {
+ return new TListSentryRolesResponseTupleScheme();
+ }
+ }
+
+ private static class TListSentryRolesResponseTupleScheme extends TupleScheme<TListSentryRolesResponse> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, TListSentryRolesResponse struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ struct.status.write(oprot);
+ BitSet optionals = new BitSet();
+ if (struct.isSetRoles()) {
+ optionals.set(0);
+ }
+ oprot.writeBitSet(optionals, 1);
+ if (struct.isSetRoles()) {
+ {
+ oprot.writeI32(struct.roles.size());
+ for (TSentryRole _iter28 : struct.roles)
+ {
+ _iter28.write(oprot);
+ }
+ }
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, TListSentryRolesResponse struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ struct.status = new org.apache.sentry.service.thrift.TSentryResponseStatus();
+ struct.status.read(iprot);
+ struct.setStatusIsSet(true);
+ BitSet incoming = iprot.readBitSet(1);
+ if (incoming.get(0)) {
+ {
+ org.apache.thrift.protocol.TSet _set29 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
+ struct.roles = new HashSet<TSentryRole>(2*_set29.size);
+ for (int _i30 = 0; _i30 < _set29.size; ++_i30)
+ {
+ TSentryRole _elem31; // required
+ _elem31 = new TSentryRole();
+ _elem31.read(iprot);
+ struct.roles.add(_elem31);
+ }
+ }
+ struct.setRolesIsSet(true);
+ }
+ }
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TPathChanges.java
----------------------------------------------------------------------
diff --git a/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TPathChanges.java b/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TPathChanges.java
new file mode 100644
index 0000000..c692099
--- /dev/null
+++ b/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TPathChanges.java
@@ -0,0 +1,765 @@
+/**
+ * Autogenerated by Thrift Compiler (0.9.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+package org.apache.sentry.provider.db.service.thrift;
+
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EnumMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.EnumSet;
+import java.util.Collections;
+import java.util.BitSet;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class TPathChanges implements org.apache.thrift.TBase<TPathChanges, TPathChanges._Fields>, java.io.Serializable, Cloneable {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TPathChanges");
+
+ private static final org.apache.thrift.protocol.TField AUTHZ_OBJ_FIELD_DESC = new org.apache.thrift.protocol.TField("authzObj", org.apache.thrift.protocol.TType.STRING, (short)1);
+ private static final org.apache.thrift.protocol.TField ADD_PATHS_FIELD_DESC = new org.apache.thrift.protocol.TField("addPaths", org.apache.thrift.protocol.TType.LIST, (short)2);
+ private static final org.apache.thrift.protocol.TField DEL_PATHS_FIELD_DESC = new org.apache.thrift.protocol.TField("delPaths", org.apache.thrift.protocol.TType.LIST, (short)3);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new TPathChangesStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new TPathChangesTupleSchemeFactory());
+ }
+
+ private String authzObj; // required
+ private List<List<String>> addPaths; // required
+ private List<List<String>> delPaths; // 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 {
+ AUTHZ_OBJ((short)1, "authzObj"),
+ ADD_PATHS((short)2, "addPaths"),
+ DEL_PATHS((short)3, "delPaths");
+
+ 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: // AUTHZ_OBJ
+ return AUTHZ_OBJ;
+ case 2: // ADD_PATHS
+ return ADD_PATHS;
+ case 3: // DEL_PATHS
+ return DEL_PATHS;
+ 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.AUTHZ_OBJ, new org.apache.thrift.meta_data.FieldMetaData("authzObj", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields.ADD_PATHS, new org.apache.thrift.meta_data.FieldMetaData("addPaths", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
+ new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)))));
+ tmpMap.put(_Fields.DEL_PATHS, new org.apache.thrift.meta_data.FieldMetaData("delPaths", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
+ new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)))));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TPathChanges.class, metaDataMap);
+ }
+
+ public TPathChanges() {
+ }
+
+ public TPathChanges(
+ String authzObj,
+ List<List<String>> addPaths,
+ List<List<String>> delPaths)
+ {
+ this();
+ this.authzObj = authzObj;
+ this.addPaths = addPaths;
+ this.delPaths = delPaths;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public TPathChanges(TPathChanges other) {
+ if (other.isSetAuthzObj()) {
+ this.authzObj = other.authzObj;
+ }
+ if (other.isSetAddPaths()) {
+ List<List<String>> __this__addPaths = new ArrayList<List<String>>();
+ for (List<String> other_element : other.addPaths) {
+ List<String> __this__addPaths_copy = new ArrayList<String>();
+ for (String other_element_element : other_element) {
+ __this__addPaths_copy.add(other_element_element);
+ }
+ __this__addPaths.add(__this__addPaths_copy);
+ }
+ this.addPaths = __this__addPaths;
+ }
+ if (other.isSetDelPaths()) {
+ List<List<String>> __this__delPaths = new ArrayList<List<String>>();
+ for (List<String> other_element : other.delPaths) {
+ List<String> __this__delPaths_copy = new ArrayList<String>();
+ for (String other_element_element : other_element) {
+ __this__delPaths_copy.add(other_element_element);
+ }
+ __this__delPaths.add(__this__delPaths_copy);
+ }
+ this.delPaths = __this__delPaths;
+ }
+ }
+
+ public TPathChanges deepCopy() {
+ return new TPathChanges(this);
+ }
+
+ @Override
+ public void clear() {
+ this.authzObj = null;
+ this.addPaths = null;
+ this.delPaths = null;
+ }
+
+ public String getAuthzObj() {
+ return this.authzObj;
+ }
+
+ public void setAuthzObj(String authzObj) {
+ this.authzObj = authzObj;
+ }
+
+ public void unsetAuthzObj() {
+ this.authzObj = null;
+ }
+
+ /** Returns true if field authzObj is set (has been assigned a value) and false otherwise */
+ public boolean isSetAuthzObj() {
+ return this.authzObj != null;
+ }
+
+ public void setAuthzObjIsSet(boolean value) {
+ if (!value) {
+ this.authzObj = null;
+ }
+ }
+
+ public int getAddPathsSize() {
+ return (this.addPaths == null) ? 0 : this.addPaths.size();
+ }
+
+ public java.util.Iterator<List<String>> getAddPathsIterator() {
+ return (this.addPaths == null) ? null : this.addPaths.iterator();
+ }
+
+ public void addToAddPaths(List<String> elem) {
+ if (this.addPaths == null) {
+ this.addPaths = new ArrayList<List<String>>();
+ }
+ this.addPaths.add(elem);
+ }
+
+ public List<List<String>> getAddPaths() {
+ return this.addPaths;
+ }
+
+ public void setAddPaths(List<List<String>> addPaths) {
+ this.addPaths = addPaths;
+ }
+
+ public void unsetAddPaths() {
+ this.addPaths = null;
+ }
+
+ /** Returns true if field addPaths is set (has been assigned a value) and false otherwise */
+ public boolean isSetAddPaths() {
+ return this.addPaths != null;
+ }
+
+ public void setAddPathsIsSet(boolean value) {
+ if (!value) {
+ this.addPaths = null;
+ }
+ }
+
+ public int getDelPathsSize() {
+ return (this.delPaths == null) ? 0 : this.delPaths.size();
+ }
+
+ public java.util.Iterator<List<String>> getDelPathsIterator() {
+ return (this.delPaths == null) ? null : this.delPaths.iterator();
+ }
+
+ public void addToDelPaths(List<String> elem) {
+ if (this.delPaths == null) {
+ this.delPaths = new ArrayList<List<String>>();
+ }
+ this.delPaths.add(elem);
+ }
+
+ public List<List<String>> getDelPaths() {
+ return this.delPaths;
+ }
+
+ public void setDelPaths(List<List<String>> delPaths) {
+ this.delPaths = delPaths;
+ }
+
+ public void unsetDelPaths() {
+ this.delPaths = null;
+ }
+
+ /** Returns true if field delPaths is set (has been assigned a value) and false otherwise */
+ public boolean isSetDelPaths() {
+ return this.delPaths != null;
+ }
+
+ public void setDelPathsIsSet(boolean value) {
+ if (!value) {
+ this.delPaths = null;
+ }
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case AUTHZ_OBJ:
+ if (value == null) {
+ unsetAuthzObj();
+ } else {
+ setAuthzObj((String)value);
+ }
+ break;
+
+ case ADD_PATHS:
+ if (value == null) {
+ unsetAddPaths();
+ } else {
+ setAddPaths((List<List<String>>)value);
+ }
+ break;
+
+ case DEL_PATHS:
+ if (value == null) {
+ unsetDelPaths();
+ } else {
+ setDelPaths((List<List<String>>)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case AUTHZ_OBJ:
+ return getAuthzObj();
+
+ case ADD_PATHS:
+ return getAddPaths();
+
+ case DEL_PATHS:
+ return getDelPaths();
+
+ }
+ 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 AUTHZ_OBJ:
+ return isSetAuthzObj();
+ case ADD_PATHS:
+ return isSetAddPaths();
+ case DEL_PATHS:
+ return isSetDelPaths();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof TPathChanges)
+ return this.equals((TPathChanges)that);
+ return false;
+ }
+
+ public boolean equals(TPathChanges that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_authzObj = true && this.isSetAuthzObj();
+ boolean that_present_authzObj = true && that.isSetAuthzObj();
+ if (this_present_authzObj || that_present_authzObj) {
+ if (!(this_present_authzObj && that_present_authzObj))
+ return false;
+ if (!this.authzObj.equals(that.authzObj))
+ return false;
+ }
+
+ boolean this_present_addPaths = true && this.isSetAddPaths();
+ boolean that_present_addPaths = true && that.isSetAddPaths();
+ if (this_present_addPaths || that_present_addPaths) {
+ if (!(this_present_addPaths && that_present_addPaths))
+ return false;
+ if (!this.addPaths.equals(that.addPaths))
+ return false;
+ }
+
+ boolean this_present_delPaths = true && this.isSetDelPaths();
+ boolean that_present_delPaths = true && that.isSetDelPaths();
+ if (this_present_delPaths || that_present_delPaths) {
+ if (!(this_present_delPaths && that_present_delPaths))
+ return false;
+ if (!this.delPaths.equals(that.delPaths))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ HashCodeBuilder builder = new HashCodeBuilder();
+
+ boolean present_authzObj = true && (isSetAuthzObj());
+ builder.append(present_authzObj);
+ if (present_authzObj)
+ builder.append(authzObj);
+
+ boolean present_addPaths = true && (isSetAddPaths());
+ builder.append(present_addPaths);
+ if (present_addPaths)
+ builder.append(addPaths);
+
+ boolean present_delPaths = true && (isSetDelPaths());
+ builder.append(present_delPaths);
+ if (present_delPaths)
+ builder.append(delPaths);
+
+ return builder.toHashCode();
+ }
+
+ public int compareTo(TPathChanges other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+ TPathChanges typedOther = (TPathChanges)other;
+
+ lastComparison = Boolean.valueOf(isSetAuthzObj()).compareTo(typedOther.isSetAuthzObj());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetAuthzObj()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.authzObj, typedOther.authzObj);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetAddPaths()).compareTo(typedOther.isSetAddPaths());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetAddPaths()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.addPaths, typedOther.addPaths);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetDelPaths()).compareTo(typedOther.isSetDelPaths());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetDelPaths()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delPaths, typedOther.delPaths);
+ 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("TPathChanges(");
+ boolean first = true;
+
+ sb.append("authzObj:");
+ if (this.authzObj == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.authzObj);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("addPaths:");
+ if (this.addPaths == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.addPaths);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("delPaths:");
+ if (this.delPaths == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.delPaths);
+ }
+ first = false;
+ sb.append(")");
+ return sb.toString();
+ }
+
+ public void validate() throws org.apache.thrift.TException {
+ // check for required fields
+ if (!isSetAuthzObj()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'authzObj' is unset! Struct:" + toString());
+ }
+
+ if (!isSetAddPaths()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'addPaths' is unset! Struct:" + toString());
+ }
+
+ if (!isSetDelPaths()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'delPaths' 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 TPathChangesStandardSchemeFactory implements SchemeFactory {
+ public TPathChangesStandardScheme getScheme() {
+ return new TPathChangesStandardScheme();
+ }
+ }
+
+ private static class TPathChangesStandardScheme extends StandardScheme<TPathChanges> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, TPathChanges 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: // AUTHZ_OBJ
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.authzObj = iprot.readString();
+ struct.setAuthzObjIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 2: // ADD_PATHS
+ if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
+ {
+ org.apache.thrift.protocol.TList _list64 = iprot.readListBegin();
+ struct.addPaths = new ArrayList<List<String>>(_list64.size);
+ for (int _i65 = 0; _i65 < _list64.size; ++_i65)
+ {
+ List<String> _elem66; // required
+ {
+ org.apache.thrift.protocol.TList _list67 = iprot.readListBegin();
+ _elem66 = new ArrayList<String>(_list67.size);
+ for (int _i68 = 0; _i68 < _list67.size; ++_i68)
+ {
+ String _elem69; // required
+ _elem69 = iprot.readString();
+ _elem66.add(_elem69);
+ }
+ iprot.readListEnd();
+ }
+ struct.addPaths.add(_elem66);
+ }
+ iprot.readListEnd();
+ }
+ struct.setAddPathsIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 3: // DEL_PATHS
+ if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
+ {
+ org.apache.thrift.protocol.TList _list70 = iprot.readListBegin();
+ struct.delPaths = new ArrayList<List<String>>(_list70.size);
+ for (int _i71 = 0; _i71 < _list70.size; ++_i71)
+ {
+ List<String> _elem72; // required
+ {
+ org.apache.thrift.protocol.TList _list73 = iprot.readListBegin();
+ _elem72 = new ArrayList<String>(_list73.size);
+ for (int _i74 = 0; _i74 < _list73.size; ++_i74)
+ {
+ String _elem75; // required
+ _elem75 = iprot.readString();
+ _elem72.add(_elem75);
+ }
+ iprot.readListEnd();
+ }
+ struct.delPaths.add(_elem72);
+ }
+ iprot.readListEnd();
+ }
+ struct.setDelPathsIsSet(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, TPathChanges struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.authzObj != null) {
+ oprot.writeFieldBegin(AUTHZ_OBJ_FIELD_DESC);
+ oprot.writeString(struct.authzObj);
+ oprot.writeFieldEnd();
+ }
+ if (struct.addPaths != null) {
+ oprot.writeFieldBegin(ADD_PATHS_FIELD_DESC);
+ {
+ oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.LIST, struct.addPaths.size()));
+ for (List<String> _iter76 : struct.addPaths)
+ {
+ {
+ oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, _iter76.size()));
+ for (String _iter77 : _iter76)
+ {
+ oprot.writeString(_iter77);
+ }
+ oprot.writeListEnd();
+ }
+ }
+ oprot.writeListEnd();
+ }
+ oprot.writeFieldEnd();
+ }
+ if (struct.delPaths != null) {
+ oprot.writeFieldBegin(DEL_PATHS_FIELD_DESC);
+ {
+ oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.LIST, struct.delPaths.size()));
+ for (List<String> _iter78 : struct.delPaths)
+ {
+ {
+ oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, _iter78.size()));
+ for (String _iter79 : _iter78)
+ {
+ oprot.writeString(_iter79);
+ }
+ oprot.writeListEnd();
+ }
+ }
+ oprot.writeListEnd();
+ }
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class TPathChangesTupleSchemeFactory implements SchemeFactory {
+ public TPathChangesTupleScheme getScheme() {
+ return new TPathChangesTupleScheme();
+ }
+ }
+
+ private static class TPathChangesTupleScheme extends TupleScheme<TPathChanges> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, TPathChanges struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ oprot.writeString(struct.authzObj);
+ {
+ oprot.writeI32(struct.addPaths.size());
+ for (List<String> _iter80 : struct.addPaths)
+ {
+ {
+ oprot.writeI32(_iter80.size());
+ for (String _iter81 : _iter80)
+ {
+ oprot.writeString(_iter81);
+ }
+ }
+ }
+ }
+ {
+ oprot.writeI32(struct.delPaths.size());
+ for (List<String> _iter82 : struct.delPaths)
+ {
+ {
+ oprot.writeI32(_iter82.size());
+ for (String _iter83 : _iter82)
+ {
+ oprot.writeString(_iter83);
+ }
+ }
+ }
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, TPathChanges struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ struct.authzObj = iprot.readString();
+ struct.setAuthzObjIsSet(true);
+ {
+ org.apache.thrift.protocol.TList _list84 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.LIST, iprot.readI32());
+ struct.addPaths = new ArrayList<List<String>>(_list84.size);
+ for (int _i85 = 0; _i85 < _list84.size; ++_i85)
+ {
+ List<String> _elem86; // required
+ {
+ org.apache.thrift.protocol.TList _list87 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
+ _elem86 = new ArrayList<String>(_list87.size);
+ for (int _i88 = 0; _i88 < _list87.size; ++_i88)
+ {
+ String _elem89; // required
+ _elem89 = iprot.readString();
+ _elem86.add(_elem89);
+ }
+ }
+ struct.addPaths.add(_elem86);
+ }
+ }
+ struct.setAddPathsIsSet(true);
+ {
+ org.apache.thrift.protocol.TList _list90 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.LIST, iprot.readI32());
+ struct.delPaths = new ArrayList<List<String>>(_list90.size);
+ for (int _i91 = 0; _i91 < _list90.size; ++_i91)
+ {
+ List<String> _elem92; // required
+ {
+ org.apache.thrift.protocol.TList _list93 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
+ _elem92 = new ArrayList<String>(_list93.size);
+ for (int _i94 = 0; _i94 < _list93.size; ++_i94)
+ {
+ String _elem95; // required
+ _elem95 = iprot.readString();
+ _elem92.add(_elem95);
+ }
+ }
+ struct.delPaths.add(_elem92);
+ }
+ }
+ struct.setDelPathsIsSet(true);
+ }
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TPathEntry.java
----------------------------------------------------------------------
diff --git a/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TPathEntry.java b/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TPathEntry.java
new file mode 100644
index 0000000..9e72802
--- /dev/null
+++ b/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TPathEntry.java
@@ -0,0 +1,747 @@
+/**
+ * Autogenerated by Thrift Compiler (0.9.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+package org.apache.sentry.provider.db.service.thrift;
+
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EnumMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.EnumSet;
+import java.util.Collections;
+import java.util.BitSet;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class TPathEntry implements org.apache.thrift.TBase<TPathEntry, TPathEntry._Fields>, java.io.Serializable, Cloneable {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TPathEntry");
+
+ private static final org.apache.thrift.protocol.TField TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("type", org.apache.thrift.protocol.TType.BYTE, (short)1);
+ private static final org.apache.thrift.protocol.TField PATH_ELEMENT_FIELD_DESC = new org.apache.thrift.protocol.TField("pathElement", org.apache.thrift.protocol.TType.STRING, (short)2);
+ private static final org.apache.thrift.protocol.TField AUTHZ_OBJ_FIELD_DESC = new org.apache.thrift.protocol.TField("authzObj", org.apache.thrift.protocol.TType.STRING, (short)3);
+ private static final org.apache.thrift.protocol.TField CHILDREN_FIELD_DESC = new org.apache.thrift.protocol.TField("children", org.apache.thrift.protocol.TType.SET, (short)4);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new TPathEntryStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new TPathEntryTupleSchemeFactory());
+ }
+
+ private byte type; // required
+ private String pathElement; // required
+ private String authzObj; // optional
+ private Set<Integer> children; // 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 {
+ TYPE((short)1, "type"),
+ PATH_ELEMENT((short)2, "pathElement"),
+ AUTHZ_OBJ((short)3, "authzObj"),
+ CHILDREN((short)4, "children");
+
+ 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: // TYPE
+ return TYPE;
+ case 2: // PATH_ELEMENT
+ return PATH_ELEMENT;
+ case 3: // AUTHZ_OBJ
+ return AUTHZ_OBJ;
+ case 4: // CHILDREN
+ return CHILDREN;
+ 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 __TYPE_ISSET_ID = 0;
+ private byte __isset_bitfield = 0;
+ private _Fields optionals[] = {_Fields.AUTHZ_OBJ};
+ 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.TYPE, new org.apache.thrift.meta_data.FieldMetaData("type", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BYTE)));
+ tmpMap.put(_Fields.PATH_ELEMENT, new org.apache.thrift.meta_data.FieldMetaData("pathElement", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields.AUTHZ_OBJ, new org.apache.thrift.meta_data.FieldMetaData("authzObj", org.apache.thrift.TFieldRequirementType.OPTIONAL,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields.CHILDREN, new org.apache.thrift.meta_data.FieldMetaData("children", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TPathEntry.class, metaDataMap);
+ }
+
+ public TPathEntry() {
+ }
+
+ public TPathEntry(
+ byte type,
+ String pathElement,
+ Set<Integer> children)
+ {
+ this();
+ this.type = type;
+ setTypeIsSet(true);
+ this.pathElement = pathElement;
+ this.children = children;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public TPathEntry(TPathEntry other) {
+ __isset_bitfield = other.__isset_bitfield;
+ this.type = other.type;
+ if (other.isSetPathElement()) {
+ this.pathElement = other.pathElement;
+ }
+ if (other.isSetAuthzObj()) {
+ this.authzObj = other.authzObj;
+ }
+ if (other.isSetChildren()) {
+ Set<Integer> __this__children = new HashSet<Integer>();
+ for (Integer other_element : other.children) {
+ __this__children.add(other_element);
+ }
+ this.children = __this__children;
+ }
+ }
+
+ public TPathEntry deepCopy() {
+ return new TPathEntry(this);
+ }
+
+ @Override
+ public void clear() {
+ setTypeIsSet(false);
+ this.type = 0;
+ this.pathElement = null;
+ this.authzObj = null;
+ this.children = null;
+ }
+
+ public byte getType() {
+ return this.type;
+ }
+
+ public void setType(byte type) {
+ this.type = type;
+ setTypeIsSet(true);
+ }
+
+ public void unsetType() {
+ __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __TYPE_ISSET_ID);
+ }
+
+ /** Returns true if field type is set (has been assigned a value) and false otherwise */
+ public boolean isSetType() {
+ return EncodingUtils.testBit(__isset_bitfield, __TYPE_ISSET_ID);
+ }
+
+ public void setTypeIsSet(boolean value) {
+ __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __TYPE_ISSET_ID, value);
+ }
+
+ public String getPathElement() {
+ return this.pathElement;
+ }
+
+ public void setPathElement(String pathElement) {
+ this.pathElement = pathElement;
+ }
+
+ public void unsetPathElement() {
+ this.pathElement = null;
+ }
+
+ /** Returns true if field pathElement is set (has been assigned a value) and false otherwise */
+ public boolean isSetPathElement() {
+ return this.pathElement != null;
+ }
+
+ public void setPathElementIsSet(boolean value) {
+ if (!value) {
+ this.pathElement = null;
+ }
+ }
+
+ public String getAuthzObj() {
+ return this.authzObj;
+ }
+
+ public void setAuthzObj(String authzObj) {
+ this.authzObj = authzObj;
+ }
+
+ public void unsetAuthzObj() {
+ this.authzObj = null;
+ }
+
+ /** Returns true if field authzObj is set (has been assigned a value) and false otherwise */
+ public boolean isSetAuthzObj() {
+ return this.authzObj != null;
+ }
+
+ public void setAuthzObjIsSet(boolean value) {
+ if (!value) {
+ this.authzObj = null;
+ }
+ }
+
+ public int getChildrenSize() {
+ return (this.children == null) ? 0 : this.children.size();
+ }
+
+ public java.util.Iterator<Integer> getChildrenIterator() {
+ return (this.children == null) ? null : this.children.iterator();
+ }
+
+ public void addToChildren(int elem) {
+ if (this.children == null) {
+ this.children = new HashSet<Integer>();
+ }
+ this.children.add(elem);
+ }
+
+ public Set<Integer> getChildren() {
+ return this.children;
+ }
+
+ public void setChildren(Set<Integer> children) {
+ this.children = children;
+ }
+
+ public void unsetChildren() {
+ this.children = null;
+ }
+
+ /** Returns true if field children is set (has been assigned a value) and false otherwise */
+ public boolean isSetChildren() {
+ return this.children != null;
+ }
+
+ public void setChildrenIsSet(boolean value) {
+ if (!value) {
+ this.children = null;
+ }
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case TYPE:
+ if (value == null) {
+ unsetType();
+ } else {
+ setType((Byte)value);
+ }
+ break;
+
+ case PATH_ELEMENT:
+ if (value == null) {
+ unsetPathElement();
+ } else {
+ setPathElement((String)value);
+ }
+ break;
+
+ case AUTHZ_OBJ:
+ if (value == null) {
+ unsetAuthzObj();
+ } else {
+ setAuthzObj((String)value);
+ }
+ break;
+
+ case CHILDREN:
+ if (value == null) {
+ unsetChildren();
+ } else {
+ setChildren((Set<Integer>)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case TYPE:
+ return Byte.valueOf(getType());
+
+ case PATH_ELEMENT:
+ return getPathElement();
+
+ case AUTHZ_OBJ:
+ return getAuthzObj();
+
+ case CHILDREN:
+ return getChildren();
+
+ }
+ 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 TYPE:
+ return isSetType();
+ case PATH_ELEMENT:
+ return isSetPathElement();
+ case AUTHZ_OBJ:
+ return isSetAuthzObj();
+ case CHILDREN:
+ return isSetChildren();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof TPathEntry)
+ return this.equals((TPathEntry)that);
+ return false;
+ }
+
+ public boolean equals(TPathEntry that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_type = true;
+ boolean that_present_type = true;
+ if (this_present_type || that_present_type) {
+ if (!(this_present_type && that_present_type))
+ return false;
+ if (this.type != that.type)
+ return false;
+ }
+
+ boolean this_present_pathElement = true && this.isSetPathElement();
+ boolean that_present_pathElement = true && that.isSetPathElement();
+ if (this_present_pathElement || that_present_pathElement) {
+ if (!(this_present_pathElement && that_present_pathElement))
+ return false;
+ if (!this.pathElement.equals(that.pathElement))
+ return false;
+ }
+
+ boolean this_present_authzObj = true && this.isSetAuthzObj();
+ boolean that_present_authzObj = true && that.isSetAuthzObj();
+ if (this_present_authzObj || that_present_authzObj) {
+ if (!(this_present_authzObj && that_present_authzObj))
+ return false;
+ if (!this.authzObj.equals(that.authzObj))
+ return false;
+ }
+
+ boolean this_present_children = true && this.isSetChildren();
+ boolean that_present_children = true && that.isSetChildren();
+ if (this_present_children || that_present_children) {
+ if (!(this_present_children && that_present_children))
+ return false;
+ if (!this.children.equals(that.children))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ HashCodeBuilder builder = new HashCodeBuilder();
+
+ boolean present_type = true;
+ builder.append(present_type);
+ if (present_type)
+ builder.append(type);
+
+ boolean present_pathElement = true && (isSetPathElement());
+ builder.append(present_pathElement);
+ if (present_pathElement)
+ builder.append(pathElement);
+
+ boolean present_authzObj = true && (isSetAuthzObj());
+ builder.append(present_authzObj);
+ if (present_authzObj)
+ builder.append(authzObj);
+
+ boolean present_children = true && (isSetChildren());
+ builder.append(present_children);
+ if (present_children)
+ builder.append(children);
+
+ return builder.toHashCode();
+ }
+
+ public int compareTo(TPathEntry other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+ TPathEntry typedOther = (TPathEntry)other;
+
+ lastComparison = Boolean.valueOf(isSetType()).compareTo(typedOther.isSetType());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetType()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.type, typedOther.type);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetPathElement()).compareTo(typedOther.isSetPathElement());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetPathElement()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.pathElement, typedOther.pathElement);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetAuthzObj()).compareTo(typedOther.isSetAuthzObj());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetAuthzObj()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.authzObj, typedOther.authzObj);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetChildren()).compareTo(typedOther.isSetChildren());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetChildren()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.children, typedOther.children);
+ 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("TPathEntry(");
+ boolean first = true;
+
+ sb.append("type:");
+ sb.append(this.type);
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("pathElement:");
+ if (this.pathElement == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.pathElement);
+ }
+ first = false;
+ if (isSetAuthzObj()) {
+ if (!first) sb.append(", ");
+ sb.append("authzObj:");
+ if (this.authzObj == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.authzObj);
+ }
+ first = false;
+ }
+ if (!first) sb.append(", ");
+ sb.append("children:");
+ if (this.children == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.children);
+ }
+ first = false;
+ sb.append(")");
+ return sb.toString();
+ }
+
+ public void validate() throws org.apache.thrift.TException {
+ // check for required fields
+ if (!isSetType()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'type' is unset! Struct:" + toString());
+ }
+
+ if (!isSetPathElement()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'pathElement' is unset! Struct:" + toString());
+ }
+
+ if (!isSetChildren()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'children' 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 TPathEntryStandardSchemeFactory implements SchemeFactory {
+ public TPathEntryStandardScheme getScheme() {
+ return new TPathEntryStandardScheme();
+ }
+ }
+
+ private static class TPathEntryStandardScheme extends StandardScheme<TPathEntry> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, TPathEntry 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: // TYPE
+ if (schemeField.type == org.apache.thrift.protocol.TType.BYTE) {
+ struct.type = iprot.readByte();
+ struct.setTypeIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 2: // PATH_ELEMENT
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.pathElement = iprot.readString();
+ struct.setPathElementIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 3: // AUTHZ_OBJ
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.authzObj = iprot.readString();
+ struct.setAuthzObjIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 4: // CHILDREN
+ if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
+ {
+ org.apache.thrift.protocol.TSet _set96 = iprot.readSetBegin();
+ struct.children = new HashSet<Integer>(2*_set96.size);
+ for (int _i97 = 0; _i97 < _set96.size; ++_i97)
+ {
+ int _elem98; // required
+ _elem98 = iprot.readI32();
+ struct.children.add(_elem98);
+ }
+ iprot.readSetEnd();
+ }
+ struct.setChildrenIsSet(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, TPathEntry struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ oprot.writeFieldBegin(TYPE_FIELD_DESC);
+ oprot.writeByte(struct.type);
+ oprot.writeFieldEnd();
+ if (struct.pathElement != null) {
+ oprot.writeFieldBegin(PATH_ELEMENT_FIELD_DESC);
+ oprot.writeString(struct.pathElement);
+ oprot.writeFieldEnd();
+ }
+ if (struct.authzObj != null) {
+ if (struct.isSetAuthzObj()) {
+ oprot.writeFieldBegin(AUTHZ_OBJ_FIELD_DESC);
+ oprot.writeString(struct.authzObj);
+ oprot.writeFieldEnd();
+ }
+ }
+ if (struct.children != null) {
+ oprot.writeFieldBegin(CHILDREN_FIELD_DESC);
+ {
+ oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.I32, struct.children.size()));
+ for (int _iter99 : struct.children)
+ {
+ oprot.writeI32(_iter99);
+ }
+ oprot.writeSetEnd();
+ }
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class TPathEntryTupleSchemeFactory implements SchemeFactory {
+ public TPathEntryTupleScheme getScheme() {
+ return new TPathEntryTupleScheme();
+ }
+ }
+
+ private static class TPathEntryTupleScheme extends TupleScheme<TPathEntry> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, TPathEntry struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ oprot.writeByte(struct.type);
+ oprot.writeString(struct.pathElement);
+ {
+ oprot.writeI32(struct.children.size());
+ for (int _iter100 : struct.children)
+ {
+ oprot.writeI32(_iter100);
+ }
+ }
+ BitSet optionals = new BitSet();
+ if (struct.isSetAuthzObj()) {
+ optionals.set(0);
+ }
+ oprot.writeBitSet(optionals, 1);
+ if (struct.isSetAuthzObj()) {
+ oprot.writeString(struct.authzObj);
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, TPathEntry struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ struct.type = iprot.readByte();
+ struct.setTypeIsSet(true);
+ struct.pathElement = iprot.readString();
+ struct.setPathElementIsSet(true);
+ {
+ org.apache.thrift.protocol.TSet _set101 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.I32, iprot.readI32());
+ struct.children = new HashSet<Integer>(2*_set101.size);
+ for (int _i102 = 0; _i102 < _set101.size; ++_i102)
+ {
+ int _elem103; // required
+ _elem103 = iprot.readI32();
+ struct.children.add(_elem103);
+ }
+ }
+ struct.setChildrenIsSet(true);
+ BitSet incoming = iprot.readBitSet(1);
+ if (incoming.get(0)) {
+ struct.authzObj = iprot.readString();
+ struct.setAuthzObjIsSet(true);
+ }
+ }
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TPathsDump.java
----------------------------------------------------------------------
diff --git a/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TPathsDump.java b/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TPathsDump.java
new file mode 100644
index 0000000..869d2bc
--- /dev/null
+++ b/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TPathsDump.java
@@ -0,0 +1,549 @@
+/**
+ * Autogenerated by Thrift Compiler (0.9.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+package org.apache.sentry.provider.db.service.thrift;
+
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EnumMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.EnumSet;
+import java.util.Collections;
+import java.util.BitSet;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class TPathsDump implements org.apache.thrift.TBase<TPathsDump, TPathsDump._Fields>, java.io.Serializable, Cloneable {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TPathsDump");
+
+ private static final org.apache.thrift.protocol.TField ROOT_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("rootId", org.apache.thrift.protocol.TType.I32, (short)1);
+ private static final org.apache.thrift.protocol.TField NODE_MAP_FIELD_DESC = new org.apache.thrift.protocol.TField("nodeMap", org.apache.thrift.protocol.TType.MAP, (short)2);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new TPathsDumpStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new TPathsDumpTupleSchemeFactory());
+ }
+
+ private int rootId; // required
+ private Map<Integer,TPathEntry> nodeMap; // 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 {
+ ROOT_ID((short)1, "rootId"),
+ NODE_MAP((short)2, "nodeMap");
+
+ 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: // ROOT_ID
+ return ROOT_ID;
+ case 2: // NODE_MAP
+ return NODE_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
+ private static final int __ROOTID_ISSET_ID = 0;
+ private byte __isset_bitfield = 0;
+ public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+ static {
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+ tmpMap.put(_Fields.ROOT_ID, new org.apache.thrift.meta_data.FieldMetaData("rootId", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
+ tmpMap.put(_Fields.NODE_MAP, new org.apache.thrift.meta_data.FieldMetaData("nodeMap", 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.I32),
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TPathEntry.class))));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TPathsDump.class, metaDataMap);
+ }
+
+ public TPathsDump() {
+ }
+
+ public TPathsDump(
+ int rootId,
+ Map<Integer,TPathEntry> nodeMap)
+ {
+ this();
+ this.rootId = rootId;
+ setRootIdIsSet(true);
+ this.nodeMap = nodeMap;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public TPathsDump(TPathsDump other) {
+ __isset_bitfield = other.__isset_bitfield;
+ this.rootId = other.rootId;
+ if (other.isSetNodeMap()) {
+ Map<Integer,TPathEntry> __this__nodeMap = new HashMap<Integer,TPathEntry>();
+ for (Map.Entry<Integer, TPathEntry> other_element : other.nodeMap.entrySet()) {
+
+ Integer other_element_key = other_element.getKey();
+ TPathEntry other_element_value = other_element.getValue();
+
+ Integer __this__nodeMap_copy_key = other_element_key;
+
+ TPathEntry __this__nodeMap_copy_value = new TPathEntry(other_element_value);
+
+ __this__nodeMap.put(__this__nodeMap_copy_key, __this__nodeMap_copy_value);
+ }
+ this.nodeMap = __this__nodeMap;
+ }
+ }
+
+ public TPathsDump deepCopy() {
+ return new TPathsDump(this);
+ }
+
+ @Override
+ public void clear() {
+ setRootIdIsSet(false);
+ this.rootId = 0;
+ this.nodeMap = null;
+ }
+
+ public int getRootId() {
+ return this.rootId;
+ }
+
+ public void setRootId(int rootId) {
+ this.rootId = rootId;
+ setRootIdIsSet(true);
+ }
+
+ public void unsetRootId() {
+ __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __ROOTID_ISSET_ID);
+ }
+
+ /** Returns true if field rootId is set (has been assigned a value) and false otherwise */
+ public boolean isSetRootId() {
+ return EncodingUtils.testBit(__isset_bitfield, __ROOTID_ISSET_ID);
+ }
+
+ public void setRootIdIsSet(boolean value) {
+ __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __ROOTID_ISSET_ID, value);
+ }
+
+ public int getNodeMapSize() {
+ return (this.nodeMap == null) ? 0 : this.nodeMap.size();
+ }
+
+ public void putToNodeMap(int key, TPathEntry val) {
+ if (this.nodeMap == null) {
+ this.nodeMap = new HashMap<Integer,TPathEntry>();
+ }
+ this.nodeMap.put(key, val);
+ }
+
+ public Map<Integer,TPathEntry> getNodeMap() {
+ return this.nodeMap;
+ }
+
+ public void setNodeMap(Map<Integer,TPathEntry> nodeMap) {
+ this.nodeMap = nodeMap;
+ }
+
+ public void unsetNodeMap() {
+ this.nodeMap = null;
+ }
+
+ /** Returns true if field nodeMap is set (has been assigned a value) and false otherwise */
+ public boolean isSetNodeMap() {
+ return this.nodeMap != null;
+ }
+
+ public void setNodeMapIsSet(boolean value) {
+ if (!value) {
+ this.nodeMap = null;
+ }
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case ROOT_ID:
+ if (value == null) {
+ unsetRootId();
+ } else {
+ setRootId((Integer)value);
+ }
+ break;
+
+ case NODE_MAP:
+ if (value == null) {
+ unsetNodeMap();
+ } else {
+ setNodeMap((Map<Integer,TPathEntry>)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case ROOT_ID:
+ return Integer.valueOf(getRootId());
+
+ case NODE_MAP:
+ return getNodeMap();
+
+ }
+ 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 ROOT_ID:
+ return isSetRootId();
+ case NODE_MAP:
+ return isSetNodeMap();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof TPathsDump)
+ return this.equals((TPathsDump)that);
+ return false;
+ }
+
+ public boolean equals(TPathsDump that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_rootId = true;
+ boolean that_present_rootId = true;
+ if (this_present_rootId || that_present_rootId) {
+ if (!(this_present_rootId && that_present_rootId))
+ return false;
+ if (this.rootId != that.rootId)
+ return false;
+ }
+
+ boolean this_present_nodeMap = true && this.isSetNodeMap();
+ boolean that_present_nodeMap = true && that.isSetNodeMap();
+ if (this_present_nodeMap || that_present_nodeMap) {
+ if (!(this_present_nodeMap && that_present_nodeMap))
+ return false;
+ if (!this.nodeMap.equals(that.nodeMap))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ HashCodeBuilder builder = new HashCodeBuilder();
+
+ boolean present_rootId = true;
+ builder.append(present_rootId);
+ if (present_rootId)
+ builder.append(rootId);
+
+ boolean present_nodeMap = true && (isSetNodeMap());
+ builder.append(present_nodeMap);
+ if (present_nodeMap)
+ builder.append(nodeMap);
+
+ return builder.toHashCode();
+ }
+
+ public int compareTo(TPathsDump other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+ TPathsDump typedOther = (TPathsDump)other;
+
+ lastComparison = Boolean.valueOf(isSetRootId()).compareTo(typedOther.isSetRootId());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetRootId()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.rootId, typedOther.rootId);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetNodeMap()).compareTo(typedOther.isSetNodeMap());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetNodeMap()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.nodeMap, typedOther.nodeMap);
+ 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("TPathsDump(");
+ boolean first = true;
+
+ sb.append("rootId:");
+ sb.append(this.rootId);
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("nodeMap:");
+ if (this.nodeMap == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.nodeMap);
+ }
+ first = false;
+ sb.append(")");
+ return sb.toString();
+ }
+
+ public void validate() throws org.apache.thrift.TException {
+ // check for required fields
+ if (!isSetRootId()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'rootId' is unset! Struct:" + toString());
+ }
+
+ if (!isSetNodeMap()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'nodeMap' 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 TPathsDumpStandardSchemeFactory implements SchemeFactory {
+ public TPathsDumpStandardScheme getScheme() {
+ return new TPathsDumpStandardScheme();
+ }
+ }
+
+ private static class TPathsDumpStandardScheme extends StandardScheme<TPathsDump> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, TPathsDump 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: // ROOT_ID
+ if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
+ struct.rootId = iprot.readI32();
+ struct.setRootIdIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 2: // NODE_MAP
+ if (schemeField.type == org.apache.thrift.protocol.TType.MAP) {
+ {
+ org.apache.thrift.protocol.TMap _map104 = iprot.readMapBegin();
+ struct.nodeMap = new HashMap<Integer,TPathEntry>(2*_map104.size);
+ for (int _i105 = 0; _i105 < _map104.size; ++_i105)
+ {
+ int _key106; // required
+ TPathEntry _val107; // required
+ _key106 = iprot.readI32();
+ _val107 = new TPathEntry();
+ _val107.read(iprot);
+ struct.nodeMap.put(_key106, _val107);
+ }
+ iprot.readMapEnd();
+ }
+ struct.setNodeMapIsSet(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, TPathsDump struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ oprot.writeFieldBegin(ROOT_ID_FIELD_DESC);
+ oprot.writeI32(struct.rootId);
+ oprot.writeFieldEnd();
+ if (struct.nodeMap != null) {
+ oprot.writeFieldBegin(NODE_MAP_FIELD_DESC);
+ {
+ oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.I32, org.apache.thrift.protocol.TType.STRUCT, struct.nodeMap.size()));
+ for (Map.Entry<Integer, TPathEntry> _iter108 : struct.nodeMap.entrySet())
+ {
+ oprot.writeI32(_iter108.getKey());
+ _iter108.getValue().write(oprot);
+ }
+ oprot.writeMapEnd();
+ }
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class TPathsDumpTupleSchemeFactory implements SchemeFactory {
+ public TPathsDumpTupleScheme getScheme() {
+ return new TPathsDumpTupleScheme();
+ }
+ }
+
+ private static class TPathsDumpTupleScheme extends TupleScheme<TPathsDump> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, TPathsDump struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ oprot.writeI32(struct.rootId);
+ {
+ oprot.writeI32(struct.nodeMap.size());
+ for (Map.Entry<Integer, TPathEntry> _iter109 : struct.nodeMap.entrySet())
+ {
+ oprot.writeI32(_iter109.getKey());
+ _iter109.getValue().write(oprot);
+ }
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, TPathsDump struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ struct.rootId = iprot.readI32();
+ struct.setRootIdIsSet(true);
+ {
+ org.apache.thrift.protocol.TMap _map110 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.I32, org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
+ struct.nodeMap = new HashMap<Integer,TPathEntry>(2*_map110.size);
+ for (int _i111 = 0; _i111 < _map110.size; ++_i111)
+ {
+ int _key112; // required
+ TPathEntry _val113; // required
+ _key112 = iprot.readI32();
+ _val113 = new TPathEntry();
+ _val113.read(iprot);
+ struct.nodeMap.put(_key112, _val113);
+ }
+ }
+ struct.setNodeMapIsSet(true);
+ }
+ }
+
+}
+
[04/25] SENTRY-432. HDFS ingration. Initial patch
Posted by pr...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TRenamePrivilegesRequest.java
----------------------------------------------------------------------
diff --git a/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TRenamePrivilegesRequest.java b/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TRenamePrivilegesRequest.java
new file mode 100644
index 0000000..a2bc805
--- /dev/null
+++ b/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TRenamePrivilegesRequest.java
@@ -0,0 +1,698 @@
+/**
+ * Autogenerated by Thrift Compiler (0.9.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+package org.apache.sentry.provider.db.service.thrift;
+
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EnumMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.EnumSet;
+import java.util.Collections;
+import java.util.BitSet;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class TRenamePrivilegesRequest implements org.apache.thrift.TBase<TRenamePrivilegesRequest, TRenamePrivilegesRequest._Fields>, java.io.Serializable, Cloneable {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TRenamePrivilegesRequest");
+
+ private static final org.apache.thrift.protocol.TField PROTOCOL_VERSION_FIELD_DESC = new org.apache.thrift.protocol.TField("protocol_version", org.apache.thrift.protocol.TType.I32, (short)1);
+ private static final org.apache.thrift.protocol.TField REQUESTOR_USER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("requestorUserName", org.apache.thrift.protocol.TType.STRING, (short)2);
+ private static final org.apache.thrift.protocol.TField OLD_AUTHORIZABLE_FIELD_DESC = new org.apache.thrift.protocol.TField("oldAuthorizable", org.apache.thrift.protocol.TType.STRUCT, (short)3);
+ private static final org.apache.thrift.protocol.TField NEW_AUTHORIZABLE_FIELD_DESC = new org.apache.thrift.protocol.TField("newAuthorizable", org.apache.thrift.protocol.TType.STRUCT, (short)4);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new TRenamePrivilegesRequestStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new TRenamePrivilegesRequestTupleSchemeFactory());
+ }
+
+ private int protocol_version; // required
+ private String requestorUserName; // required
+ private TSentryAuthorizable oldAuthorizable; // required
+ private TSentryAuthorizable newAuthorizable; // required
+
+ /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+ public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+ PROTOCOL_VERSION((short)1, "protocol_version"),
+ REQUESTOR_USER_NAME((short)2, "requestorUserName"),
+ OLD_AUTHORIZABLE((short)3, "oldAuthorizable"),
+ NEW_AUTHORIZABLE((short)4, "newAuthorizable");
+
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+ static {
+ for (_Fields field : EnumSet.allOf(_Fields.class)) {
+ byName.put(field.getFieldName(), field);
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, or null if its not found.
+ */
+ public static _Fields findByThriftId(int fieldId) {
+ switch(fieldId) {
+ case 1: // PROTOCOL_VERSION
+ return PROTOCOL_VERSION;
+ case 2: // REQUESTOR_USER_NAME
+ return REQUESTOR_USER_NAME;
+ case 3: // OLD_AUTHORIZABLE
+ return OLD_AUTHORIZABLE;
+ case 4: // NEW_AUTHORIZABLE
+ return NEW_AUTHORIZABLE;
+ default:
+ return null;
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, throwing an exception
+ * if it is not found.
+ */
+ public static _Fields findByThriftIdOrThrow(int fieldId) {
+ _Fields fields = findByThriftId(fieldId);
+ if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+ return fields;
+ }
+
+ /**
+ * Find the _Fields constant that matches name, or null if its not found.
+ */
+ public static _Fields findByName(String name) {
+ return byName.get(name);
+ }
+
+ private final short _thriftId;
+ private final String _fieldName;
+
+ _Fields(short thriftId, String fieldName) {
+ _thriftId = thriftId;
+ _fieldName = fieldName;
+ }
+
+ public short getThriftFieldId() {
+ return _thriftId;
+ }
+
+ public String getFieldName() {
+ return _fieldName;
+ }
+ }
+
+ // isset id assignments
+ private static final int __PROTOCOL_VERSION_ISSET_ID = 0;
+ private byte __isset_bitfield = 0;
+ public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+ static {
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+ tmpMap.put(_Fields.PROTOCOL_VERSION, new org.apache.thrift.meta_data.FieldMetaData("protocol_version", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
+ tmpMap.put(_Fields.REQUESTOR_USER_NAME, new org.apache.thrift.meta_data.FieldMetaData("requestorUserName", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields.OLD_AUTHORIZABLE, new org.apache.thrift.meta_data.FieldMetaData("oldAuthorizable", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TSentryAuthorizable.class)));
+ tmpMap.put(_Fields.NEW_AUTHORIZABLE, new org.apache.thrift.meta_data.FieldMetaData("newAuthorizable", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TSentryAuthorizable.class)));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TRenamePrivilegesRequest.class, metaDataMap);
+ }
+
+ public TRenamePrivilegesRequest() {
+ this.protocol_version = 1;
+
+ }
+
+ public TRenamePrivilegesRequest(
+ int protocol_version,
+ String requestorUserName,
+ TSentryAuthorizable oldAuthorizable,
+ TSentryAuthorizable newAuthorizable)
+ {
+ this();
+ this.protocol_version = protocol_version;
+ setProtocol_versionIsSet(true);
+ this.requestorUserName = requestorUserName;
+ this.oldAuthorizable = oldAuthorizable;
+ this.newAuthorizable = newAuthorizable;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public TRenamePrivilegesRequest(TRenamePrivilegesRequest other) {
+ __isset_bitfield = other.__isset_bitfield;
+ this.protocol_version = other.protocol_version;
+ if (other.isSetRequestorUserName()) {
+ this.requestorUserName = other.requestorUserName;
+ }
+ if (other.isSetOldAuthorizable()) {
+ this.oldAuthorizable = new TSentryAuthorizable(other.oldAuthorizable);
+ }
+ if (other.isSetNewAuthorizable()) {
+ this.newAuthorizable = new TSentryAuthorizable(other.newAuthorizable);
+ }
+ }
+
+ public TRenamePrivilegesRequest deepCopy() {
+ return new TRenamePrivilegesRequest(this);
+ }
+
+ @Override
+ public void clear() {
+ this.protocol_version = 1;
+
+ this.requestorUserName = null;
+ this.oldAuthorizable = null;
+ this.newAuthorizable = null;
+ }
+
+ public int getProtocol_version() {
+ return this.protocol_version;
+ }
+
+ public void setProtocol_version(int protocol_version) {
+ this.protocol_version = protocol_version;
+ setProtocol_versionIsSet(true);
+ }
+
+ public void unsetProtocol_version() {
+ __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __PROTOCOL_VERSION_ISSET_ID);
+ }
+
+ /** Returns true if field protocol_version is set (has been assigned a value) and false otherwise */
+ public boolean isSetProtocol_version() {
+ return EncodingUtils.testBit(__isset_bitfield, __PROTOCOL_VERSION_ISSET_ID);
+ }
+
+ public void setProtocol_versionIsSet(boolean value) {
+ __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __PROTOCOL_VERSION_ISSET_ID, value);
+ }
+
+ public String getRequestorUserName() {
+ return this.requestorUserName;
+ }
+
+ public void setRequestorUserName(String requestorUserName) {
+ this.requestorUserName = requestorUserName;
+ }
+
+ public void unsetRequestorUserName() {
+ this.requestorUserName = null;
+ }
+
+ /** Returns true if field requestorUserName is set (has been assigned a value) and false otherwise */
+ public boolean isSetRequestorUserName() {
+ return this.requestorUserName != null;
+ }
+
+ public void setRequestorUserNameIsSet(boolean value) {
+ if (!value) {
+ this.requestorUserName = null;
+ }
+ }
+
+ public TSentryAuthorizable getOldAuthorizable() {
+ return this.oldAuthorizable;
+ }
+
+ public void setOldAuthorizable(TSentryAuthorizable oldAuthorizable) {
+ this.oldAuthorizable = oldAuthorizable;
+ }
+
+ public void unsetOldAuthorizable() {
+ this.oldAuthorizable = null;
+ }
+
+ /** Returns true if field oldAuthorizable is set (has been assigned a value) and false otherwise */
+ public boolean isSetOldAuthorizable() {
+ return this.oldAuthorizable != null;
+ }
+
+ public void setOldAuthorizableIsSet(boolean value) {
+ if (!value) {
+ this.oldAuthorizable = null;
+ }
+ }
+
+ public TSentryAuthorizable getNewAuthorizable() {
+ return this.newAuthorizable;
+ }
+
+ public void setNewAuthorizable(TSentryAuthorizable newAuthorizable) {
+ this.newAuthorizable = newAuthorizable;
+ }
+
+ public void unsetNewAuthorizable() {
+ this.newAuthorizable = null;
+ }
+
+ /** Returns true if field newAuthorizable is set (has been assigned a value) and false otherwise */
+ public boolean isSetNewAuthorizable() {
+ return this.newAuthorizable != null;
+ }
+
+ public void setNewAuthorizableIsSet(boolean value) {
+ if (!value) {
+ this.newAuthorizable = null;
+ }
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case PROTOCOL_VERSION:
+ if (value == null) {
+ unsetProtocol_version();
+ } else {
+ setProtocol_version((Integer)value);
+ }
+ break;
+
+ case REQUESTOR_USER_NAME:
+ if (value == null) {
+ unsetRequestorUserName();
+ } else {
+ setRequestorUserName((String)value);
+ }
+ break;
+
+ case OLD_AUTHORIZABLE:
+ if (value == null) {
+ unsetOldAuthorizable();
+ } else {
+ setOldAuthorizable((TSentryAuthorizable)value);
+ }
+ break;
+
+ case NEW_AUTHORIZABLE:
+ if (value == null) {
+ unsetNewAuthorizable();
+ } else {
+ setNewAuthorizable((TSentryAuthorizable)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case PROTOCOL_VERSION:
+ return Integer.valueOf(getProtocol_version());
+
+ case REQUESTOR_USER_NAME:
+ return getRequestorUserName();
+
+ case OLD_AUTHORIZABLE:
+ return getOldAuthorizable();
+
+ case NEW_AUTHORIZABLE:
+ return getNewAuthorizable();
+
+ }
+ throw new IllegalStateException();
+ }
+
+ /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+ public boolean isSet(_Fields field) {
+ if (field == null) {
+ throw new IllegalArgumentException();
+ }
+
+ switch (field) {
+ case PROTOCOL_VERSION:
+ return isSetProtocol_version();
+ case REQUESTOR_USER_NAME:
+ return isSetRequestorUserName();
+ case OLD_AUTHORIZABLE:
+ return isSetOldAuthorizable();
+ case NEW_AUTHORIZABLE:
+ return isSetNewAuthorizable();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof TRenamePrivilegesRequest)
+ return this.equals((TRenamePrivilegesRequest)that);
+ return false;
+ }
+
+ public boolean equals(TRenamePrivilegesRequest that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_protocol_version = true;
+ boolean that_present_protocol_version = true;
+ if (this_present_protocol_version || that_present_protocol_version) {
+ if (!(this_present_protocol_version && that_present_protocol_version))
+ return false;
+ if (this.protocol_version != that.protocol_version)
+ return false;
+ }
+
+ boolean this_present_requestorUserName = true && this.isSetRequestorUserName();
+ boolean that_present_requestorUserName = true && that.isSetRequestorUserName();
+ if (this_present_requestorUserName || that_present_requestorUserName) {
+ if (!(this_present_requestorUserName && that_present_requestorUserName))
+ return false;
+ if (!this.requestorUserName.equals(that.requestorUserName))
+ return false;
+ }
+
+ boolean this_present_oldAuthorizable = true && this.isSetOldAuthorizable();
+ boolean that_present_oldAuthorizable = true && that.isSetOldAuthorizable();
+ if (this_present_oldAuthorizable || that_present_oldAuthorizable) {
+ if (!(this_present_oldAuthorizable && that_present_oldAuthorizable))
+ return false;
+ if (!this.oldAuthorizable.equals(that.oldAuthorizable))
+ return false;
+ }
+
+ boolean this_present_newAuthorizable = true && this.isSetNewAuthorizable();
+ boolean that_present_newAuthorizable = true && that.isSetNewAuthorizable();
+ if (this_present_newAuthorizable || that_present_newAuthorizable) {
+ if (!(this_present_newAuthorizable && that_present_newAuthorizable))
+ return false;
+ if (!this.newAuthorizable.equals(that.newAuthorizable))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ HashCodeBuilder builder = new HashCodeBuilder();
+
+ boolean present_protocol_version = true;
+ builder.append(present_protocol_version);
+ if (present_protocol_version)
+ builder.append(protocol_version);
+
+ boolean present_requestorUserName = true && (isSetRequestorUserName());
+ builder.append(present_requestorUserName);
+ if (present_requestorUserName)
+ builder.append(requestorUserName);
+
+ boolean present_oldAuthorizable = true && (isSetOldAuthorizable());
+ builder.append(present_oldAuthorizable);
+ if (present_oldAuthorizable)
+ builder.append(oldAuthorizable);
+
+ boolean present_newAuthorizable = true && (isSetNewAuthorizable());
+ builder.append(present_newAuthorizable);
+ if (present_newAuthorizable)
+ builder.append(newAuthorizable);
+
+ return builder.toHashCode();
+ }
+
+ public int compareTo(TRenamePrivilegesRequest other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+ TRenamePrivilegesRequest typedOther = (TRenamePrivilegesRequest)other;
+
+ lastComparison = Boolean.valueOf(isSetProtocol_version()).compareTo(typedOther.isSetProtocol_version());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetProtocol_version()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.protocol_version, typedOther.protocol_version);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetRequestorUserName()).compareTo(typedOther.isSetRequestorUserName());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetRequestorUserName()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.requestorUserName, typedOther.requestorUserName);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetOldAuthorizable()).compareTo(typedOther.isSetOldAuthorizable());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetOldAuthorizable()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.oldAuthorizable, typedOther.oldAuthorizable);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetNewAuthorizable()).compareTo(typedOther.isSetNewAuthorizable());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetNewAuthorizable()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.newAuthorizable, typedOther.newAuthorizable);
+ 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("TRenamePrivilegesRequest(");
+ boolean first = true;
+
+ sb.append("protocol_version:");
+ sb.append(this.protocol_version);
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("requestorUserName:");
+ if (this.requestorUserName == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.requestorUserName);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("oldAuthorizable:");
+ if (this.oldAuthorizable == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.oldAuthorizable);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("newAuthorizable:");
+ if (this.newAuthorizable == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.newAuthorizable);
+ }
+ first = false;
+ sb.append(")");
+ return sb.toString();
+ }
+
+ public void validate() throws org.apache.thrift.TException {
+ // check for required fields
+ if (!isSetProtocol_version()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'protocol_version' is unset! Struct:" + toString());
+ }
+
+ if (!isSetRequestorUserName()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'requestorUserName' is unset! Struct:" + toString());
+ }
+
+ if (!isSetOldAuthorizable()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'oldAuthorizable' is unset! Struct:" + toString());
+ }
+
+ if (!isSetNewAuthorizable()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'newAuthorizable' is unset! Struct:" + toString());
+ }
+
+ // check for sub-struct validity
+ if (oldAuthorizable != null) {
+ oldAuthorizable.validate();
+ }
+ if (newAuthorizable != null) {
+ newAuthorizable.validate();
+ }
+ }
+
+ private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+ try {
+ write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+ try {
+ // 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 TRenamePrivilegesRequestStandardSchemeFactory implements SchemeFactory {
+ public TRenamePrivilegesRequestStandardScheme getScheme() {
+ return new TRenamePrivilegesRequestStandardScheme();
+ }
+ }
+
+ private static class TRenamePrivilegesRequestStandardScheme extends StandardScheme<TRenamePrivilegesRequest> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, TRenamePrivilegesRequest struct) throws org.apache.thrift.TException {
+ org.apache.thrift.protocol.TField schemeField;
+ iprot.readStructBegin();
+ while (true)
+ {
+ schemeField = iprot.readFieldBegin();
+ if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
+ break;
+ }
+ switch (schemeField.id) {
+ case 1: // PROTOCOL_VERSION
+ if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
+ struct.protocol_version = iprot.readI32();
+ struct.setProtocol_versionIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 2: // REQUESTOR_USER_NAME
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.requestorUserName = iprot.readString();
+ struct.setRequestorUserNameIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 3: // OLD_AUTHORIZABLE
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+ struct.oldAuthorizable = new TSentryAuthorizable();
+ struct.oldAuthorizable.read(iprot);
+ struct.setOldAuthorizableIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 4: // NEW_AUTHORIZABLE
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+ struct.newAuthorizable = new TSentryAuthorizable();
+ struct.newAuthorizable.read(iprot);
+ struct.setNewAuthorizableIsSet(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, TRenamePrivilegesRequest struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ oprot.writeFieldBegin(PROTOCOL_VERSION_FIELD_DESC);
+ oprot.writeI32(struct.protocol_version);
+ oprot.writeFieldEnd();
+ if (struct.requestorUserName != null) {
+ oprot.writeFieldBegin(REQUESTOR_USER_NAME_FIELD_DESC);
+ oprot.writeString(struct.requestorUserName);
+ oprot.writeFieldEnd();
+ }
+ if (struct.oldAuthorizable != null) {
+ oprot.writeFieldBegin(OLD_AUTHORIZABLE_FIELD_DESC);
+ struct.oldAuthorizable.write(oprot);
+ oprot.writeFieldEnd();
+ }
+ if (struct.newAuthorizable != null) {
+ oprot.writeFieldBegin(NEW_AUTHORIZABLE_FIELD_DESC);
+ struct.newAuthorizable.write(oprot);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class TRenamePrivilegesRequestTupleSchemeFactory implements SchemeFactory {
+ public TRenamePrivilegesRequestTupleScheme getScheme() {
+ return new TRenamePrivilegesRequestTupleScheme();
+ }
+ }
+
+ private static class TRenamePrivilegesRequestTupleScheme extends TupleScheme<TRenamePrivilegesRequest> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, TRenamePrivilegesRequest struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ oprot.writeI32(struct.protocol_version);
+ oprot.writeString(struct.requestorUserName);
+ struct.oldAuthorizable.write(oprot);
+ struct.newAuthorizable.write(oprot);
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, TRenamePrivilegesRequest struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ struct.protocol_version = iprot.readI32();
+ struct.setProtocol_versionIsSet(true);
+ struct.requestorUserName = iprot.readString();
+ struct.setRequestorUserNameIsSet(true);
+ struct.oldAuthorizable = new TSentryAuthorizable();
+ struct.oldAuthorizable.read(iprot);
+ struct.setOldAuthorizableIsSet(true);
+ struct.newAuthorizable = new TSentryAuthorizable();
+ struct.newAuthorizable.read(iprot);
+ struct.setNewAuthorizableIsSet(true);
+ }
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TRenamePrivilegesResponse.java
----------------------------------------------------------------------
diff --git a/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TRenamePrivilegesResponse.java b/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TRenamePrivilegesResponse.java
new file mode 100644
index 0000000..39e7f07
--- /dev/null
+++ b/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TRenamePrivilegesResponse.java
@@ -0,0 +1,390 @@
+/**
+ * Autogenerated by Thrift Compiler (0.9.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+package org.apache.sentry.provider.db.service.thrift;
+
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EnumMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.EnumSet;
+import java.util.Collections;
+import java.util.BitSet;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class TRenamePrivilegesResponse implements org.apache.thrift.TBase<TRenamePrivilegesResponse, TRenamePrivilegesResponse._Fields>, java.io.Serializable, Cloneable {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TRenamePrivilegesResponse");
+
+ private static final org.apache.thrift.protocol.TField STATUS_FIELD_DESC = new org.apache.thrift.protocol.TField("status", org.apache.thrift.protocol.TType.STRUCT, (short)1);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new TRenamePrivilegesResponseStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new TRenamePrivilegesResponseTupleSchemeFactory());
+ }
+
+ private org.apache.sentry.service.thrift.TSentryResponseStatus status; // required
+
+ /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+ public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+ STATUS((short)1, "status");
+
+ private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+ static {
+ for (_Fields field : EnumSet.allOf(_Fields.class)) {
+ byName.put(field.getFieldName(), field);
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, or null if its not found.
+ */
+ public static _Fields findByThriftId(int fieldId) {
+ switch(fieldId) {
+ case 1: // STATUS
+ return STATUS;
+ default:
+ return null;
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches fieldId, throwing an exception
+ * if it is not found.
+ */
+ public static _Fields findByThriftIdOrThrow(int fieldId) {
+ _Fields fields = findByThriftId(fieldId);
+ if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+ return fields;
+ }
+
+ /**
+ * Find the _Fields constant that matches name, or null if its not found.
+ */
+ public static _Fields findByName(String name) {
+ return byName.get(name);
+ }
+
+ private final short _thriftId;
+ private final String _fieldName;
+
+ _Fields(short thriftId, String fieldName) {
+ _thriftId = thriftId;
+ _fieldName = fieldName;
+ }
+
+ public short getThriftFieldId() {
+ return _thriftId;
+ }
+
+ public String getFieldName() {
+ return _fieldName;
+ }
+ }
+
+ // isset id assignments
+ public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+ static {
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+ tmpMap.put(_Fields.STATUS, new org.apache.thrift.meta_data.FieldMetaData("status", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.sentry.service.thrift.TSentryResponseStatus.class)));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TRenamePrivilegesResponse.class, metaDataMap);
+ }
+
+ public TRenamePrivilegesResponse() {
+ }
+
+ public TRenamePrivilegesResponse(
+ org.apache.sentry.service.thrift.TSentryResponseStatus status)
+ {
+ this();
+ this.status = status;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public TRenamePrivilegesResponse(TRenamePrivilegesResponse other) {
+ if (other.isSetStatus()) {
+ this.status = new org.apache.sentry.service.thrift.TSentryResponseStatus(other.status);
+ }
+ }
+
+ public TRenamePrivilegesResponse deepCopy() {
+ return new TRenamePrivilegesResponse(this);
+ }
+
+ @Override
+ public void clear() {
+ this.status = null;
+ }
+
+ public org.apache.sentry.service.thrift.TSentryResponseStatus getStatus() {
+ return this.status;
+ }
+
+ public void setStatus(org.apache.sentry.service.thrift.TSentryResponseStatus status) {
+ this.status = status;
+ }
+
+ public void unsetStatus() {
+ this.status = null;
+ }
+
+ /** Returns true if field status is set (has been assigned a value) and false otherwise */
+ public boolean isSetStatus() {
+ return this.status != null;
+ }
+
+ public void setStatusIsSet(boolean value) {
+ if (!value) {
+ this.status = null;
+ }
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case STATUS:
+ if (value == null) {
+ unsetStatus();
+ } else {
+ setStatus((org.apache.sentry.service.thrift.TSentryResponseStatus)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case STATUS:
+ return getStatus();
+
+ }
+ throw new IllegalStateException();
+ }
+
+ /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+ public boolean isSet(_Fields field) {
+ if (field == null) {
+ throw new IllegalArgumentException();
+ }
+
+ switch (field) {
+ case STATUS:
+ return isSetStatus();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof TRenamePrivilegesResponse)
+ return this.equals((TRenamePrivilegesResponse)that);
+ return false;
+ }
+
+ public boolean equals(TRenamePrivilegesResponse that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_status = true && this.isSetStatus();
+ boolean that_present_status = true && that.isSetStatus();
+ if (this_present_status || that_present_status) {
+ if (!(this_present_status && that_present_status))
+ return false;
+ if (!this.status.equals(that.status))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ HashCodeBuilder builder = new HashCodeBuilder();
+
+ boolean present_status = true && (isSetStatus());
+ builder.append(present_status);
+ if (present_status)
+ builder.append(status);
+
+ return builder.toHashCode();
+ }
+
+ public int compareTo(TRenamePrivilegesResponse other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+ TRenamePrivilegesResponse typedOther = (TRenamePrivilegesResponse)other;
+
+ lastComparison = Boolean.valueOf(isSetStatus()).compareTo(typedOther.isSetStatus());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetStatus()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.status, typedOther.status);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ 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("TRenamePrivilegesResponse(");
+ boolean first = true;
+
+ sb.append("status:");
+ if (this.status == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.status);
+ }
+ first = false;
+ sb.append(")");
+ return sb.toString();
+ }
+
+ public void validate() throws org.apache.thrift.TException {
+ // check for required fields
+ if (!isSetStatus()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'status' is unset! Struct:" + toString());
+ }
+
+ // check for sub-struct validity
+ if (status != null) {
+ status.validate();
+ }
+ }
+
+ private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+ try {
+ write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+ try {
+ read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+ } catch (org.apache.thrift.TException te) {
+ throw new java.io.IOException(te);
+ }
+ }
+
+ private static class TRenamePrivilegesResponseStandardSchemeFactory implements SchemeFactory {
+ public TRenamePrivilegesResponseStandardScheme getScheme() {
+ return new TRenamePrivilegesResponseStandardScheme();
+ }
+ }
+
+ private static class TRenamePrivilegesResponseStandardScheme extends StandardScheme<TRenamePrivilegesResponse> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, TRenamePrivilegesResponse struct) throws org.apache.thrift.TException {
+ org.apache.thrift.protocol.TField schemeField;
+ iprot.readStructBegin();
+ while (true)
+ {
+ schemeField = iprot.readFieldBegin();
+ if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
+ break;
+ }
+ switch (schemeField.id) {
+ case 1: // STATUS
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+ struct.status = new org.apache.sentry.service.thrift.TSentryResponseStatus();
+ struct.status.read(iprot);
+ struct.setStatusIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ 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, TRenamePrivilegesResponse struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.status != null) {
+ oprot.writeFieldBegin(STATUS_FIELD_DESC);
+ struct.status.write(oprot);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class TRenamePrivilegesResponseTupleSchemeFactory implements SchemeFactory {
+ public TRenamePrivilegesResponseTupleScheme getScheme() {
+ return new TRenamePrivilegesResponseTupleScheme();
+ }
+ }
+
+ private static class TRenamePrivilegesResponseTupleScheme extends TupleScheme<TRenamePrivilegesResponse> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, TRenamePrivilegesResponse struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ struct.status.write(oprot);
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, TRenamePrivilegesResponse struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ struct.status = new org.apache.sentry.service.thrift.TSentryResponseStatus();
+ struct.status.read(iprot);
+ struct.setStatusIsSet(true);
+ }
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TRoleChanges.java
----------------------------------------------------------------------
diff --git a/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TRoleChanges.java b/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TRoleChanges.java
new file mode 100644
index 0000000..7a314ad
--- /dev/null
+++ b/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TRoleChanges.java
@@ -0,0 +1,691 @@
+/**
+ * Autogenerated by Thrift Compiler (0.9.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+package org.apache.sentry.provider.db.service.thrift;
+
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EnumMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.EnumSet;
+import java.util.Collections;
+import java.util.BitSet;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class TRoleChanges implements org.apache.thrift.TBase<TRoleChanges, TRoleChanges._Fields>, java.io.Serializable, Cloneable {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TRoleChanges");
+
+ private static final org.apache.thrift.protocol.TField ROLE_FIELD_DESC = new org.apache.thrift.protocol.TField("role", org.apache.thrift.protocol.TType.STRING, (short)1);
+ private static final org.apache.thrift.protocol.TField ADD_GROUPS_FIELD_DESC = new org.apache.thrift.protocol.TField("addGroups", org.apache.thrift.protocol.TType.LIST, (short)2);
+ private static final org.apache.thrift.protocol.TField DEL_GROUPS_FIELD_DESC = new org.apache.thrift.protocol.TField("delGroups", org.apache.thrift.protocol.TType.LIST, (short)3);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new TRoleChangesStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new TRoleChangesTupleSchemeFactory());
+ }
+
+ private String role; // required
+ private List<String> addGroups; // required
+ private List<String> delGroups; // 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((short)1, "role"),
+ ADD_GROUPS((short)2, "addGroups"),
+ DEL_GROUPS((short)3, "delGroups");
+
+ 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
+ return ROLE;
+ case 2: // ADD_GROUPS
+ return ADD_GROUPS;
+ case 3: // DEL_GROUPS
+ return DEL_GROUPS;
+ 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, new org.apache.thrift.meta_data.FieldMetaData("role", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields.ADD_GROUPS, new org.apache.thrift.meta_data.FieldMetaData("addGroups", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
+ tmpMap.put(_Fields.DEL_GROUPS, new org.apache.thrift.meta_data.FieldMetaData("delGroups", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TRoleChanges.class, metaDataMap);
+ }
+
+ public TRoleChanges() {
+ }
+
+ public TRoleChanges(
+ String role,
+ List<String> addGroups,
+ List<String> delGroups)
+ {
+ this();
+ this.role = role;
+ this.addGroups = addGroups;
+ this.delGroups = delGroups;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public TRoleChanges(TRoleChanges other) {
+ if (other.isSetRole()) {
+ this.role = other.role;
+ }
+ if (other.isSetAddGroups()) {
+ List<String> __this__addGroups = new ArrayList<String>();
+ for (String other_element : other.addGroups) {
+ __this__addGroups.add(other_element);
+ }
+ this.addGroups = __this__addGroups;
+ }
+ if (other.isSetDelGroups()) {
+ List<String> __this__delGroups = new ArrayList<String>();
+ for (String other_element : other.delGroups) {
+ __this__delGroups.add(other_element);
+ }
+ this.delGroups = __this__delGroups;
+ }
+ }
+
+ public TRoleChanges deepCopy() {
+ return new TRoleChanges(this);
+ }
+
+ @Override
+ public void clear() {
+ this.role = null;
+ this.addGroups = null;
+ this.delGroups = null;
+ }
+
+ public String getRole() {
+ return this.role;
+ }
+
+ public void setRole(String role) {
+ this.role = role;
+ }
+
+ public void unsetRole() {
+ this.role = null;
+ }
+
+ /** Returns true if field role is set (has been assigned a value) and false otherwise */
+ public boolean isSetRole() {
+ return this.role != null;
+ }
+
+ public void setRoleIsSet(boolean value) {
+ if (!value) {
+ this.role = null;
+ }
+ }
+
+ public int getAddGroupsSize() {
+ return (this.addGroups == null) ? 0 : this.addGroups.size();
+ }
+
+ public java.util.Iterator<String> getAddGroupsIterator() {
+ return (this.addGroups == null) ? null : this.addGroups.iterator();
+ }
+
+ public void addToAddGroups(String elem) {
+ if (this.addGroups == null) {
+ this.addGroups = new ArrayList<String>();
+ }
+ this.addGroups.add(elem);
+ }
+
+ public List<String> getAddGroups() {
+ return this.addGroups;
+ }
+
+ public void setAddGroups(List<String> addGroups) {
+ this.addGroups = addGroups;
+ }
+
+ public void unsetAddGroups() {
+ this.addGroups = null;
+ }
+
+ /** Returns true if field addGroups is set (has been assigned a value) and false otherwise */
+ public boolean isSetAddGroups() {
+ return this.addGroups != null;
+ }
+
+ public void setAddGroupsIsSet(boolean value) {
+ if (!value) {
+ this.addGroups = null;
+ }
+ }
+
+ public int getDelGroupsSize() {
+ return (this.delGroups == null) ? 0 : this.delGroups.size();
+ }
+
+ public java.util.Iterator<String> getDelGroupsIterator() {
+ return (this.delGroups == null) ? null : this.delGroups.iterator();
+ }
+
+ public void addToDelGroups(String elem) {
+ if (this.delGroups == null) {
+ this.delGroups = new ArrayList<String>();
+ }
+ this.delGroups.add(elem);
+ }
+
+ public List<String> getDelGroups() {
+ return this.delGroups;
+ }
+
+ public void setDelGroups(List<String> delGroups) {
+ this.delGroups = delGroups;
+ }
+
+ public void unsetDelGroups() {
+ this.delGroups = null;
+ }
+
+ /** Returns true if field delGroups is set (has been assigned a value) and false otherwise */
+ public boolean isSetDelGroups() {
+ return this.delGroups != null;
+ }
+
+ public void setDelGroupsIsSet(boolean value) {
+ if (!value) {
+ this.delGroups = null;
+ }
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case ROLE:
+ if (value == null) {
+ unsetRole();
+ } else {
+ setRole((String)value);
+ }
+ break;
+
+ case ADD_GROUPS:
+ if (value == null) {
+ unsetAddGroups();
+ } else {
+ setAddGroups((List<String>)value);
+ }
+ break;
+
+ case DEL_GROUPS:
+ if (value == null) {
+ unsetDelGroups();
+ } else {
+ setDelGroups((List<String>)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case ROLE:
+ return getRole();
+
+ case ADD_GROUPS:
+ return getAddGroups();
+
+ case DEL_GROUPS:
+ return getDelGroups();
+
+ }
+ 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:
+ return isSetRole();
+ case ADD_GROUPS:
+ return isSetAddGroups();
+ case DEL_GROUPS:
+ return isSetDelGroups();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof TRoleChanges)
+ return this.equals((TRoleChanges)that);
+ return false;
+ }
+
+ public boolean equals(TRoleChanges that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_role = true && this.isSetRole();
+ boolean that_present_role = true && that.isSetRole();
+ if (this_present_role || that_present_role) {
+ if (!(this_present_role && that_present_role))
+ return false;
+ if (!this.role.equals(that.role))
+ return false;
+ }
+
+ boolean this_present_addGroups = true && this.isSetAddGroups();
+ boolean that_present_addGroups = true && that.isSetAddGroups();
+ if (this_present_addGroups || that_present_addGroups) {
+ if (!(this_present_addGroups && that_present_addGroups))
+ return false;
+ if (!this.addGroups.equals(that.addGroups))
+ return false;
+ }
+
+ boolean this_present_delGroups = true && this.isSetDelGroups();
+ boolean that_present_delGroups = true && that.isSetDelGroups();
+ if (this_present_delGroups || that_present_delGroups) {
+ if (!(this_present_delGroups && that_present_delGroups))
+ return false;
+ if (!this.delGroups.equals(that.delGroups))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ HashCodeBuilder builder = new HashCodeBuilder();
+
+ boolean present_role = true && (isSetRole());
+ builder.append(present_role);
+ if (present_role)
+ builder.append(role);
+
+ boolean present_addGroups = true && (isSetAddGroups());
+ builder.append(present_addGroups);
+ if (present_addGroups)
+ builder.append(addGroups);
+
+ boolean present_delGroups = true && (isSetDelGroups());
+ builder.append(present_delGroups);
+ if (present_delGroups)
+ builder.append(delGroups);
+
+ return builder.toHashCode();
+ }
+
+ public int compareTo(TRoleChanges other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+ TRoleChanges typedOther = (TRoleChanges)other;
+
+ lastComparison = Boolean.valueOf(isSetRole()).compareTo(typedOther.isSetRole());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetRole()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.role, typedOther.role);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetAddGroups()).compareTo(typedOther.isSetAddGroups());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetAddGroups()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.addGroups, typedOther.addGroups);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetDelGroups()).compareTo(typedOther.isSetDelGroups());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetDelGroups()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delGroups, typedOther.delGroups);
+ 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("TRoleChanges(");
+ boolean first = true;
+
+ sb.append("role:");
+ if (this.role == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.role);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("addGroups:");
+ if (this.addGroups == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.addGroups);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("delGroups:");
+ if (this.delGroups == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.delGroups);
+ }
+ first = false;
+ sb.append(")");
+ return sb.toString();
+ }
+
+ public void validate() throws org.apache.thrift.TException {
+ // check for required fields
+ if (!isSetRole()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'role' is unset! Struct:" + toString());
+ }
+
+ if (!isSetAddGroups()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'addGroups' is unset! Struct:" + toString());
+ }
+
+ if (!isSetDelGroups()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'delGroups' 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 TRoleChangesStandardSchemeFactory implements SchemeFactory {
+ public TRoleChangesStandardScheme getScheme() {
+ return new TRoleChangesStandardScheme();
+ }
+ }
+
+ private static class TRoleChangesStandardScheme extends StandardScheme<TRoleChanges> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, TRoleChanges 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
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.role = iprot.readString();
+ struct.setRoleIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 2: // ADD_GROUPS
+ if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
+ {
+ org.apache.thrift.protocol.TList _list142 = iprot.readListBegin();
+ struct.addGroups = new ArrayList<String>(_list142.size);
+ for (int _i143 = 0; _i143 < _list142.size; ++_i143)
+ {
+ String _elem144; // required
+ _elem144 = iprot.readString();
+ struct.addGroups.add(_elem144);
+ }
+ iprot.readListEnd();
+ }
+ struct.setAddGroupsIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 3: // DEL_GROUPS
+ if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
+ {
+ org.apache.thrift.protocol.TList _list145 = iprot.readListBegin();
+ struct.delGroups = new ArrayList<String>(_list145.size);
+ for (int _i146 = 0; _i146 < _list145.size; ++_i146)
+ {
+ String _elem147; // required
+ _elem147 = iprot.readString();
+ struct.delGroups.add(_elem147);
+ }
+ iprot.readListEnd();
+ }
+ struct.setDelGroupsIsSet(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, TRoleChanges struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.role != null) {
+ oprot.writeFieldBegin(ROLE_FIELD_DESC);
+ oprot.writeString(struct.role);
+ oprot.writeFieldEnd();
+ }
+ if (struct.addGroups != null) {
+ oprot.writeFieldBegin(ADD_GROUPS_FIELD_DESC);
+ {
+ oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.addGroups.size()));
+ for (String _iter148 : struct.addGroups)
+ {
+ oprot.writeString(_iter148);
+ }
+ oprot.writeListEnd();
+ }
+ oprot.writeFieldEnd();
+ }
+ if (struct.delGroups != null) {
+ oprot.writeFieldBegin(DEL_GROUPS_FIELD_DESC);
+ {
+ oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.delGroups.size()));
+ for (String _iter149 : struct.delGroups)
+ {
+ oprot.writeString(_iter149);
+ }
+ oprot.writeListEnd();
+ }
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class TRoleChangesTupleSchemeFactory implements SchemeFactory {
+ public TRoleChangesTupleScheme getScheme() {
+ return new TRoleChangesTupleScheme();
+ }
+ }
+
+ private static class TRoleChangesTupleScheme extends TupleScheme<TRoleChanges> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, TRoleChanges struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ oprot.writeString(struct.role);
+ {
+ oprot.writeI32(struct.addGroups.size());
+ for (String _iter150 : struct.addGroups)
+ {
+ oprot.writeString(_iter150);
+ }
+ }
+ {
+ oprot.writeI32(struct.delGroups.size());
+ for (String _iter151 : struct.delGroups)
+ {
+ oprot.writeString(_iter151);
+ }
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, TRoleChanges struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ struct.role = iprot.readString();
+ struct.setRoleIsSet(true);
+ {
+ org.apache.thrift.protocol.TList _list152 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
+ struct.addGroups = new ArrayList<String>(_list152.size);
+ for (int _i153 = 0; _i153 < _list152.size; ++_i153)
+ {
+ String _elem154; // required
+ _elem154 = iprot.readString();
+ struct.addGroups.add(_elem154);
+ }
+ }
+ struct.setAddGroupsIsSet(true);
+ {
+ org.apache.thrift.protocol.TList _list155 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
+ struct.delGroups = new ArrayList<String>(_list155.size);
+ for (int _i156 = 0; _i156 < _list155.size; ++_i156)
+ {
+ String _elem157; // required
+ _elem157 = iprot.readString();
+ struct.delGroups.add(_elem157);
+ }
+ }
+ struct.setDelGroupsIsSet(true);
+ }
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryActiveRoleSet.java
----------------------------------------------------------------------
diff --git a/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryActiveRoleSet.java b/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryActiveRoleSet.java
new file mode 100644
index 0000000..573dc26
--- /dev/null
+++ b/sentry-service-client/src/gen/thrift/gen-javabean/org/apache/sentry/provider/db/service/thrift/TSentryActiveRoleSet.java
@@ -0,0 +1,536 @@
+/**
+ * Autogenerated by Thrift Compiler (0.9.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+package org.apache.sentry.provider.db.service.thrift;
+
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EnumMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.EnumSet;
+import java.util.Collections;
+import java.util.BitSet;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class TSentryActiveRoleSet implements org.apache.thrift.TBase<TSentryActiveRoleSet, TSentryActiveRoleSet._Fields>, java.io.Serializable, Cloneable {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TSentryActiveRoleSet");
+
+ private static final org.apache.thrift.protocol.TField ALL_FIELD_DESC = new org.apache.thrift.protocol.TField("all", org.apache.thrift.protocol.TType.BOOL, (short)1);
+ private static final org.apache.thrift.protocol.TField ROLES_FIELD_DESC = new org.apache.thrift.protocol.TField("roles", org.apache.thrift.protocol.TType.SET, (short)2);
+
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new TSentryActiveRoleSetStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new TSentryActiveRoleSetTupleSchemeFactory());
+ }
+
+ private boolean all; // required
+ private Set<String> roles; // 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 {
+ ALL((short)1, "all"),
+ ROLES((short)2, "roles");
+
+ 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: // ALL
+ return ALL;
+ case 2: // ROLES
+ return ROLES;
+ 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 __ALL_ISSET_ID = 0;
+ private byte __isset_bitfield = 0;
+ public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+ static {
+ Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+ tmpMap.put(_Fields.ALL, new org.apache.thrift.meta_data.FieldMetaData("all", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
+ tmpMap.put(_Fields.ROLES, new org.apache.thrift.meta_data.FieldMetaData("roles", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.SetMetaData(org.apache.thrift.protocol.TType.SET,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TSentryActiveRoleSet.class, metaDataMap);
+ }
+
+ public TSentryActiveRoleSet() {
+ }
+
+ public TSentryActiveRoleSet(
+ boolean all,
+ Set<String> roles)
+ {
+ this();
+ this.all = all;
+ setAllIsSet(true);
+ this.roles = roles;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public TSentryActiveRoleSet(TSentryActiveRoleSet other) {
+ __isset_bitfield = other.__isset_bitfield;
+ this.all = other.all;
+ if (other.isSetRoles()) {
+ Set<String> __this__roles = new HashSet<String>();
+ for (String other_element : other.roles) {
+ __this__roles.add(other_element);
+ }
+ this.roles = __this__roles;
+ }
+ }
+
+ public TSentryActiveRoleSet deepCopy() {
+ return new TSentryActiveRoleSet(this);
+ }
+
+ @Override
+ public void clear() {
+ setAllIsSet(false);
+ this.all = false;
+ this.roles = null;
+ }
+
+ public boolean isAll() {
+ return this.all;
+ }
+
+ public void setAll(boolean all) {
+ this.all = all;
+ setAllIsSet(true);
+ }
+
+ public void unsetAll() {
+ __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __ALL_ISSET_ID);
+ }
+
+ /** Returns true if field all is set (has been assigned a value) and false otherwise */
+ public boolean isSetAll() {
+ return EncodingUtils.testBit(__isset_bitfield, __ALL_ISSET_ID);
+ }
+
+ public void setAllIsSet(boolean value) {
+ __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __ALL_ISSET_ID, value);
+ }
+
+ public int getRolesSize() {
+ return (this.roles == null) ? 0 : this.roles.size();
+ }
+
+ public java.util.Iterator<String> getRolesIterator() {
+ return (this.roles == null) ? null : this.roles.iterator();
+ }
+
+ public void addToRoles(String elem) {
+ if (this.roles == null) {
+ this.roles = new HashSet<String>();
+ }
+ this.roles.add(elem);
+ }
+
+ public Set<String> getRoles() {
+ return this.roles;
+ }
+
+ public void setRoles(Set<String> roles) {
+ this.roles = roles;
+ }
+
+ public void unsetRoles() {
+ this.roles = null;
+ }
+
+ /** Returns true if field roles is set (has been assigned a value) and false otherwise */
+ public boolean isSetRoles() {
+ return this.roles != null;
+ }
+
+ public void setRolesIsSet(boolean value) {
+ if (!value) {
+ this.roles = null;
+ }
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case ALL:
+ if (value == null) {
+ unsetAll();
+ } else {
+ setAll((Boolean)value);
+ }
+ break;
+
+ case ROLES:
+ if (value == null) {
+ unsetRoles();
+ } else {
+ setRoles((Set<String>)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case ALL:
+ return Boolean.valueOf(isAll());
+
+ case ROLES:
+ return getRoles();
+
+ }
+ 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 ALL:
+ return isSetAll();
+ case ROLES:
+ return isSetRoles();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof TSentryActiveRoleSet)
+ return this.equals((TSentryActiveRoleSet)that);
+ return false;
+ }
+
+ public boolean equals(TSentryActiveRoleSet that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_all = true;
+ boolean that_present_all = true;
+ if (this_present_all || that_present_all) {
+ if (!(this_present_all && that_present_all))
+ return false;
+ if (this.all != that.all)
+ return false;
+ }
+
+ boolean this_present_roles = true && this.isSetRoles();
+ boolean that_present_roles = true && that.isSetRoles();
+ if (this_present_roles || that_present_roles) {
+ if (!(this_present_roles && that_present_roles))
+ return false;
+ if (!this.roles.equals(that.roles))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ HashCodeBuilder builder = new HashCodeBuilder();
+
+ boolean present_all = true;
+ builder.append(present_all);
+ if (present_all)
+ builder.append(all);
+
+ boolean present_roles = true && (isSetRoles());
+ builder.append(present_roles);
+ if (present_roles)
+ builder.append(roles);
+
+ return builder.toHashCode();
+ }
+
+ public int compareTo(TSentryActiveRoleSet other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+ TSentryActiveRoleSet typedOther = (TSentryActiveRoleSet)other;
+
+ lastComparison = Boolean.valueOf(isSetAll()).compareTo(typedOther.isSetAll());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetAll()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.all, typedOther.all);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetRoles()).compareTo(typedOther.isSetRoles());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetRoles()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.roles, typedOther.roles);
+ 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("TSentryActiveRoleSet(");
+ boolean first = true;
+
+ sb.append("all:");
+ sb.append(this.all);
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("roles:");
+ if (this.roles == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.roles);
+ }
+ first = false;
+ sb.append(")");
+ return sb.toString();
+ }
+
+ public void validate() throws org.apache.thrift.TException {
+ // check for required fields
+ if (!isSetAll()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'all' is unset! Struct:" + toString());
+ }
+
+ if (!isSetRoles()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'roles' 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 TSentryActiveRoleSetStandardSchemeFactory implements SchemeFactory {
+ public TSentryActiveRoleSetStandardScheme getScheme() {
+ return new TSentryActiveRoleSetStandardScheme();
+ }
+ }
+
+ private static class TSentryActiveRoleSetStandardScheme extends StandardScheme<TSentryActiveRoleSet> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, TSentryActiveRoleSet 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: // ALL
+ if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
+ struct.all = iprot.readBool();
+ struct.setAllIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 2: // ROLES
+ if (schemeField.type == org.apache.thrift.protocol.TType.SET) {
+ {
+ org.apache.thrift.protocol.TSet _set40 = iprot.readSetBegin();
+ struct.roles = new HashSet<String>(2*_set40.size);
+ for (int _i41 = 0; _i41 < _set40.size; ++_i41)
+ {
+ String _elem42; // required
+ _elem42 = iprot.readString();
+ struct.roles.add(_elem42);
+ }
+ iprot.readSetEnd();
+ }
+ struct.setRolesIsSet(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, TSentryActiveRoleSet struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ oprot.writeFieldBegin(ALL_FIELD_DESC);
+ oprot.writeBool(struct.all);
+ oprot.writeFieldEnd();
+ if (struct.roles != null) {
+ oprot.writeFieldBegin(ROLES_FIELD_DESC);
+ {
+ oprot.writeSetBegin(new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, struct.roles.size()));
+ for (String _iter43 : struct.roles)
+ {
+ oprot.writeString(_iter43);
+ }
+ oprot.writeSetEnd();
+ }
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class TSentryActiveRoleSetTupleSchemeFactory implements SchemeFactory {
+ public TSentryActiveRoleSetTupleScheme getScheme() {
+ return new TSentryActiveRoleSetTupleScheme();
+ }
+ }
+
+ private static class TSentryActiveRoleSetTupleScheme extends TupleScheme<TSentryActiveRoleSet> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, TSentryActiveRoleSet struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ oprot.writeBool(struct.all);
+ {
+ oprot.writeI32(struct.roles.size());
+ for (String _iter44 : struct.roles)
+ {
+ oprot.writeString(_iter44);
+ }
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, TSentryActiveRoleSet struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ struct.all = iprot.readBool();
+ struct.setAllIsSet(true);
+ {
+ org.apache.thrift.protocol.TSet _set45 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
+ struct.roles = new HashSet<String>(2*_set45.size);
+ for (int _i46 = 0; _i46 < _set45.size; ++_i46)
+ {
+ String _elem47; // required
+ _elem47 = iprot.readString();
+ struct.roles.add(_elem47);
+ }
+ }
+ struct.setRolesIsSet(true);
+ }
+ }
+
+}
+
[25/25] git commit: SENTRY-432. HDFS ingration. Initial patch
Posted by pr...@apache.org.
SENTRY-432. HDFS ingration. Initial patch
Project: http://git-wip-us.apache.org/repos/asf/incubator-sentry/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-sentry/commit/0eb6645e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-sentry/tree/0eb6645e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-sentry/diff/0eb6645e
Branch: refs/heads/sentry-hdfs-sync
Commit: 0eb6645e8848681e1746da4d616cb4160c514861
Parents: 00a5eba
Author: Prasad Mujumdar <pr...@cloudera.com>
Authored: Mon Sep 15 14:02:07 2014 -0700
Committer: Prasad Mujumdar <pr...@cloudera.com>
Committed: Mon Sep 15 14:07:13 2014 -0700
----------------------------------------------------------------------
pom.xml | 26 +-
sentry-binding/sentry-binding-hive/pom.xml | 8 +
.../SentryHiveAuthorizationTaskFactoryImpl.java | 16 +
.../sentry/binding/hive/conf/HiveAuthzConf.java | 6 +-
.../SentryMetastorePostEventListener.java | 105 +-
sentry-dist/pom.xml | 12 +
sentry-hdfs-int/pom.xml | 70 +
.../hdfs/SentryAuthorizationConstants.java | 55 +
.../sentry/hdfs/SentryAuthorizationInfo.java | 233 +
.../hdfs/SentryAuthorizationProvider.java | 370 +
.../apache/sentry/hdfs/SentryPermissions.java | 159 +
.../apache/sentry/hdfs/SentryServiceClient.java | 200 +
.../org/apache/sentry/hdfs/SentryUpdater.java | 60 +
.../sentry/hdfs/UpdateableAuthzPermissions.java | 179 +
.../hdfs/MockSentryAuthorizationProvider.java | 26 +
.../sentry/hdfs/SentryAuthorizationInfoX.java | 85 +
.../hdfs/TestSentryAuthorizationProvider.java | 163 +
.../src/test/resources/hdfs-sentry.xml | 33 +
sentry-hdfs/pom.xml | 66 +
.../java/org/apache/sentry/hdfs/AuthzPaths.java | 30 +
.../apache/sentry/hdfs/AuthzPathsDumper.java | 28 +
.../apache/sentry/hdfs/AuthzPermissions.java | 28 +
.../sentry/hdfs/ExtendedMetastoreClient.java | 104 +
.../java/org/apache/sentry/hdfs/HMSPaths.java | 467 +
.../org/apache/sentry/hdfs/HMSPathsSerDe.java | 113 +
.../org/apache/sentry/hdfs/MetastoreClient.java | 34 +
.../org/apache/sentry/hdfs/PathsUpdate.java | 84 +
.../apache/sentry/hdfs/PermissionsUpdate.java | 93 +
.../java/org/apache/sentry/hdfs/Updateable.java | 61 +
.../sentry/hdfs/UpdateableAuthzPaths.java | 130 +
.../org/apache/sentry/hdfs/DummyAdapter.java | 39 +
.../apache/sentry/hdfs/DummyAuthzSource.java | 60 +
.../org/apache/sentry/hdfs/DummyHMSClient.java | 79 +
.../sentry/hdfs/TestAuthzPathCacheOld.java | 523 +
.../apache/sentry/hdfs/TestAuthzPermCache.java | 64 +
.../org/apache/sentry/hdfs/TestHMSPaths.java | 357 +
.../sentry/hdfs/TestHMSPathsFullDump.java | 97 +
.../sentry/hdfs/TestUpdateableAuthzPaths.java | 136 +
sentry-hdfs/src/test/resources/hdfs-sentry.xml | 22 +
sentry-provider/sentry-provider-db/pom.xml | 91 +-
.../db/service/thrift/SentryPolicyService.java | 8966 -------------
.../TAlterSentryRoleAddGroupsRequest.java | 742 --
.../TAlterSentryRoleAddGroupsResponse.java | 390 -
.../TAlterSentryRoleDeleteGroupsRequest.java | 742 --
.../TAlterSentryRoleDeleteGroupsResponse.java | 390 -
.../TAlterSentryRoleGrantPrivilegeRequest.java | 693 -
.../TAlterSentryRoleGrantPrivilegeResponse.java | 390 -
.../TAlterSentryRoleRevokePrivilegeRequest.java | 693 -
...TAlterSentryRoleRevokePrivilegeResponse.java | 390 -
.../thrift/TCreateSentryRoleRequest.java | 587 -
.../thrift/TCreateSentryRoleResponse.java | 390 -
.../service/thrift/TDropPrivilegesRequest.java | 592 -
.../service/thrift/TDropPrivilegesResponse.java | 390 -
.../service/thrift/TDropSentryRoleRequest.java | 587 -
.../service/thrift/TDropSentryRoleResponse.java | 390 -
...TListSentryPrivilegesForProviderRequest.java | 759 --
...ListSentryPrivilegesForProviderResponse.java | 543 -
.../thrift/TListSentryPrivilegesRequest.java | 702 -
.../thrift/TListSentryPrivilegesResponse.java | 554 -
.../service/thrift/TListSentryRolesRequest.java | 596 -
.../thrift/TListSentryRolesResponse.java | 554 -
.../thrift/TRenamePrivilegesRequest.java | 698 -
.../thrift/TRenamePrivilegesResponse.java | 390 -
.../db/service/thrift/TSentryActiveRoleSet.java | 536 -
.../db/service/thrift/TSentryAuthorizable.java | 707 -
.../db/service/thrift/TSentryGrantOption.java | 48 -
.../db/service/thrift/TSentryGroup.java | 385 -
.../db/service/thrift/TSentryPrivilege.java | 1251 --
.../provider/db/service/thrift/TSentryRole.java | 641 -
.../service/thrift/TSentryResponseStatus.java | 594 -
.../thrift/sentry_common_serviceConstants.java | 50 -
.../provider/db/service/UpdateForwarder.java | 227 +
.../db/service/UpdateablePermissions.java | 62 +
.../db/service/persistent/SentryStore.java | 71 +-
.../thrift/SentryPolicyServiceClient.java | 14 +-
.../thrift/SentryPolicyStoreProcessor.java | 190 +
.../sentry/service/thrift/SentryService.java | 3 +-
.../sentry/service/thrift/ServiceConstants.java | 150 -
.../main/resources/sentry_common_service.thrift | 42 -
.../main/resources/sentry_policy_service.thrift | 223 -
.../db/service/TestUpdateForwarder.java | 277 +
.../thrift/TestSentryPolicyStoreProcessor.java | 2 +
.../thrift/TestSentryServerWithoutKerberos.java | 60 +-
sentry-service-client/pom.xml | 164 +
.../db/service/thrift/SentryPolicyService.java | 11554 +++++++++++++++++
.../TAlterSentryRoleAddGroupsRequest.java | 742 ++
.../TAlterSentryRoleAddGroupsResponse.java | 390 +
.../TAlterSentryRoleDeleteGroupsRequest.java | 742 ++
.../TAlterSentryRoleDeleteGroupsResponse.java | 390 +
.../TAlterSentryRoleGrantPrivilegeRequest.java | 693 +
.../TAlterSentryRoleGrantPrivilegeResponse.java | 390 +
.../TAlterSentryRoleRevokePrivilegeRequest.java | 693 +
...TAlterSentryRoleRevokePrivilegeResponse.java | 390 +
.../db/service/thrift/TAuthzUpdateResponse.java | 603 +
.../thrift/TCreateSentryRoleRequest.java | 587 +
.../thrift/TCreateSentryRoleResponse.java | 390 +
.../service/thrift/TDropPrivilegesRequest.java | 592 +
.../service/thrift/TDropPrivilegesResponse.java | 390 +
.../service/thrift/TDropSentryRoleRequest.java | 587 +
.../service/thrift/TDropSentryRoleResponse.java | 390 +
...TListSentryPrivilegesForProviderRequest.java | 759 ++
...ListSentryPrivilegesForProviderResponse.java | 543 +
.../thrift/TListSentryPrivilegesRequest.java | 702 +
.../thrift/TListSentryPrivilegesResponse.java | 554 +
.../service/thrift/TListSentryRolesRequest.java | 596 +
.../thrift/TListSentryRolesResponse.java | 554 +
.../db/service/thrift/TPathChanges.java | 765 ++
.../provider/db/service/thrift/TPathEntry.java | 747 ++
.../provider/db/service/thrift/TPathsDump.java | 549 +
.../db/service/thrift/TPathsUpdate.java | 748 ++
.../db/service/thrift/TPermissionsUpdate.java | 810 ++
.../db/service/thrift/TPrivilegeChanges.java | 713 +
.../thrift/TRenamePrivilegesRequest.java | 698 +
.../thrift/TRenamePrivilegesResponse.java | 390 +
.../db/service/thrift/TRoleChanges.java | 691 +
.../db/service/thrift/TSentryActiveRoleSet.java | 536 +
.../db/service/thrift/TSentryAuthorizable.java | 707 +
.../db/service/thrift/TSentryGrantOption.java | 48 +
.../db/service/thrift/TSentryGroup.java | 385 +
.../db/service/thrift/TSentryPrivilege.java | 1251 ++
.../provider/db/service/thrift/TSentryRole.java | 641 +
.../service/thrift/TSentryResponseStatus.java | 594 +
.../thrift/sentry_common_serviceConstants.java | 50 +
.../sentry/service/thrift/ServiceConstants.java | 153 +
.../main/resources/sentry_common_service.thrift | 42 +
.../main/resources/sentry_policy_service.thrift | 266 +
sentry-tests/sentry-tests-hive/pom.xml | 5 +
...actMetastoreTestWithStaticConfiguration.java | 3 +
.../e2e/metastore/TestMetastoreEndToEnd.java | 49 +-
129 files changed, 39566 insertions(+), 25843 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index e172e92..e66e790 100644
--- a/pom.xml
+++ b/pom.xml
@@ -68,7 +68,7 @@ limitations under the License.
<derby.version>10.10.2.0</derby.version>
<commons-cli.version>1.2</commons-cli.version>
<hive.version>0.13.1-cdh5.2.0-SNAPSHOT</hive.version>
- <hadoop.version>2.3.0-cdh5.1.0-SNAPSHOT</hadoop.version>
+ <hadoop.version>2.5.0</hadoop.version>
<fest.reflect.version>1.4.1</fest.reflect.version>
<guava.version>11.0.2</guava.version>
<junit.version>4.9</junit.version>
@@ -149,6 +149,12 @@ limitations under the License.
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
+ <artifactId>hadoop-hdfs</artifactId>
+ <version>${hadoop.version}</version>
+ <type>test-jar</type>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-minicluster</artifactId>
<version>${hadoop.version}</version>
</dependency>
@@ -324,6 +330,11 @@ limitations under the License.
</dependency>
<dependency>
<groupId>org.apache.sentry</groupId>
+ <artifactId>sentry-service-client</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.sentry</groupId>
<artifactId>sentry-provider-common</artifactId>
<version>${project.version}</version>
</dependency>
@@ -334,6 +345,16 @@ limitations under the License.
</dependency>
<dependency>
<groupId>org.apache.sentry</groupId>
+ <artifactId>sentry-hdfs</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.sentry</groupId>
+ <artifactId>sentry-hdfs-int</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.sentry</groupId>
<artifactId>sentry-provider-cache</artifactId>
<version>${project.version}</version>
</dependency>
@@ -402,6 +423,9 @@ limitations under the License.
<module>sentry-policy</module>
<module>sentry-tests</module>
<module>sentry-dist</module>
+ <module>sentry-service-client</module>
+ <module>sentry-hdfs</module>
+ <module>sentry-hdfs-int</module>
</modules>
<build>
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-binding/sentry-binding-hive/pom.xml
----------------------------------------------------------------------
diff --git a/sentry-binding/sentry-binding-hive/pom.xml b/sentry-binding/sentry-binding-hive/pom.xml
index e72b370..aa3a8c9 100644
--- a/sentry-binding/sentry-binding-hive/pom.xml
+++ b/sentry-binding/sentry-binding-hive/pom.xml
@@ -75,6 +75,14 @@ limitations under the License.
<!-- required for SentryGrantRevokeTask -->
<dependency>
<groupId>org.apache.sentry</groupId>
+ <artifactId>sentry-service-client</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.sentry</groupId>
+ <artifactId>sentry-hdfs</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.sentry</groupId>
<artifactId>sentry-provider-db</artifactId>
</dependency>
<dependency>
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-binding/sentry-binding-hive/src/main/java/org/apache/sentry/binding/hive/SentryHiveAuthorizationTaskFactoryImpl.java
----------------------------------------------------------------------
diff --git a/sentry-binding/sentry-binding-hive/src/main/java/org/apache/sentry/binding/hive/SentryHiveAuthorizationTaskFactoryImpl.java b/sentry-binding/sentry-binding-hive/src/main/java/org/apache/sentry/binding/hive/SentryHiveAuthorizationTaskFactoryImpl.java
index f38ee91..dfcf63a 100644
--- a/sentry-binding/sentry-binding-hive/src/main/java/org/apache/sentry/binding/hive/SentryHiveAuthorizationTaskFactoryImpl.java
+++ b/sentry-binding/sentry-binding-hive/src/main/java/org/apache/sentry/binding/hive/SentryHiveAuthorizationTaskFactoryImpl.java
@@ -50,11 +50,14 @@ import org.apache.hadoop.hive.ql.security.authorization.Privilege;
import org.apache.hadoop.hive.ql.security.authorization.PrivilegeRegistry;
import org.apache.hadoop.hive.ql.session.SessionState;
import org.apache.sentry.core.model.db.AccessConstants;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import com.google.common.base.Preconditions;
public class SentryHiveAuthorizationTaskFactoryImpl implements HiveAuthorizationTaskFactory {
+ private static final Logger LOG = LoggerFactory.getLogger(SentryHiveAuthorizationTaskFactoryImpl.class);
public SentryHiveAuthorizationTaskFactoryImpl(HiveConf conf, Hive db) {
@@ -236,8 +239,11 @@ public class SentryHiveAuthorizationTaskFactoryImpl implements HiveAuthorization
private Task<? extends Serializable> analyzeGrantRevokeRole(boolean isGrant, ASTNode ast,
HashSet<ReadEntity> inputs, HashSet<WriteEntity> outputs) throws SemanticException {
+ LOG.debug("## FULL AST : [" + ast.dump() + "]");
+ LOG.debug("## CHILD AST : [" + ((ASTNode)ast.getChild(0)).dump() + "]");
List<PrincipalDesc> principalDesc = analyzePrincipalListDef(
(ASTNode) ast.getChild(0));
+
List<String> roles = new ArrayList<String>();
for (int i = 1; i < ast.getChildCount(); i++) {
roles.add(BaseSemanticAnalyzer.unescapeIdentifier(ast.getChild(i).getText()));
@@ -314,18 +320,28 @@ public class SentryHiveAuthorizationTaskFactoryImpl implements HiveAuthorization
ASTNode child = (ASTNode) node.getChild(i);
PrincipalType type = null;
switch (child.getType()) {
+ case 880:
+ type = PrincipalType.USER;
+ break;
case HiveParser.TOK_USER:
type = PrincipalType.USER;
break;
+ case 685:
+ type = PrincipalType.GROUP;
+ break;
case HiveParser.TOK_GROUP:
type = PrincipalType.GROUP;
break;
+ case 782:
+ type = PrincipalType.ROLE;
+ break;
case HiveParser.TOK_ROLE:
type = PrincipalType.ROLE;
break;
}
String principalName = BaseSemanticAnalyzer.unescapeIdentifier(child.getChild(0).getText());
PrincipalDesc principalDesc = new PrincipalDesc(principalName, type);
+ LOG.debug("## Principal : [ " + principalName + ", " + type + "]");
principalList.add(principalDesc);
}
return principalList;
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-binding/sentry-binding-hive/src/main/java/org/apache/sentry/binding/hive/conf/HiveAuthzConf.java
----------------------------------------------------------------------
diff --git a/sentry-binding/sentry-binding-hive/src/main/java/org/apache/sentry/binding/hive/conf/HiveAuthzConf.java b/sentry-binding/sentry-binding-hive/src/main/java/org/apache/sentry/binding/hive/conf/HiveAuthzConf.java
index 3a83895..65d3933 100644
--- a/sentry-binding/sentry-binding-hive/src/main/java/org/apache/sentry/binding/hive/conf/HiveAuthzConf.java
+++ b/sentry-binding/sentry-binding-hive/src/main/java/org/apache/sentry/binding/hive/conf/HiveAuthzConf.java
@@ -18,7 +18,7 @@ package org.apache.sentry.binding.hive.conf;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hive.conf.HiveConf;
-import org.mortbay.log.Log;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -201,8 +201,8 @@ public class HiveAuthzConf extends Configuration {
if (retVal == null) {
retVal = AuthzConfVars.getDefault(varName);
} else {
- Log.warn("Using the deprecated config setting " + currentToDeprecatedProps.get(varName).getVar() +
- " instead of " + varName);
+// Log.warn("Using the deprecated config setting " + currentToDeprecatedProps.get(varName).getVar() +
+// " instead of " + varName);
}
}
if (retVal == null) {
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-binding/sentry-binding-hive/src/main/java/org/apache/sentry/binding/metastore/SentryMetastorePostEventListener.java
----------------------------------------------------------------------
diff --git a/sentry-binding/sentry-binding-hive/src/main/java/org/apache/sentry/binding/metastore/SentryMetastorePostEventListener.java b/sentry-binding/sentry-binding-hive/src/main/java/org/apache/sentry/binding/metastore/SentryMetastorePostEventListener.java
index 0500483..30b68ab 100644
--- a/sentry-binding/sentry-binding-hive/src/main/java/org/apache/sentry/binding/metastore/SentryMetastorePostEventListener.java
+++ b/sentry-binding/sentry-binding-hive/src/main/java/org/apache/sentry/binding/metastore/SentryMetastorePostEventListener.java
@@ -19,34 +19,48 @@ package org.apache.sentry.binding.metastore;
import java.io.IOException;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicInteger;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hive.conf.HiveConf;
import org.apache.hadoop.hive.metastore.MetaStoreEventListener;
import org.apache.hadoop.hive.metastore.api.MetaException;
+import org.apache.hadoop.hive.metastore.api.Partition;
+import org.apache.hadoop.hive.metastore.events.AddPartitionEvent;
import org.apache.hadoop.hive.metastore.events.AlterTableEvent;
import org.apache.hadoop.hive.metastore.events.CreateDatabaseEvent;
import org.apache.hadoop.hive.metastore.events.CreateTableEvent;
import org.apache.hadoop.hive.metastore.events.DropDatabaseEvent;
+import org.apache.hadoop.hive.metastore.events.DropPartitionEvent;
import org.apache.hadoop.hive.metastore.events.DropTableEvent;
import org.apache.hadoop.security.UserGroupInformation;
import org.apache.sentry.SentryUserException;
-import org.apache.sentry.binding.hive.HiveAuthzBindingHook;
import org.apache.sentry.binding.hive.conf.HiveAuthzConf;
import org.apache.sentry.binding.hive.conf.HiveAuthzConf.AuthzConfVars;
import org.apache.sentry.core.common.Authorizable;
import org.apache.sentry.core.model.db.Database;
import org.apache.sentry.core.model.db.Server;
import org.apache.sentry.core.model.db.Table;
+import org.apache.sentry.hdfs.PathsUpdate;
import org.apache.sentry.provider.db.service.thrift.SentryPolicyServiceClient;
+import org.apache.sentry.provider.db.service.thrift.TPathChanges;
import org.apache.sentry.service.thrift.SentryServiceClientFactory;
+import org.apache.sentry.service.thrift.ServiceConstants.ServerConfig;
+
+import com.google.common.collect.Lists;
public class SentryMetastorePostEventListener extends MetaStoreEventListener {
private final SentryServiceClientFactory sentryClientFactory;
private final HiveAuthzConf authzConf;
private final Server server;
+ // Initialized to some value > 1 so that the first update notification
+ // will trigger a full Image fetch
+ private final AtomicInteger seqNum = new AtomicInteger(5);
+
public SentryMetastorePostEventListener(Configuration config) {
super(config);
sentryClientFactory = new SentryServiceClientFactory();
@@ -57,6 +71,14 @@ public class SentryMetastorePostEventListener extends MetaStoreEventListener {
@Override
public void onCreateTable (CreateTableEvent tableEvent) throws MetaException {
+ PathsUpdate update = createHMSUpdate();
+ if (tableEvent.getTable().getSd().getLocation() != null) {
+ update.newPathChange(
+ tableEvent.getTable().getDbName() + "."
+ + tableEvent.getTable().getTableName()).addToAddPaths(
+ PathsUpdate.cleanPath(tableEvent.getTable().getSd().getLocation()));
+ notifySentry(update);
+ }
// drop the privileges on the given table, in case if anything was left
// behind during the drop
if (!syncWithPolicyStore(AuthzConfVars.AUTHZ_SYNC_CREATE_WITH_POLICY_STORE)) {
@@ -68,6 +90,12 @@ public class SentryMetastorePostEventListener extends MetaStoreEventListener {
@Override
public void onDropTable(DropTableEvent tableEvent) throws MetaException {
+ PathsUpdate update = createHMSUpdate();
+ update.newPathChange(
+ tableEvent.getTable().getDbName() + "."
+ + tableEvent.getTable().getTableName()).addToDelPaths(
+ Lists.newArrayList(PathsUpdate.ALL_PATHS));
+ notifySentry(update);
// drop the privileges on the given table
if (!syncWithPolicyStore(AuthzConfVars.AUTHZ_SYNC_DROP_WITH_POLICY_STORE)) {
return;
@@ -79,6 +107,12 @@ public class SentryMetastorePostEventListener extends MetaStoreEventListener {
@Override
public void onCreateDatabase(CreateDatabaseEvent dbEvent)
throws MetaException {
+ if (dbEvent.getDatabase().getLocationUri() != null) {
+ PathsUpdate update = createHMSUpdate();
+ update.newPathChange(dbEvent.getDatabase().getName()).addToAddPaths(
+ PathsUpdate.cleanPath(dbEvent.getDatabase().getLocationUri()));
+ notifySentry(update);
+ }
// drop the privileges on the database, incase anything left behind during
// last drop db
if (!syncWithPolicyStore(AuthzConfVars.AUTHZ_SYNC_CREATE_WITH_POLICY_STORE)) {
@@ -94,10 +128,14 @@ public class SentryMetastorePostEventListener extends MetaStoreEventListener {
*/
@Override
public void onDropDatabase(DropDatabaseEvent dbEvent) throws MetaException {
+ PathsUpdate update = createHMSUpdate();
+ update.newPathChange(dbEvent.getDatabase().getName()).addToDelPaths(
+ Lists.newArrayList(PathsUpdate.ALL_PATHS));
+ notifySentry(update);
+ dropSentryDbPrivileges(dbEvent.getDatabase().getName());
if (!syncWithPolicyStore(AuthzConfVars.AUTHZ_SYNC_DROP_WITH_POLICY_STORE)) {
return;
}
- dropSentryDbPrivileges(dbEvent.getDatabase().getName());
}
/**
@@ -106,6 +144,7 @@ public class SentryMetastorePostEventListener extends MetaStoreEventListener {
@Override
public void onAlterTable (AlterTableEvent tableEvent) throws MetaException {
String oldTableName = null, newTableName = null;
+ // TODO : notify SentryHMSPathCache
if (!syncWithPolicyStore(AuthzConfVars.AUTHZ_SYNC_ALTER_WITH_POLICY_STORE)) {
return;
}
@@ -121,6 +160,51 @@ public class SentryMetastorePostEventListener extends MetaStoreEventListener {
}
}
+
+
+ @Override
+ public void onAddPartition(AddPartitionEvent partitionEvent)
+ throws MetaException {
+ PathsUpdate update = createHMSUpdate();
+// TPathChanges pathUpdate = update.newPathChange(
+// partitionEvent.getTable().getDbName() + "."
+// + partitionEvent.getTable().getTableName());
+ Map<String, TPathChanges> pcMap = new HashMap<String, TPathChanges>();
+ boolean anyPaths = false;
+ for (Partition part : partitionEvent.getPartitions()) {
+ if ((part.getSd() != null) && (part.getSd().getLocation() != null)) {
+ String authzObj = part.getDbName() + "." + part.getTableName();
+ TPathChanges pathUpdate = pcMap.get(authzObj);
+ if (pathUpdate == null) {
+ pathUpdate = update.newPathChange(authzObj);
+ pcMap.put(authzObj, pathUpdate);
+ }
+ pathUpdate.addToAddPaths(PathsUpdate
+ .cleanPath(part.getSd().getLocation()));
+ anyPaths = true;
+ }
+ }
+ if (anyPaths) {
+ notifySentry(update);
+ }
+ // TODO Auto-generated method stub
+ super.onAddPartition(partitionEvent);
+ }
+
+ @Override
+ public void onDropPartition(DropPartitionEvent partitionEvent)
+ throws MetaException {
+ PathsUpdate update = createHMSUpdate();
+ update.newPathChange(
+ partitionEvent.getTable().getDbName() + "."
+ + partitionEvent.getTable().getTableName()).addToDelPaths(
+ PathsUpdate.cleanPath(partitionEvent.getPartition().getSd()
+ .getLocation()));
+ notifySentry(update);
+ // TODO Auto-generated method stub
+ super.onDropPartition(partitionEvent);
+ }
+
private SentryPolicyServiceClient getSentryServiceClient()
throws MetaException {
try {
@@ -201,8 +285,25 @@ public class SentryMetastorePostEventListener extends MetaStoreEventListener {
}
}
+ private void notifySentry(PathsUpdate update) throws MetaException {
+ if (!authzConf.getBoolean(ServerConfig.SENTRY_HDFS_INTEGRATION_ENABLE, true)) {
+ return;
+ }
+ try {
+ getSentryServiceClient().notifyHMSUpdate(update);
+ } catch (SentryUserException e) {
+ throw new MetaException("Error sending update to Sentry [" + e.getMessage() + "]");
+ }
+ }
+
private boolean syncWithPolicyStore(AuthzConfVars syncConfVar) {
return "true"
.equalsIgnoreCase((authzConf.get(syncConfVar.getVar(), "true")));
}
+
+ private PathsUpdate createHMSUpdate() {
+ PathsUpdate update = new PathsUpdate(seqNum.incrementAndGet(), false);
+ return update;
+ }
+
}
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-dist/pom.xml
----------------------------------------------------------------------
diff --git a/sentry-dist/pom.xml b/sentry-dist/pom.xml
index cd7126b..510fd97 100644
--- a/sentry-dist/pom.xml
+++ b/sentry-dist/pom.xml
@@ -64,6 +64,18 @@ limitations under the License.
</dependency>
<dependency>
<groupId>org.apache.sentry</groupId>
+ <artifactId>sentry-hdfs</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.sentry</groupId>
+ <artifactId>sentry-hdfs-int</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.sentry</groupId>
+ <artifactId>sentry-service-client</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.sentry</groupId>
<artifactId>sentry-policy-common</artifactId>
</dependency>
<dependency>
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-hdfs-int/pom.xml
----------------------------------------------------------------------
diff --git a/sentry-hdfs-int/pom.xml b/sentry-hdfs-int/pom.xml
new file mode 100644
index 0000000..7f86186
--- /dev/null
+++ b/sentry-hdfs-int/pom.xml
@@ -0,0 +1,70 @@
+<?xml version="1.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.
+-->
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.sentry</groupId>
+ <artifactId>sentry</artifactId>
+ <version>1.5.0-incubating-SNAPSHOT</version>
+ <relativePath>..</relativePath>
+ </parent>
+
+ <artifactId>sentry-hdfs-int</artifactId>
+ <name>Sentry HDFS Integration Plugin</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.sentry</groupId>
+ <artifactId>sentry-hdfs</artifactId>
+ <version>1.5.0-incubating-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.sentry</groupId>
+ <artifactId>sentry-service-client</artifactId>
+ <version>1.5.0-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hadoop</groupId>
+ <artifactId>hadoop-common</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hadoop</groupId>
+ <artifactId>hadoop-hdfs</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hadoop</groupId>
+ <artifactId>hadoop-minicluster</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+</project>
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-hdfs-int/src/main/java/org/apache/sentry/hdfs/SentryAuthorizationConstants.java
----------------------------------------------------------------------
diff --git a/sentry-hdfs-int/src/main/java/org/apache/sentry/hdfs/SentryAuthorizationConstants.java b/sentry-hdfs-int/src/main/java/org/apache/sentry/hdfs/SentryAuthorizationConstants.java
new file mode 100644
index 0000000..9f219ce
--- /dev/null
+++ b/sentry-hdfs-int/src/main/java/org/apache/sentry/hdfs/SentryAuthorizationConstants.java
@@ -0,0 +1,55 @@
+/**
+ * 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.hdfs;
+
+public class SentryAuthorizationConstants {
+
+ public static final String CONFIG_FILE = "hdfs-sentry.xml";
+
+ public static final String CONFIG_PREFIX = "sentry.authorization-provider.";
+
+ public static final String HDFS_USER_KEY = CONFIG_PREFIX + "hdfs-user";
+ public static final String HDFS_USER_DEFAULT = "hive";
+
+ public static final String HDFS_GROUP_KEY = CONFIG_PREFIX + "hdfs-group";
+ public static final String HDFS_GROUP_DEFAULT = "hive";
+
+ public static final String HDFS_PERMISSION_KEY = CONFIG_PREFIX +
+ "hdfs-permission";
+ public static final long HDFS_PERMISSION_DEFAULT = 0770;
+
+ public static final String HDFS_PATH_PREFIXES_KEY = CONFIG_PREFIX +
+ "hdfs-path-prefixes";
+ public static final String[] HDFS_PATH_PREFIXES_DEFAULT = new String[0];
+
+ public static final String CACHE_REFRESH_INTERVAL_KEY = CONFIG_PREFIX +
+ "cache-refresh-interval.ms";
+ public static final int CACHE_REFRESH_INTERVAL_DEFAULT = 500;
+
+ public static final String CACHE_STALE_THRESHOLD_KEY = CONFIG_PREFIX +
+ "cache-stale-threshold.ms";
+ public static final int CACHE_STALE_THRESHOLD_DEFAULT = 60 * 1000;
+
+ public static final String CACHE_REFRESH_RETRY_WAIT_KEY = CONFIG_PREFIX +
+ "cache-refresh-retry-wait.ms";
+ public static final int CACHE_REFRESH_RETRY_WAIT_DEFAULT = 30 * 1000;
+
+ public static final String INCLUDE_HDFS_AUTHZ_AS_ACL_KEY = CONFIG_PREFIX +
+ "include-hdfs-authz-as-acl";
+ public static final boolean INCLUDE_HDFS_AUTHZ_AS_ACL_DEFAULT = true;
+}
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-hdfs-int/src/main/java/org/apache/sentry/hdfs/SentryAuthorizationInfo.java
----------------------------------------------------------------------
diff --git a/sentry-hdfs-int/src/main/java/org/apache/sentry/hdfs/SentryAuthorizationInfo.java b/sentry-hdfs-int/src/main/java/org/apache/sentry/hdfs/SentryAuthorizationInfo.java
new file mode 100644
index 0000000..59f4f5e
--- /dev/null
+++ b/sentry-hdfs-int/src/main/java/org/apache/sentry/hdfs/SentryAuthorizationInfo.java
@@ -0,0 +1,233 @@
+/**
+ * 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.hdfs;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.locks.ReadWriteLock;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.permission.AclEntry;
+import org.apache.hadoop.util.StringUtils;
+import org.apache.sentry.hdfs.SentryServiceClient.SentryAuthzUpdate;
+import org.apache.sentry.hdfs.Updateable.Update;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.annotations.VisibleForTesting;
+
+public class SentryAuthorizationInfo implements Runnable {
+ private static Logger LOG =
+ LoggerFactory.getLogger(SentryAuthorizationInfo.class);
+
+ private SentryUpdater updater;
+ private volatile UpdateableAuthzPaths authzPaths;
+ private volatile UpdateableAuthzPermissions authzPermissions;
+
+ private int refreshIntervalMillisec;
+ private int staleThresholdMillisec;
+ private int retryWaitMillisec;
+ private ScheduledExecutorService executor;
+ private volatile long lastUpdate;
+ private volatile long waitUntil;
+ private volatile long lastStaleReport;
+ // We don't need a re-entrant lock.. but we do need a ReadWriteLock
+ // Unfortunately, the ReentrantReadWriteLick is the only available
+ // concrete implementation of a ReadWriteLock.
+ private final ReadWriteLock lock = new ReentrantReadWriteLock();
+
+ @VisibleForTesting
+ SentryAuthorizationInfo() {}
+
+ public SentryAuthorizationInfo(Configuration conf) throws Exception {
+ String[] pathPrefixes = conf.getTrimmedStrings(
+ SentryAuthorizationConstants.HDFS_PATH_PREFIXES_KEY,
+ SentryAuthorizationConstants.HDFS_PATH_PREFIXES_DEFAULT);
+ if (pathPrefixes.length == 0) {
+ LOG.warn("There are not HDFS path prefixes configured in [{}], "
+ + "Sentry authorization won't be enforced on any HDFS location",
+ SentryAuthorizationConstants.HDFS_PATH_PREFIXES_KEY);
+ } else {
+ refreshIntervalMillisec = conf.getInt(
+ SentryAuthorizationConstants.CACHE_REFRESH_INTERVAL_KEY,
+ SentryAuthorizationConstants.CACHE_REFRESH_INTERVAL_DEFAULT);
+ staleThresholdMillisec = conf.getInt(
+ SentryAuthorizationConstants.CACHE_STALE_THRESHOLD_KEY,
+ SentryAuthorizationConstants.CACHE_STALE_THRESHOLD_DEFAULT);
+ retryWaitMillisec = conf.getInt(
+ SentryAuthorizationConstants.CACHE_REFRESH_RETRY_WAIT_KEY,
+ SentryAuthorizationConstants.CACHE_REFRESH_RETRY_WAIT_DEFAULT);
+
+ LOG.debug("Sentry authorization will enforced in the following HDFS " +
+ "locations: [{}]", StringUtils.arrayToString(pathPrefixes));
+ LOG.debug("Refresh interval [{}]ms, retry wait [{}], stale threshold " +
+ "[{}]ms", new Object[]
+ {refreshIntervalMillisec, retryWaitMillisec, staleThresholdMillisec});
+
+ authzPaths = new UpdateableAuthzPaths(pathPrefixes);
+ authzPermissions = new UpdateableAuthzPermissions();
+ waitUntil = System.currentTimeMillis();
+ lastStaleReport = 0;
+ updater = new SentryUpdater(conf, this);
+ }
+ }
+
+ UpdateableAuthzPaths getAuthzPaths() {
+ return authzPaths;
+ }
+
+ UpdateableAuthzPermissions getAuthzPermissions() {
+ return authzPermissions;
+ }
+
+ private void update() {
+ SentryAuthzUpdate updates = updater.getUpdates();
+ UpdateableAuthzPaths newAuthzPaths = processUpdates(
+ updates.getPathUpdates(), authzPaths);
+ UpdateableAuthzPermissions newAuthzPerms = processUpdates(
+ updates.getPermUpdates(), authzPermissions);
+ // If there were any FULL updates the returned instance would be
+ // different
+ if ((newAuthzPaths != authzPaths)||(newAuthzPerms != authzPermissions)) {
+ lock.writeLock().lock();
+ try {
+ authzPaths = newAuthzPaths;
+ LOG.warn("##### FULL Updated paths seq Num [" + authzPaths.getLastUpdatedSeqNum() + "]");
+ authzPermissions = newAuthzPerms;
+ LOG.warn("##### FULL Updated perms seq Num [" + authzPermissions.getLastUpdatedSeqNum() + "]");
+ } finally {
+ lock.writeLock().unlock();
+ }
+ }
+
+ }
+
+ private <K extends Update, V extends Updateable<K>> V processUpdates(List<K> updates,
+ V updateable) {
+ // In a list of Updates, if there is a full Update, it will be the first
+ // one in the List.. all the remaining will be partial updates
+ if (updates.size() > 0) {
+ if (updates.get(0).hasFullImage()) {
+ updateable = (V)updateable.updateFull(updates.remove(0));
+ }
+ // Any more elements ?
+ if (!updates.isEmpty()) {
+ updateable.updatePartial(updates, lock);
+ }
+ }
+ return updateable;
+ }
+
+ public void run() {
+ try {
+ // In case of previous preUpdate failure, we sleep for a retry wait
+ // interval we can do this because we are using a singledthreadedexecutor
+ // and scheduling the runs with fixed delay.
+ long currTime = System.currentTimeMillis();
+ if (waitUntil > currTime) {
+ Thread.sleep(waitUntil - currTime);
+ }
+ update();
+ // we reset lastUpdate only on successful pulling
+ lastUpdate = System.currentTimeMillis();
+ waitUntil = lastUpdate;
+ } catch (Exception ex) {
+ LOG.warn("Failed to update, will retry in [{}]ms, error: ",
+ new Object[]{ retryWaitMillisec, ex.getMessage(), ex});
+ waitUntil = System.currentTimeMillis() + retryWaitMillisec;
+ }
+ }
+
+ public void start() {
+ if (authzPaths != null) {
+ try {
+ update();
+ } catch (Exception ex) {
+ LOG.warn("Failed to do initial update, will retry in [{}]ms, error: ",
+ new Object[]{retryWaitMillisec, ex.getMessage(), ex});
+ waitUntil = System.currentTimeMillis() + retryWaitMillisec;
+ }
+ executor = Executors.newSingleThreadScheduledExecutor(
+ new ThreadFactory() {
+ @Override
+ public Thread newThread(Runnable r) {
+ Thread t = new Thread(r, SentryAuthorizationInfo.class.getName() +
+ "-refresher");
+ t.setDaemon(true);
+ return t;
+ }
+ }
+ );
+ executor.scheduleWithFixedDelay(this, refreshIntervalMillisec,
+ refreshIntervalMillisec, TimeUnit.MILLISECONDS);
+ }
+ }
+
+ public void stop() {
+ if (authzPaths != null) {
+ executor.shutdownNow();
+ }
+ }
+
+ public boolean isStale() {
+ long now = System.currentTimeMillis();
+ boolean stale = now - lastUpdate > staleThresholdMillisec;
+ if (stale && now - lastStaleReport > 30 * 1000) {
+ LOG.warn("Authorization information has been stale for [{}]s",
+ (now - lastUpdate) / 1000);
+ lastStaleReport = now;
+ }
+ return stale;
+ }
+
+ public boolean isManaged(String[] pathElements) {
+ lock.readLock().lock();
+ try {
+ return authzPaths.isUnderPrefix(pathElements);
+ } finally {
+ lock.readLock().unlock();
+ }
+ }
+
+ public boolean doesBelongToAuthzObject(String[] pathElements) {
+ lock.readLock().lock();
+ try {
+ return authzPaths.findAuthzObject(pathElements) != null;
+ } finally {
+ lock.readLock().unlock();
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ public List<AclEntry> getAclEntries(String[] pathElements) {
+ lock.readLock().lock();
+ try {
+ String authzObj = authzPaths.findAuthzObject(pathElements);
+ return (authzObj != null) ? authzPermissions.getAcls(authzObj)
+ : Collections.EMPTY_LIST;
+ } finally {
+ lock.readLock().unlock();
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-hdfs-int/src/main/java/org/apache/sentry/hdfs/SentryAuthorizationProvider.java
----------------------------------------------------------------------
diff --git a/sentry-hdfs-int/src/main/java/org/apache/sentry/hdfs/SentryAuthorizationProvider.java b/sentry-hdfs-int/src/main/java/org/apache/sentry/hdfs/SentryAuthorizationProvider.java
new file mode 100644
index 0000000..2375d1b
--- /dev/null
+++ b/sentry-hdfs-int/src/main/java/org/apache/sentry/hdfs/SentryAuthorizationProvider.java
@@ -0,0 +1,370 @@
+/**
+ * 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 permission and
+ * limitations under the License.
+ */
+package org.apache.sentry.hdfs;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.hadoop.conf.Configurable;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.UnresolvedLinkException;
+import org.apache.hadoop.fs.permission.AclEntry;
+import org.apache.hadoop.fs.permission.AclEntryScope;
+import org.apache.hadoop.fs.permission.AclEntryType;
+import org.apache.hadoop.fs.permission.FsAction;
+import org.apache.hadoop.fs.permission.FsPermission;
+import org.apache.hadoop.hdfs.DFSConfigKeys;
+import org.apache.hadoop.hdfs.server.namenode.AclFeature;
+import org.apache.hadoop.hdfs.server.namenode.AuthorizationProvider;
+import org.apache.hadoop.hdfs.server.namenode.DefaultAuthorizationProvider;
+import org.apache.hadoop.security.AccessControlException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.annotations.VisibleForTesting;
+import com.google.common.collect.ImmutableList;
+
+public class SentryAuthorizationProvider
+ implements AuthorizationProvider, Configurable {
+
+ static class SentryAclFeature extends AclFeature {
+ public SentryAclFeature(ImmutableList<AclEntry> entries) {
+ super(entries);
+ }
+ }
+
+ private static Logger LOG =
+ LoggerFactory.getLogger(SentryAuthorizationProvider.class);
+
+ private boolean started;
+ private Configuration conf;
+ private AuthorizationProvider defaultAuthzProvider;
+ private String user;
+ private String group;
+ private FsPermission permission;
+ private boolean originalAuthzAsAcl;
+ private SentryAuthorizationInfo authzInfo;
+
+ public SentryAuthorizationProvider() {
+ this(null);
+ }
+
+ @VisibleForTesting
+ SentryAuthorizationProvider(SentryAuthorizationInfo authzInfo) {
+ this.authzInfo = authzInfo;
+ }
+
+ @Override
+ public void setConf(Configuration conf) {
+ this.conf = conf;
+ }
+
+ @Override
+ public Configuration getConf() {
+ return conf;
+ }
+
+ @Override
+ public synchronized void start() {
+ if (started) {
+ throw new IllegalStateException("Provider already started");
+ }
+ started = true;
+ try {
+ if (!conf.getBoolean(DFSConfigKeys.DFS_NAMENODE_ACLS_ENABLED_KEY, false)) {
+ throw new RuntimeException("HDFS ACLs must be enabled");
+ }
+
+ defaultAuthzProvider = new DefaultAuthorizationProvider();
+ defaultAuthzProvider.start();
+ // Configuration is read from hdfs-sentry.xml and NN configuration, in
+ // that order of precedence.
+ Configuration conf = new Configuration(this.conf);
+ conf.addResource(SentryAuthorizationConstants.CONFIG_FILE);
+ user = conf.get(SentryAuthorizationConstants.HDFS_USER_KEY,
+ SentryAuthorizationConstants.HDFS_USER_DEFAULT);
+ group = conf.get(SentryAuthorizationConstants.HDFS_GROUP_KEY,
+ SentryAuthorizationConstants.HDFS_GROUP_DEFAULT);
+ permission = FsPermission.createImmutable(
+ (short) conf.getLong(SentryAuthorizationConstants.HDFS_PERMISSION_KEY,
+ SentryAuthorizationConstants.HDFS_PERMISSION_DEFAULT)
+ );
+ originalAuthzAsAcl = conf.getBoolean(
+ SentryAuthorizationConstants.INCLUDE_HDFS_AUTHZ_AS_ACL_KEY,
+ SentryAuthorizationConstants.INCLUDE_HDFS_AUTHZ_AS_ACL_DEFAULT);
+
+ LOG.info("Starting");
+ LOG.info("Config: hdfs-user[{}] hdfs-group[{}] hdfs-permission[{}] " +
+ "include-hdfs-authz-as-acl[{}]", new Object[]
+ {user, group, permission, originalAuthzAsAcl});
+
+ if (authzInfo == null) {
+ authzInfo = new SentryAuthorizationInfo(conf);
+ }
+ authzInfo.start();
+ } catch (Exception ex) {
+ throw new RuntimeException(ex);
+ }
+ }
+
+ @Override
+ public synchronized void stop() {
+ LOG.debug("Stopping");
+ authzInfo.stop();
+ defaultAuthzProvider.stop();
+ defaultAuthzProvider = null;
+ }
+
+ @Override
+ public void setSnaphottableDirs(Map<INodeAuthorizationInfo, Integer>
+ snapshotableDirs) {
+ defaultAuthzProvider.setSnaphottableDirs(snapshotableDirs);
+ }
+
+ @Override
+ public void addSnapshottable(INodeAuthorizationInfo dir) {
+ defaultAuthzProvider.addSnapshottable(dir);
+ }
+
+ @Override
+ public void removeSnapshottable(INodeAuthorizationInfo dir) {
+ defaultAuthzProvider.removeSnapshottable(dir);
+ }
+
+ @Override
+ public void createSnapshot(INodeAuthorizationInfo dir, int snapshotId)
+ throws IOException{
+ defaultAuthzProvider.createSnapshot(dir, snapshotId);
+ }
+
+ @Override
+ public void removeSnapshot(INodeAuthorizationInfo dir, int snapshotId)
+ throws IOException {
+ defaultAuthzProvider.removeSnapshot(dir, snapshotId);
+ }
+
+ @Override
+ public void checkPermission(String user, Set<String> groups,
+ INodeAuthorizationInfo[] inodes, int snapshotId,
+ boolean doCheckOwner, FsAction ancestorAccess, FsAction parentAccess,
+ FsAction access, FsAction subAccess, boolean ignoreEmptyDir)
+ throws AccessControlException, UnresolvedLinkException {
+ defaultAuthzProvider.checkPermission(user, groups, inodes, snapshotId,
+ doCheckOwner, ancestorAccess, parentAccess, access, subAccess,
+ ignoreEmptyDir);
+ }
+
+ private static final String[] EMPTY_STRING_ARRAY = new String[0];
+
+ private String[] getPathElements(INodeAuthorizationInfo node) {
+ return getPathElements(node, 0);
+ }
+
+ private String[] getPathElements(INodeAuthorizationInfo node, int idx) {
+ String[] paths;
+ INodeAuthorizationInfo parent = node.getParent();
+ if (parent == null) {
+ paths = (idx > 0) ? new String[idx] : EMPTY_STRING_ARRAY;
+ } else {
+ paths = getPathElements(parent, idx + 1);
+ paths[paths.length - 1 - idx] = node.getLocalName();
+ }
+ return paths;
+ }
+
+ @Override
+ public void setUser(INodeAuthorizationInfo node, String user) {
+ defaultAuthzProvider.setUser(node, user);
+ }
+
+ @Override
+ public String getUser(INodeAuthorizationInfo node, int snapshotId) {
+ String user;
+ String[] pathElements = getPathElements(node);
+ if (!authzInfo.isManaged(pathElements)) {
+ user = defaultAuthzProvider.getUser(node, snapshotId);
+ } else {
+ if (!authzInfo.isStale()) {
+ if (authzInfo.doesBelongToAuthzObject(pathElements)) {
+ user = this.user;
+ } else {
+ user = defaultAuthzProvider.getUser(node, snapshotId);
+ }
+ } else {
+ user = this.user;
+ }
+ }
+ return user;
+ }
+
+ @Override
+ public void setGroup(INodeAuthorizationInfo node, String group) {
+ defaultAuthzProvider.setGroup(node, group);
+ }
+
+ @Override
+ public String getGroup(INodeAuthorizationInfo node, int snapshotId) {
+ String group;
+ String[] pathElements = getPathElements(node);
+ if (!authzInfo.isManaged(pathElements)) {
+ group = defaultAuthzProvider.getGroup(node, snapshotId);
+ } else {
+ if (!authzInfo.isStale()) {
+ if (authzInfo.doesBelongToAuthzObject(pathElements)) {
+ group = this.group;
+ } else {
+ group = defaultAuthzProvider.getGroup(node, snapshotId);
+ }
+ } else {
+ group = this.group;
+ }
+ }
+ return group;
+ }
+
+ @Override
+ public void setPermission(INodeAuthorizationInfo node,
+ FsPermission permission) {
+ defaultAuthzProvider.setPermission(node, permission);
+ }
+
+ @Override
+ public FsPermission getFsPermission(
+ INodeAuthorizationInfo node, int snapshotId) {
+ FsPermission permission;
+ String[] pathElements = getPathElements(node);
+ if (!authzInfo.isManaged(pathElements)) {
+ permission = defaultAuthzProvider.getFsPermission(node, snapshotId);
+ } else {
+ if (!authzInfo.isStale()) {
+ if (authzInfo.doesBelongToAuthzObject(pathElements)) {
+ permission = this.permission;
+ } else {
+ permission = defaultAuthzProvider.getFsPermission(node, snapshotId);
+ }
+ } else {
+ permission = this.permission;
+ }
+ }
+ return permission;
+ }
+
+ private List<AclEntry> createAclEntries(String user, String group,
+ FsPermission permission) {
+ List<AclEntry> list = new ArrayList<AclEntry>();
+ AclEntry.Builder builder = new AclEntry.Builder();
+ FsPermission fsPerm = new FsPermission(permission);
+ builder.setName(user);
+ builder.setType(AclEntryType.USER);
+ builder.setScope(AclEntryScope.ACCESS);
+ builder.setPermission(fsPerm.getUserAction());
+ list.add(builder.build());
+ builder.setName(group);
+ builder.setType(AclEntryType.GROUP);
+ builder.setScope(AclEntryScope.ACCESS);
+ builder.setPermission(fsPerm.getGroupAction());
+ list.add(builder.build());
+ builder.setName(null);
+ builder.setType(AclEntryType.OTHER);
+ builder.setScope(AclEntryScope.ACCESS);
+ builder.setPermission(fsPerm.getOtherAction());
+ list.add(builder.build());
+ return list;
+ }
+
+ @Override
+ public AclFeature getAclFeature(INodeAuthorizationInfo node, int snapshotId) {
+ AclFeature f = null;
+ String[] pathElements = getPathElements(node);
+ String p = Arrays.toString(pathElements);
+ boolean isManaged = false;
+ boolean isStale = false;
+ boolean hasAuthzObj = false;
+ if (!authzInfo.isManaged(pathElements)) {
+ isManaged = false;
+ f = defaultAuthzProvider.getAclFeature(node, snapshotId);
+ } else {
+ isManaged = true;
+ List<AclEntry> list = new ArrayList<AclEntry>();
+ if (originalAuthzAsAcl) {
+ String user = defaultAuthzProvider.getUser(node, snapshotId);
+ String group = defaultAuthzProvider.getGroup(node, snapshotId);
+ INodeAuthorizationInfo pNode = node.getParent();
+ while (group == null || pNode != null) {
+ group = defaultAuthzProvider.getGroup(pNode, snapshotId);
+ pNode = pNode.getParent();
+ }
+ FsPermission perm = defaultAuthzProvider.getFsPermission(node, snapshotId);
+ list.addAll(createAclEntries(user, group, perm));
+ }
+ if (!authzInfo.isStale()) {
+ isStale = false;
+ if (authzInfo.doesBelongToAuthzObject(pathElements)) {
+ hasAuthzObj = true;
+ list.addAll(authzInfo.getAclEntries(pathElements));
+ f = new SentryAclFeature(ImmutableList.copyOf(list));
+ } else {
+ hasAuthzObj = false;
+ f = defaultAuthzProvider.getAclFeature(node, snapshotId);
+ }
+ } else {
+ isStale = true;
+ f = new SentryAclFeature(ImmutableList.copyOf(list));
+ }
+ }
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("### getAclEntry [" + (p == null ? "null" : p) + "] : ["
+ + "isManaged=" + isManaged
+ + ",isStale=" + isStale
+ + ",hasAuthzObj=" + hasAuthzObj
+ + ",origAtuhzAsAcl=" + originalAuthzAsAcl + "]"
+ + "[" + (f == null ? "null" : f.getEntries()) + "]");
+ }
+ return f;
+ }
+
+ @Override
+ public void removeAclFeature(INodeAuthorizationInfo node) {
+ AclFeature aclFeature = node.getAclFeature(CURRENT_STATE_ID);
+ if (aclFeature.getClass() != SentryAclFeature.class) {
+ defaultAuthzProvider.removeAclFeature(node);
+ }
+ }
+
+ @Override
+ public void addAclFeature(INodeAuthorizationInfo node, AclFeature f) {
+ String[] pathElements = getPathElements(node);
+ if (!authzInfo.isManaged(pathElements)) {
+ defaultAuthzProvider.addAclFeature(node, f);
+ }
+ }
+
+ @Override
+ public boolean doesAllowChanges(INodeAuthorizationInfo node) {
+ String[] pathElements = getPathElements(node);
+ if (!authzInfo.isManaged(pathElements)) {
+ return defaultAuthzProvider.doesAllowChanges(node);
+ }
+ return !authzInfo.doesBelongToAuthzObject(getPathElements(node));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-hdfs-int/src/main/java/org/apache/sentry/hdfs/SentryPermissions.java
----------------------------------------------------------------------
diff --git a/sentry-hdfs-int/src/main/java/org/apache/sentry/hdfs/SentryPermissions.java b/sentry-hdfs-int/src/main/java/org/apache/sentry/hdfs/SentryPermissions.java
new file mode 100644
index 0000000..7461f89
--- /dev/null
+++ b/sentry-hdfs-int/src/main/java/org/apache/sentry/hdfs/SentryPermissions.java
@@ -0,0 +1,159 @@
+/**
+ * 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.hdfs;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.hadoop.fs.permission.AclEntry;
+import org.apache.hadoop.fs.permission.AclEntryScope;
+import org.apache.hadoop.fs.permission.AclEntryType;
+import org.apache.hadoop.fs.permission.FsAction;
+
+import com.google.common.collect.Lists;
+
+public class SentryPermissions implements AuthzPermissions {
+
+ public static class PrivilegeInfo {
+ private final String authzObj;
+ private final Map<String, FsAction> roleToPermission = new HashMap<String, FsAction>();
+ public PrivilegeInfo(String authzObj) {
+ this.authzObj = authzObj;
+ }
+ public PrivilegeInfo setPermission(String role, FsAction perm) {
+ roleToPermission.put(role, perm);
+ return this;
+ }
+ public PrivilegeInfo removePermission(String role) {
+ roleToPermission.remove(role);
+ return this;
+ }
+ public FsAction getPermission(String role) {
+ return roleToPermission.get(role);
+ }
+ public Map<String, FsAction> getAllPermissions() {
+ return roleToPermission;
+ }
+ public String getAuthzObj() {
+ return authzObj;
+ }
+ }
+
+ public static class RoleInfo {
+ private final String role;
+ private final Set<String> groups = new HashSet<String>();
+ public RoleInfo(String role) {
+ this.role = role;
+ }
+ public RoleInfo addGroup(String group) {
+ groups.add(group);
+ return this;
+ }
+ public RoleInfo delGroup(String group) {
+ groups.remove(group);
+ return this;
+ }
+ public String getRole() {
+ return role;
+ }
+ public Set<String> getAllGroups() {
+ return groups;
+ }
+ }
+
+ private final Map<String, PrivilegeInfo> privileges = new HashMap<String, PrivilegeInfo>();
+ private final Map<String, RoleInfo> roles = new HashMap<String, RoleInfo>();
+
+ @Override
+ public List<AclEntry> getAcls(String authzObj) {
+ PrivilegeInfo privilegeInfo = privileges.get(authzObj);
+ Map<String, FsAction> groupPerms = new HashMap<String, FsAction>();
+ if (privilegeInfo != null) {
+ for (Map.Entry<String, FsAction> privs : privilegeInfo
+ .getAllPermissions().entrySet()) {
+ constructAclEntry(privs.getKey(), privs.getValue(), groupPerms);
+ }
+ }
+ List<AclEntry> retList = new LinkedList<AclEntry>();
+ for (Map.Entry<String, FsAction> groupPerm : groupPerms.entrySet()) {
+ AclEntry.Builder builder = new AclEntry.Builder();
+ builder.setName(groupPerm.getKey());
+ builder.setType(AclEntryType.GROUP);
+ builder.setScope(AclEntryScope.ACCESS);
+ FsAction action = groupPerm.getValue();
+ if ((action == FsAction.READ) || (action == FsAction.WRITE)
+ || (action == FsAction.READ_WRITE)) {
+ action = action.or(FsAction.EXECUTE);
+ }
+ builder.setPermission(action);
+ retList.add(builder.build());
+ }
+ return retList;
+ }
+
+ private void constructAclEntry(String role, FsAction permission,
+ Map<String, FsAction> groupPerms) {
+ RoleInfo roleInfo = roles.get(role);
+ if (roleInfo != null) {
+ for (String group : roleInfo.groups) {
+ FsAction fsAction = groupPerms.get(group);
+ if (fsAction == null) {
+ fsAction = FsAction.NONE;
+ }
+ groupPerms.put(group, fsAction.or(permission));
+ }
+ }
+ }
+
+ public PrivilegeInfo getPrivilegeInfo(String authzObj) {
+ return privileges.get(authzObj);
+ }
+
+ Collection<PrivilegeInfo> getAllPrivileges() {
+ return privileges.values();
+ }
+
+ Collection<RoleInfo> getAllRoles() {
+ return roles.values();
+ }
+
+ public void delPrivilegeInfo(String authzObj) {
+ privileges.remove(authzObj);
+ }
+
+ public void addPrivilegeInfo(PrivilegeInfo privilegeInfo) {
+ privileges.put(privilegeInfo.authzObj, privilegeInfo);
+ }
+
+ public RoleInfo getRoleInfo(String role) {
+ return roles.get(role);
+ }
+
+ public void delRoleInfo(String role) {
+ roles.remove(role);
+ }
+
+ public void addRoleInfo(RoleInfo roleInfo) {
+ roles.put(roleInfo.role, roleInfo);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-hdfs-int/src/main/java/org/apache/sentry/hdfs/SentryServiceClient.java
----------------------------------------------------------------------
diff --git a/sentry-hdfs-int/src/main/java/org/apache/sentry/hdfs/SentryServiceClient.java b/sentry-hdfs-int/src/main/java/org/apache/sentry/hdfs/SentryServiceClient.java
new file mode 100644
index 0000000..97da9aa
--- /dev/null
+++ b/sentry-hdfs-int/src/main/java/org/apache/sentry/hdfs/SentryServiceClient.java
@@ -0,0 +1,200 @@
+/**
+ * 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.hdfs;
+
+import java.io.IOException;
+import java.net.InetSocketAddress;
+import java.security.PrivilegedExceptionAction;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import javax.security.auth.callback.CallbackHandler;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.net.NetUtils;
+import org.apache.hadoop.security.SaslRpcServer;
+import org.apache.hadoop.security.SaslRpcServer.AuthMethod;
+import org.apache.hadoop.security.SecurityUtil;
+import org.apache.hadoop.security.UserGroupInformation;
+import org.apache.sentry.provider.db.service.thrift.SentryPolicyService;
+import org.apache.sentry.provider.db.service.thrift.SentryPolicyService.Client;
+import org.apache.sentry.provider.db.service.thrift.TAuthzUpdateResponse;
+import org.apache.sentry.provider.db.service.thrift.TPathsUpdate;
+import org.apache.sentry.provider.db.service.thrift.TPermissionsUpdate;
+import org.apache.sentry.service.thrift.ServiceConstants.ClientConfig;
+import org.apache.sentry.service.thrift.ServiceConstants.ServerConfig;
+import org.apache.thrift.protocol.TCompactProtocol;
+import org.apache.thrift.protocol.TMultiplexedProtocol;
+import org.apache.thrift.transport.TSaslClientTransport;
+import org.apache.thrift.transport.TSocket;
+import org.apache.thrift.transport.TTransport;
+import org.apache.thrift.transport.TTransportException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.base.Preconditions;
+
+public class SentryServiceClient {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(SentryServiceClient.class);
+
+ public static class SentryAuthzUpdate {
+
+ private final List<PermissionsUpdate> permUpdates;
+ private final List<PathsUpdate> pathUpdates;
+
+ public SentryAuthzUpdate(List<PermissionsUpdate> permUpdates, List<PathsUpdate> pathUpdates) {
+ this.permUpdates = permUpdates;
+ this.pathUpdates = pathUpdates;
+ }
+
+ public List<PermissionsUpdate> getPermUpdates() {
+ return permUpdates;
+ }
+
+ public List<PathsUpdate> getPathUpdates() {
+ return pathUpdates;
+ }
+ }
+
+ /**
+ * This transport wraps the Sasl transports to set up the right UGI context for open().
+ */
+ public static class UgiSaslClientTransport extends TSaslClientTransport {
+ protected UserGroupInformation ugi = null;
+
+ public UgiSaslClientTransport(String mechanism, String authorizationId,
+ String protocol, String serverName, Map<String, String> props,
+ CallbackHandler cbh, TTransport transport, boolean wrapUgi)
+ throws IOException {
+ super(mechanism, authorizationId, protocol, serverName, props, cbh,
+ transport);
+ if (wrapUgi) {
+ ugi = UserGroupInformation.getLoginUser();
+ }
+ }
+
+ // open the SASL transport with using the current UserGroupInformation
+ // This is needed to get the current login context stored
+ @Override
+ public void open() throws TTransportException {
+ if (ugi == null) {
+ baseOpen();
+ } else {
+ try {
+ ugi.doAs(new PrivilegedExceptionAction<Void>() {
+ public Void run() throws TTransportException {
+ baseOpen();
+ return null;
+ }
+ });
+ } catch (IOException e) {
+ throw new TTransportException("Failed to open SASL transport", e);
+ } catch (InterruptedException e) {
+ throw new TTransportException(
+ "Interrupted while opening underlying transport", e);
+ }
+ }
+ }
+
+ private void baseOpen() throws TTransportException {
+ super.open();
+ }
+ }
+
+ private final Configuration conf;
+ private final InetSocketAddress serverAddress;
+ private final int connectionTimeout;
+ private boolean kerberos;
+ private TTransport transport;
+
+ private String[] serverPrincipalParts;
+ private Client client;
+
+ public SentryServiceClient(Configuration conf) throws IOException {
+ this.conf = conf;
+ Preconditions.checkNotNull(this.conf, "Configuration object cannot be null");
+ this.serverAddress = NetUtils.createSocketAddr(Preconditions.checkNotNull(
+ conf.get(ClientConfig.SERVER_RPC_ADDRESS), "Config key "
+ + ClientConfig.SERVER_RPC_ADDRESS + " is required"), conf.getInt(
+ ClientConfig.SERVER_RPC_PORT, ClientConfig.SERVER_RPC_PORT_DEFAULT));
+ this.connectionTimeout = conf.getInt(ClientConfig.SERVER_RPC_CONN_TIMEOUT,
+ ClientConfig.SERVER_RPC_CONN_TIMEOUT_DEFAULT);
+ kerberos = ServerConfig.SECURITY_MODE_KERBEROS.equalsIgnoreCase(
+ conf.get(ServerConfig.SECURITY_MODE, ServerConfig.SECURITY_MODE_KERBEROS).trim());
+ transport = new TSocket(serverAddress.getHostName(),
+ serverAddress.getPort(), connectionTimeout);
+ if (kerberos) {
+ String serverPrincipal = Preconditions.checkNotNull(conf.get(ServerConfig.PRINCIPAL), ServerConfig.PRINCIPAL + " is required");
+
+ // Resolve server host in the same way as we are doing on server side
+ serverPrincipal = SecurityUtil.getServerPrincipal(serverPrincipal, serverAddress.getAddress());
+ LOGGER.info("Using server kerberos principal: " + serverPrincipal);
+
+ serverPrincipalParts = SaslRpcServer.splitKerberosName(serverPrincipal);
+ Preconditions.checkArgument(serverPrincipalParts.length == 3,
+ "Kerberos principal should have 3 parts: " + serverPrincipal);
+ boolean wrapUgi = "true".equalsIgnoreCase(conf
+ .get(ServerConfig.SECURITY_USE_UGI_TRANSPORT, "true"));
+ transport = new UgiSaslClientTransport(AuthMethod.KERBEROS.getMechanismName(),
+ null, serverPrincipalParts[0], serverPrincipalParts[1],
+ ClientConfig.SASL_PROPERTIES, null, transport, wrapUgi);
+ } else {
+ serverPrincipalParts = null;
+ }
+ try {
+ transport.open();
+ } catch (TTransportException e) {
+ throw new IOException("Transport exception while opening transport: " + e.getMessage(), e);
+ }
+ LOGGER.info("Successfully opened transport: " + transport + " to " + serverAddress);
+ TMultiplexedProtocol protocol = new TMultiplexedProtocol(
+ new TCompactProtocol(transport),
+ "SentryPolicyService");
+ client = new SentryPolicyService.Client(protocol);
+ LOGGER.info("Successfully created client");
+ }
+
+ public synchronized SentryAuthzUpdate getAllUpdatesFrom(long permSeqNum, long pathSeqNum)
+ throws IOException {
+ SentryAuthzUpdate retVal = new SentryAuthzUpdate(new LinkedList<PermissionsUpdate>(), new LinkedList<PathsUpdate>());
+ try {
+ TAuthzUpdateResponse sentryUpdates = client.get_all_authz_updates_from(permSeqNum, pathSeqNum);
+ if (sentryUpdates.getAuthzPathUpdate() != null) {
+ for (TPathsUpdate pathsUpdate : sentryUpdates.getAuthzPathUpdate()) {
+ retVal.getPathUpdates().add(new PathsUpdate(pathsUpdate));
+ }
+ }
+ if (sentryUpdates.getAuthzPermUpdate() != null) {
+ for (TPermissionsUpdate permsUpdate : sentryUpdates.getAuthzPermUpdate()) {
+ retVal.getPermUpdates().add(new PermissionsUpdate(permsUpdate));
+ }
+ }
+ } catch (Exception e) {
+ throw new IOException("Thrift Exception occurred !!", e);
+ }
+ return retVal;
+ }
+
+ public void close() {
+ if (transport != null) {
+ transport.close();
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-hdfs-int/src/main/java/org/apache/sentry/hdfs/SentryUpdater.java
----------------------------------------------------------------------
diff --git a/sentry-hdfs-int/src/main/java/org/apache/sentry/hdfs/SentryUpdater.java b/sentry-hdfs-int/src/main/java/org/apache/sentry/hdfs/SentryUpdater.java
new file mode 100644
index 0000000..bc46651
--- /dev/null
+++ b/sentry-hdfs-int/src/main/java/org/apache/sentry/hdfs/SentryUpdater.java
@@ -0,0 +1,60 @@
+/**
+ * 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.hdfs;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.sentry.hdfs.SentryServiceClient.SentryAuthzUpdate;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class SentryUpdater {
+
+ private SentryServiceClient sentryClient;
+ private final Configuration conf;
+ private final SentryAuthorizationInfo authzInfo;
+
+ private static Logger LOG = LoggerFactory.getLogger(SentryUpdater.class);
+
+ public SentryUpdater(Configuration conf, SentryAuthorizationInfo authzInfo) throws Exception {
+ this.conf = conf;
+ this.authzInfo = authzInfo;
+ }
+
+ public SentryAuthzUpdate getUpdates() {
+ if (sentryClient == null) {
+ try {
+ sentryClient = new SentryServiceClient(conf);
+ } catch (Exception e) {
+ LOG.error("Error connecting to Sentry ['{}'] !!",
+ e.getMessage());
+ return null;
+ }
+ }
+ try {
+ SentryAuthzUpdate sentryUpdates = sentryClient.getAllUpdatesFrom(
+ authzInfo.getAuthzPermissions().getLastUpdatedSeqNum() + 1,
+ authzInfo.getAuthzPaths().getLastUpdatedSeqNum() + 1);
+ return sentryUpdates;
+ } catch (Exception e) {
+ sentryClient = null;
+ LOG.error("Error receiving updates from Sentry !!", e);
+ return null;
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-hdfs-int/src/main/java/org/apache/sentry/hdfs/UpdateableAuthzPermissions.java
----------------------------------------------------------------------
diff --git a/sentry-hdfs-int/src/main/java/org/apache/sentry/hdfs/UpdateableAuthzPermissions.java b/sentry-hdfs-int/src/main/java/org/apache/sentry/hdfs/UpdateableAuthzPermissions.java
new file mode 100644
index 0000000..f9e1cf4
--- /dev/null
+++ b/sentry-hdfs-int/src/main/java/org/apache/sentry/hdfs/UpdateableAuthzPermissions.java
@@ -0,0 +1,179 @@
+/**
+ * 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.hdfs;
+
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.concurrent.locks.ReadWriteLock;
+
+import org.apache.hadoop.fs.permission.AclEntry;
+import org.apache.hadoop.fs.permission.FsAction;
+import org.apache.sentry.hdfs.SentryPermissions.PrivilegeInfo;
+import org.apache.sentry.hdfs.SentryPermissions.RoleInfo;
+import org.apache.sentry.provider.db.service.thrift.TPrivilegeChanges;
+import org.apache.sentry.provider.db.service.thrift.TRoleChanges;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class UpdateableAuthzPermissions implements AuthzPermissions, Updateable<PermissionsUpdate> {
+ private volatile SentryPermissions perms = new SentryPermissions();
+ private final AtomicLong seqNum = new AtomicLong(0);
+
+ private static Logger LOG = LoggerFactory.getLogger(UpdateableAuthzPermissions.class);
+
+ @Override
+ public List<AclEntry> getAcls(String authzObj) {
+ return perms.getAcls(authzObj);
+ }
+
+ @Override
+ public UpdateableAuthzPermissions updateFull(PermissionsUpdate update) {
+ UpdateableAuthzPermissions other = new UpdateableAuthzPermissions();
+ other.applyPartialUpdate(update);
+ other.seqNum.set(update.getSeqNum());
+ return other;
+ }
+
+ @Override
+ public void updatePartial(Iterable<PermissionsUpdate> updates, ReadWriteLock lock) {
+ lock.writeLock().lock();
+ try {
+ int counter = 0;
+ for (PermissionsUpdate update : updates) {
+ applyPartialUpdate(update);
+ if (++counter > 99) {
+ counter = 0;
+ lock.writeLock().unlock();
+ lock.writeLock().lock();
+ }
+ seqNum.set(update.getSeqNum());
+ LOG.warn("##### Updated perms seq Num [" + seqNum.get() + "]");
+ }
+ } finally {
+ lock.writeLock().unlock();
+ }
+ }
+
+
+ private void applyPartialUpdate(PermissionsUpdate update) {
+ applyPrivilegeUpdates(update);
+ applyRoleUpdates(update);
+ }
+
+ private void applyRoleUpdates(PermissionsUpdate update) {
+ for (TRoleChanges rUpdate : update.getRoleUpdates()) {
+ if (rUpdate.getRole().equals(PermissionsUpdate.ALL_ROLES)) {
+ // Request to remove group from all roles
+ String groupToRemove = rUpdate.getDelGroups().iterator().next();
+ for (RoleInfo rInfo : perms.getAllRoles()) {
+ rInfo.delGroup(groupToRemove);
+ }
+ }
+ RoleInfo rInfo = perms.getRoleInfo(rUpdate.getRole());
+ for (String group : rUpdate.getAddGroups()) {
+ if (rInfo == null) {
+ rInfo = new RoleInfo(rUpdate.getRole());
+ }
+ rInfo.addGroup(group);
+ }
+ if (rInfo != null) {
+ perms.addRoleInfo(rInfo);
+ for (String group : rUpdate.getDelGroups()) {
+ if (group.equals(PermissionsUpdate.ALL_GROUPS)) {
+ perms.delRoleInfo(rInfo.getRole());
+ break;
+ }
+ // If there are no groups to remove, rUpdate.getDelGroups() will
+ // return empty list and this code will not be reached
+ rInfo.delGroup(group);
+ }
+ }
+ }
+ }
+
+ private void applyPrivilegeUpdates(PermissionsUpdate update) {
+ for (TPrivilegeChanges pUpdate : update.getPrivilegeUpdates()) {
+ if (pUpdate.getAuthzObj().equals(PermissionsUpdate.ALL_PRIVS)) {
+ // Request to remove role from all Privileges
+ String roleToRemove = pUpdate.getDelPrivileges().keySet().iterator()
+ .next();
+ for (PrivilegeInfo pInfo : perms.getAllPrivileges()) {
+ pInfo.removePermission(roleToRemove);
+ }
+ }
+ PrivilegeInfo pInfo = perms.getPrivilegeInfo(pUpdate.getAuthzObj());
+ for (Map.Entry<String, String> aMap : pUpdate.getAddPrivileges().entrySet()) {
+ if (pInfo == null) {
+ pInfo = new PrivilegeInfo(pUpdate.getAuthzObj());
+ }
+ FsAction fsAction = pInfo.getPermission(aMap.getKey());
+ if (fsAction == null) {
+ fsAction = FsAction.getFsAction(aMap.getValue());
+ } else {
+ fsAction = fsAction.or(FsAction.getFsAction(aMap.getValue()));
+ }
+ pInfo.setPermission(aMap.getKey(), fsAction);
+ }
+ if (pInfo != null) {
+ perms.addPrivilegeInfo(pInfo);
+ for (Map.Entry<String, String> dMap : pUpdate.getDelPrivileges().entrySet()) {
+ if (dMap.getKey().equals(PermissionsUpdate.ALL_ROLES)) {
+ // Remove all privileges
+ perms.delPrivilegeInfo(pUpdate.getAuthzObj());
+ break;
+ }
+ FsAction fsAction = pInfo.getPermission(dMap.getKey());
+ if (fsAction != null) {
+ fsAction = fsAction.and(FsAction.getFsAction(dMap.getValue()).not());
+ if (FsAction.NONE == fsAction) {
+ pInfo.removePermission(dMap.getKey());
+ } else {
+ pInfo.setPermission(dMap.getKey(), fsAction);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ @Override
+ public long getLastUpdatedSeqNum() {
+ return seqNum.get();
+ }
+
+ @Override
+ public PermissionsUpdate createFullImageUpdate(long currSeqNum) {
+ PermissionsUpdate retVal = new PermissionsUpdate(currSeqNum, true);
+ for (PrivilegeInfo pInfo : perms.getAllPrivileges()) {
+ TPrivilegeChanges pUpdate = retVal.addPrivilegeUpdate(pInfo.getAuthzObj());
+ for (Map.Entry<String, FsAction> ent : pInfo.getAllPermissions().entrySet()) {
+ pUpdate.putToAddPrivileges(ent.getKey(), ent.getValue().SYMBOL);
+ }
+ }
+ for (RoleInfo rInfo : perms.getAllRoles()) {
+ TRoleChanges rUpdate = retVal.addRoleUpdate(rInfo.getRole());
+ for (String group : rInfo.getAllGroups()) {
+ rUpdate.addToAddGroups(group);
+ }
+ }
+ return retVal;
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-hdfs-int/src/test/java/org/apache/sentry/hdfs/MockSentryAuthorizationProvider.java
----------------------------------------------------------------------
diff --git a/sentry-hdfs-int/src/test/java/org/apache/sentry/hdfs/MockSentryAuthorizationProvider.java b/sentry-hdfs-int/src/test/java/org/apache/sentry/hdfs/MockSentryAuthorizationProvider.java
new file mode 100644
index 0000000..2085b52
--- /dev/null
+++ b/sentry-hdfs-int/src/test/java/org/apache/sentry/hdfs/MockSentryAuthorizationProvider.java
@@ -0,0 +1,26 @@
+/**
+ * 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.hdfs;
+
+public class MockSentryAuthorizationProvider extends
+ SentryAuthorizationProvider {
+
+ public MockSentryAuthorizationProvider() {
+ super(new SentryAuthorizationInfoX());
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/0eb6645e/sentry-hdfs-int/src/test/java/org/apache/sentry/hdfs/SentryAuthorizationInfoX.java
----------------------------------------------------------------------
diff --git a/sentry-hdfs-int/src/test/java/org/apache/sentry/hdfs/SentryAuthorizationInfoX.java b/sentry-hdfs-int/src/test/java/org/apache/sentry/hdfs/SentryAuthorizationInfoX.java
new file mode 100644
index 0000000..7a1539b
--- /dev/null
+++ b/sentry-hdfs-int/src/test/java/org/apache/sentry/hdfs/SentryAuthorizationInfoX.java
@@ -0,0 +1,85 @@
+/**
+ * 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.hdfs;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.permission.AclEntry;
+import org.apache.hadoop.fs.permission.AclEntryScope;
+import org.apache.hadoop.fs.permission.AclEntryType;
+import org.apache.hadoop.fs.permission.FsAction;
+
+public class SentryAuthorizationInfoX extends SentryAuthorizationInfo {
+
+ public SentryAuthorizationInfoX() {
+ super();
+ }
+
+ @Override
+ public void run() {
+
+ }
+
+ @Override
+ public void start() {
+
+ }
+
+ @Override
+ public void stop() {
+
+ }
+
+ @Override
+ public boolean isStale() {
+ return false;
+ }
+
+ private static final String[] MANAGED = {"user", "authz"};
+ private static final String[] AUTHZ_OBJ = {"user", "authz", "obj"};
+
+ private boolean hasPrefix(String[] prefix, String[] pathElement) {
+ int i = 0;
+ for (; i < prefix.length && i < pathElement.length; i ++) {
+ if (!prefix[i].equals(pathElement[i])) {
+ return false;
+ }
+ }
+ return (i == prefix.length);
+ }
+
+ @Override
+ public boolean isManaged(String[] pathElements) {
+ return hasPrefix(MANAGED, pathElements);
+ }
+
+ @Override
+ public boolean doesBelongToAuthzObject(String[] pathElements) {
+ return hasPrefix(AUTHZ_OBJ, pathElements);
+ }
+
+ @Override
+ public List<AclEntry> getAclEntries(String[] pathElements) {
+ AclEntry acl = new AclEntry.Builder().setType(AclEntryType.USER).
+ setPermission(FsAction.ALL).setName("user-authz").
+ setScope(AclEntryScope.ACCESS).build();
+ return Arrays.asList(acl);
+ }
+}