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