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