FLUME-3127. Upgrade libfb303 library dependency - thrift version changed to 0.9.3 - thrift objects generated with the new version - deprecated method calls updated in ScribeSource - cross-compatibility tested with Flume 1.6 and 1.7
This closes #163 Reviewers: Denes Arvay (Ferenc Szabo via Denes Arvay) Project: http://git-wip-us.apache.org/repos/asf/flume/repo Commit: http://git-wip-us.apache.org/repos/asf/flume/commit/773555c5 Tree: http://git-wip-us.apache.org/repos/asf/flume/tree/773555c5 Diff: http://git-wip-us.apache.org/repos/asf/flume/diff/773555c5 Branch: refs/heads/trunk Commit: 773555c5c7d09650f8f4173ced232954b1a3a361 Parents: d355262 Author: Ferenc Szabo <[email protected]> Authored: Fri Sep 1 16:16:08 2017 +0200 Committer: Denes Arvay <[email protected]> Committed: Mon Sep 11 14:33:31 2017 +0200 ---------------------------------------------------------------------- .../flume/handlers/thrift/EventStatus.java | 3 +- .../flume/handlers/thrift/Priority.java | 3 +- .../flume/handlers/thrift/ThriftFlumeEvent.java | 476 +++++++---- .../handlers/thrift/ThriftFlumeEventServer.java | 500 +++++++++--- .../java/org/apache/flume/thrift/Status.java | 3 +- .../apache/flume/thrift/ThriftFlumeEvent.java | 269 ++++--- .../flume/thrift/ThriftSourceProtocol.java | 806 ++++++++++++++----- .../apache/flume/source/scribe/LogEntry.java | 206 +++-- .../apache/flume/source/scribe/ResultCode.java | 3 +- .../org/apache/flume/source/scribe/Scribe.java | 444 +++++++--- .../flume/source/scribe/ScribeSource.java | 3 +- pom.xml | 4 +- 12 files changed, 1928 insertions(+), 792 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flume/blob/773555c5/flume-ng-legacy-sources/flume-thrift-source/src/main/java/com/cloudera/flume/handlers/thrift/EventStatus.java ---------------------------------------------------------------------- diff --git a/flume-ng-legacy-sources/flume-thrift-source/src/main/java/com/cloudera/flume/handlers/thrift/EventStatus.java b/flume-ng-legacy-sources/flume-thrift-source/src/main/java/com/cloudera/flume/handlers/thrift/EventStatus.java index 7af9e77..fa05210 100644 --- a/flume-ng-legacy-sources/flume-thrift-source/src/main/java/com/cloudera/flume/handlers/thrift/EventStatus.java +++ b/flume-ng-legacy-sources/flume-thrift-source/src/main/java/com/cloudera/flume/handlers/thrift/EventStatus.java @@ -17,9 +17,10 @@ * under the License. */ /** - * Autogenerated by Thrift Compiler (0.7.0) + * Autogenerated by Thrift Compiler (0.9.3) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated */ package com.cloudera.flume.handlers.thrift; http://git-wip-us.apache.org/repos/asf/flume/blob/773555c5/flume-ng-legacy-sources/flume-thrift-source/src/main/java/com/cloudera/flume/handlers/thrift/Priority.java ---------------------------------------------------------------------- diff --git a/flume-ng-legacy-sources/flume-thrift-source/src/main/java/com/cloudera/flume/handlers/thrift/Priority.java b/flume-ng-legacy-sources/flume-thrift-source/src/main/java/com/cloudera/flume/handlers/thrift/Priority.java index 40826dc..46d4a5b 100644 --- a/flume-ng-legacy-sources/flume-thrift-source/src/main/java/com/cloudera/flume/handlers/thrift/Priority.java +++ b/flume-ng-legacy-sources/flume-thrift-source/src/main/java/com/cloudera/flume/handlers/thrift/Priority.java @@ -17,9 +17,10 @@ * under the License. */ /** - * Autogenerated by Thrift Compiler (0.7.0) + * Autogenerated by Thrift Compiler (0.9.3) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated */ package com.cloudera.flume.handlers.thrift; http://git-wip-us.apache.org/repos/asf/flume/blob/773555c5/flume-ng-legacy-sources/flume-thrift-source/src/main/java/com/cloudera/flume/handlers/thrift/ThriftFlumeEvent.java ---------------------------------------------------------------------- diff --git a/flume-ng-legacy-sources/flume-thrift-source/src/main/java/com/cloudera/flume/handlers/thrift/ThriftFlumeEvent.java b/flume-ng-legacy-sources/flume-thrift-source/src/main/java/com/cloudera/flume/handlers/thrift/ThriftFlumeEvent.java index f83cba4..1649abd 100644 --- a/flume-ng-legacy-sources/flume-thrift-source/src/main/java/com/cloudera/flume/handlers/thrift/ThriftFlumeEvent.java +++ b/flume-ng-legacy-sources/flume-thrift-source/src/main/java/com/cloudera/flume/handlers/thrift/ThriftFlumeEvent.java @@ -17,13 +17,24 @@ * under the License. */ /** - * Autogenerated by Thrift Compiler (0.7.0) + * Autogenerated by Thrift Compiler (0.9.3) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated */ package com.cloudera.flume.handlers.thrift; -import org.apache.commons.lang.builder.HashCodeBuilder; +import org.apache.thrift.scheme.IScheme; +import org.apache.thrift.scheme.SchemeFactory; +import org.apache.thrift.scheme.StandardScheme; + +import org.apache.thrift.scheme.TupleScheme; +import org.apache.thrift.protocol.TTupleProtocol; +import org.apache.thrift.protocol.TProtocolException; +import org.apache.thrift.EncodingUtils; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.server.AbstractNonblockingServer.*; import java.util.List; import java.util.ArrayList; import java.util.Map; @@ -36,10 +47,13 @@ import java.util.Collections; import java.util.BitSet; import java.nio.ByteBuffer; import java.util.Arrays; +import javax.annotation.Generated; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class ThriftFlumeEvent implements org.apache.thrift.TBase<ThriftFlumeEvent, ThriftFlumeEvent._Fields>, java.io.Serializable, Cloneable { +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) +@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2017-09-01") +public class ThriftFlumeEvent implements org.apache.thrift.TBase<ThriftFlumeEvent, ThriftFlumeEvent._Fields>, java.io.Serializable, Cloneable, Comparable<ThriftFlumeEvent> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ThriftFlumeEvent"); private static final org.apache.thrift.protocol.TField TIMESTAMP_FIELD_DESC = new org.apache.thrift.protocol.TField("timestamp", org.apache.thrift.protocol.TType.I64, (short)1); @@ -49,6 +63,12 @@ public class ThriftFlumeEvent implements org.apache.thrift.TBase<ThriftFlumeEven private static final org.apache.thrift.protocol.TField HOST_FIELD_DESC = new org.apache.thrift.protocol.TField("host", org.apache.thrift.protocol.TType.STRING, (short)5); private static final org.apache.thrift.protocol.TField FIELDS_FIELD_DESC = new org.apache.thrift.protocol.TField("fields", org.apache.thrift.protocol.TType.MAP, (short)6); + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new ThriftFlumeEventStandardSchemeFactory()); + schemes.put(TupleScheme.class, new ThriftFlumeEventTupleSchemeFactory()); + } + public long timestamp; // required /** * @@ -140,8 +160,7 @@ public class ThriftFlumeEvent implements org.apache.thrift.TBase<ThriftFlumeEven // isset id assignments private static final int __TIMESTAMP_ISSET_ID = 0; private static final int __NANOS_ISSET_ID = 1; - private BitSet __isset_bit_vector = new BitSet(2); - + private byte __isset_bitfield = 0; 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); @@ -178,7 +197,7 @@ public class ThriftFlumeEvent implements org.apache.thrift.TBase<ThriftFlumeEven this.timestamp = timestamp; setTimestampIsSet(true); this.priority = priority; - this.body = body; + this.body = org.apache.thrift.TBaseHelper.copyBinary(body); this.nanos = nanos; setNanosIsSet(true); this.host = host; @@ -189,34 +208,20 @@ public class ThriftFlumeEvent implements org.apache.thrift.TBase<ThriftFlumeEven * Performs a deep copy on <i>other</i>. */ public ThriftFlumeEvent(ThriftFlumeEvent other) { - __isset_bit_vector.clear(); - __isset_bit_vector.or(other.__isset_bit_vector); + __isset_bitfield = other.__isset_bitfield; this.timestamp = other.timestamp; if (other.isSetPriority()) { this.priority = other.priority; } if (other.isSetBody()) { this.body = org.apache.thrift.TBaseHelper.copyBinary(other.body); -; } this.nanos = other.nanos; if (other.isSetHost()) { this.host = other.host; } if (other.isSetFields()) { - Map<String,ByteBuffer> __this__fields = new HashMap<String,ByteBuffer>(); - for (Map.Entry<String, ByteBuffer> other_element : other.fields.entrySet()) { - - String other_element_key = other_element.getKey(); - ByteBuffer other_element_value = other_element.getValue(); - - String __this__fields_copy_key = other_element_key; - - ByteBuffer __this__fields_copy_value = org.apache.thrift.TBaseHelper.copyBinary(other_element_value); -; - - __this__fields.put(__this__fields_copy_key, __this__fields_copy_value); - } + Map<String,ByteBuffer> __this__fields = new HashMap<String,ByteBuffer>(other.fields); this.fields = __this__fields; } } @@ -248,16 +253,16 @@ public class ThriftFlumeEvent implements org.apache.thrift.TBase<ThriftFlumeEven } public void unsetTimestamp() { - __isset_bit_vector.clear(__TIMESTAMP_ISSET_ID); + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __TIMESTAMP_ISSET_ID); } /** Returns true if field timestamp is set (has been assigned a value) and false otherwise */ public boolean isSetTimestamp() { - return __isset_bit_vector.get(__TIMESTAMP_ISSET_ID); + return EncodingUtils.testBit(__isset_bitfield, __TIMESTAMP_ISSET_ID); } public void setTimestampIsSet(boolean value) { - __isset_bit_vector.set(__TIMESTAMP_ISSET_ID, value); + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __TIMESTAMP_ISSET_ID, value); } /** @@ -298,16 +303,16 @@ public class ThriftFlumeEvent implements org.apache.thrift.TBase<ThriftFlumeEven } public ByteBuffer bufferForBody() { - return body; + return org.apache.thrift.TBaseHelper.copyBinary(body); } public ThriftFlumeEvent setBody(byte[] body) { - setBody(body == null ? (ByteBuffer)null : ByteBuffer.wrap(body)); + this.body = body == null ? (ByteBuffer)null : ByteBuffer.wrap(Arrays.copyOf(body, body.length)); return this; } public ThriftFlumeEvent setBody(ByteBuffer body) { - this.body = body; + this.body = org.apache.thrift.TBaseHelper.copyBinary(body); return this; } @@ -337,16 +342,16 @@ public class ThriftFlumeEvent implements org.apache.thrift.TBase<ThriftFlumeEven } public void unsetNanos() { - __isset_bit_vector.clear(__NANOS_ISSET_ID); + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __NANOS_ISSET_ID); } /** Returns true if field nanos is set (has been assigned a value) and false otherwise */ public boolean isSetNanos() { - return __isset_bit_vector.get(__NANOS_ISSET_ID); + return EncodingUtils.testBit(__isset_bitfield, __NANOS_ISSET_ID); } public void setNanosIsSet(boolean value) { - __isset_bit_vector.set(__NANOS_ISSET_ID, value); + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __NANOS_ISSET_ID, value); } public String getHost() { @@ -464,7 +469,7 @@ public class ThriftFlumeEvent implements org.apache.thrift.TBase<ThriftFlumeEven public Object getFieldValue(_Fields field) { switch (field) { case TIMESTAMP: - return Long.valueOf(getTimestamp()); + return getTimestamp(); case PRIORITY: return getPriority(); @@ -473,7 +478,7 @@ public class ThriftFlumeEvent implements org.apache.thrift.TBase<ThriftFlumeEven return getBody(); case NANOS: - return Long.valueOf(getNanos()); + return getNanos(); case HOST: return getHost(); @@ -580,105 +585,105 @@ public class ThriftFlumeEvent implements org.apache.thrift.TBase<ThriftFlumeEven @Override public int hashCode() { - HashCodeBuilder builder = new HashCodeBuilder(); + List<Object> list = new ArrayList<Object>(); boolean present_timestamp = true; - builder.append(present_timestamp); + list.add(present_timestamp); if (present_timestamp) - builder.append(timestamp); + list.add(timestamp); boolean present_priority = true && (isSetPriority()); - builder.append(present_priority); + list.add(present_priority); if (present_priority) - builder.append(priority.getValue()); + list.add(priority.getValue()); boolean present_body = true && (isSetBody()); - builder.append(present_body); + list.add(present_body); if (present_body) - builder.append(body); + list.add(body); boolean present_nanos = true; - builder.append(present_nanos); + list.add(present_nanos); if (present_nanos) - builder.append(nanos); + list.add(nanos); boolean present_host = true && (isSetHost()); - builder.append(present_host); + list.add(present_host); if (present_host) - builder.append(host); + list.add(host); boolean present_fields = true && (isSetFields()); - builder.append(present_fields); + list.add(present_fields); if (present_fields) - builder.append(fields); + list.add(fields); - return builder.toHashCode(); + return list.hashCode(); } + @Override public int compareTo(ThriftFlumeEvent other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; - ThriftFlumeEvent typedOther = (ThriftFlumeEvent)other; - lastComparison = Boolean.valueOf(isSetTimestamp()).compareTo(typedOther.isSetTimestamp()); + lastComparison = Boolean.valueOf(isSetTimestamp()).compareTo(other.isSetTimestamp()); if (lastComparison != 0) { return lastComparison; } if (isSetTimestamp()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.timestamp, typedOther.timestamp); + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.timestamp, other.timestamp); if (lastComparison != 0) { return lastComparison; } } - lastComparison = Boolean.valueOf(isSetPriority()).compareTo(typedOther.isSetPriority()); + lastComparison = Boolean.valueOf(isSetPriority()).compareTo(other.isSetPriority()); if (lastComparison != 0) { return lastComparison; } if (isSetPriority()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.priority, typedOther.priority); + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.priority, other.priority); if (lastComparison != 0) { return lastComparison; } } - lastComparison = Boolean.valueOf(isSetBody()).compareTo(typedOther.isSetBody()); + lastComparison = Boolean.valueOf(isSetBody()).compareTo(other.isSetBody()); if (lastComparison != 0) { return lastComparison; } if (isSetBody()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.body, typedOther.body); + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.body, other.body); if (lastComparison != 0) { return lastComparison; } } - lastComparison = Boolean.valueOf(isSetNanos()).compareTo(typedOther.isSetNanos()); + lastComparison = Boolean.valueOf(isSetNanos()).compareTo(other.isSetNanos()); if (lastComparison != 0) { return lastComparison; } if (isSetNanos()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.nanos, typedOther.nanos); + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.nanos, other.nanos); if (lastComparison != 0) { return lastComparison; } } - lastComparison = Boolean.valueOf(isSetHost()).compareTo(typedOther.isSetHost()); + lastComparison = Boolean.valueOf(isSetHost()).compareTo(other.isSetHost()); if (lastComparison != 0) { return lastComparison; } if (isSetHost()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.host, typedOther.host); + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.host, other.host); if (lastComparison != 0) { return lastComparison; } } - lastComparison = Boolean.valueOf(isSetFields()).compareTo(typedOther.isSetFields()); + lastComparison = Boolean.valueOf(isSetFields()).compareTo(other.isSetFields()); if (lastComparison != 0) { return lastComparison; } if (isSetFields()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.fields, typedOther.fields); + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.fields, other.fields); if (lastComparison != 0) { return lastComparison; } @@ -691,122 +696,11 @@ public class ThriftFlumeEvent implements org.apache.thrift.TBase<ThriftFlumeEven } public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField field; - iprot.readStructBegin(); - while (true) - { - field = iprot.readFieldBegin(); - if (field.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (field.id) { - case 1: // TIMESTAMP - if (field.type == org.apache.thrift.protocol.TType.I64) { - this.timestamp = iprot.readI64(); - setTimestampIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); - } - break; - case 2: // PRIORITY - if (field.type == org.apache.thrift.protocol.TType.I32) { - this.priority = Priority.findByValue(iprot.readI32()); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); - } - break; - case 3: // BODY - if (field.type == org.apache.thrift.protocol.TType.STRING) { - this.body = iprot.readBinary(); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); - } - break; - case 4: // NANOS - if (field.type == org.apache.thrift.protocol.TType.I64) { - this.nanos = iprot.readI64(); - setNanosIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); - } - break; - case 5: // HOST - if (field.type == org.apache.thrift.protocol.TType.STRING) { - this.host = iprot.readString(); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); - } - break; - case 6: // FIELDS - if (field.type == org.apache.thrift.protocol.TType.MAP) { - { - org.apache.thrift.protocol.TMap _map0 = iprot.readMapBegin(); - this.fields = new HashMap<String,ByteBuffer>(2*_map0.size); - for (int _i1 = 0; _i1 < _map0.size; ++_i1) - { - String _key2; // required - ByteBuffer _val3; // required - _key2 = iprot.readString(); - _val3 = iprot.readBinary(); - this.fields.put(_key2, _val3); - } - iprot.readMapEnd(); - } - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - validate(); + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); } public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - validate(); - - oprot.writeStructBegin(STRUCT_DESC); - oprot.writeFieldBegin(TIMESTAMP_FIELD_DESC); - oprot.writeI64(this.timestamp); - oprot.writeFieldEnd(); - if (this.priority != null) { - oprot.writeFieldBegin(PRIORITY_FIELD_DESC); - oprot.writeI32(this.priority.getValue()); - oprot.writeFieldEnd(); - } - if (this.body != null) { - oprot.writeFieldBegin(BODY_FIELD_DESC); - oprot.writeBinary(this.body); - oprot.writeFieldEnd(); - } - oprot.writeFieldBegin(NANOS_FIELD_DESC); - oprot.writeI64(this.nanos); - oprot.writeFieldEnd(); - if (this.host != null) { - oprot.writeFieldBegin(HOST_FIELD_DESC); - oprot.writeString(this.host); - oprot.writeFieldEnd(); - } - if (this.fields != null) { - oprot.writeFieldBegin(FIELDS_FIELD_DESC); - { - oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, this.fields.size())); - for (Map.Entry<String, ByteBuffer> _iter4 : this.fields.entrySet()) - { - oprot.writeString(_iter4.getKey()); - oprot.writeBinary(_iter4.getValue()); - } - oprot.writeMapEnd(); - } - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); } @Override @@ -859,6 +753,7 @@ public class ThriftFlumeEvent implements org.apache.thrift.TBase<ThriftFlumeEven 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 { @@ -872,12 +767,245 @@ public class ThriftFlumeEvent implements org.apache.thrift.TBase<ThriftFlumeEven private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { try { // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor. - __isset_bit_vector = new BitSet(1); + __isset_bitfield = 0; 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 ThriftFlumeEventStandardSchemeFactory implements SchemeFactory { + public ThriftFlumeEventStandardScheme getScheme() { + return new ThriftFlumeEventStandardScheme(); + } + } + + private static class ThriftFlumeEventStandardScheme extends StandardScheme<ThriftFlumeEvent> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, ThriftFlumeEvent 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 1: // TIMESTAMP + if (schemeField.type == org.apache.thrift.protocol.TType.I64) { + struct.timestamp = iprot.readI64(); + struct.setTimestampIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // PRIORITY + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.priority = com.cloudera.flume.handlers.thrift.Priority.findByValue(iprot.readI32()); + struct.setPriorityIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 3: // BODY + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.body = iprot.readBinary(); + struct.setBodyIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 4: // NANOS + if (schemeField.type == org.apache.thrift.protocol.TType.I64) { + struct.nanos = iprot.readI64(); + struct.setNanosIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 5: // HOST + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.host = iprot.readString(); + struct.setHostIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 6: // FIELDS + if (schemeField.type == org.apache.thrift.protocol.TType.MAP) { + { + org.apache.thrift.protocol.TMap _map0 = iprot.readMapBegin(); + struct.fields = new HashMap<String,ByteBuffer>(2*_map0.size); + String _key1; + ByteBuffer _val2; + for (int _i3 = 0; _i3 < _map0.size; ++_i3) + { + _key1 = iprot.readString(); + _val2 = iprot.readBinary(); + struct.fields.put(_key1, _val2); + } + iprot.readMapEnd(); + } + struct.setFieldsIsSet(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, ThriftFlumeEvent struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(TIMESTAMP_FIELD_DESC); + oprot.writeI64(struct.timestamp); + oprot.writeFieldEnd(); + if (struct.priority != null) { + oprot.writeFieldBegin(PRIORITY_FIELD_DESC); + oprot.writeI32(struct.priority.getValue()); + oprot.writeFieldEnd(); + } + if (struct.body != null) { + oprot.writeFieldBegin(BODY_FIELD_DESC); + oprot.writeBinary(struct.body); + oprot.writeFieldEnd(); + } + oprot.writeFieldBegin(NANOS_FIELD_DESC); + oprot.writeI64(struct.nanos); + oprot.writeFieldEnd(); + if (struct.host != null) { + oprot.writeFieldBegin(HOST_FIELD_DESC); + oprot.writeString(struct.host); + oprot.writeFieldEnd(); + } + if (struct.fields != null) { + oprot.writeFieldBegin(FIELDS_FIELD_DESC); + { + oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, struct.fields.size())); + for (Map.Entry<String, ByteBuffer> _iter4 : struct.fields.entrySet()) + { + oprot.writeString(_iter4.getKey()); + oprot.writeBinary(_iter4.getValue()); + } + oprot.writeMapEnd(); + } + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class ThriftFlumeEventTupleSchemeFactory implements SchemeFactory { + public ThriftFlumeEventTupleScheme getScheme() { + return new ThriftFlumeEventTupleScheme(); + } + } + + private static class ThriftFlumeEventTupleScheme extends TupleScheme<ThriftFlumeEvent> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, ThriftFlumeEvent struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetTimestamp()) { + optionals.set(0); + } + if (struct.isSetPriority()) { + optionals.set(1); + } + if (struct.isSetBody()) { + optionals.set(2); + } + if (struct.isSetNanos()) { + optionals.set(3); + } + if (struct.isSetHost()) { + optionals.set(4); + } + if (struct.isSetFields()) { + optionals.set(5); + } + oprot.writeBitSet(optionals, 6); + if (struct.isSetTimestamp()) { + oprot.writeI64(struct.timestamp); + } + if (struct.isSetPriority()) { + oprot.writeI32(struct.priority.getValue()); + } + if (struct.isSetBody()) { + oprot.writeBinary(struct.body); + } + if (struct.isSetNanos()) { + oprot.writeI64(struct.nanos); + } + if (struct.isSetHost()) { + oprot.writeString(struct.host); + } + if (struct.isSetFields()) { + { + oprot.writeI32(struct.fields.size()); + for (Map.Entry<String, ByteBuffer> _iter5 : struct.fields.entrySet()) + { + oprot.writeString(_iter5.getKey()); + oprot.writeBinary(_iter5.getValue()); + } + } + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, ThriftFlumeEvent struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(6); + if (incoming.get(0)) { + struct.timestamp = iprot.readI64(); + struct.setTimestampIsSet(true); + } + if (incoming.get(1)) { + struct.priority = com.cloudera.flume.handlers.thrift.Priority.findByValue(iprot.readI32()); + struct.setPriorityIsSet(true); + } + if (incoming.get(2)) { + struct.body = iprot.readBinary(); + struct.setBodyIsSet(true); + } + if (incoming.get(3)) { + struct.nanos = iprot.readI64(); + struct.setNanosIsSet(true); + } + if (incoming.get(4)) { + struct.host = iprot.readString(); + struct.setHostIsSet(true); + } + if (incoming.get(5)) { + { + org.apache.thrift.protocol.TMap _map6 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32()); + struct.fields = new HashMap<String,ByteBuffer>(2*_map6.size); + String _key7; + ByteBuffer _val8; + for (int _i9 = 0; _i9 < _map6.size; ++_i9) + { + _key7 = iprot.readString(); + _val8 = iprot.readBinary(); + struct.fields.put(_key7, _val8); + } + } + struct.setFieldsIsSet(true); + } + } + } + } http://git-wip-us.apache.org/repos/asf/flume/blob/773555c5/flume-ng-legacy-sources/flume-thrift-source/src/main/java/com/cloudera/flume/handlers/thrift/ThriftFlumeEventServer.java ---------------------------------------------------------------------- diff --git a/flume-ng-legacy-sources/flume-thrift-source/src/main/java/com/cloudera/flume/handlers/thrift/ThriftFlumeEventServer.java b/flume-ng-legacy-sources/flume-thrift-source/src/main/java/com/cloudera/flume/handlers/thrift/ThriftFlumeEventServer.java index 3bf632a..dbc2417 100644 --- a/flume-ng-legacy-sources/flume-thrift-source/src/main/java/com/cloudera/flume/handlers/thrift/ThriftFlumeEventServer.java +++ b/flume-ng-legacy-sources/flume-thrift-source/src/main/java/com/cloudera/flume/handlers/thrift/ThriftFlumeEventServer.java @@ -17,13 +17,24 @@ * under the License. */ /** - * Autogenerated by Thrift Compiler (0.7.0) + * Autogenerated by Thrift Compiler (0.9.3) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated */ package com.cloudera.flume.handlers.thrift; -import org.apache.commons.lang.builder.HashCodeBuilder; +import org.apache.thrift.scheme.IScheme; +import org.apache.thrift.scheme.SchemeFactory; +import org.apache.thrift.scheme.StandardScheme; + +import org.apache.thrift.scheme.TupleScheme; +import org.apache.thrift.protocol.TTupleProtocol; +import org.apache.thrift.protocol.TProtocolException; +import org.apache.thrift.EncodingUtils; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.server.AbstractNonblockingServer.*; import java.util.List; import java.util.ArrayList; import java.util.Map; @@ -36,9 +47,12 @@ import java.util.Collections; import java.util.BitSet; import java.nio.ByteBuffer; import java.util.Arrays; +import javax.annotation.Generated; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) +@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2017-09-01") public class ThriftFlumeEventServer { public interface Iface { @@ -51,9 +65,9 @@ public class ThriftFlumeEventServer { public interface AsyncIface { - public void append(ThriftFlumeEvent evt, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.append_call> resultHandler) throws org.apache.thrift.TException; + public void append(ThriftFlumeEvent evt, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; - public void close(org.apache.thrift.async.AsyncMethodCallback<AsyncClient.close_call> resultHandler) throws org.apache.thrift.TException; + public void close(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; } @@ -86,7 +100,7 @@ public class ThriftFlumeEventServer { { append_args args = new append_args(); args.setEvt(evt); - sendBase("append", args); + sendBaseOneway("append", args); } public void close() throws org.apache.thrift.TException @@ -126,7 +140,7 @@ public class ThriftFlumeEventServer { super(protocolFactory, clientManager, transport); } - public void append(ThriftFlumeEvent evt, org.apache.thrift.async.AsyncMethodCallback<append_call> resultHandler) throws org.apache.thrift.TException { + public void append(ThriftFlumeEvent evt, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { checkReady(); append_call method_call = new append_call(evt, resultHandler, this, ___protocolFactory, ___transport); this.___currentMethod = method_call; @@ -135,13 +149,13 @@ public class ThriftFlumeEventServer { public static class append_call extends org.apache.thrift.async.TAsyncMethodCall { private ThriftFlumeEvent evt; - public append_call(ThriftFlumeEvent evt, org.apache.thrift.async.AsyncMethodCallback<append_call> 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 append_call(ThriftFlumeEvent evt, 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, true); this.evt = evt; } public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { - prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("append", org.apache.thrift.protocol.TMessageType.CALL, 0)); + prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("append", org.apache.thrift.protocol.TMessageType.ONEWAY, 0)); append_args args = new append_args(); args.setEvt(evt); args.write(prot); @@ -157,7 +171,7 @@ public class ThriftFlumeEventServer { } } - public void close(org.apache.thrift.async.AsyncMethodCallback<close_call> resultHandler) throws org.apache.thrift.TException { + public void close(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { checkReady(); close_call method_call = new close_call(resultHandler, this, ___protocolFactory, ___transport); this.___currentMethod = method_call; @@ -165,7 +179,7 @@ public class ThriftFlumeEventServer { } public static class close_call extends org.apache.thrift.async.TAsyncMethodCall { - public close_call(org.apache.thrift.async.AsyncMethodCallback<close_call> 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 close_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); } @@ -188,7 +202,7 @@ public class ThriftFlumeEventServer { } - public static class Processor<I extends Iface> extends org.apache.thrift.TBaseProcessor implements org.apache.thrift.TProcessor { + public static class Processor<I extends Iface> extends org.apache.thrift.TBaseProcessor<I> implements org.apache.thrift.TProcessor { private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName()); public Processor(I iface) { super(iface, getProcessMap(new HashMap<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>>())); @@ -204,7 +218,7 @@ public class ThriftFlumeEventServer { return processMap; } - private static class append<I extends Iface> extends org.apache.thrift.ProcessFunction<I, append_args> { + public static class append<I extends Iface> extends org.apache.thrift.ProcessFunction<I, append_args> { public append() { super("append"); } @@ -213,18 +227,17 @@ public class ThriftFlumeEventServer { return new append_args(); } - public org.apache.thrift.TBase getResult(I iface, - append_args args) throws org.apache.thrift.TException { - iface.append(args.evt); - return null; + protected boolean isOneway() { + return true; } - public boolean isOneway() { - return false; + public org.apache.thrift.TBase getResult(I iface, append_args args) throws org.apache.thrift.TException { + iface.append(args.evt); + return null; } } - private static class close<I extends Iface> extends org.apache.thrift.ProcessFunction<I, close_args> { + public static class close<I extends Iface> extends org.apache.thrift.ProcessFunction<I, close_args> { public close() { super("close"); } @@ -233,25 +246,126 @@ public class ThriftFlumeEventServer { return new close_args(); } - public close_result getResult(I iface, close_args args) throws org.apache - .thrift.TException { + protected boolean isOneway() { + return false; + } + + public close_result getResult(I iface, close_args args) throws org.apache.thrift.TException { close_result result = new close_result(); iface.close(); return result; } + } + + } + + public static class AsyncProcessor<I extends AsyncIface> extends org.apache.thrift.TBaseAsyncProcessor<I> { + private static final Logger LOGGER = LoggerFactory.getLogger(AsyncProcessor.class.getName()); + public AsyncProcessor(I iface) { + super(iface, getProcessMap(new HashMap<String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase, ?>>())); + } + + protected AsyncProcessor(I iface, Map<String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase, ?>> processMap) { + super(iface, getProcessMap(processMap)); + } + + private static <I extends AsyncIface> Map<String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase,?>> getProcessMap(Map<String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase, ?>> processMap) { + processMap.put("append", new append()); + processMap.put("close", new close()); + return processMap; + } - public boolean isOneway() { + public static class append<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, append_args, Void> { + public append() { + super("append"); + } + + public append_args getEmptyArgsInstance() { + return new append_args(); + } + + public AsyncMethodCallback<Void> getResultHandler(final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback<Void>() { + public void onComplete(Void o) { + } + public void onError(Exception e) { + } + }; + } + + protected boolean isOneway() { + return true; + } + + public void start(I iface, append_args args, org.apache.thrift.async.AsyncMethodCallback<Void> resultHandler) throws TException { + iface.append(args.evt,resultHandler); + } + } + + public static class close<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, close_args, Void> { + public close() { + super("close"); + } + + public close_args getEmptyArgsInstance() { + return new close_args(); + } + + public AsyncMethodCallback<Void> getResultHandler(final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback<Void>() { + public void onComplete(Void o) { + close_result result = new close_result(); + 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; + close_result result = new close_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, close_args args, org.apache.thrift.async.AsyncMethodCallback<Void> resultHandler) throws TException { + iface.close(resultHandler); + } } } - public static class append_args implements org.apache.thrift.TBase<append_args, append_args._Fields>, java.io.Serializable, Cloneable { + public static class append_args implements org.apache.thrift.TBase<append_args, append_args._Fields>, java.io.Serializable, Cloneable, Comparable<append_args> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("append_args"); private static final org.apache.thrift.protocol.TField EVT_FIELD_DESC = new org.apache.thrift.protocol.TField("evt", org.apache.thrift.protocol.TType.STRUCT, (short)1); + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new append_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new append_argsTupleSchemeFactory()); + } + public ThriftFlumeEvent evt; // required /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ @@ -313,7 +427,6 @@ public class ThriftFlumeEventServer { } // 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); @@ -437,30 +550,30 @@ public class ThriftFlumeEventServer { @Override public int hashCode() { - HashCodeBuilder builder = new HashCodeBuilder(); + List<Object> list = new ArrayList<Object>(); boolean present_evt = true && (isSetEvt()); - builder.append(present_evt); + list.add(present_evt); if (present_evt) - builder.append(evt); + list.add(evt); - return builder.toHashCode(); + return list.hashCode(); } + @Override public int compareTo(append_args other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; - append_args typedOther = (append_args)other; - lastComparison = Boolean.valueOf(isSetEvt()).compareTo(typedOther.isSetEvt()); + lastComparison = Boolean.valueOf(isSetEvt()).compareTo(other.isSetEvt()); if (lastComparison != 0) { return lastComparison; } if (isSetEvt()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.evt, typedOther.evt); + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.evt, other.evt); if (lastComparison != 0) { return lastComparison; } @@ -473,45 +586,11 @@ public class ThriftFlumeEventServer { } public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField field; - iprot.readStructBegin(); - while (true) - { - field = iprot.readFieldBegin(); - if (field.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (field.id) { - case 1: // EVT - if (field.type == org.apache.thrift.protocol.TType.STRUCT) { - this.evt = new ThriftFlumeEvent(); - this.evt.read(iprot); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - validate(); + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); } public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (this.evt != null) { - oprot.writeFieldBegin(EVT_FIELD_DESC); - this.evt.write(oprot); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); } @Override @@ -532,6 +611,10 @@ public class ThriftFlumeEventServer { public void validate() throws org.apache.thrift.TException { // check for required fields + // check for sub-struct validity + if (evt != null) { + evt.validate(); + } } private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { @@ -550,12 +633,104 @@ public class ThriftFlumeEventServer { } } + private static class append_argsStandardSchemeFactory implements SchemeFactory { + public append_argsStandardScheme getScheme() { + return new append_argsStandardScheme(); + } + } + + private static class append_argsStandardScheme extends StandardScheme<append_args> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, append_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) { + case 1: // EVT + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.evt = new ThriftFlumeEvent(); + struct.evt.read(iprot); + struct.setEvtIsSet(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, append_args struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.evt != null) { + oprot.writeFieldBegin(EVT_FIELD_DESC); + struct.evt.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class append_argsTupleSchemeFactory implements SchemeFactory { + public append_argsTupleScheme getScheme() { + return new append_argsTupleScheme(); + } + } + + private static class append_argsTupleScheme extends TupleScheme<append_args> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, append_args struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetEvt()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetEvt()) { + struct.evt.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, append_args struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.evt = new ThriftFlumeEvent(); + struct.evt.read(iprot); + struct.setEvtIsSet(true); + } + } + } + } - public static class close_args implements org.apache.thrift.TBase<close_args, close_args._Fields>, java.io.Serializable, Cloneable { + public static class close_args implements org.apache.thrift.TBase<close_args, close_args._Fields>, java.io.Serializable, Cloneable, Comparable<close_args> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("close_args"); + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new close_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new close_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 { @@ -676,18 +851,18 @@ public class ThriftFlumeEventServer { @Override public int hashCode() { - HashCodeBuilder builder = new HashCodeBuilder(); + List<Object> list = new ArrayList<Object>(); - return builder.toHashCode(); + return list.hashCode(); } + @Override public int compareTo(close_args other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; - close_args typedOther = (close_args)other; return 0; } @@ -697,32 +872,11 @@ public class ThriftFlumeEventServer { } public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField field; - iprot.readStructBegin(); - while (true) - { - field = iprot.readFieldBegin(); - if (field.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (field.id) { - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - validate(); + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); } public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - validate(); - - oprot.writeStructBegin(STRUCT_DESC); - oprot.writeFieldStop(); - oprot.writeStructEnd(); + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); } @Override @@ -736,6 +890,7 @@ public class ThriftFlumeEventServer { 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 { @@ -754,12 +909,76 @@ public class ThriftFlumeEventServer { } } + private static class close_argsStandardSchemeFactory implements SchemeFactory { + public close_argsStandardScheme getScheme() { + return new close_argsStandardScheme(); + } + } + + private static class close_argsStandardScheme extends StandardScheme<close_args> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, close_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, close_args struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class close_argsTupleSchemeFactory implements SchemeFactory { + public close_argsTupleScheme getScheme() { + return new close_argsTupleScheme(); + } + } + + private static class close_argsTupleScheme extends TupleScheme<close_args> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, close_args struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, close_args struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + } + } + } - public static class close_result implements org.apache.thrift.TBase<close_result, close_result._Fields>, java.io.Serializable, Cloneable { + public static class close_result implements org.apache.thrift.TBase<close_result, close_result._Fields>, java.io.Serializable, Cloneable, Comparable<close_result> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("close_result"); + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new close_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new close_resultTupleSchemeFactory()); + } + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements org.apache.thrift.TFieldIdEnum { @@ -880,18 +1099,18 @@ public class ThriftFlumeEventServer { @Override public int hashCode() { - HashCodeBuilder builder = new HashCodeBuilder(); + List<Object> list = new ArrayList<Object>(); - return builder.toHashCode(); + return list.hashCode(); } + @Override public int compareTo(close_result other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; - close_result typedOther = (close_result)other; return 0; } @@ -901,32 +1120,12 @@ public class ThriftFlumeEventServer { } public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField field; - iprot.readStructBegin(); - while (true) - { - field = iprot.readFieldBegin(); - if (field.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (field.id) { - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - validate(); + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); } public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - oprot.writeStructBegin(STRUCT_DESC); - - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } @Override public String toString() { @@ -939,6 +1138,7 @@ public class ThriftFlumeEventServer { 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 { @@ -957,6 +1157,64 @@ public class ThriftFlumeEventServer { } } + private static class close_resultStandardSchemeFactory implements SchemeFactory { + public close_resultStandardScheme getScheme() { + return new close_resultStandardScheme(); + } + } + + private static class close_resultStandardScheme extends StandardScheme<close_result> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, close_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) { + 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, close_result struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class close_resultTupleSchemeFactory implements SchemeFactory { + public close_resultTupleScheme getScheme() { + return new close_resultTupleScheme(); + } + } + + private static class close_resultTupleScheme extends TupleScheme<close_result> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, close_result struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, close_result struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + } + } + } } http://git-wip-us.apache.org/repos/asf/flume/blob/773555c5/flume-ng-sdk/src/main/java/org/apache/flume/thrift/Status.java ---------------------------------------------------------------------- diff --git a/flume-ng-sdk/src/main/java/org/apache/flume/thrift/Status.java b/flume-ng-sdk/src/main/java/org/apache/flume/thrift/Status.java index 634c323..9118d35 100644 --- a/flume-ng-sdk/src/main/java/org/apache/flume/thrift/Status.java +++ b/flume-ng-sdk/src/main/java/org/apache/flume/thrift/Status.java @@ -17,9 +17,10 @@ * under the License. */ /** - * Autogenerated by Thrift Compiler (0.7.0) + * 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.flume.thrift; http://git-wip-us.apache.org/repos/asf/flume/blob/773555c5/flume-ng-sdk/src/main/java/org/apache/flume/thrift/ThriftFlumeEvent.java ---------------------------------------------------------------------- diff --git a/flume-ng-sdk/src/main/java/org/apache/flume/thrift/ThriftFlumeEvent.java b/flume-ng-sdk/src/main/java/org/apache/flume/thrift/ThriftFlumeEvent.java index fc0b678..1eeea84 100644 --- a/flume-ng-sdk/src/main/java/org/apache/flume/thrift/ThriftFlumeEvent.java +++ b/flume-ng-sdk/src/main/java/org/apache/flume/thrift/ThriftFlumeEvent.java @@ -17,13 +17,24 @@ * under the License. */ /** - * Autogenerated by Thrift Compiler (0.7.0) + * 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.flume.thrift; -import org.apache.commons.lang.builder.HashCodeBuilder; +import org.apache.thrift.scheme.IScheme; +import org.apache.thrift.scheme.SchemeFactory; +import org.apache.thrift.scheme.StandardScheme; + +import org.apache.thrift.scheme.TupleScheme; +import org.apache.thrift.protocol.TTupleProtocol; +import org.apache.thrift.protocol.TProtocolException; +import org.apache.thrift.EncodingUtils; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.server.AbstractNonblockingServer.*; import java.util.List; import java.util.ArrayList; import java.util.Map; @@ -36,15 +47,24 @@ import java.util.Collections; import java.util.BitSet; import java.nio.ByteBuffer; import java.util.Arrays; +import javax.annotation.Generated; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class ThriftFlumeEvent implements org.apache.thrift.TBase<ThriftFlumeEvent, ThriftFlumeEvent._Fields>, java.io.Serializable, Cloneable { +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) +@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2017-09-01") +public class ThriftFlumeEvent implements org.apache.thrift.TBase<ThriftFlumeEvent, ThriftFlumeEvent._Fields>, java.io.Serializable, Cloneable, Comparable<ThriftFlumeEvent> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ThriftFlumeEvent"); private static final org.apache.thrift.protocol.TField HEADERS_FIELD_DESC = new org.apache.thrift.protocol.TField("headers", org.apache.thrift.protocol.TType.MAP, (short)1); private static final org.apache.thrift.protocol.TField BODY_FIELD_DESC = new org.apache.thrift.protocol.TField("body", org.apache.thrift.protocol.TType.STRING, (short)2); + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new ThriftFlumeEventStandardSchemeFactory()); + schemes.put(TupleScheme.class, new ThriftFlumeEventTupleSchemeFactory()); + } + public Map<String,String> headers; // required public ByteBuffer body; // required @@ -110,7 +130,6 @@ public class ThriftFlumeEvent implements org.apache.thrift.TBase<ThriftFlumeEven } // 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); @@ -133,7 +152,7 @@ public class ThriftFlumeEvent implements org.apache.thrift.TBase<ThriftFlumeEven { this(); this.headers = headers; - this.body = body; + this.body = org.apache.thrift.TBaseHelper.copyBinary(body); } /** @@ -141,23 +160,11 @@ public class ThriftFlumeEvent implements org.apache.thrift.TBase<ThriftFlumeEven */ public ThriftFlumeEvent(ThriftFlumeEvent other) { if (other.isSetHeaders()) { - Map<String,String> __this__headers = new HashMap<String,String>(); - for (Map.Entry<String, String> other_element : other.headers.entrySet()) { - - String other_element_key = other_element.getKey(); - String other_element_value = other_element.getValue(); - - String __this__headers_copy_key = other_element_key; - - String __this__headers_copy_value = other_element_value; - - __this__headers.put(__this__headers_copy_key, __this__headers_copy_value); - } + Map<String,String> __this__headers = new HashMap<String,String>(other.headers); this.headers = __this__headers; } if (other.isSetBody()) { this.body = org.apache.thrift.TBaseHelper.copyBinary(other.body); -; } } @@ -212,16 +219,16 @@ public class ThriftFlumeEvent implements org.apache.thrift.TBase<ThriftFlumeEven } public ByteBuffer bufferForBody() { - return body; + return org.apache.thrift.TBaseHelper.copyBinary(body); } public ThriftFlumeEvent setBody(byte[] body) { - setBody(body == null ? (ByteBuffer)null : ByteBuffer.wrap(body)); + this.body = body == null ? (ByteBuffer)null : ByteBuffer.wrap(Arrays.copyOf(body, body.length)); return this; } public ThriftFlumeEvent setBody(ByteBuffer body) { - this.body = body; + this.body = org.apache.thrift.TBaseHelper.copyBinary(body); return this; } @@ -324,45 +331,45 @@ public class ThriftFlumeEvent implements org.apache.thrift.TBase<ThriftFlumeEven @Override public int hashCode() { - HashCodeBuilder builder = new HashCodeBuilder(); + List<Object> list = new ArrayList<Object>(); boolean present_headers = true && (isSetHeaders()); - builder.append(present_headers); + list.add(present_headers); if (present_headers) - builder.append(headers); + list.add(headers); boolean present_body = true && (isSetBody()); - builder.append(present_body); + list.add(present_body); if (present_body) - builder.append(body); + list.add(body); - return builder.toHashCode(); + return list.hashCode(); } + @Override public int compareTo(ThriftFlumeEvent other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; - ThriftFlumeEvent typedOther = (ThriftFlumeEvent)other; - lastComparison = Boolean.valueOf(isSetHeaders()).compareTo(typedOther.isSetHeaders()); + lastComparison = Boolean.valueOf(isSetHeaders()).compareTo(other.isSetHeaders()); if (lastComparison != 0) { return lastComparison; } if (isSetHeaders()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.headers, typedOther.headers); + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.headers, other.headers); if (lastComparison != 0) { return lastComparison; } } - lastComparison = Boolean.valueOf(isSetBody()).compareTo(typedOther.isSetBody()); + lastComparison = Boolean.valueOf(isSetBody()).compareTo(other.isSetBody()); if (lastComparison != 0) { return lastComparison; } if (isSetBody()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.body, typedOther.body); + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.body, other.body); if (lastComparison != 0) { return lastComparison; } @@ -375,76 +382,11 @@ public class ThriftFlumeEvent implements org.apache.thrift.TBase<ThriftFlumeEven } public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField field; - iprot.readStructBegin(); - while (true) - { - field = iprot.readFieldBegin(); - if (field.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (field.id) { - case 1: // HEADERS - if (field.type == org.apache.thrift.protocol.TType.MAP) { - { - org.apache.thrift.protocol.TMap _map0 = iprot.readMapBegin(); - this.headers = new HashMap<String,String>(2*_map0.size); - for (int _i1 = 0; _i1 < _map0.size; ++_i1) - { - String _key2; // required - String _val3; // required - _key2 = iprot.readString(); - _val3 = iprot.readString(); - this.headers.put(_key2, _val3); - } - iprot.readMapEnd(); - } - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); - } - break; - case 2: // BODY - if (field.type == org.apache.thrift.protocol.TType.STRING) { - this.body = iprot.readBinary(); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - validate(); + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); } public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (this.headers != null) { - oprot.writeFieldBegin(HEADERS_FIELD_DESC); - { - oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, this.headers.size())); - for (Map.Entry<String, String> _iter4 : this.headers.entrySet()) - { - oprot.writeString(_iter4.getKey()); - oprot.writeString(_iter4.getValue()); - } - oprot.writeMapEnd(); - } - oprot.writeFieldEnd(); - } - if (this.body != null) { - oprot.writeFieldBegin(BODY_FIELD_DESC); - oprot.writeBinary(this.body); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); } @Override @@ -479,6 +421,7 @@ public class ThriftFlumeEvent implements org.apache.thrift.TBase<ThriftFlumeEven if (body == null) { throw new org.apache.thrift.protocol.TProtocolException("Required field 'body' was not present! Struct: " + toString()); } + // check for sub-struct validity } private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { @@ -497,5 +440,133 @@ public class ThriftFlumeEvent implements org.apache.thrift.TBase<ThriftFlumeEven } } + private static class ThriftFlumeEventStandardSchemeFactory implements SchemeFactory { + public ThriftFlumeEventStandardScheme getScheme() { + return new ThriftFlumeEventStandardScheme(); + } + } + + private static class ThriftFlumeEventStandardScheme extends StandardScheme<ThriftFlumeEvent> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, ThriftFlumeEvent 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 1: // HEADERS + if (schemeField.type == org.apache.thrift.protocol.TType.MAP) { + { + org.apache.thrift.protocol.TMap _map0 = iprot.readMapBegin(); + struct.headers = new HashMap<String,String>(2*_map0.size); + String _key1; + String _val2; + for (int _i3 = 0; _i3 < _map0.size; ++_i3) + { + _key1 = iprot.readString(); + _val2 = iprot.readString(); + struct.headers.put(_key1, _val2); + } + iprot.readMapEnd(); + } + struct.setHeadersIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // BODY + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.body = iprot.readBinary(); + struct.setBodyIsSet(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, ThriftFlumeEvent struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.headers != null) { + oprot.writeFieldBegin(HEADERS_FIELD_DESC); + { + oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, struct.headers.size())); + for (Map.Entry<String, String> _iter4 : struct.headers.entrySet()) + { + oprot.writeString(_iter4.getKey()); + oprot.writeString(_iter4.getValue()); + } + oprot.writeMapEnd(); + } + oprot.writeFieldEnd(); + } + if (struct.body != null) { + oprot.writeFieldBegin(BODY_FIELD_DESC); + oprot.writeBinary(struct.body); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class ThriftFlumeEventTupleSchemeFactory implements SchemeFactory { + public ThriftFlumeEventTupleScheme getScheme() { + return new ThriftFlumeEventTupleScheme(); + } + } + + private static class ThriftFlumeEventTupleScheme extends TupleScheme<ThriftFlumeEvent> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, ThriftFlumeEvent struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + { + oprot.writeI32(struct.headers.size()); + for (Map.Entry<String, String> _iter5 : struct.headers.entrySet()) + { + oprot.writeString(_iter5.getKey()); + oprot.writeString(_iter5.getValue()); + } + } + oprot.writeBinary(struct.body); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, ThriftFlumeEvent struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + { + org.apache.thrift.protocol.TMap _map6 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32()); + struct.headers = new HashMap<String,String>(2*_map6.size); + String _key7; + String _val8; + for (int _i9 = 0; _i9 < _map6.size; ++_i9) + { + _key7 = iprot.readString(); + _val8 = iprot.readString(); + struct.headers.put(_key7, _val8); + } + } + struct.setHeadersIsSet(true); + struct.body = iprot.readBinary(); + struct.setBodyIsSet(true); + } + } + }
