Back to home page

OSCL-LXR

 
 

    


0001 /**
0002  * Autogenerated by Thrift Compiler (0.9.0)
0003  *
0004  * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
0005  *  @generated
0006  */
0007 package org.apache.hive.service.cli.thrift;
0008 
0009 import org.apache.commons.lang.builder.HashCodeBuilder;
0010 import org.apache.thrift.scheme.IScheme;
0011 import org.apache.thrift.scheme.SchemeFactory;
0012 import org.apache.thrift.scheme.StandardScheme;
0013 
0014 import org.apache.thrift.scheme.TupleScheme;
0015 import org.apache.thrift.protocol.TTupleProtocol;
0016 import org.apache.thrift.protocol.TProtocolException;
0017 import org.apache.thrift.EncodingUtils;
0018 import org.apache.thrift.TException;
0019 import java.util.List;
0020 import java.util.ArrayList;
0021 import java.util.Map;
0022 import java.util.HashMap;
0023 import java.util.EnumMap;
0024 import java.util.Set;
0025 import java.util.HashSet;
0026 import java.util.EnumSet;
0027 import java.util.Collections;
0028 import java.util.BitSet;
0029 import java.nio.ByteBuffer;
0030 import java.util.Arrays;
0031 import org.slf4j.Logger;
0032 import org.slf4j.LoggerFactory;
0033 
0034 public class TCancelDelegationTokenReq implements org.apache.thrift.TBase<TCancelDelegationTokenReq, TCancelDelegationTokenReq._Fields>, java.io.Serializable, Cloneable {
0035   private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TCancelDelegationTokenReq");
0036 
0037   private static final org.apache.thrift.protocol.TField SESSION_HANDLE_FIELD_DESC = new org.apache.thrift.protocol.TField("sessionHandle", org.apache.thrift.protocol.TType.STRUCT, (short)1);
0038   private static final org.apache.thrift.protocol.TField DELEGATION_TOKEN_FIELD_DESC = new org.apache.thrift.protocol.TField("delegationToken", org.apache.thrift.protocol.TType.STRING, (short)2);
0039 
0040   private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
0041   static {
0042     schemes.put(StandardScheme.class, new TCancelDelegationTokenReqStandardSchemeFactory());
0043     schemes.put(TupleScheme.class, new TCancelDelegationTokenReqTupleSchemeFactory());
0044   }
0045 
0046   private TSessionHandle sessionHandle; // required
0047   private String delegationToken; // required
0048 
0049   /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
0050   public enum _Fields implements org.apache.thrift.TFieldIdEnum {
0051     SESSION_HANDLE((short)1, "sessionHandle"),
0052     DELEGATION_TOKEN((short)2, "delegationToken");
0053 
0054     private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
0055 
0056     static {
0057       for (_Fields field : EnumSet.allOf(_Fields.class)) {
0058         byName.put(field.getFieldName(), field);
0059       }
0060     }
0061 
0062     /**
0063      * Find the _Fields constant that matches fieldId, or null if its not found.
0064      */
0065     public static _Fields findByThriftId(int fieldId) {
0066       switch(fieldId) {
0067         case 1: // SESSION_HANDLE
0068           return SESSION_HANDLE;
0069         case 2: // DELEGATION_TOKEN
0070           return DELEGATION_TOKEN;
0071         default:
0072           return null;
0073       }
0074     }
0075 
0076     /**
0077      * Find the _Fields constant that matches fieldId, throwing an exception
0078      * if it is not found.
0079      */
0080     public static _Fields findByThriftIdOrThrow(int fieldId) {
0081       _Fields fields = findByThriftId(fieldId);
0082       if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
0083       return fields;
0084     }
0085 
0086     /**
0087      * Find the _Fields constant that matches name, or null if its not found.
0088      */
0089     public static _Fields findByName(String name) {
0090       return byName.get(name);
0091     }
0092 
0093     private final short _thriftId;
0094     private final String _fieldName;
0095 
0096     _Fields(short thriftId, String fieldName) {
0097       _thriftId = thriftId;
0098       _fieldName = fieldName;
0099     }
0100 
0101     public short getThriftFieldId() {
0102       return _thriftId;
0103     }
0104 
0105     public String getFieldName() {
0106       return _fieldName;
0107     }
0108   }
0109 
0110   // isset id assignments
0111   public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
0112   static {
0113     Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
0114     tmpMap.put(_Fields.SESSION_HANDLE, new org.apache.thrift.meta_data.FieldMetaData("sessionHandle", org.apache.thrift.TFieldRequirementType.REQUIRED, 
0115         new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TSessionHandle.class)));
0116     tmpMap.put(_Fields.DELEGATION_TOKEN, new org.apache.thrift.meta_data.FieldMetaData("delegationToken", org.apache.thrift.TFieldRequirementType.REQUIRED, 
0117         new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
0118     metaDataMap = Collections.unmodifiableMap(tmpMap);
0119     org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TCancelDelegationTokenReq.class, metaDataMap);
0120   }
0121 
0122   public TCancelDelegationTokenReq() {
0123   }
0124 
0125   public TCancelDelegationTokenReq(
0126     TSessionHandle sessionHandle,
0127     String delegationToken)
0128   {
0129     this();
0130     this.sessionHandle = sessionHandle;
0131     this.delegationToken = delegationToken;
0132   }
0133 
0134   /**
0135    * Performs a deep copy on <i>other</i>.
0136    */
0137   public TCancelDelegationTokenReq(TCancelDelegationTokenReq other) {
0138     if (other.isSetSessionHandle()) {
0139       this.sessionHandle = new TSessionHandle(other.sessionHandle);
0140     }
0141     if (other.isSetDelegationToken()) {
0142       this.delegationToken = other.delegationToken;
0143     }
0144   }
0145 
0146   public TCancelDelegationTokenReq deepCopy() {
0147     return new TCancelDelegationTokenReq(this);
0148   }
0149 
0150   @Override
0151   public void clear() {
0152     this.sessionHandle = null;
0153     this.delegationToken = null;
0154   }
0155 
0156   public TSessionHandle getSessionHandle() {
0157     return this.sessionHandle;
0158   }
0159 
0160   public void setSessionHandle(TSessionHandle sessionHandle) {
0161     this.sessionHandle = sessionHandle;
0162   }
0163 
0164   public void unsetSessionHandle() {
0165     this.sessionHandle = null;
0166   }
0167 
0168   /** Returns true if field sessionHandle is set (has been assigned a value) and false otherwise */
0169   public boolean isSetSessionHandle() {
0170     return this.sessionHandle != null;
0171   }
0172 
0173   public void setSessionHandleIsSet(boolean value) {
0174     if (!value) {
0175       this.sessionHandle = null;
0176     }
0177   }
0178 
0179   public String getDelegationToken() {
0180     return this.delegationToken;
0181   }
0182 
0183   public void setDelegationToken(String delegationToken) {
0184     this.delegationToken = delegationToken;
0185   }
0186 
0187   public void unsetDelegationToken() {
0188     this.delegationToken = null;
0189   }
0190 
0191   /** Returns true if field delegationToken is set (has been assigned a value) and false otherwise */
0192   public boolean isSetDelegationToken() {
0193     return this.delegationToken != null;
0194   }
0195 
0196   public void setDelegationTokenIsSet(boolean value) {
0197     if (!value) {
0198       this.delegationToken = null;
0199     }
0200   }
0201 
0202   public void setFieldValue(_Fields field, Object value) {
0203     switch (field) {
0204     case SESSION_HANDLE:
0205       if (value == null) {
0206         unsetSessionHandle();
0207       } else {
0208         setSessionHandle((TSessionHandle)value);
0209       }
0210       break;
0211 
0212     case DELEGATION_TOKEN:
0213       if (value == null) {
0214         unsetDelegationToken();
0215       } else {
0216         setDelegationToken((String)value);
0217       }
0218       break;
0219 
0220     }
0221   }
0222 
0223   public Object getFieldValue(_Fields field) {
0224     switch (field) {
0225     case SESSION_HANDLE:
0226       return getSessionHandle();
0227 
0228     case DELEGATION_TOKEN:
0229       return getDelegationToken();
0230 
0231     }
0232     throw new IllegalStateException();
0233   }
0234 
0235   /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
0236   public boolean isSet(_Fields field) {
0237     if (field == null) {
0238       throw new IllegalArgumentException();
0239     }
0240 
0241     switch (field) {
0242     case SESSION_HANDLE:
0243       return isSetSessionHandle();
0244     case DELEGATION_TOKEN:
0245       return isSetDelegationToken();
0246     }
0247     throw new IllegalStateException();
0248   }
0249 
0250   @Override
0251   public boolean equals(Object that) {
0252     if (that == null)
0253       return false;
0254     if (that instanceof TCancelDelegationTokenReq)
0255       return this.equals((TCancelDelegationTokenReq)that);
0256     return false;
0257   }
0258 
0259   public boolean equals(TCancelDelegationTokenReq that) {
0260     if (that == null)
0261       return false;
0262 
0263     boolean this_present_sessionHandle = true && this.isSetSessionHandle();
0264     boolean that_present_sessionHandle = true && that.isSetSessionHandle();
0265     if (this_present_sessionHandle || that_present_sessionHandle) {
0266       if (!(this_present_sessionHandle && that_present_sessionHandle))
0267         return false;
0268       if (!this.sessionHandle.equals(that.sessionHandle))
0269         return false;
0270     }
0271 
0272     boolean this_present_delegationToken = true && this.isSetDelegationToken();
0273     boolean that_present_delegationToken = true && that.isSetDelegationToken();
0274     if (this_present_delegationToken || that_present_delegationToken) {
0275       if (!(this_present_delegationToken && that_present_delegationToken))
0276         return false;
0277       if (!this.delegationToken.equals(that.delegationToken))
0278         return false;
0279     }
0280 
0281     return true;
0282   }
0283 
0284   @Override
0285   public int hashCode() {
0286     HashCodeBuilder builder = new HashCodeBuilder();
0287 
0288     boolean present_sessionHandle = true && (isSetSessionHandle());
0289     builder.append(present_sessionHandle);
0290     if (present_sessionHandle)
0291       builder.append(sessionHandle);
0292 
0293     boolean present_delegationToken = true && (isSetDelegationToken());
0294     builder.append(present_delegationToken);
0295     if (present_delegationToken)
0296       builder.append(delegationToken);
0297 
0298     return builder.toHashCode();
0299   }
0300 
0301   public int compareTo(TCancelDelegationTokenReq other) {
0302     if (!getClass().equals(other.getClass())) {
0303       return getClass().getName().compareTo(other.getClass().getName());
0304     }
0305 
0306     int lastComparison = 0;
0307     TCancelDelegationTokenReq typedOther = (TCancelDelegationTokenReq)other;
0308 
0309     lastComparison = Boolean.valueOf(isSetSessionHandle()).compareTo(typedOther.isSetSessionHandle());
0310     if (lastComparison != 0) {
0311       return lastComparison;
0312     }
0313     if (isSetSessionHandle()) {
0314       lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.sessionHandle, typedOther.sessionHandle);
0315       if (lastComparison != 0) {
0316         return lastComparison;
0317       }
0318     }
0319     lastComparison = Boolean.valueOf(isSetDelegationToken()).compareTo(typedOther.isSetDelegationToken());
0320     if (lastComparison != 0) {
0321       return lastComparison;
0322     }
0323     if (isSetDelegationToken()) {
0324       lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delegationToken, typedOther.delegationToken);
0325       if (lastComparison != 0) {
0326         return lastComparison;
0327       }
0328     }
0329     return 0;
0330   }
0331 
0332   public _Fields fieldForId(int fieldId) {
0333     return _Fields.findByThriftId(fieldId);
0334   }
0335 
0336   public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
0337     schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
0338   }
0339 
0340   public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
0341     schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
0342   }
0343 
0344   @Override
0345   public String toString() {
0346     StringBuilder sb = new StringBuilder("TCancelDelegationTokenReq(");
0347     boolean first = true;
0348 
0349     sb.append("sessionHandle:");
0350     if (this.sessionHandle == null) {
0351       sb.append("null");
0352     } else {
0353       sb.append(this.sessionHandle);
0354     }
0355     first = false;
0356     if (!first) sb.append(", ");
0357     sb.append("delegationToken:");
0358     if (this.delegationToken == null) {
0359       sb.append("null");
0360     } else {
0361       sb.append(this.delegationToken);
0362     }
0363     first = false;
0364     sb.append(")");
0365     return sb.toString();
0366   }
0367 
0368   public void validate() throws org.apache.thrift.TException {
0369     // check for required fields
0370     if (!isSetSessionHandle()) {
0371       throw new org.apache.thrift.protocol.TProtocolException("Required field 'sessionHandle' is unset! Struct:" + toString());
0372     }
0373 
0374     if (!isSetDelegationToken()) {
0375       throw new org.apache.thrift.protocol.TProtocolException("Required field 'delegationToken' is unset! Struct:" + toString());
0376     }
0377 
0378     // check for sub-struct validity
0379     if (sessionHandle != null) {
0380       sessionHandle.validate();
0381     }
0382   }
0383 
0384   private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
0385     try {
0386       write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
0387     } catch (org.apache.thrift.TException te) {
0388       throw new java.io.IOException(te);
0389     }
0390   }
0391 
0392   private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
0393     try {
0394       read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
0395     } catch (org.apache.thrift.TException te) {
0396       throw new java.io.IOException(te);
0397     }
0398   }
0399 
0400   private static class TCancelDelegationTokenReqStandardSchemeFactory implements SchemeFactory {
0401     public TCancelDelegationTokenReqStandardScheme getScheme() {
0402       return new TCancelDelegationTokenReqStandardScheme();
0403     }
0404   }
0405 
0406   private static class TCancelDelegationTokenReqStandardScheme extends StandardScheme<TCancelDelegationTokenReq> {
0407 
0408     public void read(org.apache.thrift.protocol.TProtocol iprot, TCancelDelegationTokenReq struct) throws org.apache.thrift.TException {
0409       org.apache.thrift.protocol.TField schemeField;
0410       iprot.readStructBegin();
0411       while (true)
0412       {
0413         schemeField = iprot.readFieldBegin();
0414         if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
0415           break;
0416         }
0417         switch (schemeField.id) {
0418           case 1: // SESSION_HANDLE
0419             if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
0420               struct.sessionHandle = new TSessionHandle();
0421               struct.sessionHandle.read(iprot);
0422               struct.setSessionHandleIsSet(true);
0423             } else { 
0424               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
0425             }
0426             break;
0427           case 2: // DELEGATION_TOKEN
0428             if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
0429               struct.delegationToken = iprot.readString();
0430               struct.setDelegationTokenIsSet(true);
0431             } else { 
0432               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
0433             }
0434             break;
0435           default:
0436             org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
0437         }
0438         iprot.readFieldEnd();
0439       }
0440       iprot.readStructEnd();
0441       struct.validate();
0442     }
0443 
0444     public void write(org.apache.thrift.protocol.TProtocol oprot, TCancelDelegationTokenReq struct) throws org.apache.thrift.TException {
0445       struct.validate();
0446 
0447       oprot.writeStructBegin(STRUCT_DESC);
0448       if (struct.sessionHandle != null) {
0449         oprot.writeFieldBegin(SESSION_HANDLE_FIELD_DESC);
0450         struct.sessionHandle.write(oprot);
0451         oprot.writeFieldEnd();
0452       }
0453       if (struct.delegationToken != null) {
0454         oprot.writeFieldBegin(DELEGATION_TOKEN_FIELD_DESC);
0455         oprot.writeString(struct.delegationToken);
0456         oprot.writeFieldEnd();
0457       }
0458       oprot.writeFieldStop();
0459       oprot.writeStructEnd();
0460     }
0461 
0462   }
0463 
0464   private static class TCancelDelegationTokenReqTupleSchemeFactory implements SchemeFactory {
0465     public TCancelDelegationTokenReqTupleScheme getScheme() {
0466       return new TCancelDelegationTokenReqTupleScheme();
0467     }
0468   }
0469 
0470   private static class TCancelDelegationTokenReqTupleScheme extends TupleScheme<TCancelDelegationTokenReq> {
0471 
0472     @Override
0473     public void write(org.apache.thrift.protocol.TProtocol prot, TCancelDelegationTokenReq struct) throws org.apache.thrift.TException {
0474       TTupleProtocol oprot = (TTupleProtocol) prot;
0475       struct.sessionHandle.write(oprot);
0476       oprot.writeString(struct.delegationToken);
0477     }
0478 
0479     @Override
0480     public void read(org.apache.thrift.protocol.TProtocol prot, TCancelDelegationTokenReq struct) throws org.apache.thrift.TException {
0481       TTupleProtocol iprot = (TTupleProtocol) prot;
0482       struct.sessionHandle = new TSessionHandle();
0483       struct.sessionHandle.read(iprot);
0484       struct.setSessionHandleIsSet(true);
0485       struct.delegationToken = iprot.readString();
0486       struct.setDelegationTokenIsSet(true);
0487     }
0488   }
0489 
0490 }
0491