blob: 9e7280212cca31fc6ef467a4004ea20f1b46bc8c [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 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);
}
}
}
}