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 TGetTableTypesResp implements org.apache.thrift.TBase<TGetTableTypesResp, TGetTableTypesResp._Fields>, java.io.Serializable, Cloneable {
0035   private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TGetTableTypesResp");
0036 
0037   private static final org.apache.thrift.protocol.TField STATUS_FIELD_DESC = new org.apache.thrift.protocol.TField("status", org.apache.thrift.protocol.TType.STRUCT, (short)1);
0038   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)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 TGetTableTypesRespStandardSchemeFactory());
0043     schemes.put(TupleScheme.class, new TGetTableTypesRespTupleSchemeFactory());
0044   }
0045 
0046   private TStatus status; // required
0047   private TOperationHandle operationHandle; // optional
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     STATUS((short)1, "status"),
0052     OPERATION_HANDLE((short)2, "operationHandle");
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: // STATUS
0068           return STATUS;
0069         case 2: // OPERATION_HANDLE
0070           return OPERATION_HANDLE;
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   private _Fields optionals[] = {_Fields.OPERATION_HANDLE};
0112   public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
0113   static {
0114     Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
0115     tmpMap.put(_Fields.STATUS, new org.apache.thrift.meta_data.FieldMetaData("status", org.apache.thrift.TFieldRequirementType.REQUIRED, 
0116         new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TStatus.class)));
0117     tmpMap.put(_Fields.OPERATION_HANDLE, new org.apache.thrift.meta_data.FieldMetaData("operationHandle", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
0118         new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TOperationHandle.class)));
0119     metaDataMap = Collections.unmodifiableMap(tmpMap);
0120     org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TGetTableTypesResp.class, metaDataMap);
0121   }
0122 
0123   public TGetTableTypesResp() {
0124   }
0125 
0126   public TGetTableTypesResp(
0127     TStatus status)
0128   {
0129     this();
0130     this.status = status;
0131   }
0132 
0133   /**
0134    * Performs a deep copy on <i>other</i>.
0135    */
0136   public TGetTableTypesResp(TGetTableTypesResp other) {
0137     if (other.isSetStatus()) {
0138       this.status = new TStatus(other.status);
0139     }
0140     if (other.isSetOperationHandle()) {
0141       this.operationHandle = new TOperationHandle(other.operationHandle);
0142     }
0143   }
0144 
0145   public TGetTableTypesResp deepCopy() {
0146     return new TGetTableTypesResp(this);
0147   }
0148 
0149   @Override
0150   public void clear() {
0151     this.status = null;
0152     this.operationHandle = null;
0153   }
0154 
0155   public TStatus getStatus() {
0156     return this.status;
0157   }
0158 
0159   public void setStatus(TStatus status) {
0160     this.status = status;
0161   }
0162 
0163   public void unsetStatus() {
0164     this.status = null;
0165   }
0166 
0167   /** Returns true if field status is set (has been assigned a value) and false otherwise */
0168   public boolean isSetStatus() {
0169     return this.status != null;
0170   }
0171 
0172   public void setStatusIsSet(boolean value) {
0173     if (!value) {
0174       this.status = null;
0175     }
0176   }
0177 
0178   public TOperationHandle getOperationHandle() {
0179     return this.operationHandle;
0180   }
0181 
0182   public void setOperationHandle(TOperationHandle operationHandle) {
0183     this.operationHandle = operationHandle;
0184   }
0185 
0186   public void unsetOperationHandle() {
0187     this.operationHandle = null;
0188   }
0189 
0190   /** Returns true if field operationHandle is set (has been assigned a value) and false otherwise */
0191   public boolean isSetOperationHandle() {
0192     return this.operationHandle != null;
0193   }
0194 
0195   public void setOperationHandleIsSet(boolean value) {
0196     if (!value) {
0197       this.operationHandle = null;
0198     }
0199   }
0200 
0201   public void setFieldValue(_Fields field, Object value) {
0202     switch (field) {
0203     case STATUS:
0204       if (value == null) {
0205         unsetStatus();
0206       } else {
0207         setStatus((TStatus)value);
0208       }
0209       break;
0210 
0211     case OPERATION_HANDLE:
0212       if (value == null) {
0213         unsetOperationHandle();
0214       } else {
0215         setOperationHandle((TOperationHandle)value);
0216       }
0217       break;
0218 
0219     }
0220   }
0221 
0222   public Object getFieldValue(_Fields field) {
0223     switch (field) {
0224     case STATUS:
0225       return getStatus();
0226 
0227     case OPERATION_HANDLE:
0228       return getOperationHandle();
0229 
0230     }
0231     throw new IllegalStateException();
0232   }
0233 
0234   /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
0235   public boolean isSet(_Fields field) {
0236     if (field == null) {
0237       throw new IllegalArgumentException();
0238     }
0239 
0240     switch (field) {
0241     case STATUS:
0242       return isSetStatus();
0243     case OPERATION_HANDLE:
0244       return isSetOperationHandle();
0245     }
0246     throw new IllegalStateException();
0247   }
0248 
0249   @Override
0250   public boolean equals(Object that) {
0251     if (that == null)
0252       return false;
0253     if (that instanceof TGetTableTypesResp)
0254       return this.equals((TGetTableTypesResp)that);
0255     return false;
0256   }
0257 
0258   public boolean equals(TGetTableTypesResp that) {
0259     if (that == null)
0260       return false;
0261 
0262     boolean this_present_status = true && this.isSetStatus();
0263     boolean that_present_status = true && that.isSetStatus();
0264     if (this_present_status || that_present_status) {
0265       if (!(this_present_status && that_present_status))
0266         return false;
0267       if (!this.status.equals(that.status))
0268         return false;
0269     }
0270 
0271     boolean this_present_operationHandle = true && this.isSetOperationHandle();
0272     boolean that_present_operationHandle = true && that.isSetOperationHandle();
0273     if (this_present_operationHandle || that_present_operationHandle) {
0274       if (!(this_present_operationHandle && that_present_operationHandle))
0275         return false;
0276       if (!this.operationHandle.equals(that.operationHandle))
0277         return false;
0278     }
0279 
0280     return true;
0281   }
0282 
0283   @Override
0284   public int hashCode() {
0285     HashCodeBuilder builder = new HashCodeBuilder();
0286 
0287     boolean present_status = true && (isSetStatus());
0288     builder.append(present_status);
0289     if (present_status)
0290       builder.append(status);
0291 
0292     boolean present_operationHandle = true && (isSetOperationHandle());
0293     builder.append(present_operationHandle);
0294     if (present_operationHandle)
0295       builder.append(operationHandle);
0296 
0297     return builder.toHashCode();
0298   }
0299 
0300   public int compareTo(TGetTableTypesResp other) {
0301     if (!getClass().equals(other.getClass())) {
0302       return getClass().getName().compareTo(other.getClass().getName());
0303     }
0304 
0305     int lastComparison = 0;
0306     TGetTableTypesResp typedOther = (TGetTableTypesResp)other;
0307 
0308     lastComparison = Boolean.valueOf(isSetStatus()).compareTo(typedOther.isSetStatus());
0309     if (lastComparison != 0) {
0310       return lastComparison;
0311     }
0312     if (isSetStatus()) {
0313       lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.status, typedOther.status);
0314       if (lastComparison != 0) {
0315         return lastComparison;
0316       }
0317     }
0318     lastComparison = Boolean.valueOf(isSetOperationHandle()).compareTo(typedOther.isSetOperationHandle());
0319     if (lastComparison != 0) {
0320       return lastComparison;
0321     }
0322     if (isSetOperationHandle()) {
0323       lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.operationHandle, typedOther.operationHandle);
0324       if (lastComparison != 0) {
0325         return lastComparison;
0326       }
0327     }
0328     return 0;
0329   }
0330 
0331   public _Fields fieldForId(int fieldId) {
0332     return _Fields.findByThriftId(fieldId);
0333   }
0334 
0335   public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
0336     schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
0337   }
0338 
0339   public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
0340     schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
0341   }
0342 
0343   @Override
0344   public String toString() {
0345     StringBuilder sb = new StringBuilder("TGetTableTypesResp(");
0346     boolean first = true;
0347 
0348     sb.append("status:");
0349     if (this.status == null) {
0350       sb.append("null");
0351     } else {
0352       sb.append(this.status);
0353     }
0354     first = false;
0355     if (isSetOperationHandle()) {
0356       if (!first) sb.append(", ");
0357       sb.append("operationHandle:");
0358       if (this.operationHandle == null) {
0359         sb.append("null");
0360       } else {
0361         sb.append(this.operationHandle);
0362       }
0363       first = false;
0364     }
0365     sb.append(")");
0366     return sb.toString();
0367   }
0368 
0369   public void validate() throws org.apache.thrift.TException {
0370     // check for required fields
0371     if (!isSetStatus()) {
0372       throw new org.apache.thrift.protocol.TProtocolException("Required field 'status' is unset! Struct:" + toString());
0373     }
0374 
0375     // check for sub-struct validity
0376     if (status != null) {
0377       status.validate();
0378     }
0379     if (operationHandle != null) {
0380       operationHandle.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 TGetTableTypesRespStandardSchemeFactory implements SchemeFactory {
0401     public TGetTableTypesRespStandardScheme getScheme() {
0402       return new TGetTableTypesRespStandardScheme();
0403     }
0404   }
0405 
0406   private static class TGetTableTypesRespStandardScheme extends StandardScheme<TGetTableTypesResp> {
0407 
0408     public void read(org.apache.thrift.protocol.TProtocol iprot, TGetTableTypesResp 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: // STATUS
0419             if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
0420               struct.status = new TStatus();
0421               struct.status.read(iprot);
0422               struct.setStatusIsSet(true);
0423             } else { 
0424               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
0425             }
0426             break;
0427           case 2: // OPERATION_HANDLE
0428             if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
0429               struct.operationHandle = new TOperationHandle();
0430               struct.operationHandle.read(iprot);
0431               struct.setOperationHandleIsSet(true);
0432             } else { 
0433               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
0434             }
0435             break;
0436           default:
0437             org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
0438         }
0439         iprot.readFieldEnd();
0440       }
0441       iprot.readStructEnd();
0442       struct.validate();
0443     }
0444 
0445     public void write(org.apache.thrift.protocol.TProtocol oprot, TGetTableTypesResp struct) throws org.apache.thrift.TException {
0446       struct.validate();
0447 
0448       oprot.writeStructBegin(STRUCT_DESC);
0449       if (struct.status != null) {
0450         oprot.writeFieldBegin(STATUS_FIELD_DESC);
0451         struct.status.write(oprot);
0452         oprot.writeFieldEnd();
0453       }
0454       if (struct.operationHandle != null) {
0455         if (struct.isSetOperationHandle()) {
0456           oprot.writeFieldBegin(OPERATION_HANDLE_FIELD_DESC);
0457           struct.operationHandle.write(oprot);
0458           oprot.writeFieldEnd();
0459         }
0460       }
0461       oprot.writeFieldStop();
0462       oprot.writeStructEnd();
0463     }
0464 
0465   }
0466 
0467   private static class TGetTableTypesRespTupleSchemeFactory implements SchemeFactory {
0468     public TGetTableTypesRespTupleScheme getScheme() {
0469       return new TGetTableTypesRespTupleScheme();
0470     }
0471   }
0472 
0473   private static class TGetTableTypesRespTupleScheme extends TupleScheme<TGetTableTypesResp> {
0474 
0475     @Override
0476     public void write(org.apache.thrift.protocol.TProtocol prot, TGetTableTypesResp struct) throws org.apache.thrift.TException {
0477       TTupleProtocol oprot = (TTupleProtocol) prot;
0478       struct.status.write(oprot);
0479       BitSet optionals = new BitSet();
0480       if (struct.isSetOperationHandle()) {
0481         optionals.set(0);
0482       }
0483       oprot.writeBitSet(optionals, 1);
0484       if (struct.isSetOperationHandle()) {
0485         struct.operationHandle.write(oprot);
0486       }
0487     }
0488 
0489     @Override
0490     public void read(org.apache.thrift.protocol.TProtocol prot, TGetTableTypesResp struct) throws org.apache.thrift.TException {
0491       TTupleProtocol iprot = (TTupleProtocol) prot;
0492       struct.status = new TStatus();
0493       struct.status.read(iprot);
0494       struct.setStatusIsSet(true);
0495       BitSet incoming = iprot.readBitSet(1);
0496       if (incoming.get(0)) {
0497         struct.operationHandle = new TOperationHandle();
0498         struct.operationHandle.read(iprot);
0499         struct.setOperationHandleIsSet(true);
0500       }
0501     }
0502   }
0503 
0504 }
0505