blob: 3ded6314f862e7775c6aff732ea10dfd21bc747a [file] [log] [blame]
/**
* 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);
}
}
}