0001
0002
0003
0004
0005
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 TGetDelegationTokenResp implements org.apache.thrift.TBase<TGetDelegationTokenResp, TGetDelegationTokenResp._Fields>, java.io.Serializable, Cloneable, Comparable<TGetDelegationTokenResp> {
0039 private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TGetDelegationTokenResp");
0040
0041 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);
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 TGetDelegationTokenRespStandardSchemeFactory());
0047 schemes.put(TupleScheme.class, new TGetDelegationTokenRespTupleSchemeFactory());
0048 }
0049
0050 private TStatus status;
0051 private String delegationToken;
0052
0053
0054 public enum _Fields implements org.apache.thrift.TFieldIdEnum {
0055 STATUS((short)1, "status"),
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
0068
0069 public static _Fields findByThriftId(int fieldId) {
0070 switch(fieldId) {
0071 case 1:
0072 return STATUS;
0073 case 2:
0074 return DELEGATION_TOKEN;
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 private static final _Fields optionals[] = {_Fields.DELEGATION_TOKEN};
0116 public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
0117 static {
0118 Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
0119 tmpMap.put(_Fields.STATUS, new org.apache.thrift.meta_data.FieldMetaData("status", org.apache.thrift.TFieldRequirementType.REQUIRED,
0120 new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TStatus.class)));
0121 tmpMap.put(_Fields.DELEGATION_TOKEN, new org.apache.thrift.meta_data.FieldMetaData("delegationToken", org.apache.thrift.TFieldRequirementType.OPTIONAL,
0122 new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
0123 metaDataMap = Collections.unmodifiableMap(tmpMap);
0124 org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TGetDelegationTokenResp.class, metaDataMap);
0125 }
0126
0127 public TGetDelegationTokenResp() {
0128 }
0129
0130 public TGetDelegationTokenResp(
0131 TStatus status)
0132 {
0133 this();
0134 this.status = status;
0135 }
0136
0137
0138
0139
0140 public TGetDelegationTokenResp(TGetDelegationTokenResp other) {
0141 if (other.isSetStatus()) {
0142 this.status = new TStatus(other.status);
0143 }
0144 if (other.isSetDelegationToken()) {
0145 this.delegationToken = other.delegationToken;
0146 }
0147 }
0148
0149 public TGetDelegationTokenResp deepCopy() {
0150 return new TGetDelegationTokenResp(this);
0151 }
0152
0153 @Override
0154 public void clear() {
0155 this.status = null;
0156 this.delegationToken = null;
0157 }
0158
0159 public TStatus getStatus() {
0160 return this.status;
0161 }
0162
0163 public void setStatus(TStatus status) {
0164 this.status = status;
0165 }
0166
0167 public void unsetStatus() {
0168 this.status = null;
0169 }
0170
0171
0172 public boolean isSetStatus() {
0173 return this.status != null;
0174 }
0175
0176 public void setStatusIsSet(boolean value) {
0177 if (!value) {
0178 this.status = null;
0179 }
0180 }
0181
0182 public String getDelegationToken() {
0183 return this.delegationToken;
0184 }
0185
0186 public void setDelegationToken(String delegationToken) {
0187 this.delegationToken = delegationToken;
0188 }
0189
0190 public void unsetDelegationToken() {
0191 this.delegationToken = null;
0192 }
0193
0194
0195 public boolean isSetDelegationToken() {
0196 return this.delegationToken != null;
0197 }
0198
0199 public void setDelegationTokenIsSet(boolean value) {
0200 if (!value) {
0201 this.delegationToken = null;
0202 }
0203 }
0204
0205 public void setFieldValue(_Fields field, Object value) {
0206 switch (field) {
0207 case STATUS:
0208 if (value == null) {
0209 unsetStatus();
0210 } else {
0211 setStatus((TStatus)value);
0212 }
0213 break;
0214
0215 case DELEGATION_TOKEN:
0216 if (value == null) {
0217 unsetDelegationToken();
0218 } else {
0219 setDelegationToken((String)value);
0220 }
0221 break;
0222
0223 }
0224 }
0225
0226 public Object getFieldValue(_Fields field) {
0227 switch (field) {
0228 case STATUS:
0229 return getStatus();
0230
0231 case DELEGATION_TOKEN:
0232 return getDelegationToken();
0233
0234 }
0235 throw new IllegalStateException();
0236 }
0237
0238
0239 public boolean isSet(_Fields field) {
0240 if (field == null) {
0241 throw new IllegalArgumentException();
0242 }
0243
0244 switch (field) {
0245 case STATUS:
0246 return isSetStatus();
0247 case DELEGATION_TOKEN:
0248 return isSetDelegationToken();
0249 }
0250 throw new IllegalStateException();
0251 }
0252
0253 @Override
0254 public boolean equals(Object that) {
0255 if (that == null)
0256 return false;
0257 if (that instanceof TGetDelegationTokenResp)
0258 return this.equals((TGetDelegationTokenResp)that);
0259 return false;
0260 }
0261
0262 public boolean equals(TGetDelegationTokenResp that) {
0263 if (that == null)
0264 return false;
0265
0266 boolean this_present_status = true && this.isSetStatus();
0267 boolean that_present_status = true && that.isSetStatus();
0268 if (this_present_status || that_present_status) {
0269 if (!(this_present_status && that_present_status))
0270 return false;
0271 if (!this.status.equals(that.status))
0272 return false;
0273 }
0274
0275 boolean this_present_delegationToken = true && this.isSetDelegationToken();
0276 boolean that_present_delegationToken = true && that.isSetDelegationToken();
0277 if (this_present_delegationToken || that_present_delegationToken) {
0278 if (!(this_present_delegationToken && that_present_delegationToken))
0279 return false;
0280 if (!this.delegationToken.equals(that.delegationToken))
0281 return false;
0282 }
0283
0284 return true;
0285 }
0286
0287 @Override
0288 public int hashCode() {
0289 List<Object> list = new ArrayList<Object>();
0290
0291 boolean present_status = true && (isSetStatus());
0292 list.add(present_status);
0293 if (present_status)
0294 list.add(status);
0295
0296 boolean present_delegationToken = true && (isSetDelegationToken());
0297 list.add(present_delegationToken);
0298 if (present_delegationToken)
0299 list.add(delegationToken);
0300
0301 return list.hashCode();
0302 }
0303
0304 @Override
0305 public int compareTo(TGetDelegationTokenResp other) {
0306 if (!getClass().equals(other.getClass())) {
0307 return getClass().getName().compareTo(other.getClass().getName());
0308 }
0309
0310 int lastComparison = 0;
0311
0312 lastComparison = Boolean.valueOf(isSetStatus()).compareTo(other.isSetStatus());
0313 if (lastComparison != 0) {
0314 return lastComparison;
0315 }
0316 if (isSetStatus()) {
0317 lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.status, other.status);
0318 if (lastComparison != 0) {
0319 return lastComparison;
0320 }
0321 }
0322 lastComparison = Boolean.valueOf(isSetDelegationToken()).compareTo(other.isSetDelegationToken());
0323 if (lastComparison != 0) {
0324 return lastComparison;
0325 }
0326 if (isSetDelegationToken()) {
0327 lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delegationToken, other.delegationToken);
0328 if (lastComparison != 0) {
0329 return lastComparison;
0330 }
0331 }
0332 return 0;
0333 }
0334
0335 public _Fields fieldForId(int fieldId) {
0336 return _Fields.findByThriftId(fieldId);
0337 }
0338
0339 public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
0340 schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
0341 }
0342
0343 public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
0344 schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
0345 }
0346
0347 @Override
0348 public String toString() {
0349 StringBuilder sb = new StringBuilder("TGetDelegationTokenResp(");
0350 boolean first = true;
0351
0352 sb.append("status:");
0353 if (this.status == null) {
0354 sb.append("null");
0355 } else {
0356 sb.append(this.status);
0357 }
0358 first = false;
0359 if (isSetDelegationToken()) {
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 }
0369 sb.append(")");
0370 return sb.toString();
0371 }
0372
0373 public void validate() throws org.apache.thrift.TException {
0374
0375 if (!isSetStatus()) {
0376 throw new org.apache.thrift.protocol.TProtocolException("Required field 'status' is unset! Struct:" + toString());
0377 }
0378
0379
0380 if (status != null) {
0381 status.validate();
0382 }
0383 }
0384
0385 private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
0386 try {
0387 write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
0388 } catch (org.apache.thrift.TException te) {
0389 throw new java.io.IOException(te);
0390 }
0391 }
0392
0393 private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
0394 try {
0395 read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
0396 } catch (org.apache.thrift.TException te) {
0397 throw new java.io.IOException(te);
0398 }
0399 }
0400
0401 private static class TGetDelegationTokenRespStandardSchemeFactory implements SchemeFactory {
0402 public TGetDelegationTokenRespStandardScheme getScheme() {
0403 return new TGetDelegationTokenRespStandardScheme();
0404 }
0405 }
0406
0407 private static class TGetDelegationTokenRespStandardScheme extends StandardScheme<TGetDelegationTokenResp> {
0408
0409 public void read(org.apache.thrift.protocol.TProtocol iprot, TGetDelegationTokenResp struct) throws org.apache.thrift.TException {
0410 org.apache.thrift.protocol.TField schemeField;
0411 iprot.readStructBegin();
0412 while (true)
0413 {
0414 schemeField = iprot.readFieldBegin();
0415 if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
0416 break;
0417 }
0418 switch (schemeField.id) {
0419 case 1:
0420 if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
0421 struct.status = new TStatus();
0422 struct.status.read(iprot);
0423 struct.setStatusIsSet(true);
0424 } else {
0425 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
0426 }
0427 break;
0428 case 2:
0429 if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
0430 struct.delegationToken = iprot.readString();
0431 struct.setDelegationTokenIsSet(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, TGetDelegationTokenResp 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.delegationToken != null) {
0455 if (struct.isSetDelegationToken()) {
0456 oprot.writeFieldBegin(DELEGATION_TOKEN_FIELD_DESC);
0457 oprot.writeString(struct.delegationToken);
0458 oprot.writeFieldEnd();
0459 }
0460 }
0461 oprot.writeFieldStop();
0462 oprot.writeStructEnd();
0463 }
0464
0465 }
0466
0467 private static class TGetDelegationTokenRespTupleSchemeFactory implements SchemeFactory {
0468 public TGetDelegationTokenRespTupleScheme getScheme() {
0469 return new TGetDelegationTokenRespTupleScheme();
0470 }
0471 }
0472
0473 private static class TGetDelegationTokenRespTupleScheme extends TupleScheme<TGetDelegationTokenResp> {
0474
0475 @Override
0476 public void write(org.apache.thrift.protocol.TProtocol prot, TGetDelegationTokenResp struct) throws org.apache.thrift.TException {
0477 TTupleProtocol oprot = (TTupleProtocol) prot;
0478 struct.status.write(oprot);
0479 BitSet optionals = new BitSet();
0480 if (struct.isSetDelegationToken()) {
0481 optionals.set(0);
0482 }
0483 oprot.writeBitSet(optionals, 1);
0484 if (struct.isSetDelegationToken()) {
0485 oprot.writeString(struct.delegationToken);
0486 }
0487 }
0488
0489 @Override
0490 public void read(org.apache.thrift.protocol.TProtocol prot, TGetDelegationTokenResp 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.delegationToken = iprot.readString();
0498 struct.setDelegationTokenIsSet(true);
0499 }
0500 }
0501 }
0502
0503 }
0504