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 TGetDelegationTokenResp implements org.apache.thrift.TBase<TGetDelegationTokenResp, TGetDelegationTokenResp._Fields>, java.io.Serializable, Cloneable {
0035 private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TGetDelegationTokenResp");
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 DELEGATION_TOKEN_FIELD_DESC = new org.apache.thrift.protocol.TField("delegationToken", org.apache.thrift.protocol.TType.STRING, (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 TGetDelegationTokenRespStandardSchemeFactory());
0043 schemes.put(TupleScheme.class, new TGetDelegationTokenRespTupleSchemeFactory());
0044 }
0045
0046 private TStatus status;
0047 private String delegationToken;
0048
0049
0050 public enum _Fields implements org.apache.thrift.TFieldIdEnum {
0051 STATUS((short)1, "status"),
0052 DELEGATION_TOKEN((short)2, "delegationToken");
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
0064
0065 public static _Fields findByThriftId(int fieldId) {
0066 switch(fieldId) {
0067 case 1:
0068 return STATUS;
0069 case 2:
0070 return DELEGATION_TOKEN;
0071 default:
0072 return null;
0073 }
0074 }
0075
0076
0077
0078
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
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
0111 private _Fields optionals[] = {_Fields.DELEGATION_TOKEN};
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.DELEGATION_TOKEN, new org.apache.thrift.meta_data.FieldMetaData("delegationToken", org.apache.thrift.TFieldRequirementType.OPTIONAL,
0118 new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
0119 metaDataMap = Collections.unmodifiableMap(tmpMap);
0120 org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TGetDelegationTokenResp.class, metaDataMap);
0121 }
0122
0123 public TGetDelegationTokenResp() {
0124 }
0125
0126 public TGetDelegationTokenResp(
0127 TStatus status)
0128 {
0129 this();
0130 this.status = status;
0131 }
0132
0133
0134
0135
0136 public TGetDelegationTokenResp(TGetDelegationTokenResp other) {
0137 if (other.isSetStatus()) {
0138 this.status = new TStatus(other.status);
0139 }
0140 if (other.isSetDelegationToken()) {
0141 this.delegationToken = other.delegationToken;
0142 }
0143 }
0144
0145 public TGetDelegationTokenResp deepCopy() {
0146 return new TGetDelegationTokenResp(this);
0147 }
0148
0149 @Override
0150 public void clear() {
0151 this.status = null;
0152 this.delegationToken = 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
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 String getDelegationToken() {
0179 return this.delegationToken;
0180 }
0181
0182 public void setDelegationToken(String delegationToken) {
0183 this.delegationToken = delegationToken;
0184 }
0185
0186 public void unsetDelegationToken() {
0187 this.delegationToken = null;
0188 }
0189
0190
0191 public boolean isSetDelegationToken() {
0192 return this.delegationToken != null;
0193 }
0194
0195 public void setDelegationTokenIsSet(boolean value) {
0196 if (!value) {
0197 this.delegationToken = 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 DELEGATION_TOKEN:
0212 if (value == null) {
0213 unsetDelegationToken();
0214 } else {
0215 setDelegationToken((String)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 DELEGATION_TOKEN:
0228 return getDelegationToken();
0229
0230 }
0231 throw new IllegalStateException();
0232 }
0233
0234
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 DELEGATION_TOKEN:
0244 return isSetDelegationToken();
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 TGetDelegationTokenResp)
0254 return this.equals((TGetDelegationTokenResp)that);
0255 return false;
0256 }
0257
0258 public boolean equals(TGetDelegationTokenResp 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_delegationToken = true && this.isSetDelegationToken();
0272 boolean that_present_delegationToken = true && that.isSetDelegationToken();
0273 if (this_present_delegationToken || that_present_delegationToken) {
0274 if (!(this_present_delegationToken && that_present_delegationToken))
0275 return false;
0276 if (!this.delegationToken.equals(that.delegationToken))
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_delegationToken = true && (isSetDelegationToken());
0293 builder.append(present_delegationToken);
0294 if (present_delegationToken)
0295 builder.append(delegationToken);
0296
0297 return builder.toHashCode();
0298 }
0299
0300 public int compareTo(TGetDelegationTokenResp other) {
0301 if (!getClass().equals(other.getClass())) {
0302 return getClass().getName().compareTo(other.getClass().getName());
0303 }
0304
0305 int lastComparison = 0;
0306 TGetDelegationTokenResp typedOther = (TGetDelegationTokenResp)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(isSetDelegationToken()).compareTo(typedOther.isSetDelegationToken());
0319 if (lastComparison != 0) {
0320 return lastComparison;
0321 }
0322 if (isSetDelegationToken()) {
0323 lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delegationToken, typedOther.delegationToken);
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("TGetDelegationTokenResp(");
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 (isSetDelegationToken()) {
0356 if (!first) sb.append(", ");
0357 sb.append("delegationToken:");
0358 if (this.delegationToken == null) {
0359 sb.append("null");
0360 } else {
0361 sb.append(this.delegationToken);
0362 }
0363 first = false;
0364 }
0365 sb.append(")");
0366 return sb.toString();
0367 }
0368
0369 public void validate() throws org.apache.thrift.TException {
0370
0371 if (!isSetStatus()) {
0372 throw new org.apache.thrift.protocol.TProtocolException("Required field 'status' is unset! Struct:" + toString());
0373 }
0374
0375
0376 if (status != null) {
0377 status.validate();
0378 }
0379 }
0380
0381 private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
0382 try {
0383 write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
0384 } catch (org.apache.thrift.TException te) {
0385 throw new java.io.IOException(te);
0386 }
0387 }
0388
0389 private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
0390 try {
0391 read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
0392 } catch (org.apache.thrift.TException te) {
0393 throw new java.io.IOException(te);
0394 }
0395 }
0396
0397 private static class TGetDelegationTokenRespStandardSchemeFactory implements SchemeFactory {
0398 public TGetDelegationTokenRespStandardScheme getScheme() {
0399 return new TGetDelegationTokenRespStandardScheme();
0400 }
0401 }
0402
0403 private static class TGetDelegationTokenRespStandardScheme extends StandardScheme<TGetDelegationTokenResp> {
0404
0405 public void read(org.apache.thrift.protocol.TProtocol iprot, TGetDelegationTokenResp struct) throws org.apache.thrift.TException {
0406 org.apache.thrift.protocol.TField schemeField;
0407 iprot.readStructBegin();
0408 while (true)
0409 {
0410 schemeField = iprot.readFieldBegin();
0411 if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
0412 break;
0413 }
0414 switch (schemeField.id) {
0415 case 1:
0416 if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
0417 struct.status = new TStatus();
0418 struct.status.read(iprot);
0419 struct.setStatusIsSet(true);
0420 } else {
0421 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
0422 }
0423 break;
0424 case 2:
0425 if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
0426 struct.delegationToken = iprot.readString();
0427 struct.setDelegationTokenIsSet(true);
0428 } else {
0429 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
0430 }
0431 break;
0432 default:
0433 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
0434 }
0435 iprot.readFieldEnd();
0436 }
0437 iprot.readStructEnd();
0438 struct.validate();
0439 }
0440
0441 public void write(org.apache.thrift.protocol.TProtocol oprot, TGetDelegationTokenResp struct) throws org.apache.thrift.TException {
0442 struct.validate();
0443
0444 oprot.writeStructBegin(STRUCT_DESC);
0445 if (struct.status != null) {
0446 oprot.writeFieldBegin(STATUS_FIELD_DESC);
0447 struct.status.write(oprot);
0448 oprot.writeFieldEnd();
0449 }
0450 if (struct.delegationToken != null) {
0451 if (struct.isSetDelegationToken()) {
0452 oprot.writeFieldBegin(DELEGATION_TOKEN_FIELD_DESC);
0453 oprot.writeString(struct.delegationToken);
0454 oprot.writeFieldEnd();
0455 }
0456 }
0457 oprot.writeFieldStop();
0458 oprot.writeStructEnd();
0459 }
0460
0461 }
0462
0463 private static class TGetDelegationTokenRespTupleSchemeFactory implements SchemeFactory {
0464 public TGetDelegationTokenRespTupleScheme getScheme() {
0465 return new TGetDelegationTokenRespTupleScheme();
0466 }
0467 }
0468
0469 private static class TGetDelegationTokenRespTupleScheme extends TupleScheme<TGetDelegationTokenResp> {
0470
0471 @Override
0472 public void write(org.apache.thrift.protocol.TProtocol prot, TGetDelegationTokenResp struct) throws org.apache.thrift.TException {
0473 TTupleProtocol oprot = (TTupleProtocol) prot;
0474 struct.status.write(oprot);
0475 BitSet optionals = new BitSet();
0476 if (struct.isSetDelegationToken()) {
0477 optionals.set(0);
0478 }
0479 oprot.writeBitSet(optionals, 1);
0480 if (struct.isSetDelegationToken()) {
0481 oprot.writeString(struct.delegationToken);
0482 }
0483 }
0484
0485 @Override
0486 public void read(org.apache.thrift.protocol.TProtocol prot, TGetDelegationTokenResp struct) throws org.apache.thrift.TException {
0487 TTupleProtocol iprot = (TTupleProtocol) prot;
0488 struct.status = new TStatus();
0489 struct.status.read(iprot);
0490 struct.setStatusIsSet(true);
0491 BitSet incoming = iprot.readBitSet(1);
0492 if (incoming.get(0)) {
0493 struct.delegationToken = iprot.readString();
0494 struct.setDelegationTokenIsSet(true);
0495 }
0496 }
0497 }
0498
0499 }
0500