Back to home page

OSCL-LXR

 
 

    


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