| /** |
| * Autogenerated by Thrift Compiler (0.9.3) |
| * |
| * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING |
| * @generated |
| */ |
| package org.apache.sentry.hdfs.service.thrift; |
| |
| import org.apache.thrift.scheme.IScheme; |
| import org.apache.thrift.scheme.SchemeFactory; |
| import org.apache.thrift.scheme.StandardScheme; |
| |
| import org.apache.thrift.scheme.TupleScheme; |
| import org.apache.thrift.protocol.TTupleProtocol; |
| import org.apache.thrift.protocol.TProtocolException; |
| import org.apache.thrift.EncodingUtils; |
| import org.apache.thrift.TException; |
| import org.apache.thrift.async.AsyncMethodCallback; |
| import org.apache.thrift.server.AbstractNonblockingServer.*; |
| import java.util.List; |
| import java.util.ArrayList; |
| import java.util.Map; |
| import java.util.HashMap; |
| import java.util.EnumMap; |
| import java.util.Set; |
| import java.util.HashSet; |
| import java.util.EnumSet; |
| import java.util.Collections; |
| import java.util.BitSet; |
| import java.nio.ByteBuffer; |
| import java.util.Arrays; |
| import javax.annotation.Generated; |
| import org.slf4j.Logger; |
| import org.slf4j.LoggerFactory; |
| |
| @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) |
| @Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2017-04-26") |
| public class TAuthzUpdateResponse implements org.apache.thrift.TBase<TAuthzUpdateResponse, TAuthzUpdateResponse._Fields>, java.io.Serializable, Cloneable, Comparable<TAuthzUpdateResponse> { |
| 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 static final _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>(other.authzPathUpdate.size()); |
| 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>(other.authzPermUpdate.size()); |
| 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() { |
| List<Object> list = new ArrayList<Object>(); |
| |
| boolean present_authzPathUpdate = true && (isSetAuthzPathUpdate()); |
| list.add(present_authzPathUpdate); |
| if (present_authzPathUpdate) |
| list.add(authzPathUpdate); |
| |
| boolean present_authzPermUpdate = true && (isSetAuthzPermUpdate()); |
| list.add(present_authzPermUpdate); |
| if (present_authzPermUpdate) |
| list.add(authzPermUpdate); |
| |
| return list.hashCode(); |
| } |
| |
| @Override |
| public int compareTo(TAuthzUpdateResponse other) { |
| if (!getClass().equals(other.getClass())) { |
| return getClass().getName().compareTo(other.getClass().getName()); |
| } |
| |
| int lastComparison = 0; |
| |
| lastComparison = Boolean.valueOf(isSetAuthzPathUpdate()).compareTo(other.isSetAuthzPathUpdate()); |
| if (lastComparison != 0) { |
| return lastComparison; |
| } |
| if (isSetAuthzPathUpdate()) { |
| lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.authzPathUpdate, other.authzPathUpdate); |
| if (lastComparison != 0) { |
| return lastComparison; |
| } |
| } |
| lastComparison = Boolean.valueOf(isSetAuthzPermUpdate()).compareTo(other.isSetAuthzPermUpdate()); |
| if (lastComparison != 0) { |
| return lastComparison; |
| } |
| if (isSetAuthzPermUpdate()) { |
| lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.authzPermUpdate, other.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 _list122 = iprot.readListBegin(); |
| struct.authzPathUpdate = new ArrayList<TPathsUpdate>(_list122.size); |
| TPathsUpdate _elem123; |
| for (int _i124 = 0; _i124 < _list122.size; ++_i124) |
| { |
| _elem123 = new TPathsUpdate(); |
| _elem123.read(iprot); |
| struct.authzPathUpdate.add(_elem123); |
| } |
| 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 _list125 = iprot.readListBegin(); |
| struct.authzPermUpdate = new ArrayList<TPermissionsUpdate>(_list125.size); |
| TPermissionsUpdate _elem126; |
| for (int _i127 = 0; _i127 < _list125.size; ++_i127) |
| { |
| _elem126 = new TPermissionsUpdate(); |
| _elem126.read(iprot); |
| struct.authzPermUpdate.add(_elem126); |
| } |
| 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 _iter128 : struct.authzPathUpdate) |
| { |
| _iter128.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 _iter129 : struct.authzPermUpdate) |
| { |
| _iter129.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 _iter130 : struct.authzPathUpdate) |
| { |
| _iter130.write(oprot); |
| } |
| } |
| } |
| if (struct.isSetAuthzPermUpdate()) { |
| { |
| oprot.writeI32(struct.authzPermUpdate.size()); |
| for (TPermissionsUpdate _iter131 : struct.authzPermUpdate) |
| { |
| _iter131.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 _list132 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); |
| struct.authzPathUpdate = new ArrayList<TPathsUpdate>(_list132.size); |
| TPathsUpdate _elem133; |
| for (int _i134 = 0; _i134 < _list132.size; ++_i134) |
| { |
| _elem133 = new TPathsUpdate(); |
| _elem133.read(iprot); |
| struct.authzPathUpdate.add(_elem133); |
| } |
| } |
| struct.setAuthzPathUpdateIsSet(true); |
| } |
| if (incoming.get(1)) { |
| { |
| org.apache.thrift.protocol.TList _list135 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); |
| struct.authzPermUpdate = new ArrayList<TPermissionsUpdate>(_list135.size); |
| TPermissionsUpdate _elem136; |
| for (int _i137 = 0; _i137 < _list135.size; ++_i137) |
| { |
| _elem136 = new TPermissionsUpdate(); |
| _elem136.read(iprot); |
| struct.authzPermUpdate.add(_elem136); |
| } |
| } |
| struct.setAuthzPermUpdateIsSet(true); |
| } |
| } |
| } |
| |
| } |
| |