From 1fd90ddd0655c0ccdeed9f9e2d35617615161498 Mon Sep 17 00:00:00 2001 From: Guangxu Cheng Date: Fri, 13 Apr 2018 11:51:35 +0800 Subject: [PATCH] HBASE-20395 Displaying thrift server type on the thrift page --- .../apache/hadoop/hbase/thrift/ThriftServer.java | 2 + .../hadoop/hbase/thrift/ThriftServerRunner.java | 6 + .../hadoop/hbase/thrift/generated/Hbase.java | 760 +++++++++- .../hbase/thrift/generated/TThriftServerType.java | 48 + .../hbase/thrift2/ThriftHBaseServiceHandler.java | 6 + .../apache/hadoop/hbase/thrift2/ThriftServer.java | 2 + .../hbase/thrift2/generated/THBaseService.java | 1469 +++++++++++++++----- .../hbase/thrift2/generated/TThriftServerType.java | 48 + .../main/resources/hbase-webapps/thrift/thrift.jsp | 6 + .../org/apache/hadoop/hbase/thrift/Hbase.thrift | 15 + .../org/apache/hadoop/hbase/thrift2/hbase.thrift | 15 + .../hadoop/hbase/thrift/TestThriftServer.java | 9 + .../thrift2/TestThriftHBaseServiceHandler.java | 7 + .../asciidoc/_chapters/thrift_filter_language.adoc | 4 + 14 files changed, 2076 insertions(+), 321 deletions(-) create mode 100644 hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/generated/TThriftServerType.java create mode 100644 hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/generated/TThriftServerType.java diff --git a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/ThriftServer.java b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/ThriftServer.java index d8b814e5a7..d8db473dfa 100644 --- a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/ThriftServer.java +++ b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/ThriftServer.java @@ -99,6 +99,8 @@ public class ThriftServer { String a = conf.get("hbase.thrift.info.bindAddress", "0.0.0.0"); infoServer = new InfoServer("thrift", a, port, false, conf); infoServer.setAttribute("hbase.conf", conf); + infoServer.setAttribute("hbase.thrift.type", + ThriftMetrics.ThriftServerType.ONE.name()); infoServer.start(); } diff --git a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/ThriftServerRunner.java b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/ThriftServerRunner.java index 39ea259426..7ff60287fc 100644 --- a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/ThriftServerRunner.java +++ b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/ThriftServerRunner.java @@ -97,6 +97,7 @@ import org.apache.hadoop.hbase.thrift.generated.TIncrement; import org.apache.hadoop.hbase.thrift.generated.TRegionInfo; import org.apache.hadoop.hbase.thrift.generated.TRowResult; import org.apache.hadoop.hbase.thrift.generated.TScan; +import org.apache.hadoop.hbase.thrift.generated.TThriftServerType; import org.apache.hadoop.hbase.util.Bytes; import org.apache.hadoop.hbase.util.ConnectionCache; import org.apache.hadoop.hbase.util.DNS; @@ -1951,6 +1952,11 @@ public class ThriftServerRunner implements Runnable { closeTable(table); } } + + @Override + public TThriftServerType getThriftServerType() { + return TThriftServerType.ONE; + } } diff --git a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/generated/Hbase.java b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/generated/Hbase.java index f77ce143f2..e77e6f08ef 100644 --- a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/generated/Hbase.java +++ b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/generated/Hbase.java @@ -34,7 +34,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) -@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2016-05-25") +@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2018-04-13") public class Hbase { public interface Iface { @@ -642,6 +642,13 @@ public class Hbase { */ public boolean checkAndPut(ByteBuffer tableName, ByteBuffer row, ByteBuffer column, ByteBuffer value, Mutation mput, Map attributes) throws IOError, IllegalArgument, org.apache.thrift.TException; + /** + * Get the type of this thrift server. + * + * @return the type of this thrift server + */ + public TThriftServerType getThriftServerType() throws org.apache.thrift.TException; + } public interface AsyncIface { @@ -734,6 +741,8 @@ public class Hbase { public void checkAndPut(ByteBuffer tableName, ByteBuffer row, ByteBuffer column, ByteBuffer value, Mutation mput, Map attributes, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + public void getThriftServerType(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + } public static class Client extends org.apache.thrift.TServiceClient implements Iface { @@ -1972,6 +1981,28 @@ public class Hbase { throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "checkAndPut failed: unknown result"); } + public TThriftServerType getThriftServerType() throws org.apache.thrift.TException + { + send_getThriftServerType(); + return recv_getThriftServerType(); + } + + public void send_getThriftServerType() throws org.apache.thrift.TException + { + getThriftServerType_args args = new getThriftServerType_args(); + sendBase("getThriftServerType", args); + } + + public TThriftServerType recv_getThriftServerType() throws org.apache.thrift.TException + { + getThriftServerType_result result = new getThriftServerType_result(); + receiveBase(result, "getThriftServerType"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getThriftServerType failed: unknown result"); + } + } public static class AsyncClient extends org.apache.thrift.async.TAsyncClient implements AsyncIface { public static class Factory implements org.apache.thrift.async.TAsyncClientFactory { @@ -3668,6 +3699,35 @@ public class Hbase { } } + public void getThriftServerType(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { + checkReady(); + getThriftServerType_call method_call = new getThriftServerType_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class getThriftServerType_call extends org.apache.thrift.async.TAsyncMethodCall { + public getThriftServerType_call(org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { + prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getThriftServerType", org.apache.thrift.protocol.TMessageType.CALL, 0)); + getThriftServerType_args args = new getThriftServerType_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public TThriftServerType getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_getThriftServerType(); + } + } + } public static class Processor extends org.apache.thrift.TBaseProcessor implements org.apache.thrift.TProcessor { @@ -3725,6 +3785,7 @@ public class Hbase { processMap.put("getRegionInfo", new getRegionInfo()); processMap.put("append", new append()); processMap.put("checkAndPut", new checkAndPut()); + processMap.put("getThriftServerType", new getThriftServerType()); return processMap; } @@ -4815,6 +4876,26 @@ public class Hbase { } } + public static class getThriftServerType extends org.apache.thrift.ProcessFunction { + public getThriftServerType() { + super("getThriftServerType"); + } + + public getThriftServerType_args getEmptyArgsInstance() { + return new getThriftServerType_args(); + } + + protected boolean isOneway() { + return false; + } + + public getThriftServerType_result getResult(I iface, getThriftServerType_args args) throws org.apache.thrift.TException { + getThriftServerType_result result = new getThriftServerType_result(); + result.success = iface.getThriftServerType(); + return result; + } + } + } public static class AsyncProcessor extends org.apache.thrift.TBaseAsyncProcessor { @@ -4872,6 +4953,7 @@ public class Hbase { processMap.put("getRegionInfo", new getRegionInfo()); processMap.put("append", new append()); processMap.put("checkAndPut", new checkAndPut()); + processMap.put("getThriftServerType", new getThriftServerType()); return processMap; } @@ -7430,6 +7512,57 @@ public class Hbase { } } + public static class getThriftServerType extends org.apache.thrift.AsyncProcessFunction { + public getThriftServerType() { + super("getThriftServerType"); + } + + public getThriftServerType_args getEmptyArgsInstance() { + return new getThriftServerType_args(); + } + + public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback() { + public void onComplete(TThriftServerType o) { + getThriftServerType_result result = new getThriftServerType_result(); + result.success = o; + try { + fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); + return; + } catch (Exception e) { + LOGGER.error("Exception writing to internal frame buffer", e); + } + fb.close(); + } + public void onError(Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TBase msg; + getThriftServerType_result result = new getThriftServerType_result(); + { + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb,msg,msgType,seqid); + return; + } catch (Exception ex) { + LOGGER.error("Exception writing to internal frame buffer", ex); + } + fb.close(); + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start(I iface, getThriftServerType_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException { + iface.getThriftServerType(resultHandler); + } + } + } public static class enableTable_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { @@ -58582,4 +58715,629 @@ public class Hbase { } + public static class getThriftServerType_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getThriftServerType_args"); + + + private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new getThriftServerType_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new getThriftServerType_argsTupleSchemeFactory()); + } + + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { +; + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** + * Find the _Fields constant that matches fieldId, or null if its not found. + */ + public static _Fields findByThriftId(int fieldId) { + switch(fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception + * if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** + * Find the _Fields constant that matches name, or null if its not found. + */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getThriftServerType_args.class, metaDataMap); + } + + public getThriftServerType_args() { + } + + /** + * Performs a deep copy on other. + */ + public getThriftServerType_args(getThriftServerType_args other) { + } + + public getThriftServerType_args deepCopy() { + return new getThriftServerType_args(this); + } + + @Override + public void clear() { + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + } + throw new IllegalStateException(); + } + + /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof getThriftServerType_args) + return this.equals((getThriftServerType_args)that); + return false; + } + + public boolean equals(getThriftServerType_args that) { + if (that == null) + return false; + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + return list.hashCode(); + } + + @Override + public int compareTo(getThriftServerType_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("getThriftServerType_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { + try { + read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class getThriftServerType_argsStandardSchemeFactory implements SchemeFactory { + public getThriftServerType_argsStandardScheme getScheme() { + return new getThriftServerType_argsStandardScheme(); + } + } + + private static class getThriftServerType_argsStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, getThriftServerType_args struct) throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) + { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, getThriftServerType_args struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class getThriftServerType_argsTupleSchemeFactory implements SchemeFactory { + public getThriftServerType_argsTupleScheme getScheme() { + return new getThriftServerType_argsTupleScheme(); + } + } + + private static class getThriftServerType_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, getThriftServerType_args struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, getThriftServerType_args struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + } + } + + } + + public static class getThriftServerType_result implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getThriftServerType_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.I32, (short)0); + + private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new getThriftServerType_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new getThriftServerType_resultTupleSchemeFactory()); + } + + /** + * + * @see TThriftServerType + */ + public TThriftServerType success; // required + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + /** + * + * @see TThriftServerType + */ + SUCCESS((short)0, "success"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** + * Find the _Fields constant that matches fieldId, or null if its not found. + */ + public static _Fields findByThriftId(int fieldId) { + switch(fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception + * if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** + * Find the _Fields constant that matches name, or null if its not found. + */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, TThriftServerType.class))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getThriftServerType_result.class, metaDataMap); + } + + public getThriftServerType_result() { + } + + public getThriftServerType_result( + TThriftServerType success) + { + this(); + this.success = success; + } + + /** + * Performs a deep copy on other. + */ + public getThriftServerType_result(getThriftServerType_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public getThriftServerType_result deepCopy() { + return new getThriftServerType_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + /** + * + * @see TThriftServerType + */ + public TThriftServerType getSuccess() { + return this.success; + } + + /** + * + * @see TThriftServerType + */ + public getThriftServerType_result setSuccess(TThriftServerType success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((TThriftServerType)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + + } + throw new IllegalStateException(); + } + + /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof getThriftServerType_result) + return this.equals((getThriftServerType_result)that); + return false; + } + + public boolean equals(getThriftServerType_result that) { + if (that == null) + return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) + return false; + if (!this.success.equals(that.success)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + boolean present_success = true && (isSetSuccess()); + list.add(present_success); + if (present_success) + list.add(success.getValue()); + + return list.hashCode(); + } + + @Override + public int compareTo(getThriftServerType_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("getThriftServerType_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { + try { + read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class getThriftServerType_resultStandardSchemeFactory implements SchemeFactory { + public getThriftServerType_resultStandardScheme getScheme() { + return new getThriftServerType_resultStandardScheme(); + } + } + + private static class getThriftServerType_resultStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, getThriftServerType_result struct) throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) + { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.success = org.apache.hadoop.hbase.thrift.generated.TThriftServerType.findByValue(iprot.readI32()); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, getThriftServerType_result struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeI32(struct.success.getValue()); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class getThriftServerType_resultTupleSchemeFactory implements SchemeFactory { + public getThriftServerType_resultTupleScheme getScheme() { + return new getThriftServerType_resultTupleScheme(); + } + } + + private static class getThriftServerType_resultTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, getThriftServerType_result struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeI32(struct.success.getValue()); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, getThriftServerType_result struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = org.apache.hadoop.hbase.thrift.generated.TThriftServerType.findByValue(iprot.readI32()); + struct.setSuccessIsSet(true); + } + } + } + + } + } diff --git a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/generated/TThriftServerType.java b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/generated/TThriftServerType.java new file mode 100644 index 0000000000..49cbf64ba8 --- /dev/null +++ b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/generated/TThriftServerType.java @@ -0,0 +1,48 @@ +/** + * Autogenerated by Thrift Compiler (0.9.3) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +package org.apache.hadoop.hbase.thrift.generated; + + +import java.util.Map; +import java.util.HashMap; +import org.apache.thrift.TEnum; + +/** + * Specify type of thrift server: thrift and thrift2 + */ +public enum TThriftServerType implements org.apache.thrift.TEnum { + ONE(1), + TWO(2); + + private final int value; + + private TThriftServerType(int value) { + this.value = value; + } + + /** + * Get the integer value of this enum value, as defined in the Thrift IDL. + */ + public int getValue() { + return value; + } + + /** + * Find a the enum type by its integer value, as defined in the Thrift IDL. + * @return null if the value is not found. + */ + public static TThriftServerType findByValue(int value) { + switch (value) { + case 1: + return ONE; + case 2: + return TWO; + default: + return null; + } + } +} diff --git a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/ThriftHBaseServiceHandler.java b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/ThriftHBaseServiceHandler.java index 8e3ee964db..1c10a074c1 100644 --- a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/ThriftHBaseServiceHandler.java +++ b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/ThriftHBaseServiceHandler.java @@ -67,6 +67,7 @@ import org.apache.hadoop.hbase.thrift2.generated.TPut; import org.apache.hadoop.hbase.thrift2.generated.TResult; import org.apache.hadoop.hbase.thrift2.generated.TRowMutations; import org.apache.hadoop.hbase.thrift2.generated.TScan; +import org.apache.hadoop.hbase.thrift2.generated.TThriftServerType; import org.apache.hadoop.hbase.util.Bytes; import org.apache.hadoop.hbase.util.ConnectionCache; import org.apache.thrift.TException; @@ -561,6 +562,11 @@ public class ThriftHBaseServiceHandler implements THBaseService.Iface { } } + @Override + public TThriftServerType getThriftServerType() { + return TThriftServerType.TWO; + } + private void checkReadOnlyMode() throws TIOError { if (isReadOnly()) { throw getTIOError(ioe); diff --git a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/ThriftServer.java b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/ThriftServer.java index 5681569cc5..98f638e52f 100644 --- a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/ThriftServer.java +++ b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/ThriftServer.java @@ -594,6 +594,8 @@ public class ThriftServer extends Configured implements Tool { String a = conf.get("hbase.thrift.info.bindAddress", "0.0.0.0"); InfoServer infoServer = new InfoServer("thrift", a, port, false, conf); infoServer.setAttribute("hbase.conf", conf); + infoServer.setAttribute("hbase.thrift.type", + ThriftMetrics.ThriftServerType.TWO.name()); infoServer.start(); } } diff --git a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/generated/THBaseService.java b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/generated/THBaseService.java index ae7c9d67e5..a5fd570555 100644 --- a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/generated/THBaseService.java +++ b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/generated/THBaseService.java @@ -34,7 +34,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) -@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2016-05-25") +@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2018-04-13") public class THBaseService { public interface Iface { @@ -52,12 +52,12 @@ public class THBaseService { /** * Test for the existence of columns in the table, as specified by the TGets. - * + * * This will return an array of booleans. Each value will be true if the related Get matches * one or more keys, false if not. - * + * * @param table the table to check on - * + * * @param tgets a list of TGets to check for */ public List existsAll(ByteBuffer table, List tgets) throws TIOError, org.apache.thrift.TException; @@ -282,13 +282,20 @@ public class THBaseService { */ public boolean checkAndMutate(ByteBuffer table, ByteBuffer row, ByteBuffer family, ByteBuffer qualifier, TCompareOp compareOp, ByteBuffer value, TRowMutations rowMutations) throws TIOError, org.apache.thrift.TException; + /** + * Get the type of this thrift server. + * + * @return the type of this thrift server + */ + public TThriftServerType getThriftServerType() throws org.apache.thrift.TException; + } public interface AsyncIface { public void exists(ByteBuffer table, TGet tget, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; - public void existsAll(ByteBuffer table, List tgets, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + public void existsAll(ByteBuffer table, List tgets, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; public void get(ByteBuffer table, TGet tget, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; @@ -326,6 +333,8 @@ public class THBaseService { public void checkAndMutate(ByteBuffer table, ByteBuffer row, ByteBuffer family, ByteBuffer qualifier, TCompareOp compareOp, ByteBuffer value, TRowMutations rowMutations, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + public void getThriftServerType(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + } public static class Client extends org.apache.thrift.TServiceClient implements Iface { @@ -892,6 +901,28 @@ public class THBaseService { throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "checkAndMutate failed: unknown result"); } + public TThriftServerType getThriftServerType() throws org.apache.thrift.TException + { + send_getThriftServerType(); + return recv_getThriftServerType(); + } + + public void send_getThriftServerType() throws org.apache.thrift.TException + { + getThriftServerType_args args = new getThriftServerType_args(); + sendBase("getThriftServerType", args); + } + + public TThriftServerType recv_getThriftServerType() throws org.apache.thrift.TException + { + getThriftServerType_result result = new getThriftServerType_result(); + receiveBase(result, "getThriftServerType"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getThriftServerType failed: unknown result"); + } + } public static class AsyncClient extends org.apache.thrift.async.TAsyncClient implements AsyncIface { public static class Factory implements org.apache.thrift.async.TAsyncClientFactory { @@ -945,7 +976,7 @@ public class THBaseService { } } - public void existsAll(ByteBuffer table, List tgets, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { + public void existsAll(ByteBuffer table, List tgets, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { checkReady(); existsAll_call method_call = new existsAll_call(table, tgets, resultHandler, this, ___protocolFactory, ___transport); this.___currentMethod = method_call; @@ -955,7 +986,7 @@ public class THBaseService { public static class existsAll_call extends org.apache.thrift.async.TAsyncMethodCall { private ByteBuffer table; private List tgets; - public existsAll_call(ByteBuffer table, List tgets, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException { + public existsAll_call(ByteBuffer table, List tgets, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException { super(client, protocolFactory, transport, resultHandler, false); this.table = table; this.tgets = tgets; @@ -1649,6 +1680,35 @@ public class THBaseService { } } + public void getThriftServerType(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { + checkReady(); + getThriftServerType_call method_call = new getThriftServerType_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class getThriftServerType_call extends org.apache.thrift.async.TAsyncMethodCall { + public getThriftServerType_call(org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { + prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getThriftServerType", org.apache.thrift.protocol.TMessageType.CALL, 0)); + getThriftServerType_args args = new getThriftServerType_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public TThriftServerType getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_getThriftServerType(); + } + } + } public static class Processor extends org.apache.thrift.TBaseProcessor implements org.apache.thrift.TProcessor { @@ -1682,6 +1742,7 @@ public class THBaseService { processMap.put("getRegionLocation", new getRegionLocation()); processMap.put("getAllRegionLocations", new getAllRegionLocations()); processMap.put("checkAndMutate", new checkAndMutate()); + processMap.put("getThriftServerType", new getThriftServerType()); return processMap; } @@ -1733,6 +1794,7 @@ public class THBaseService { return result; } } + public static class get extends org.apache.thrift.ProcessFunction { public get() { super("get"); @@ -2173,6 +2235,26 @@ public class THBaseService { } } + public static class getThriftServerType extends org.apache.thrift.ProcessFunction { + public getThriftServerType() { + super("getThriftServerType"); + } + + public getThriftServerType_args getEmptyArgsInstance() { + return new getThriftServerType_args(); + } + + protected boolean isOneway() { + return false; + } + + public getThriftServerType_result getResult(I iface, getThriftServerType_args args) throws org.apache.thrift.TException { + getThriftServerType_result result = new getThriftServerType_result(); + result.success = iface.getThriftServerType(); + return result; + } + } + } public static class AsyncProcessor extends org.apache.thrift.TBaseAsyncProcessor { @@ -2187,6 +2269,7 @@ public class THBaseService { private static Map> getProcessMap(Map> processMap) { processMap.put("exists", new exists()); + processMap.put("existsAll", new existsAll()); processMap.put("get", new get()); processMap.put("getMultiple", new getMultiple()); processMap.put("put", new put()); @@ -2205,6 +2288,7 @@ public class THBaseService { processMap.put("getRegionLocation", new getRegionLocation()); processMap.put("getAllRegionLocations", new getAllRegionLocations()); processMap.put("checkAndMutate", new checkAndMutate()); + processMap.put("getThriftServerType", new getThriftServerType()); return processMap; } @@ -2266,6 +2350,63 @@ public class THBaseService { } } + public static class existsAll extends org.apache.thrift.AsyncProcessFunction> { + public existsAll() { + super("existsAll"); + } + + public existsAll_args getEmptyArgsInstance() { + return new existsAll_args(); + } + + public AsyncMethodCallback> getResultHandler(final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback>() { + public void onComplete(List o) { + existsAll_result result = new existsAll_result(); + result.success = o; + try { + fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); + return; + } catch (Exception e) { + LOGGER.error("Exception writing to internal frame buffer", e); + } + fb.close(); + } + public void onError(Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TBase msg; + existsAll_result result = new existsAll_result(); + if (e instanceof TIOError) { + result.io = (TIOError) e; + result.setIoIsSet(true); + msg = result; + } + else + { + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb,msg,msgType,seqid); + return; + } catch (Exception ex) { + LOGGER.error("Exception writing to internal frame buffer", ex); + } + fb.close(); + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start(I iface, existsAll_args args, org.apache.thrift.async.AsyncMethodCallback> resultHandler) throws TException { + iface.existsAll(args.table, args.tgets,resultHandler); + } + } + public static class get extends org.apache.thrift.AsyncProcessFunction { public get() { super("get"); @@ -3301,6 +3442,57 @@ public class THBaseService { } } + public static class getThriftServerType extends org.apache.thrift.AsyncProcessFunction { + public getThriftServerType() { + super("getThriftServerType"); + } + + public getThriftServerType_args getEmptyArgsInstance() { + return new getThriftServerType_args(); + } + + public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback() { + public void onComplete(TThriftServerType o) { + getThriftServerType_result result = new getThriftServerType_result(); + result.success = o; + try { + fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); + return; + } catch (Exception e) { + LOGGER.error("Exception writing to internal frame buffer", e); + } + fb.close(); + } + public void onError(Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TBase msg; + getThriftServerType_result result = new getThriftServerType_result(); + { + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb,msg,msgType,seqid); + return; + } catch (Exception ex) { + LOGGER.error("Exception writing to internal frame buffer", ex); + } + fb.close(); + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start(I iface, getThriftServerType_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException { + iface.getThriftServerType(resultHandler); + } + } + } public static class exists_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { @@ -4265,14 +4457,13 @@ public class THBaseService { } - public static class existsAll_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable { + public static class existsAll_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("existsAll_args"); - private static final org.apache.thrift.protocol.TField TABLE_FIELD_DESC = new org.apache.thrift.protocol.TField("table", org.apache.thrift.protocol.TType.STRING, (short) 1); - private static final org.apache.thrift.protocol.TField TGETS_FIELD_DESC = new org.apache.thrift.protocol.TField("tgets", org.apache.thrift.protocol.TType.LIST, (short) 2); + private static final org.apache.thrift.protocol.TField TABLE_FIELD_DESC = new org.apache.thrift.protocol.TField("table", org.apache.thrift.protocol.TType.STRING, (short)1); + private static final org.apache.thrift.protocol.TField TGETS_FIELD_DESC = new org.apache.thrift.protocol.TField("tgets", org.apache.thrift.protocol.TType.LIST, (short)2); private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { schemes.put(StandardScheme.class, new existsAll_argsStandardSchemeFactory()); schemes.put(TupleScheme.class, new existsAll_argsTupleSchemeFactory()); @@ -4287,18 +4478,16 @@ public class THBaseService { */ public List tgets; // required - /** - * The set of fields this struct contains, along with convenience methods for finding and manipulating them. - */ + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements org.apache.thrift.TFieldIdEnum { /** * the table to check on */ - TABLE((short) 1, "table"), + TABLE((short)1, "table"), /** * a list of TGets to check for */ - TGETS((short) 2, "tgets"); + TGETS((short)2, "tgets"); private static final Map byName = new HashMap(); @@ -4312,7 +4501,7 @@ public class THBaseService { * Find the _Fields constant that matches fieldId, or null if its not found. */ public static _Fields findByThriftId(int fieldId) { - switch (fieldId) { + switch(fieldId) { case 1: // TABLE return TABLE; case 2: // TGETS @@ -4358,14 +4547,13 @@ public class THBaseService { // isset id assignments public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - tmpMap.put(_Fields.TABLE, new org.apache.thrift.meta_data.FieldMetaData("table", org.apache.thrift.TFieldRequirementType.REQUIRED, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING, true))); - tmpMap.put(_Fields.TGETS, new org.apache.thrift.meta_data.FieldMetaData("tgets", org.apache.thrift.TFieldRequirementType.REQUIRED, - new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, - new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TGet.class)))); + tmpMap.put(_Fields.TABLE, new org.apache.thrift.meta_data.FieldMetaData("table", org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true))); + tmpMap.put(_Fields.TGETS, new org.apache.thrift.meta_data.FieldMetaData("tgets", org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TGet.class)))); metaDataMap = Collections.unmodifiableMap(tmpMap); org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(existsAll_args.class, metaDataMap); } @@ -4374,10 +4562,11 @@ public class THBaseService { } public existsAll_args( - ByteBuffer table, - List tgets) { + ByteBuffer table, + List tgets) + { this(); - this.table = table; + this.table = org.apache.thrift.TBaseHelper.copyBinary(table); this.tgets = tgets; } @@ -4387,10 +4576,9 @@ public class THBaseService { public existsAll_args(existsAll_args other) { if (other.isSetTable()) { this.table = org.apache.thrift.TBaseHelper.copyBinary(other.table); - ; } if (other.isSetTgets()) { - List __this__tgets = new ArrayList(); + List __this__tgets = new ArrayList(other.tgets.size()); for (TGet other_element : other.tgets) { __this__tgets.add(new TGet(other_element)); } @@ -4417,19 +4605,19 @@ public class THBaseService { } public ByteBuffer bufferForTable() { - return table; + return org.apache.thrift.TBaseHelper.copyBinary(table); } /** * the table to check on */ public existsAll_args setTable(byte[] table) { - setTable(table == null ? (ByteBuffer) null : ByteBuffer.wrap(table)); + this.table = table == null ? (ByteBuffer)null : ByteBuffer.wrap(Arrays.copyOf(table, table.length)); return this; } public existsAll_args setTable(ByteBuffer table) { - this.table = table; + this.table = org.apache.thrift.TBaseHelper.copyBinary(table); return this; } @@ -4437,9 +4625,7 @@ public class THBaseService { this.table = null; } - /** - * Returns true if field table is set (has been assigned a value) and false otherwise - */ + /** Returns true if field table is set (has been assigned a value) and false otherwise */ public boolean isSetTable() { return this.table != null; } @@ -4484,9 +4670,7 @@ public class THBaseService { this.tgets = null; } - /** - * Returns true if field tgets is set (has been assigned a value) and false otherwise - */ + /** Returns true if field tgets is set (has been assigned a value) and false otherwise */ public boolean isSetTgets() { return this.tgets != null; } @@ -4499,50 +4683,48 @@ public class THBaseService { public void setFieldValue(_Fields field, Object value) { switch (field) { - case TABLE: - if (value == null) { - unsetTable(); - } else { - setTable((ByteBuffer) value); - } - break; + case TABLE: + if (value == null) { + unsetTable(); + } else { + setTable((ByteBuffer)value); + } + break; - case TGETS: - if (value == null) { - unsetTgets(); - } else { - setTgets((List) value); - } - break; + case TGETS: + if (value == null) { + unsetTgets(); + } else { + setTgets((List)value); + } + break; } } public Object getFieldValue(_Fields field) { switch (field) { - case TABLE: - return getTable(); + case TABLE: + return getTable(); - case TGETS: - return getTgets(); + case TGETS: + return getTgets(); } throw new IllegalStateException(); } - /** - * Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise - */ + /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ public boolean isSet(_Fields field) { if (field == null) { throw new IllegalArgumentException(); } switch (field) { - case TABLE: - return isSetTable(); - case TGETS: - return isSetTgets(); + case TABLE: + return isSetTable(); + case TGETS: + return isSetTgets(); } throw new IllegalStateException(); } @@ -4552,7 +4734,7 @@ public class THBaseService { if (that == null) return false; if (that instanceof existsAll_args) - return this.equals((existsAll_args) that); + return this.equals((existsAll_args)that); return false; } @@ -4583,33 +4765,45 @@ public class THBaseService { @Override public int hashCode() { - return 0; + List list = new ArrayList(); + + boolean present_table = true && (isSetTable()); + list.add(present_table); + if (present_table) + list.add(table); + + boolean present_tgets = true && (isSetTgets()); + list.add(present_tgets); + if (present_tgets) + list.add(tgets); + + return list.hashCode(); } + @Override public int compareTo(existsAll_args other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; - existsAll_args typedOther = (existsAll_args) other; - lastComparison = Boolean.valueOf(isSetTable()).compareTo(typedOther.isSetTable()); + lastComparison = Boolean.valueOf(isSetTable()).compareTo(other.isSetTable()); if (lastComparison != 0) { return lastComparison; } if (isSetTable()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.table, typedOther.table); + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.table, other.table); if (lastComparison != 0) { return lastComparison; } } - lastComparison = Boolean.valueOf(isSetTgets()).compareTo(typedOther.isSetTgets()); + lastComparison = Boolean.valueOf(isSetTgets()).compareTo(other.isSetTgets()); if (lastComparison != 0) { return lastComparison; } if (isSetTgets()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.tgets, typedOther.tgets); + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.tgets, other.tgets); if (lastComparison != 0) { return lastComparison; } @@ -4691,9 +4885,10 @@ public class THBaseService { public void read(org.apache.thrift.protocol.TProtocol iprot, existsAll_args struct) throws org.apache.thrift.TException { org.apache.thrift.protocol.TField schemeField; iprot.readStructBegin(); - while (true) { + while (true) + { schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { break; } switch (schemeField.id) { @@ -4701,25 +4896,26 @@ public class THBaseService { if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { struct.table = iprot.readBinary(); struct.setTableIsSet(true); - } else { + } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 2: // TGETS if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list132 = iprot.readListBegin(); - struct.tgets = new ArrayList(_list132.size); - for (int _i133 = 0; _i133 < _list132.size; ++_i133) { - TGet _elem134; // required - _elem134 = new TGet(); - _elem134.read(iprot); - struct.tgets.add(_elem134); + org.apache.thrift.protocol.TList _list142 = iprot.readListBegin(); + struct.tgets = new ArrayList(_list142.size); + TGet _elem143; + for (int _i144 = 0; _i144 < _list142.size; ++_i144) + { + _elem143 = new TGet(); + _elem143.read(iprot); + struct.tgets.add(_elem143); } iprot.readListEnd(); } struct.setTgetsIsSet(true); - } else { + } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; @@ -4747,8 +4943,9 @@ public class THBaseService { oprot.writeFieldBegin(TGETS_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.tgets.size())); - for (TGet _iter135 : struct.tgets) { - _iter135.write(oprot); + for (TGet _iter145 : struct.tgets) + { + _iter145.write(oprot); } oprot.writeListEnd(); } @@ -4774,8 +4971,9 @@ public class THBaseService { oprot.writeBinary(struct.table); { oprot.writeI32(struct.tgets.size()); - for (TGet _iter136 : struct.tgets) { - _iter136.write(oprot); + for (TGet _iter146 : struct.tgets) + { + _iter146.write(oprot); } } } @@ -4786,13 +4984,14 @@ public class THBaseService { struct.table = iprot.readBinary(); struct.setTableIsSet(true); { - org.apache.thrift.protocol.TList _list137 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); - struct.tgets = new ArrayList(_list137.size); - for (int _i138 = 0; _i138 < _list137.size; ++_i138) { - TGet _elem139; // required - _elem139 = new TGet(); - _elem139.read(iprot); - struct.tgets.add(_elem139); + org.apache.thrift.protocol.TList _list147 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.tgets = new ArrayList(_list147.size); + TGet _elem148; + for (int _i149 = 0; _i149 < _list147.size; ++_i149) + { + _elem148 = new TGet(); + _elem148.read(iprot); + struct.tgets.add(_elem148); } } struct.setTgetsIsSet(true); @@ -4801,14 +5000,13 @@ public class THBaseService { } - public static class existsAll_result implements org.apache.thrift.TBase, java.io.Serializable, Cloneable { + public static class existsAll_result implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("existsAll_result"); - private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.LIST, (short) 0); - private static final org.apache.thrift.protocol.TField IO_FIELD_DESC = new org.apache.thrift.protocol.TField("io", org.apache.thrift.protocol.TType.STRUCT, (short) 1); + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.LIST, (short)0); + private static final org.apache.thrift.protocol.TField IO_FIELD_DESC = new org.apache.thrift.protocol.TField("io", org.apache.thrift.protocol.TType.STRUCT, (short)1); private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); - static { schemes.put(StandardScheme.class, new existsAll_resultStandardSchemeFactory()); schemes.put(TupleScheme.class, new existsAll_resultTupleSchemeFactory()); @@ -4817,12 +5015,10 @@ public class THBaseService { public List success; // required public TIOError io; // required - /** - * The set of fields this struct contains, along with convenience methods for finding and manipulating them. - */ + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements org.apache.thrift.TFieldIdEnum { - SUCCESS((short) 0, "success"), - IO((short) 1, "io"); + SUCCESS((short)0, "success"), + IO((short)1, "io"); private static final Map byName = new HashMap(); @@ -4836,7 +5032,7 @@ public class THBaseService { * Find the _Fields constant that matches fieldId, or null if its not found. */ public static _Fields findByThriftId(int fieldId) { - switch (fieldId) { + switch(fieldId) { case 0: // SUCCESS return SUCCESS; case 1: // IO @@ -4882,14 +5078,13 @@ public class THBaseService { // isset id assignments public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)))); - tmpMap.put(_Fields.IO, new org.apache.thrift.meta_data.FieldMetaData("io", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT))); + tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)))); + tmpMap.put(_Fields.IO, new org.apache.thrift.meta_data.FieldMetaData("io", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT))); metaDataMap = Collections.unmodifiableMap(tmpMap); org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(existsAll_result.class, metaDataMap); } @@ -4898,8 +5093,9 @@ public class THBaseService { } public existsAll_result( - List success, - TIOError io) { + List success, + TIOError io) + { this(); this.success = success; this.io = io; @@ -4910,10 +5106,7 @@ public class THBaseService { */ public existsAll_result(existsAll_result other) { if (other.isSetSuccess()) { - List __this__success = new ArrayList(); - for (Boolean other_element : other.success) { - __this__success.add(other_element); - } + List __this__success = new ArrayList(other.success); this.success = __this__success; } if (other.isSetIo()) { @@ -4959,9 +5152,7 @@ public class THBaseService { this.success = null; } - /** - * Returns true if field success is set (has been assigned a value) and false otherwise - */ + /** Returns true if field success is set (has been assigned a value) and false otherwise */ public boolean isSetSuccess() { return this.success != null; } @@ -4985,9 +5176,7 @@ public class THBaseService { this.io = null; } - /** - * Returns true if field io is set (has been assigned a value) and false otherwise - */ + /** Returns true if field io is set (has been assigned a value) and false otherwise */ public boolean isSetIo() { return this.io != null; } @@ -5000,50 +5189,48 @@ public class THBaseService { public void setFieldValue(_Fields field, Object value) { switch (field) { - case SUCCESS: - if (value == null) { - unsetSuccess(); - } else { - setSuccess((List) value); - } - break; - - case IO: - if (value == null) { - unsetIo(); - } else { - setIo((TIOError) value); - } - break; - - } - } + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((List)value); + } + break; + + case IO: + if (value == null) { + unsetIo(); + } else { + setIo((TIOError)value); + } + break; + + } + } public Object getFieldValue(_Fields field) { switch (field) { - case SUCCESS: - return getSuccess(); + case SUCCESS: + return getSuccess(); - case IO: - return getIo(); + case IO: + return getIo(); } throw new IllegalStateException(); } - /** - * Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise - */ + /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ public boolean isSet(_Fields field) { if (field == null) { throw new IllegalArgumentException(); } switch (field) { - case SUCCESS: - return isSetSuccess(); - case IO: - return isSetIo(); + case SUCCESS: + return isSetSuccess(); + case IO: + return isSetIo(); } throw new IllegalStateException(); } @@ -5053,7 +5240,7 @@ public class THBaseService { if (that == null) return false; if (that instanceof existsAll_result) - return this.equals((existsAll_result) that); + return this.equals((existsAll_result)that); return false; } @@ -5084,33 +5271,45 @@ public class THBaseService { @Override public int hashCode() { - return 0; + List list = new ArrayList(); + + boolean present_success = true && (isSetSuccess()); + list.add(present_success); + if (present_success) + list.add(success); + + boolean present_io = true && (isSetIo()); + list.add(present_io); + if (present_io) + list.add(io); + + return list.hashCode(); } + @Override public int compareTo(existsAll_result other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; - existsAll_result typedOther = (existsAll_result) other; - lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess()); + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); if (lastComparison != 0) { return lastComparison; } if (isSetSuccess()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, typedOther.success); + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); if (lastComparison != 0) { return lastComparison; } } - lastComparison = Boolean.valueOf(isSetIo()).compareTo(typedOther.isSetIo()); + lastComparison = Boolean.valueOf(isSetIo()).compareTo(other.isSetIo()); if (lastComparison != 0) { return lastComparison; } if (isSetIo()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.io, typedOther.io); + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.io, other.io); if (lastComparison != 0) { return lastComparison; } @@ -5128,7 +5327,7 @@ public class THBaseService { public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { schemes.get(oprot.getScheme()).getScheme().write(oprot, this); - } + } @Override public String toString() { @@ -5186,26 +5385,28 @@ public class THBaseService { public void read(org.apache.thrift.protocol.TProtocol iprot, existsAll_result struct) throws org.apache.thrift.TException { org.apache.thrift.protocol.TField schemeField; iprot.readStructBegin(); - while (true) { + while (true) + { schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { break; } switch (schemeField.id) { case 0: // SUCCESS if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list140 = iprot.readListBegin(); - struct.success = new ArrayList(_list140.size); - for (int _i141 = 0; _i141 < _list140.size; ++_i141) { - boolean _elem142; // required - _elem142 = iprot.readBool(); - struct.success.add(_elem142); + org.apache.thrift.protocol.TList _list150 = iprot.readListBegin(); + struct.success = new ArrayList(_list150.size); + boolean _elem151; + for (int _i152 = 0; _i152 < _list150.size; ++_i152) + { + _elem151 = iprot.readBool(); + struct.success.add(_elem151); } iprot.readListEnd(); } struct.setSuccessIsSet(true); - } else { + } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; @@ -5214,7 +5415,7 @@ public class THBaseService { struct.io = new TIOError(); struct.io.read(iprot); struct.setIoIsSet(true); - } else { + } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; @@ -5237,8 +5438,9 @@ public class THBaseService { oprot.writeFieldBegin(SUCCESS_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.BOOL, struct.success.size())); - for (boolean _iter143 : struct.success) { - oprot.writeBool(_iter143); + for (boolean _iter153 : struct.success) + { + oprot.writeBool(_iter153); } oprot.writeListEnd(); } @@ -5277,8 +5479,9 @@ public class THBaseService { if (struct.isSetSuccess()) { { oprot.writeI32(struct.success.size()); - for (boolean _iter144 : struct.success) { - oprot.writeBool(_iter144); + for (boolean _iter154 : struct.success) + { + oprot.writeBool(_iter154); } } } @@ -5293,12 +5496,13 @@ public class THBaseService { BitSet incoming = iprot.readBitSet(2); if (incoming.get(0)) { { - org.apache.thrift.protocol.TList _list145 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.BOOL, iprot.readI32()); - struct.success = new ArrayList(_list145.size); - for (int _i146 = 0; _i146 < _list145.size; ++_i146) { - boolean _elem147; // required - _elem147 = iprot.readBool(); - struct.success.add(_elem147); + org.apache.thrift.protocol.TList _list155 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.BOOL, iprot.readI32()); + struct.success = new ArrayList(_list155.size); + boolean _elem156; + for (int _i157 = 0; _i157 < _list155.size; ++_i157) + { + _elem156 = iprot.readBool(); + struct.success.add(_elem156); } } struct.setSuccessIsSet(true); @@ -6734,14 +6938,14 @@ public class THBaseService { case 2: // TGETS if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list132 = iprot.readListBegin(); - struct.tgets = new ArrayList(_list132.size); - TGet _elem133; - for (int _i134 = 0; _i134 < _list132.size; ++_i134) + org.apache.thrift.protocol.TList _list158 = iprot.readListBegin(); + struct.tgets = new ArrayList(_list158.size); + TGet _elem159; + for (int _i160 = 0; _i160 < _list158.size; ++_i160) { - _elem133 = new TGet(); - _elem133.read(iprot); - struct.tgets.add(_elem133); + _elem159 = new TGet(); + _elem159.read(iprot); + struct.tgets.add(_elem159); } iprot.readListEnd(); } @@ -6774,9 +6978,9 @@ public class THBaseService { oprot.writeFieldBegin(TGETS_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.tgets.size())); - for (TGet _iter135 : struct.tgets) + for (TGet _iter161 : struct.tgets) { - _iter135.write(oprot); + _iter161.write(oprot); } oprot.writeListEnd(); } @@ -6802,9 +7006,9 @@ public class THBaseService { oprot.writeBinary(struct.table); { oprot.writeI32(struct.tgets.size()); - for (TGet _iter136 : struct.tgets) + for (TGet _iter162 : struct.tgets) { - _iter136.write(oprot); + _iter162.write(oprot); } } } @@ -6815,14 +7019,14 @@ public class THBaseService { struct.table = iprot.readBinary(); struct.setTableIsSet(true); { - org.apache.thrift.protocol.TList _list137 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); - struct.tgets = new ArrayList(_list137.size); - TGet _elem138; - for (int _i139 = 0; _i139 < _list137.size; ++_i139) + org.apache.thrift.protocol.TList _list163 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.tgets = new ArrayList(_list163.size); + TGet _elem164; + for (int _i165 = 0; _i165 < _list163.size; ++_i165) { - _elem138 = new TGet(); - _elem138.read(iprot); - struct.tgets.add(_elem138); + _elem164 = new TGet(); + _elem164.read(iprot); + struct.tgets.add(_elem164); } } struct.setTgetsIsSet(true); @@ -7229,14 +7433,14 @@ public class THBaseService { case 0: // SUCCESS if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list140 = iprot.readListBegin(); - struct.success = new ArrayList(_list140.size); - TResult _elem141; - for (int _i142 = 0; _i142 < _list140.size; ++_i142) + org.apache.thrift.protocol.TList _list166 = iprot.readListBegin(); + struct.success = new ArrayList(_list166.size); + TResult _elem167; + for (int _i168 = 0; _i168 < _list166.size; ++_i168) { - _elem141 = new TResult(); - _elem141.read(iprot); - struct.success.add(_elem141); + _elem167 = new TResult(); + _elem167.read(iprot); + struct.success.add(_elem167); } iprot.readListEnd(); } @@ -7273,9 +7477,9 @@ public class THBaseService { oprot.writeFieldBegin(SUCCESS_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.success.size())); - for (TResult _iter143 : struct.success) + for (TResult _iter169 : struct.success) { - _iter143.write(oprot); + _iter169.write(oprot); } oprot.writeListEnd(); } @@ -7314,9 +7518,9 @@ public class THBaseService { if (struct.isSetSuccess()) { { oprot.writeI32(struct.success.size()); - for (TResult _iter144 : struct.success) + for (TResult _iter170 : struct.success) { - _iter144.write(oprot); + _iter170.write(oprot); } } } @@ -7331,14 +7535,14 @@ public class THBaseService { BitSet incoming = iprot.readBitSet(2); if (incoming.get(0)) { { - org.apache.thrift.protocol.TList _list145 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); - struct.success = new ArrayList(_list145.size); - TResult _elem146; - for (int _i147 = 0; _i147 < _list145.size; ++_i147) + org.apache.thrift.protocol.TList _list171 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.success = new ArrayList(_list171.size); + TResult _elem172; + for (int _i173 = 0; _i173 < _list171.size; ++_i173) { - _elem146 = new TResult(); - _elem146.read(iprot); - struct.success.add(_elem146); + _elem172 = new TResult(); + _elem172.read(iprot); + struct.success.add(_elem172); } } struct.setSuccessIsSet(true); @@ -10125,14 +10329,14 @@ public class THBaseService { case 2: // TPUTS if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list148 = iprot.readListBegin(); - struct.tputs = new ArrayList(_list148.size); - TPut _elem149; - for (int _i150 = 0; _i150 < _list148.size; ++_i150) + org.apache.thrift.protocol.TList _list174 = iprot.readListBegin(); + struct.tputs = new ArrayList(_list174.size); + TPut _elem175; + for (int _i176 = 0; _i176 < _list174.size; ++_i176) { - _elem149 = new TPut(); - _elem149.read(iprot); - struct.tputs.add(_elem149); + _elem175 = new TPut(); + _elem175.read(iprot); + struct.tputs.add(_elem175); } iprot.readListEnd(); } @@ -10165,9 +10369,9 @@ public class THBaseService { oprot.writeFieldBegin(TPUTS_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.tputs.size())); - for (TPut _iter151 : struct.tputs) + for (TPut _iter177 : struct.tputs) { - _iter151.write(oprot); + _iter177.write(oprot); } oprot.writeListEnd(); } @@ -10193,9 +10397,9 @@ public class THBaseService { oprot.writeBinary(struct.table); { oprot.writeI32(struct.tputs.size()); - for (TPut _iter152 : struct.tputs) + for (TPut _iter178 : struct.tputs) { - _iter152.write(oprot); + _iter178.write(oprot); } } } @@ -10206,14 +10410,14 @@ public class THBaseService { struct.table = iprot.readBinary(); struct.setTableIsSet(true); { - org.apache.thrift.protocol.TList _list153 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); - struct.tputs = new ArrayList(_list153.size); - TPut _elem154; - for (int _i155 = 0; _i155 < _list153.size; ++_i155) + org.apache.thrift.protocol.TList _list179 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.tputs = new ArrayList(_list179.size); + TPut _elem180; + for (int _i181 = 0; _i181 < _list179.size; ++_i181) { - _elem154 = new TPut(); - _elem154.read(iprot); - struct.tputs.add(_elem154); + _elem180 = new TPut(); + _elem180.read(iprot); + struct.tputs.add(_elem180); } } struct.setTputsIsSet(true); @@ -11888,14 +12092,14 @@ public class THBaseService { case 2: // TDELETES if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list156 = iprot.readListBegin(); - struct.tdeletes = new ArrayList(_list156.size); - TDelete _elem157; - for (int _i158 = 0; _i158 < _list156.size; ++_i158) + org.apache.thrift.protocol.TList _list182 = iprot.readListBegin(); + struct.tdeletes = new ArrayList(_list182.size); + TDelete _elem183; + for (int _i184 = 0; _i184 < _list182.size; ++_i184) { - _elem157 = new TDelete(); - _elem157.read(iprot); - struct.tdeletes.add(_elem157); + _elem183 = new TDelete(); + _elem183.read(iprot); + struct.tdeletes.add(_elem183); } iprot.readListEnd(); } @@ -11928,9 +12132,9 @@ public class THBaseService { oprot.writeFieldBegin(TDELETES_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.tdeletes.size())); - for (TDelete _iter159 : struct.tdeletes) + for (TDelete _iter185 : struct.tdeletes) { - _iter159.write(oprot); + _iter185.write(oprot); } oprot.writeListEnd(); } @@ -11956,9 +12160,9 @@ public class THBaseService { oprot.writeBinary(struct.table); { oprot.writeI32(struct.tdeletes.size()); - for (TDelete _iter160 : struct.tdeletes) + for (TDelete _iter186 : struct.tdeletes) { - _iter160.write(oprot); + _iter186.write(oprot); } } } @@ -11969,14 +12173,14 @@ public class THBaseService { struct.table = iprot.readBinary(); struct.setTableIsSet(true); { - org.apache.thrift.protocol.TList _list161 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); - struct.tdeletes = new ArrayList(_list161.size); - TDelete _elem162; - for (int _i163 = 0; _i163 < _list161.size; ++_i163) + org.apache.thrift.protocol.TList _list187 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.tdeletes = new ArrayList(_list187.size); + TDelete _elem188; + for (int _i189 = 0; _i189 < _list187.size; ++_i189) { - _elem162 = new TDelete(); - _elem162.read(iprot); - struct.tdeletes.add(_elem162); + _elem188 = new TDelete(); + _elem188.read(iprot); + struct.tdeletes.add(_elem188); } } struct.setTdeletesIsSet(true); @@ -12383,14 +12587,14 @@ public class THBaseService { case 0: // SUCCESS if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list164 = iprot.readListBegin(); - struct.success = new ArrayList(_list164.size); - TDelete _elem165; - for (int _i166 = 0; _i166 < _list164.size; ++_i166) + org.apache.thrift.protocol.TList _list190 = iprot.readListBegin(); + struct.success = new ArrayList(_list190.size); + TDelete _elem191; + for (int _i192 = 0; _i192 < _list190.size; ++_i192) { - _elem165 = new TDelete(); - _elem165.read(iprot); - struct.success.add(_elem165); + _elem191 = new TDelete(); + _elem191.read(iprot); + struct.success.add(_elem191); } iprot.readListEnd(); } @@ -12427,9 +12631,9 @@ public class THBaseService { oprot.writeFieldBegin(SUCCESS_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.success.size())); - for (TDelete _iter167 : struct.success) + for (TDelete _iter193 : struct.success) { - _iter167.write(oprot); + _iter193.write(oprot); } oprot.writeListEnd(); } @@ -12468,9 +12672,9 @@ public class THBaseService { if (struct.isSetSuccess()) { { oprot.writeI32(struct.success.size()); - for (TDelete _iter168 : struct.success) + for (TDelete _iter194 : struct.success) { - _iter168.write(oprot); + _iter194.write(oprot); } } } @@ -12485,14 +12689,14 @@ public class THBaseService { BitSet incoming = iprot.readBitSet(2); if (incoming.get(0)) { { - org.apache.thrift.protocol.TList _list169 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); - struct.success = new ArrayList(_list169.size); - TDelete _elem170; - for (int _i171 = 0; _i171 < _list169.size; ++_i171) + org.apache.thrift.protocol.TList _list195 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.success = new ArrayList(_list195.size); + TDelete _elem196; + for (int _i197 = 0; _i197 < _list195.size; ++_i197) { - _elem170 = new TDelete(); - _elem170.read(iprot); - struct.success.add(_elem170); + _elem196 = new TDelete(); + _elem196.read(iprot); + struct.success.add(_elem196); } } struct.setSuccessIsSet(true); @@ -17845,14 +18049,14 @@ public class THBaseService { case 0: // SUCCESS if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list172 = iprot.readListBegin(); - struct.success = new ArrayList(_list172.size); - TResult _elem173; - for (int _i174 = 0; _i174 < _list172.size; ++_i174) + org.apache.thrift.protocol.TList _list198 = iprot.readListBegin(); + struct.success = new ArrayList(_list198.size); + TResult _elem199; + for (int _i200 = 0; _i200 < _list198.size; ++_i200) { - _elem173 = new TResult(); - _elem173.read(iprot); - struct.success.add(_elem173); + _elem199 = new TResult(); + _elem199.read(iprot); + struct.success.add(_elem199); } iprot.readListEnd(); } @@ -17898,9 +18102,9 @@ public class THBaseService { oprot.writeFieldBegin(SUCCESS_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.success.size())); - for (TResult _iter175 : struct.success) + for (TResult _iter201 : struct.success) { - _iter175.write(oprot); + _iter201.write(oprot); } oprot.writeListEnd(); } @@ -17947,9 +18151,9 @@ public class THBaseService { if (struct.isSetSuccess()) { { oprot.writeI32(struct.success.size()); - for (TResult _iter176 : struct.success) + for (TResult _iter202 : struct.success) { - _iter176.write(oprot); + _iter202.write(oprot); } } } @@ -17967,14 +18171,14 @@ public class THBaseService { BitSet incoming = iprot.readBitSet(3); if (incoming.get(0)) { { - org.apache.thrift.protocol.TList _list177 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); - struct.success = new ArrayList(_list177.size); - TResult _elem178; - for (int _i179 = 0; _i179 < _list177.size; ++_i179) + org.apache.thrift.protocol.TList _list203 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.success = new ArrayList(_list203.size); + TResult _elem204; + for (int _i205 = 0; _i205 < _list203.size; ++_i205) { - _elem178 = new TResult(); - _elem178.read(iprot); - struct.success.add(_elem178); + _elem204 = new TResult(); + _elem204.read(iprot); + struct.success.add(_elem204); } } struct.setSuccessIsSet(true); @@ -20710,14 +20914,14 @@ public class THBaseService { case 0: // SUCCESS if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list180 = iprot.readListBegin(); - struct.success = new ArrayList(_list180.size); - TResult _elem181; - for (int _i182 = 0; _i182 < _list180.size; ++_i182) + org.apache.thrift.protocol.TList _list206 = iprot.readListBegin(); + struct.success = new ArrayList(_list206.size); + TResult _elem207; + for (int _i208 = 0; _i208 < _list206.size; ++_i208) { - _elem181 = new TResult(); - _elem181.read(iprot); - struct.success.add(_elem181); + _elem207 = new TResult(); + _elem207.read(iprot); + struct.success.add(_elem207); } iprot.readListEnd(); } @@ -20754,9 +20958,9 @@ public class THBaseService { oprot.writeFieldBegin(SUCCESS_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.success.size())); - for (TResult _iter183 : struct.success) + for (TResult _iter209 : struct.success) { - _iter183.write(oprot); + _iter209.write(oprot); } oprot.writeListEnd(); } @@ -20795,9 +20999,9 @@ public class THBaseService { if (struct.isSetSuccess()) { { oprot.writeI32(struct.success.size()); - for (TResult _iter184 : struct.success) + for (TResult _iter210 : struct.success) { - _iter184.write(oprot); + _iter210.write(oprot); } } } @@ -20812,14 +21016,14 @@ public class THBaseService { BitSet incoming = iprot.readBitSet(2); if (incoming.get(0)) { { - org.apache.thrift.protocol.TList _list185 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); - struct.success = new ArrayList(_list185.size); - TResult _elem186; - for (int _i187 = 0; _i187 < _list185.size; ++_i187) + org.apache.thrift.protocol.TList _list211 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.success = new ArrayList(_list211.size); + TResult _elem212; + for (int _i213 = 0; _i213 < _list211.size; ++_i213) { - _elem186 = new TResult(); - _elem186.read(iprot); - struct.success.add(_elem186); + _elem212 = new TResult(); + _elem212.read(iprot); + struct.success.add(_elem212); } } struct.setSuccessIsSet(true); @@ -22650,14 +22854,14 @@ public class THBaseService { case 0: // SUCCESS if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list188 = iprot.readListBegin(); - struct.success = new ArrayList(_list188.size); - THRegionLocation _elem189; - for (int _i190 = 0; _i190 < _list188.size; ++_i190) + org.apache.thrift.protocol.TList _list214 = iprot.readListBegin(); + struct.success = new ArrayList(_list214.size); + THRegionLocation _elem215; + for (int _i216 = 0; _i216 < _list214.size; ++_i216) { - _elem189 = new THRegionLocation(); - _elem189.read(iprot); - struct.success.add(_elem189); + _elem215 = new THRegionLocation(); + _elem215.read(iprot); + struct.success.add(_elem215); } iprot.readListEnd(); } @@ -22694,9 +22898,9 @@ public class THBaseService { oprot.writeFieldBegin(SUCCESS_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.success.size())); - for (THRegionLocation _iter191 : struct.success) + for (THRegionLocation _iter217 : struct.success) { - _iter191.write(oprot); + _iter217.write(oprot); } oprot.writeListEnd(); } @@ -22735,9 +22939,9 @@ public class THBaseService { if (struct.isSetSuccess()) { { oprot.writeI32(struct.success.size()); - for (THRegionLocation _iter192 : struct.success) + for (THRegionLocation _iter218 : struct.success) { - _iter192.write(oprot); + _iter218.write(oprot); } } } @@ -22752,14 +22956,14 @@ public class THBaseService { BitSet incoming = iprot.readBitSet(2); if (incoming.get(0)) { { - org.apache.thrift.protocol.TList _list193 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); - struct.success = new ArrayList(_list193.size); - THRegionLocation _elem194; - for (int _i195 = 0; _i195 < _list193.size; ++_i195) + org.apache.thrift.protocol.TList _list219 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.success = new ArrayList(_list219.size); + THRegionLocation _elem220; + for (int _i221 = 0; _i221 < _list219.size; ++_i221) { - _elem194 = new THRegionLocation(); - _elem194.read(iprot); - struct.success.add(_elem194); + _elem220 = new THRegionLocation(); + _elem220.read(iprot); + struct.success.add(_elem220); } } struct.setSuccessIsSet(true); @@ -24360,4 +24564,629 @@ public class THBaseService { } + public static class getThriftServerType_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getThriftServerType_args"); + + + private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new getThriftServerType_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new getThriftServerType_argsTupleSchemeFactory()); + } + + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { +; + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** + * Find the _Fields constant that matches fieldId, or null if its not found. + */ + public static _Fields findByThriftId(int fieldId) { + switch(fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception + * if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** + * Find the _Fields constant that matches name, or null if its not found. + */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getThriftServerType_args.class, metaDataMap); + } + + public getThriftServerType_args() { + } + + /** + * Performs a deep copy on other. + */ + public getThriftServerType_args(getThriftServerType_args other) { + } + + public getThriftServerType_args deepCopy() { + return new getThriftServerType_args(this); + } + + @Override + public void clear() { + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + } + throw new IllegalStateException(); + } + + /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof getThriftServerType_args) + return this.equals((getThriftServerType_args)that); + return false; + } + + public boolean equals(getThriftServerType_args that) { + if (that == null) + return false; + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + return list.hashCode(); + } + + @Override + public int compareTo(getThriftServerType_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("getThriftServerType_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { + try { + read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class getThriftServerType_argsStandardSchemeFactory implements SchemeFactory { + public getThriftServerType_argsStandardScheme getScheme() { + return new getThriftServerType_argsStandardScheme(); + } + } + + private static class getThriftServerType_argsStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, getThriftServerType_args struct) throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) + { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, getThriftServerType_args struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class getThriftServerType_argsTupleSchemeFactory implements SchemeFactory { + public getThriftServerType_argsTupleScheme getScheme() { + return new getThriftServerType_argsTupleScheme(); + } + } + + private static class getThriftServerType_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, getThriftServerType_args struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, getThriftServerType_args struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + } + } + + } + + public static class getThriftServerType_result implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getThriftServerType_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.I32, (short)0); + + private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new getThriftServerType_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new getThriftServerType_resultTupleSchemeFactory()); + } + + /** + * + * @see TThriftServerType + */ + public TThriftServerType success; // required + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + /** + * + * @see TThriftServerType + */ + SUCCESS((short)0, "success"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** + * Find the _Fields constant that matches fieldId, or null if its not found. + */ + public static _Fields findByThriftId(int fieldId) { + switch(fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception + * if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** + * Find the _Fields constant that matches name, or null if its not found. + */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, TThriftServerType.class))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getThriftServerType_result.class, metaDataMap); + } + + public getThriftServerType_result() { + } + + public getThriftServerType_result( + TThriftServerType success) + { + this(); + this.success = success; + } + + /** + * Performs a deep copy on other. + */ + public getThriftServerType_result(getThriftServerType_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public getThriftServerType_result deepCopy() { + return new getThriftServerType_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + /** + * + * @see TThriftServerType + */ + public TThriftServerType getSuccess() { + return this.success; + } + + /** + * + * @see TThriftServerType + */ + public getThriftServerType_result setSuccess(TThriftServerType success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((TThriftServerType)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + + } + throw new IllegalStateException(); + } + + /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof getThriftServerType_result) + return this.equals((getThriftServerType_result)that); + return false; + } + + public boolean equals(getThriftServerType_result that) { + if (that == null) + return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) + return false; + if (!this.success.equals(that.success)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + boolean present_success = true && (isSetSuccess()); + list.add(present_success); + if (present_success) + list.add(success.getValue()); + + return list.hashCode(); + } + + @Override + public int compareTo(getThriftServerType_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("getThriftServerType_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { + try { + read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class getThriftServerType_resultStandardSchemeFactory implements SchemeFactory { + public getThriftServerType_resultStandardScheme getScheme() { + return new getThriftServerType_resultStandardScheme(); + } + } + + private static class getThriftServerType_resultStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, getThriftServerType_result struct) throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) + { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.success = org.apache.hadoop.hbase.thrift2.generated.TThriftServerType.findByValue(iprot.readI32()); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, getThriftServerType_result struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeI32(struct.success.getValue()); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class getThriftServerType_resultTupleSchemeFactory implements SchemeFactory { + public getThriftServerType_resultTupleScheme getScheme() { + return new getThriftServerType_resultTupleScheme(); + } + } + + private static class getThriftServerType_resultTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, getThriftServerType_result struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeI32(struct.success.getValue()); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, getThriftServerType_result struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = org.apache.hadoop.hbase.thrift2.generated.TThriftServerType.findByValue(iprot.readI32()); + struct.setSuccessIsSet(true); + } + } + } + + } + } diff --git a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/generated/TThriftServerType.java b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/generated/TThriftServerType.java new file mode 100644 index 0000000000..6073204546 --- /dev/null +++ b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/generated/TThriftServerType.java @@ -0,0 +1,48 @@ +/** + * Autogenerated by Thrift Compiler (0.9.3) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +package org.apache.hadoop.hbase.thrift2.generated; + + +import java.util.Map; +import java.util.HashMap; +import org.apache.thrift.TEnum; + +/** + * Specify type of thrift server: thrift and thrift2 + */ +public enum TThriftServerType implements org.apache.thrift.TEnum { + ONE(1), + TWO(2); + + private final int value; + + private TThriftServerType(int value) { + this.value = value; + } + + /** + * Get the integer value of this enum value, as defined in the Thrift IDL. + */ + public int getValue() { + return value; + } + + /** + * Find a the enum type by its integer value, as defined in the Thrift IDL. + * @return null if the value is not found. + */ + public static TThriftServerType findByValue(int value) { + switch (value) { + case 1: + return ONE; + case 2: + return TWO; + default: + return null; + } + } +} diff --git a/hbase-thrift/src/main/resources/hbase-webapps/thrift/thrift.jsp b/hbase-thrift/src/main/resources/hbase-webapps/thrift/thrift.jsp index 579d0f7d38..0b44722971 100644 --- a/hbase-thrift/src/main/resources/hbase-webapps/thrift/thrift.jsp +++ b/hbase-thrift/src/main/resources/hbase-webapps/thrift/thrift.jsp @@ -26,6 +26,7 @@ <% Configuration conf = (Configuration)getServletContext().getAttribute("hbase.conf"); +String serverType = (String)getServletContext().getAttribute("hbase.thrift.type"); long startcode = conf.getLong("startcode", System.currentTimeMillis()); String listenPort = conf.get("hbase.regionserver.thrift.port", "9090"); String serverInfo = listenPort + "," + String.valueOf(startcode); @@ -119,6 +120,11 @@ String framed = conf.get("hbase.regionserver.thrift.framed", "false"); <%= framed %> Thrift RPC engine uses framed transport + + Thrift Server Type + <%= serverType %> + The type of this Thrift server + diff --git a/hbase-thrift/src/main/resources/org/apache/hadoop/hbase/thrift/Hbase.thrift b/hbase-thrift/src/main/resources/org/apache/hadoop/hbase/thrift/Hbase.thrift index 13faa8e7c4..91ed9dae0e 100644 --- a/hbase-thrift/src/main/resources/org/apache/hadoop/hbase/thrift/Hbase.thrift +++ b/hbase-thrift/src/main/resources/org/apache/hadoop/hbase/thrift/Hbase.thrift @@ -192,6 +192,14 @@ exception AlreadyExists { 1:string message } +/** + * Specify type of thrift server: thrift and thrift2 + */ +enum TThriftServerType { + ONE = 1, + TWO = 2 +} + // // Service // @@ -957,4 +965,11 @@ service Hbase { /** Mutation attributes */ 7:map attributes ) throws (1:IOError io, 2:IllegalArgument ia) + + /** + * Get the type of this thrift server. + * + * @return the type of this thrift server + */ + TThriftServerType getThriftServerType() } diff --git a/hbase-thrift/src/main/resources/org/apache/hadoop/hbase/thrift2/hbase.thrift b/hbase-thrift/src/main/resources/org/apache/hadoop/hbase/thrift2/hbase.thrift index 8c5ef59917..14afcb1f60 100644 --- a/hbase-thrift/src/main/resources/org/apache/hadoop/hbase/thrift2/hbase.thrift +++ b/hbase-thrift/src/main/resources/org/apache/hadoop/hbase/thrift2/hbase.thrift @@ -311,6 +311,14 @@ exception TIllegalArgument { 1: optional string message } +/** + * Specify type of thrift server: thrift and thrift2 + */ +enum TThriftServerType { + ONE = 1, + TWO = 2 +} + service THBaseService { /** @@ -628,4 +636,11 @@ service THBaseService { /** row mutations to execute if the value matches */ 7: required TRowMutations rowMutations ) throws (1: TIOError io) + + /** + * Get the type of this thrift server. + * + * @return the type of this thrift server + */ + TThriftServerType getThriftServerType() } diff --git a/hbase-thrift/src/test/java/org/apache/hadoop/hbase/thrift/TestThriftServer.java b/hbase-thrift/src/test/java/org/apache/hadoop/hbase/thrift/TestThriftServer.java index 05dc2aeaeb..9d126ee30b 100644 --- a/hbase-thrift/src/test/java/org/apache/hadoop/hbase/thrift/TestThriftServer.java +++ b/hbase-thrift/src/test/java/org/apache/hadoop/hbase/thrift/TestThriftServer.java @@ -58,6 +58,7 @@ import org.apache.hadoop.hbase.thrift.generated.TIncrement; import org.apache.hadoop.hbase.thrift.generated.TRegionInfo; import org.apache.hadoop.hbase.thrift.generated.TRowResult; import org.apache.hadoop.hbase.thrift.generated.TScan; +import org.apache.hadoop.hbase.thrift.generated.TThriftServerType; import org.apache.hadoop.hbase.util.Bytes; import org.apache.hadoop.hbase.util.Threads; import org.junit.AfterClass; @@ -870,4 +871,12 @@ public class TestThriftServer { handler.scannerGet(scannerId); handler.scannerClose(scannerId); } + + @Test + public void testGetThriftServerType() throws Exception { + ThriftServerRunner.HBaseHandler handler = + new ThriftServerRunner.HBaseHandler(UTIL.getConfiguration(), + UserProvider.instantiate(UTIL.getConfiguration())); + assertEquals(TThriftServerType.ONE, handler.getThriftServerType()); + } } diff --git a/hbase-thrift/src/test/java/org/apache/hadoop/hbase/thrift2/TestThriftHBaseServiceHandler.java b/hbase-thrift/src/test/java/org/apache/hadoop/hbase/thrift2/TestThriftHBaseServiceHandler.java index 3653ce5ffe..94c4996e08 100644 --- a/hbase-thrift/src/test/java/org/apache/hadoop/hbase/thrift2/TestThriftHBaseServiceHandler.java +++ b/hbase-thrift/src/test/java/org/apache/hadoop/hbase/thrift2/TestThriftHBaseServiceHandler.java @@ -89,6 +89,7 @@ import org.apache.hadoop.hbase.thrift2.generated.TReadType; import org.apache.hadoop.hbase.thrift2.generated.TResult; import org.apache.hadoop.hbase.thrift2.generated.TRowMutations; import org.apache.hadoop.hbase.thrift2.generated.TScan; +import org.apache.hadoop.hbase.thrift2.generated.TThriftServerType; import org.apache.hadoop.hbase.thrift2.generated.TTimeRange; import org.apache.hadoop.hbase.util.Bytes; import org.apache.thrift.TException; @@ -1559,6 +1560,12 @@ public class TestThriftHBaseServiceHandler { assertTColumnValueEqual(columnValueB, result.getColumnValues().get(1)); } + @Test + public void testGetThriftServerType() throws Exception { + ThriftHBaseServiceHandler handler = createHandler(); + assertEquals(TThriftServerType.TWO, handler.getThriftServerType()); + } + public static class DelayingRegionObserver implements RegionCoprocessor, RegionObserver { private static final Logger LOG = LoggerFactory.getLogger(DelayingRegionObserver.class); // sleep time in msec diff --git a/src/main/asciidoc/_chapters/thrift_filter_language.adoc b/src/main/asciidoc/_chapters/thrift_filter_language.adoc index 1c1279de88..890c7d3644 100644 --- a/src/main/asciidoc/_chapters/thrift_filter_language.adoc +++ b/src/main/asciidoc/_chapters/thrift_filter_language.adoc @@ -34,6 +34,10 @@ The Thrift API relies on client and server processes. You can configure Thrift for secure authentication at the server and client side, by following the procedures in <> and <>. +Go to http://localhost:9095/thrift.jsp to view the Thrift Server Web UI. +The homepage of this Thrift Server shows some important information, +such as Thrift Server Type/Thrift Impl Type/Thrift Server Start Time etc. + The rest of this chapter discusses the filter language provided by the Thrift API. [[thrift.filter_language]] -- 2.13.0