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 TGetDelegationTokenReq implements org.apache.thrift.TBase<TGetDelegationTokenReq, TGetDelegationTokenReq._Fields>, java.io.Serializable, Cloneable {
0035 private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TGetDelegationTokenReq");
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 OWNER_FIELD_DESC = new org.apache.thrift.protocol.TField("owner", org.apache.thrift.protocol.TType.STRING, (short)2);
0039 private static final org.apache.thrift.protocol.TField RENEWER_FIELD_DESC = new org.apache.thrift.protocol.TField("renewer", org.apache.thrift.protocol.TType.STRING, (short)3);
0040
0041 private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
0042 static {
0043 schemes.put(StandardScheme.class, new TGetDelegationTokenReqStandardSchemeFactory());
0044 schemes.put(TupleScheme.class, new TGetDelegationTokenReqTupleSchemeFactory());
0045 }
0046
0047 private TSessionHandle sessionHandle;
0048 private String owner;
0049 private String renewer;
0050
0051
0052 public enum _Fields implements org.apache.thrift.TFieldIdEnum {
0053 SESSION_HANDLE((short)1, "sessionHandle"),
0054 OWNER((short)2, "owner"),
0055 RENEWER((short)3, "renewer");
0056
0057 private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
0058
0059 static {
0060 for (_Fields field : EnumSet.allOf(_Fields.class)) {
0061 byName.put(field.getFieldName(), field);
0062 }
0063 }
0064
0065
0066
0067
0068 public static _Fields findByThriftId(int fieldId) {
0069 switch(fieldId) {
0070 case 1:
0071 return SESSION_HANDLE;
0072 case 2:
0073 return OWNER;
0074 case 3:
0075 return RENEWER;
0076 default:
0077 return null;
0078 }
0079 }
0080
0081
0082
0083
0084
0085 public static _Fields findByThriftIdOrThrow(int fieldId) {
0086 _Fields fields = findByThriftId(fieldId);
0087 if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
0088 return fields;
0089 }
0090
0091
0092
0093
0094 public static _Fields findByName(String name) {
0095 return byName.get(name);
0096 }
0097
0098 private final short _thriftId;
0099 private final String _fieldName;
0100
0101 _Fields(short thriftId, String fieldName) {
0102 _thriftId = thriftId;
0103 _fieldName = fieldName;
0104 }
0105
0106 public short getThriftFieldId() {
0107 return _thriftId;
0108 }
0109
0110 public String getFieldName() {
0111 return _fieldName;
0112 }
0113 }
0114
0115
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.SESSION_HANDLE, new org.apache.thrift.meta_data.FieldMetaData("sessionHandle", org.apache.thrift.TFieldRequirementType.REQUIRED,
0120 new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TSessionHandle.class)));
0121 tmpMap.put(_Fields.OWNER, new org.apache.thrift.meta_data.FieldMetaData("owner", org.apache.thrift.TFieldRequirementType.REQUIRED,
0122 new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
0123 tmpMap.put(_Fields.RENEWER, new org.apache.thrift.meta_data.FieldMetaData("renewer", org.apache.thrift.TFieldRequirementType.REQUIRED,
0124 new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
0125 metaDataMap = Collections.unmodifiableMap(tmpMap);
0126 org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TGetDelegationTokenReq.class, metaDataMap);
0127 }
0128
0129 public TGetDelegationTokenReq() {
0130 }
0131
0132 public TGetDelegationTokenReq(
0133 TSessionHandle sessionHandle,
0134 String owner,
0135 String renewer)
0136 {
0137 this();
0138 this.sessionHandle = sessionHandle;
0139 this.owner = owner;
0140 this.renewer = renewer;
0141 }
0142
0143
0144
0145
0146 public TGetDelegationTokenReq(TGetDelegationTokenReq other) {
0147 if (other.isSetSessionHandle()) {
0148 this.sessionHandle = new TSessionHandle(other.sessionHandle);
0149 }
0150 if (other.isSetOwner()) {
0151 this.owner = other.owner;
0152 }
0153 if (other.isSetRenewer()) {
0154 this.renewer = other.renewer;
0155 }
0156 }
0157
0158 public TGetDelegationTokenReq deepCopy() {
0159 return new TGetDelegationTokenReq(this);
0160 }
0161
0162 @Override
0163 public void clear() {
0164 this.sessionHandle = null;
0165 this.owner = null;
0166 this.renewer = null;
0167 }
0168
0169 public TSessionHandle getSessionHandle() {
0170 return this.sessionHandle;
0171 }
0172
0173 public void setSessionHandle(TSessionHandle sessionHandle) {
0174 this.sessionHandle = sessionHandle;
0175 }
0176
0177 public void unsetSessionHandle() {
0178 this.sessionHandle = null;
0179 }
0180
0181
0182 public boolean isSetSessionHandle() {
0183 return this.sessionHandle != null;
0184 }
0185
0186 public void setSessionHandleIsSet(boolean value) {
0187 if (!value) {
0188 this.sessionHandle = null;
0189 }
0190 }
0191
0192 public String getOwner() {
0193 return this.owner;
0194 }
0195
0196 public void setOwner(String owner) {
0197 this.owner = owner;
0198 }
0199
0200 public void unsetOwner() {
0201 this.owner = null;
0202 }
0203
0204
0205 public boolean isSetOwner() {
0206 return this.owner != null;
0207 }
0208
0209 public void setOwnerIsSet(boolean value) {
0210 if (!value) {
0211 this.owner = null;
0212 }
0213 }
0214
0215 public String getRenewer() {
0216 return this.renewer;
0217 }
0218
0219 public void setRenewer(String renewer) {
0220 this.renewer = renewer;
0221 }
0222
0223 public void unsetRenewer() {
0224 this.renewer = null;
0225 }
0226
0227
0228 public boolean isSetRenewer() {
0229 return this.renewer != null;
0230 }
0231
0232 public void setRenewerIsSet(boolean value) {
0233 if (!value) {
0234 this.renewer = null;
0235 }
0236 }
0237
0238 public void setFieldValue(_Fields field, Object value) {
0239 switch (field) {
0240 case SESSION_HANDLE:
0241 if (value == null) {
0242 unsetSessionHandle();
0243 } else {
0244 setSessionHandle((TSessionHandle)value);
0245 }
0246 break;
0247
0248 case OWNER:
0249 if (value == null) {
0250 unsetOwner();
0251 } else {
0252 setOwner((String)value);
0253 }
0254 break;
0255
0256 case RENEWER:
0257 if (value == null) {
0258 unsetRenewer();
0259 } else {
0260 setRenewer((String)value);
0261 }
0262 break;
0263
0264 }
0265 }
0266
0267 public Object getFieldValue(_Fields field) {
0268 switch (field) {
0269 case SESSION_HANDLE:
0270 return getSessionHandle();
0271
0272 case OWNER:
0273 return getOwner();
0274
0275 case RENEWER:
0276 return getRenewer();
0277
0278 }
0279 throw new IllegalStateException();
0280 }
0281
0282
0283 public boolean isSet(_Fields field) {
0284 if (field == null) {
0285 throw new IllegalArgumentException();
0286 }
0287
0288 switch (field) {
0289 case SESSION_HANDLE:
0290 return isSetSessionHandle();
0291 case OWNER:
0292 return isSetOwner();
0293 case RENEWER:
0294 return isSetRenewer();
0295 }
0296 throw new IllegalStateException();
0297 }
0298
0299 @Override
0300 public boolean equals(Object that) {
0301 if (that == null)
0302 return false;
0303 if (that instanceof TGetDelegationTokenReq)
0304 return this.equals((TGetDelegationTokenReq)that);
0305 return false;
0306 }
0307
0308 public boolean equals(TGetDelegationTokenReq that) {
0309 if (that == null)
0310 return false;
0311
0312 boolean this_present_sessionHandle = true && this.isSetSessionHandle();
0313 boolean that_present_sessionHandle = true && that.isSetSessionHandle();
0314 if (this_present_sessionHandle || that_present_sessionHandle) {
0315 if (!(this_present_sessionHandle && that_present_sessionHandle))
0316 return false;
0317 if (!this.sessionHandle.equals(that.sessionHandle))
0318 return false;
0319 }
0320
0321 boolean this_present_owner = true && this.isSetOwner();
0322 boolean that_present_owner = true && that.isSetOwner();
0323 if (this_present_owner || that_present_owner) {
0324 if (!(this_present_owner && that_present_owner))
0325 return false;
0326 if (!this.owner.equals(that.owner))
0327 return false;
0328 }
0329
0330 boolean this_present_renewer = true && this.isSetRenewer();
0331 boolean that_present_renewer = true && that.isSetRenewer();
0332 if (this_present_renewer || that_present_renewer) {
0333 if (!(this_present_renewer && that_present_renewer))
0334 return false;
0335 if (!this.renewer.equals(that.renewer))
0336 return false;
0337 }
0338
0339 return true;
0340 }
0341
0342 @Override
0343 public int hashCode() {
0344 HashCodeBuilder builder = new HashCodeBuilder();
0345
0346 boolean present_sessionHandle = true && (isSetSessionHandle());
0347 builder.append(present_sessionHandle);
0348 if (present_sessionHandle)
0349 builder.append(sessionHandle);
0350
0351 boolean present_owner = true && (isSetOwner());
0352 builder.append(present_owner);
0353 if (present_owner)
0354 builder.append(owner);
0355
0356 boolean present_renewer = true && (isSetRenewer());
0357 builder.append(present_renewer);
0358 if (present_renewer)
0359 builder.append(renewer);
0360
0361 return builder.toHashCode();
0362 }
0363
0364 public int compareTo(TGetDelegationTokenReq other) {
0365 if (!getClass().equals(other.getClass())) {
0366 return getClass().getName().compareTo(other.getClass().getName());
0367 }
0368
0369 int lastComparison = 0;
0370 TGetDelegationTokenReq typedOther = (TGetDelegationTokenReq)other;
0371
0372 lastComparison = Boolean.valueOf(isSetSessionHandle()).compareTo(typedOther.isSetSessionHandle());
0373 if (lastComparison != 0) {
0374 return lastComparison;
0375 }
0376 if (isSetSessionHandle()) {
0377 lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.sessionHandle, typedOther.sessionHandle);
0378 if (lastComparison != 0) {
0379 return lastComparison;
0380 }
0381 }
0382 lastComparison = Boolean.valueOf(isSetOwner()).compareTo(typedOther.isSetOwner());
0383 if (lastComparison != 0) {
0384 return lastComparison;
0385 }
0386 if (isSetOwner()) {
0387 lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.owner, typedOther.owner);
0388 if (lastComparison != 0) {
0389 return lastComparison;
0390 }
0391 }
0392 lastComparison = Boolean.valueOf(isSetRenewer()).compareTo(typedOther.isSetRenewer());
0393 if (lastComparison != 0) {
0394 return lastComparison;
0395 }
0396 if (isSetRenewer()) {
0397 lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.renewer, typedOther.renewer);
0398 if (lastComparison != 0) {
0399 return lastComparison;
0400 }
0401 }
0402 return 0;
0403 }
0404
0405 public _Fields fieldForId(int fieldId) {
0406 return _Fields.findByThriftId(fieldId);
0407 }
0408
0409 public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
0410 schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
0411 }
0412
0413 public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
0414 schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
0415 }
0416
0417 @Override
0418 public String toString() {
0419 StringBuilder sb = new StringBuilder("TGetDelegationTokenReq(");
0420 boolean first = true;
0421
0422 sb.append("sessionHandle:");
0423 if (this.sessionHandle == null) {
0424 sb.append("null");
0425 } else {
0426 sb.append(this.sessionHandle);
0427 }
0428 first = false;
0429 if (!first) sb.append(", ");
0430 sb.append("owner:");
0431 if (this.owner == null) {
0432 sb.append("null");
0433 } else {
0434 sb.append(this.owner);
0435 }
0436 first = false;
0437 if (!first) sb.append(", ");
0438 sb.append("renewer:");
0439 if (this.renewer == null) {
0440 sb.append("null");
0441 } else {
0442 sb.append(this.renewer);
0443 }
0444 first = false;
0445 sb.append(")");
0446 return sb.toString();
0447 }
0448
0449 public void validate() throws org.apache.thrift.TException {
0450
0451 if (!isSetSessionHandle()) {
0452 throw new org.apache.thrift.protocol.TProtocolException("Required field 'sessionHandle' is unset! Struct:" + toString());
0453 }
0454
0455 if (!isSetOwner()) {
0456 throw new org.apache.thrift.protocol.TProtocolException("Required field 'owner' is unset! Struct:" + toString());
0457 }
0458
0459 if (!isSetRenewer()) {
0460 throw new org.apache.thrift.protocol.TProtocolException("Required field 'renewer' is unset! Struct:" + toString());
0461 }
0462
0463
0464 if (sessionHandle != null) {
0465 sessionHandle.validate();
0466 }
0467 }
0468
0469 private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
0470 try {
0471 write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
0472 } catch (org.apache.thrift.TException te) {
0473 throw new java.io.IOException(te);
0474 }
0475 }
0476
0477 private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
0478 try {
0479 read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
0480 } catch (org.apache.thrift.TException te) {
0481 throw new java.io.IOException(te);
0482 }
0483 }
0484
0485 private static class TGetDelegationTokenReqStandardSchemeFactory implements SchemeFactory {
0486 public TGetDelegationTokenReqStandardScheme getScheme() {
0487 return new TGetDelegationTokenReqStandardScheme();
0488 }
0489 }
0490
0491 private static class TGetDelegationTokenReqStandardScheme extends StandardScheme<TGetDelegationTokenReq> {
0492
0493 public void read(org.apache.thrift.protocol.TProtocol iprot, TGetDelegationTokenReq struct) throws org.apache.thrift.TException {
0494 org.apache.thrift.protocol.TField schemeField;
0495 iprot.readStructBegin();
0496 while (true)
0497 {
0498 schemeField = iprot.readFieldBegin();
0499 if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
0500 break;
0501 }
0502 switch (schemeField.id) {
0503 case 1:
0504 if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
0505 struct.sessionHandle = new TSessionHandle();
0506 struct.sessionHandle.read(iprot);
0507 struct.setSessionHandleIsSet(true);
0508 } else {
0509 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
0510 }
0511 break;
0512 case 2:
0513 if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
0514 struct.owner = iprot.readString();
0515 struct.setOwnerIsSet(true);
0516 } else {
0517 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
0518 }
0519 break;
0520 case 3:
0521 if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
0522 struct.renewer = iprot.readString();
0523 struct.setRenewerIsSet(true);
0524 } else {
0525 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
0526 }
0527 break;
0528 default:
0529 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
0530 }
0531 iprot.readFieldEnd();
0532 }
0533 iprot.readStructEnd();
0534 struct.validate();
0535 }
0536
0537 public void write(org.apache.thrift.protocol.TProtocol oprot, TGetDelegationTokenReq struct) throws org.apache.thrift.TException {
0538 struct.validate();
0539
0540 oprot.writeStructBegin(STRUCT_DESC);
0541 if (struct.sessionHandle != null) {
0542 oprot.writeFieldBegin(SESSION_HANDLE_FIELD_DESC);
0543 struct.sessionHandle.write(oprot);
0544 oprot.writeFieldEnd();
0545 }
0546 if (struct.owner != null) {
0547 oprot.writeFieldBegin(OWNER_FIELD_DESC);
0548 oprot.writeString(struct.owner);
0549 oprot.writeFieldEnd();
0550 }
0551 if (struct.renewer != null) {
0552 oprot.writeFieldBegin(RENEWER_FIELD_DESC);
0553 oprot.writeString(struct.renewer);
0554 oprot.writeFieldEnd();
0555 }
0556 oprot.writeFieldStop();
0557 oprot.writeStructEnd();
0558 }
0559
0560 }
0561
0562 private static class TGetDelegationTokenReqTupleSchemeFactory implements SchemeFactory {
0563 public TGetDelegationTokenReqTupleScheme getScheme() {
0564 return new TGetDelegationTokenReqTupleScheme();
0565 }
0566 }
0567
0568 private static class TGetDelegationTokenReqTupleScheme extends TupleScheme<TGetDelegationTokenReq> {
0569
0570 @Override
0571 public void write(org.apache.thrift.protocol.TProtocol prot, TGetDelegationTokenReq struct) throws org.apache.thrift.TException {
0572 TTupleProtocol oprot = (TTupleProtocol) prot;
0573 struct.sessionHandle.write(oprot);
0574 oprot.writeString(struct.owner);
0575 oprot.writeString(struct.renewer);
0576 }
0577
0578 @Override
0579 public void read(org.apache.thrift.protocol.TProtocol prot, TGetDelegationTokenReq struct) throws org.apache.thrift.TException {
0580 TTupleProtocol iprot = (TTupleProtocol) prot;
0581 struct.sessionHandle = new TSessionHandle();
0582 struct.sessionHandle.read(iprot);
0583 struct.setSessionHandleIsSet(true);
0584 struct.owner = iprot.readString();
0585 struct.setOwnerIsSet(true);
0586 struct.renewer = iprot.readString();
0587 struct.setRenewerIsSet(true);
0588 }
0589 }
0590
0591 }
0592