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 TGetOperationStatusReq implements org.apache.thrift.TBase<TGetOperationStatusReq, TGetOperationStatusReq._Fields>, java.io.Serializable, Cloneable, Comparable<TGetOperationStatusReq> {
0039   private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TGetOperationStatusReq");
0040 
0041   private static final org.apache.thrift.protocol.TField OPERATION_HANDLE_FIELD_DESC = new org.apache.thrift.protocol.TField("operationHandle", org.apache.thrift.protocol.TType.STRUCT, (short)1);
0042   private static final org.apache.thrift.protocol.TField GET_PROGRESS_UPDATE_FIELD_DESC = new org.apache.thrift.protocol.TField("getProgressUpdate", org.apache.thrift.protocol.TType.BOOL, (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 TGetOperationStatusReqStandardSchemeFactory());
0047     schemes.put(TupleScheme.class, new TGetOperationStatusReqTupleSchemeFactory());
0048   }
0049 
0050   private TOperationHandle operationHandle; // required
0051   private boolean getProgressUpdate; // optional
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     OPERATION_HANDLE((short)1, "operationHandle"),
0056     GET_PROGRESS_UPDATE((short)2, "getProgressUpdate");
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: // OPERATION_HANDLE
0072           return OPERATION_HANDLE;
0073         case 2: // GET_PROGRESS_UPDATE
0074           return GET_PROGRESS_UPDATE;
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   private static final int __GETPROGRESSUPDATE_ISSET_ID = 0;
0116   private byte __isset_bitfield = 0;
0117   private static final _Fields optionals[] = {_Fields.GET_PROGRESS_UPDATE};
0118   public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
0119   static {
0120     Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
0121     tmpMap.put(_Fields.OPERATION_HANDLE, new org.apache.thrift.meta_data.FieldMetaData("operationHandle", org.apache.thrift.TFieldRequirementType.REQUIRED, 
0122         new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TOperationHandle.class)));
0123     tmpMap.put(_Fields.GET_PROGRESS_UPDATE, new org.apache.thrift.meta_data.FieldMetaData("getProgressUpdate", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
0124         new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
0125     metaDataMap = Collections.unmodifiableMap(tmpMap);
0126     org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TGetOperationStatusReq.class, metaDataMap);
0127   }
0128 
0129   public TGetOperationStatusReq() {
0130   }
0131 
0132   public TGetOperationStatusReq(
0133     TOperationHandle operationHandle)
0134   {
0135     this();
0136     this.operationHandle = operationHandle;
0137   }
0138 
0139   /**
0140    * Performs a deep copy on <i>other</i>.
0141    */
0142   public TGetOperationStatusReq(TGetOperationStatusReq other) {
0143     __isset_bitfield = other.__isset_bitfield;
0144     if (other.isSetOperationHandle()) {
0145       this.operationHandle = new TOperationHandle(other.operationHandle);
0146     }
0147     this.getProgressUpdate = other.getProgressUpdate;
0148   }
0149 
0150   public TGetOperationStatusReq deepCopy() {
0151     return new TGetOperationStatusReq(this);
0152   }
0153 
0154   @Override
0155   public void clear() {
0156     this.operationHandle = null;
0157     setGetProgressUpdateIsSet(false);
0158     this.getProgressUpdate = false;
0159   }
0160 
0161   public TOperationHandle getOperationHandle() {
0162     return this.operationHandle;
0163   }
0164 
0165   public void setOperationHandle(TOperationHandle operationHandle) {
0166     this.operationHandle = operationHandle;
0167   }
0168 
0169   public void unsetOperationHandle() {
0170     this.operationHandle = null;
0171   }
0172 
0173   /** Returns true if field operationHandle is set (has been assigned a value) and false otherwise */
0174   public boolean isSetOperationHandle() {
0175     return this.operationHandle != null;
0176   }
0177 
0178   public void setOperationHandleIsSet(boolean value) {
0179     if (!value) {
0180       this.operationHandle = null;
0181     }
0182   }
0183 
0184   public boolean isGetProgressUpdate() {
0185     return this.getProgressUpdate;
0186   }
0187 
0188   public void setGetProgressUpdate(boolean getProgressUpdate) {
0189     this.getProgressUpdate = getProgressUpdate;
0190     setGetProgressUpdateIsSet(true);
0191   }
0192 
0193   public void unsetGetProgressUpdate() {
0194     __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __GETPROGRESSUPDATE_ISSET_ID);
0195   }
0196 
0197   /** Returns true if field getProgressUpdate is set (has been assigned a value) and false otherwise */
0198   public boolean isSetGetProgressUpdate() {
0199     return EncodingUtils.testBit(__isset_bitfield, __GETPROGRESSUPDATE_ISSET_ID);
0200   }
0201 
0202   public void setGetProgressUpdateIsSet(boolean value) {
0203     __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __GETPROGRESSUPDATE_ISSET_ID, value);
0204   }
0205 
0206   public void setFieldValue(_Fields field, Object value) {
0207     switch (field) {
0208     case OPERATION_HANDLE:
0209       if (value == null) {
0210         unsetOperationHandle();
0211       } else {
0212         setOperationHandle((TOperationHandle)value);
0213       }
0214       break;
0215 
0216     case GET_PROGRESS_UPDATE:
0217       if (value == null) {
0218         unsetGetProgressUpdate();
0219       } else {
0220         setGetProgressUpdate((Boolean)value);
0221       }
0222       break;
0223 
0224     }
0225   }
0226 
0227   public Object getFieldValue(_Fields field) {
0228     switch (field) {
0229     case OPERATION_HANDLE:
0230       return getOperationHandle();
0231 
0232     case GET_PROGRESS_UPDATE:
0233       return isGetProgressUpdate();
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 OPERATION_HANDLE:
0247       return isSetOperationHandle();
0248     case GET_PROGRESS_UPDATE:
0249       return isSetGetProgressUpdate();
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 TGetOperationStatusReq)
0259       return this.equals((TGetOperationStatusReq)that);
0260     return false;
0261   }
0262 
0263   public boolean equals(TGetOperationStatusReq that) {
0264     if (that == null)
0265       return false;
0266 
0267     boolean this_present_operationHandle = true && this.isSetOperationHandle();
0268     boolean that_present_operationHandle = true && that.isSetOperationHandle();
0269     if (this_present_operationHandle || that_present_operationHandle) {
0270       if (!(this_present_operationHandle && that_present_operationHandle))
0271         return false;
0272       if (!this.operationHandle.equals(that.operationHandle))
0273         return false;
0274     }
0275 
0276     boolean this_present_getProgressUpdate = true && this.isSetGetProgressUpdate();
0277     boolean that_present_getProgressUpdate = true && that.isSetGetProgressUpdate();
0278     if (this_present_getProgressUpdate || that_present_getProgressUpdate) {
0279       if (!(this_present_getProgressUpdate && that_present_getProgressUpdate))
0280         return false;
0281       if (this.getProgressUpdate != that.getProgressUpdate)
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_operationHandle = true && (isSetOperationHandle());
0293     list.add(present_operationHandle);
0294     if (present_operationHandle)
0295       list.add(operationHandle);
0296 
0297     boolean present_getProgressUpdate = true && (isSetGetProgressUpdate());
0298     list.add(present_getProgressUpdate);
0299     if (present_getProgressUpdate)
0300       list.add(getProgressUpdate);
0301 
0302     return list.hashCode();
0303   }
0304 
0305   @Override
0306   public int compareTo(TGetOperationStatusReq 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(isSetOperationHandle()).compareTo(other.isSetOperationHandle());
0314     if (lastComparison != 0) {
0315       return lastComparison;
0316     }
0317     if (isSetOperationHandle()) {
0318       lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.operationHandle, other.operationHandle);
0319       if (lastComparison != 0) {
0320         return lastComparison;
0321       }
0322     }
0323     lastComparison = Boolean.valueOf(isSetGetProgressUpdate()).compareTo(other.isSetGetProgressUpdate());
0324     if (lastComparison != 0) {
0325       return lastComparison;
0326     }
0327     if (isSetGetProgressUpdate()) {
0328       lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.getProgressUpdate, other.getProgressUpdate);
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("TGetOperationStatusReq(");
0351     boolean first = true;
0352 
0353     sb.append("operationHandle:");
0354     if (this.operationHandle == null) {
0355       sb.append("null");
0356     } else {
0357       sb.append(this.operationHandle);
0358     }
0359     first = false;
0360     if (isSetGetProgressUpdate()) {
0361       if (!first) sb.append(", ");
0362       sb.append("getProgressUpdate:");
0363       sb.append(this.getProgressUpdate);
0364       first = false;
0365     }
0366     sb.append(")");
0367     return sb.toString();
0368   }
0369 
0370   public void validate() throws org.apache.thrift.TException {
0371     // check for required fields
0372     if (!isSetOperationHandle()) {
0373       throw new org.apache.thrift.protocol.TProtocolException("Required field 'operationHandle' is unset! Struct:" + toString());
0374     }
0375 
0376     // check for sub-struct validity
0377     if (operationHandle != null) {
0378       operationHandle.validate();
0379     }
0380   }
0381 
0382   private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
0383     try {
0384       write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
0385     } catch (org.apache.thrift.TException te) {
0386       throw new java.io.IOException(te);
0387     }
0388   }
0389 
0390   private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
0391     try {
0392       // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
0393       __isset_bitfield = 0;
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 TGetOperationStatusReqStandardSchemeFactory implements SchemeFactory {
0401     public TGetOperationStatusReqStandardScheme getScheme() {
0402       return new TGetOperationStatusReqStandardScheme();
0403     }
0404   }
0405 
0406   private static class TGetOperationStatusReqStandardScheme extends StandardScheme<TGetOperationStatusReq> {
0407 
0408     public void read(org.apache.thrift.protocol.TProtocol iprot, TGetOperationStatusReq 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: // OPERATION_HANDLE
0419             if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
0420               struct.operationHandle = new TOperationHandle();
0421               struct.operationHandle.read(iprot);
0422               struct.setOperationHandleIsSet(true);
0423             } else { 
0424               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
0425             }
0426             break;
0427           case 2: // GET_PROGRESS_UPDATE
0428             if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
0429               struct.getProgressUpdate = iprot.readBool();
0430               struct.setGetProgressUpdateIsSet(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, TGetOperationStatusReq struct) throws org.apache.thrift.TException {
0445       struct.validate();
0446 
0447       oprot.writeStructBegin(STRUCT_DESC);
0448       if (struct.operationHandle != null) {
0449         oprot.writeFieldBegin(OPERATION_HANDLE_FIELD_DESC);
0450         struct.operationHandle.write(oprot);
0451         oprot.writeFieldEnd();
0452       }
0453       if (struct.isSetGetProgressUpdate()) {
0454         oprot.writeFieldBegin(GET_PROGRESS_UPDATE_FIELD_DESC);
0455         oprot.writeBool(struct.getProgressUpdate);
0456         oprot.writeFieldEnd();
0457       }
0458       oprot.writeFieldStop();
0459       oprot.writeStructEnd();
0460     }
0461 
0462   }
0463 
0464   private static class TGetOperationStatusReqTupleSchemeFactory implements SchemeFactory {
0465     public TGetOperationStatusReqTupleScheme getScheme() {
0466       return new TGetOperationStatusReqTupleScheme();
0467     }
0468   }
0469 
0470   private static class TGetOperationStatusReqTupleScheme extends TupleScheme<TGetOperationStatusReq> {
0471 
0472     @Override
0473     public void write(org.apache.thrift.protocol.TProtocol prot, TGetOperationStatusReq struct) throws org.apache.thrift.TException {
0474       TTupleProtocol oprot = (TTupleProtocol) prot;
0475       struct.operationHandle.write(oprot);
0476       BitSet optionals = new BitSet();
0477       if (struct.isSetGetProgressUpdate()) {
0478         optionals.set(0);
0479       }
0480       oprot.writeBitSet(optionals, 1);
0481       if (struct.isSetGetProgressUpdate()) {
0482         oprot.writeBool(struct.getProgressUpdate);
0483       }
0484     }
0485 
0486     @Override
0487     public void read(org.apache.thrift.protocol.TProtocol prot, TGetOperationStatusReq struct) throws org.apache.thrift.TException {
0488       TTupleProtocol iprot = (TTupleProtocol) prot;
0489       struct.operationHandle = new TOperationHandle();
0490       struct.operationHandle.read(iprot);
0491       struct.setOperationHandleIsSet(true);
0492       BitSet incoming = iprot.readBitSet(1);
0493       if (incoming.get(0)) {
0494         struct.getProgressUpdate = iprot.readBool();
0495         struct.setGetProgressUpdateIsSet(true);
0496       }
0497     }
0498   }
0499 
0500 }
0501