0001
0002
0003
0004
0005
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 TGetInfoReq implements org.apache.thrift.TBase<TGetInfoReq, TGetInfoReq._Fields>, java.io.Serializable, Cloneable {
0035 private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TGetInfoReq");
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 INFO_TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("infoType", org.apache.thrift.protocol.TType.I32, (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 TGetInfoReqStandardSchemeFactory());
0043 schemes.put(TupleScheme.class, new TGetInfoReqTupleSchemeFactory());
0044 }
0045
0046 private TSessionHandle sessionHandle;
0047 private TGetInfoType infoType;
0048
0049
0050 public enum _Fields implements org.apache.thrift.TFieldIdEnum {
0051 SESSION_HANDLE((short)1, "sessionHandle"),
0052
0053
0054
0055
0056 INFO_TYPE((short)2, "infoType");
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
0068
0069 public static _Fields findByThriftId(int fieldId) {
0070 switch(fieldId) {
0071 case 1:
0072 return SESSION_HANDLE;
0073 case 2:
0074 return INFO_TYPE;
0075 default:
0076 return null;
0077 }
0078 }
0079
0080
0081
0082
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
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
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.INFO_TYPE, new org.apache.thrift.meta_data.FieldMetaData("infoType", org.apache.thrift.TFieldRequirementType.REQUIRED,
0121 new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, TGetInfoType.class)));
0122 metaDataMap = Collections.unmodifiableMap(tmpMap);
0123 org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TGetInfoReq.class, metaDataMap);
0124 }
0125
0126 public TGetInfoReq() {
0127 }
0128
0129 public TGetInfoReq(
0130 TSessionHandle sessionHandle,
0131 TGetInfoType infoType)
0132 {
0133 this();
0134 this.sessionHandle = sessionHandle;
0135 this.infoType = infoType;
0136 }
0137
0138
0139
0140
0141 public TGetInfoReq(TGetInfoReq other) {
0142 if (other.isSetSessionHandle()) {
0143 this.sessionHandle = new TSessionHandle(other.sessionHandle);
0144 }
0145 if (other.isSetInfoType()) {
0146 this.infoType = other.infoType;
0147 }
0148 }
0149
0150 public TGetInfoReq deepCopy() {
0151 return new TGetInfoReq(this);
0152 }
0153
0154 @Override
0155 public void clear() {
0156 this.sessionHandle = null;
0157 this.infoType = 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
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
0184
0185
0186
0187 public TGetInfoType getInfoType() {
0188 return this.infoType;
0189 }
0190
0191
0192
0193
0194
0195 public void setInfoType(TGetInfoType infoType) {
0196 this.infoType = infoType;
0197 }
0198
0199 public void unsetInfoType() {
0200 this.infoType = null;
0201 }
0202
0203
0204 public boolean isSetInfoType() {
0205 return this.infoType != null;
0206 }
0207
0208 public void setInfoTypeIsSet(boolean value) {
0209 if (!value) {
0210 this.infoType = null;
0211 }
0212 }
0213
0214 public void setFieldValue(_Fields field, Object value) {
0215 switch (field) {
0216 case SESSION_HANDLE:
0217 if (value == null) {
0218 unsetSessionHandle();
0219 } else {
0220 setSessionHandle((TSessionHandle)value);
0221 }
0222 break;
0223
0224 case INFO_TYPE:
0225 if (value == null) {
0226 unsetInfoType();
0227 } else {
0228 setInfoType((TGetInfoType)value);
0229 }
0230 break;
0231
0232 }
0233 }
0234
0235 public Object getFieldValue(_Fields field) {
0236 switch (field) {
0237 case SESSION_HANDLE:
0238 return getSessionHandle();
0239
0240 case INFO_TYPE:
0241 return getInfoType();
0242
0243 }
0244 throw new IllegalStateException();
0245 }
0246
0247
0248 public boolean isSet(_Fields field) {
0249 if (field == null) {
0250 throw new IllegalArgumentException();
0251 }
0252
0253 switch (field) {
0254 case SESSION_HANDLE:
0255 return isSetSessionHandle();
0256 case INFO_TYPE:
0257 return isSetInfoType();
0258 }
0259 throw new IllegalStateException();
0260 }
0261
0262 @Override
0263 public boolean equals(Object that) {
0264 if (that == null)
0265 return false;
0266 if (that instanceof TGetInfoReq)
0267 return this.equals((TGetInfoReq)that);
0268 return false;
0269 }
0270
0271 public boolean equals(TGetInfoReq that) {
0272 if (that == null)
0273 return false;
0274
0275 boolean this_present_sessionHandle = true && this.isSetSessionHandle();
0276 boolean that_present_sessionHandle = true && that.isSetSessionHandle();
0277 if (this_present_sessionHandle || that_present_sessionHandle) {
0278 if (!(this_present_sessionHandle && that_present_sessionHandle))
0279 return false;
0280 if (!this.sessionHandle.equals(that.sessionHandle))
0281 return false;
0282 }
0283
0284 boolean this_present_infoType = true && this.isSetInfoType();
0285 boolean that_present_infoType = true && that.isSetInfoType();
0286 if (this_present_infoType || that_present_infoType) {
0287 if (!(this_present_infoType && that_present_infoType))
0288 return false;
0289 if (!this.infoType.equals(that.infoType))
0290 return false;
0291 }
0292
0293 return true;
0294 }
0295
0296 @Override
0297 public int hashCode() {
0298 HashCodeBuilder builder = new HashCodeBuilder();
0299
0300 boolean present_sessionHandle = true && (isSetSessionHandle());
0301 builder.append(present_sessionHandle);
0302 if (present_sessionHandle)
0303 builder.append(sessionHandle);
0304
0305 boolean present_infoType = true && (isSetInfoType());
0306 builder.append(present_infoType);
0307 if (present_infoType)
0308 builder.append(infoType.getValue());
0309
0310 return builder.toHashCode();
0311 }
0312
0313 public int compareTo(TGetInfoReq other) {
0314 if (!getClass().equals(other.getClass())) {
0315 return getClass().getName().compareTo(other.getClass().getName());
0316 }
0317
0318 int lastComparison = 0;
0319 TGetInfoReq typedOther = (TGetInfoReq)other;
0320
0321 lastComparison = Boolean.valueOf(isSetSessionHandle()).compareTo(typedOther.isSetSessionHandle());
0322 if (lastComparison != 0) {
0323 return lastComparison;
0324 }
0325 if (isSetSessionHandle()) {
0326 lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.sessionHandle, typedOther.sessionHandle);
0327 if (lastComparison != 0) {
0328 return lastComparison;
0329 }
0330 }
0331 lastComparison = Boolean.valueOf(isSetInfoType()).compareTo(typedOther.isSetInfoType());
0332 if (lastComparison != 0) {
0333 return lastComparison;
0334 }
0335 if (isSetInfoType()) {
0336 lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.infoType, typedOther.infoType);
0337 if (lastComparison != 0) {
0338 return lastComparison;
0339 }
0340 }
0341 return 0;
0342 }
0343
0344 public _Fields fieldForId(int fieldId) {
0345 return _Fields.findByThriftId(fieldId);
0346 }
0347
0348 public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
0349 schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
0350 }
0351
0352 public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
0353 schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
0354 }
0355
0356 @Override
0357 public String toString() {
0358 StringBuilder sb = new StringBuilder("TGetInfoReq(");
0359 boolean first = true;
0360
0361 sb.append("sessionHandle:");
0362 if (this.sessionHandle == null) {
0363 sb.append("null");
0364 } else {
0365 sb.append(this.sessionHandle);
0366 }
0367 first = false;
0368 if (!first) sb.append(", ");
0369 sb.append("infoType:");
0370 if (this.infoType == null) {
0371 sb.append("null");
0372 } else {
0373 sb.append(this.infoType);
0374 }
0375 first = false;
0376 sb.append(")");
0377 return sb.toString();
0378 }
0379
0380 public void validate() throws org.apache.thrift.TException {
0381
0382 if (!isSetSessionHandle()) {
0383 throw new org.apache.thrift.protocol.TProtocolException("Required field 'sessionHandle' is unset! Struct:" + toString());
0384 }
0385
0386 if (!isSetInfoType()) {
0387 throw new org.apache.thrift.protocol.TProtocolException("Required field 'infoType' is unset! Struct:" + toString());
0388 }
0389
0390
0391 if (sessionHandle != null) {
0392 sessionHandle.validate();
0393 }
0394 }
0395
0396 private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
0397 try {
0398 write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
0399 } catch (org.apache.thrift.TException te) {
0400 throw new java.io.IOException(te);
0401 }
0402 }
0403
0404 private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
0405 try {
0406 read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
0407 } catch (org.apache.thrift.TException te) {
0408 throw new java.io.IOException(te);
0409 }
0410 }
0411
0412 private static class TGetInfoReqStandardSchemeFactory implements SchemeFactory {
0413 public TGetInfoReqStandardScheme getScheme() {
0414 return new TGetInfoReqStandardScheme();
0415 }
0416 }
0417
0418 private static class TGetInfoReqStandardScheme extends StandardScheme<TGetInfoReq> {
0419
0420 public void read(org.apache.thrift.protocol.TProtocol iprot, TGetInfoReq struct) throws org.apache.thrift.TException {
0421 org.apache.thrift.protocol.TField schemeField;
0422 iprot.readStructBegin();
0423 while (true)
0424 {
0425 schemeField = iprot.readFieldBegin();
0426 if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
0427 break;
0428 }
0429 switch (schemeField.id) {
0430 case 1:
0431 if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
0432 struct.sessionHandle = new TSessionHandle();
0433 struct.sessionHandle.read(iprot);
0434 struct.setSessionHandleIsSet(true);
0435 } else {
0436 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
0437 }
0438 break;
0439 case 2:
0440 if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
0441 struct.infoType = TGetInfoType.findByValue(iprot.readI32());
0442 struct.setInfoTypeIsSet(true);
0443 } else {
0444 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
0445 }
0446 break;
0447 default:
0448 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
0449 }
0450 iprot.readFieldEnd();
0451 }
0452 iprot.readStructEnd();
0453 struct.validate();
0454 }
0455
0456 public void write(org.apache.thrift.protocol.TProtocol oprot, TGetInfoReq struct) throws org.apache.thrift.TException {
0457 struct.validate();
0458
0459 oprot.writeStructBegin(STRUCT_DESC);
0460 if (struct.sessionHandle != null) {
0461 oprot.writeFieldBegin(SESSION_HANDLE_FIELD_DESC);
0462 struct.sessionHandle.write(oprot);
0463 oprot.writeFieldEnd();
0464 }
0465 if (struct.infoType != null) {
0466 oprot.writeFieldBegin(INFO_TYPE_FIELD_DESC);
0467 oprot.writeI32(struct.infoType.getValue());
0468 oprot.writeFieldEnd();
0469 }
0470 oprot.writeFieldStop();
0471 oprot.writeStructEnd();
0472 }
0473
0474 }
0475
0476 private static class TGetInfoReqTupleSchemeFactory implements SchemeFactory {
0477 public TGetInfoReqTupleScheme getScheme() {
0478 return new TGetInfoReqTupleScheme();
0479 }
0480 }
0481
0482 private static class TGetInfoReqTupleScheme extends TupleScheme<TGetInfoReq> {
0483
0484 @Override
0485 public void write(org.apache.thrift.protocol.TProtocol prot, TGetInfoReq struct) throws org.apache.thrift.TException {
0486 TTupleProtocol oprot = (TTupleProtocol) prot;
0487 struct.sessionHandle.write(oprot);
0488 oprot.writeI32(struct.infoType.getValue());
0489 }
0490
0491 @Override
0492 public void read(org.apache.thrift.protocol.TProtocol prot, TGetInfoReq struct) throws org.apache.thrift.TException {
0493 TTupleProtocol iprot = (TTupleProtocol) prot;
0494 struct.sessionHandle = new TSessionHandle();
0495 struct.sessionHandle.read(iprot);
0496 struct.setSessionHandleIsSet(true);
0497 struct.infoType = TGetInfoType.findByValue(iprot.readI32());
0498 struct.setInfoTypeIsSet(true);
0499 }
0500 }
0501
0502 }
0503