http://git-wip-us.apache.org/repos/asf/storm/blob/ef51dbee/storm-core/src/jvm/backtype/storm/generated/ComponentCommon.java ---------------------------------------------------------------------- diff --git a/storm-core/src/jvm/backtype/storm/generated/ComponentCommon.java b/storm-core/src/jvm/backtype/storm/generated/ComponentCommon.java index f2cc2e9..3feaec4 100644 --- a/storm-core/src/jvm/backtype/storm/generated/ComponentCommon.java +++ b/storm-core/src/jvm/backtype/storm/generated/ComponentCommon.java @@ -16,13 +16,24 @@ * limitations under the License. */ /** - * Autogenerated by Thrift Compiler (0.7.0) + * Autogenerated by Thrift Compiler (0.9.2) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated */ package backtype.storm.generated; -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; @@ -35,10 +46,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 ComponentCommon implements org.apache.thrift.TBase<ComponentCommon, ComponentCommon._Fields>, java.io.Serializable, Cloneable { +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) +@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2015-2-2") +public class ComponentCommon implements org.apache.thrift.TBase<ComponentCommon, ComponentCommon._Fields>, java.io.Serializable, Cloneable, Comparable<ComponentCommon> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ComponentCommon"); private static final org.apache.thrift.protocol.TField INPUTS_FIELD_DESC = new org.apache.thrift.protocol.TField("inputs", org.apache.thrift.protocol.TType.MAP, (short)1); @@ -46,10 +60,16 @@ public class ComponentCommon implements org.apache.thrift.TBase<ComponentCommon, private static final org.apache.thrift.protocol.TField PARALLELISM_HINT_FIELD_DESC = new org.apache.thrift.protocol.TField("parallelism_hint", org.apache.thrift.protocol.TType.I32, (short)3); private static final org.apache.thrift.protocol.TField JSON_CONF_FIELD_DESC = new org.apache.thrift.protocol.TField("json_conf", org.apache.thrift.protocol.TType.STRING, (short)4); + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new ComponentCommonStandardSchemeFactory()); + schemes.put(TupleScheme.class, new ComponentCommonTupleSchemeFactory()); + } + private Map<GlobalStreamId,Grouping> inputs; // required private Map<String,StreamInfo> streams; // required - private int parallelism_hint; // required - private String json_conf; // required + private int parallelism_hint; // optional + private String json_conf; // optional /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements org.apache.thrift.TFieldIdEnum { @@ -120,8 +140,8 @@ public class ComponentCommon implements org.apache.thrift.TBase<ComponentCommon, // isset id assignments private static final int __PARALLELISM_HINT_ISSET_ID = 0; - private BitSet __isset_bit_vector = new BitSet(1); - + private byte __isset_bitfield = 0; + private static final _Fields optionals[] = {_Fields.PARALLELISM_HINT,_Fields.JSON_CONF}; 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); @@ -157,10 +177,9 @@ public class ComponentCommon implements org.apache.thrift.TBase<ComponentCommon, * Performs a deep copy on <i>other</i>. */ public ComponentCommon(ComponentCommon other) { - __isset_bit_vector.clear(); - __isset_bit_vector.or(other.__isset_bit_vector); + __isset_bitfield = other.__isset_bitfield; if (other.is_set_inputs()) { - Map<GlobalStreamId,Grouping> __this__inputs = new HashMap<GlobalStreamId,Grouping>(); + Map<GlobalStreamId,Grouping> __this__inputs = new HashMap<GlobalStreamId,Grouping>(other.inputs.size()); for (Map.Entry<GlobalStreamId, Grouping> other_element : other.inputs.entrySet()) { GlobalStreamId other_element_key = other_element.getKey(); @@ -175,7 +194,7 @@ public class ComponentCommon implements org.apache.thrift.TBase<ComponentCommon, this.inputs = __this__inputs; } if (other.is_set_streams()) { - Map<String,StreamInfo> __this__streams = new HashMap<String,StreamInfo>(); + Map<String,StreamInfo> __this__streams = new HashMap<String,StreamInfo>(other.streams.size()); for (Map.Entry<String, StreamInfo> other_element : other.streams.entrySet()) { String other_element_key = other_element.getKey(); @@ -286,16 +305,16 @@ public class ComponentCommon implements org.apache.thrift.TBase<ComponentCommon, } public void unset_parallelism_hint() { - __isset_bit_vector.clear(__PARALLELISM_HINT_ISSET_ID); + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __PARALLELISM_HINT_ISSET_ID); } /** Returns true if field parallelism_hint is set (has been assigned a value) and false otherwise */ public boolean is_set_parallelism_hint() { - return __isset_bit_vector.get(__PARALLELISM_HINT_ISSET_ID); + return EncodingUtils.testBit(__isset_bitfield, __PARALLELISM_HINT_ISSET_ID); } public void set_parallelism_hint_isSet(boolean value) { - __isset_bit_vector.set(__PARALLELISM_HINT_ISSET_ID, value); + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __PARALLELISM_HINT_ISSET_ID, value); } public String get_json_conf() { @@ -449,75 +468,75 @@ public class ComponentCommon implements org.apache.thrift.TBase<ComponentCommon, @Override public int hashCode() { - HashCodeBuilder builder = new HashCodeBuilder(); + List<Object> list = new ArrayList<Object>(); boolean present_inputs = true && (is_set_inputs()); - builder.append(present_inputs); + list.add(present_inputs); if (present_inputs) - builder.append(inputs); + list.add(inputs); boolean present_streams = true && (is_set_streams()); - builder.append(present_streams); + list.add(present_streams); if (present_streams) - builder.append(streams); + list.add(streams); boolean present_parallelism_hint = true && (is_set_parallelism_hint()); - builder.append(present_parallelism_hint); + list.add(present_parallelism_hint); if (present_parallelism_hint) - builder.append(parallelism_hint); + list.add(parallelism_hint); boolean present_json_conf = true && (is_set_json_conf()); - builder.append(present_json_conf); + list.add(present_json_conf); if (present_json_conf) - builder.append(json_conf); + list.add(json_conf); - return builder.toHashCode(); + return list.hashCode(); } + @Override public int compareTo(ComponentCommon other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; - ComponentCommon typedOther = (ComponentCommon)other; - lastComparison = Boolean.valueOf(is_set_inputs()).compareTo(typedOther.is_set_inputs()); + lastComparison = Boolean.valueOf(is_set_inputs()).compareTo(other.is_set_inputs()); if (lastComparison != 0) { return lastComparison; } if (is_set_inputs()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.inputs, typedOther.inputs); + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.inputs, other.inputs); if (lastComparison != 0) { return lastComparison; } } - lastComparison = Boolean.valueOf(is_set_streams()).compareTo(typedOther.is_set_streams()); + lastComparison = Boolean.valueOf(is_set_streams()).compareTo(other.is_set_streams()); if (lastComparison != 0) { return lastComparison; } if (is_set_streams()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.streams, typedOther.streams); + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.streams, other.streams); if (lastComparison != 0) { return lastComparison; } } - lastComparison = Boolean.valueOf(is_set_parallelism_hint()).compareTo(typedOther.is_set_parallelism_hint()); + lastComparison = Boolean.valueOf(is_set_parallelism_hint()).compareTo(other.is_set_parallelism_hint()); if (lastComparison != 0) { return lastComparison; } if (is_set_parallelism_hint()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.parallelism_hint, typedOther.parallelism_hint); + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.parallelism_hint, other.parallelism_hint); if (lastComparison != 0) { return lastComparison; } } - lastComparison = Boolean.valueOf(is_set_json_conf()).compareTo(typedOther.is_set_json_conf()); + lastComparison = Boolean.valueOf(is_set_json_conf()).compareTo(other.is_set_json_conf()); if (lastComparison != 0) { return lastComparison; } if (is_set_json_conf()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.json_conf, typedOther.json_conf); + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.json_conf, other.json_conf); if (lastComparison != 0) { return lastComparison; } @@ -530,124 +549,11 @@ public class ComponentCommon implements org.apache.thrift.TBase<ComponentCommon, } 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: // INPUTS - if (field.type == org.apache.thrift.protocol.TType.MAP) { - { - org.apache.thrift.protocol.TMap _map12 = iprot.readMapBegin(); - this.inputs = new HashMap<GlobalStreamId,Grouping>(2*_map12.size); - for (int _i13 = 0; _i13 < _map12.size; ++_i13) - { - GlobalStreamId _key14; // required - Grouping _val15; // required - _key14 = new GlobalStreamId(); - _key14.read(iprot); - _val15 = new Grouping(); - _val15.read(iprot); - this.inputs.put(_key14, _val15); - } - iprot.readMapEnd(); - } - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); - } - break; - case 2: // STREAMS - if (field.type == org.apache.thrift.protocol.TType.MAP) { - { - org.apache.thrift.protocol.TMap _map16 = iprot.readMapBegin(); - this.streams = new HashMap<String,StreamInfo>(2*_map16.size); - for (int _i17 = 0; _i17 < _map16.size; ++_i17) - { - String _key18; // required - StreamInfo _val19; // required - _key18 = iprot.readString(); - _val19 = new StreamInfo(); - _val19.read(iprot); - this.streams.put(_key18, _val19); - } - iprot.readMapEnd(); - } - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); - } - break; - case 3: // PARALLELISM_HINT - if (field.type == org.apache.thrift.protocol.TType.I32) { - this.parallelism_hint = iprot.readI32(); - set_parallelism_hint_isSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); - } - break; - case 4: // JSON_CONF - if (field.type == org.apache.thrift.protocol.TType.STRING) { - this.json_conf = iprot.readString(); - } 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(); - 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.inputs != null) { - oprot.writeFieldBegin(INPUTS_FIELD_DESC); - { - oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRUCT, org.apache.thrift.protocol.TType.STRUCT, this.inputs.size())); - for (Map.Entry<GlobalStreamId, Grouping> _iter20 : this.inputs.entrySet()) - { - _iter20.getKey().write(oprot); - _iter20.getValue().write(oprot); - } - oprot.writeMapEnd(); - } - oprot.writeFieldEnd(); - } - if (this.streams != null) { - oprot.writeFieldBegin(STREAMS_FIELD_DESC); - { - oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRUCT, this.streams.size())); - for (Map.Entry<String, StreamInfo> _iter21 : this.streams.entrySet()) - { - oprot.writeString(_iter21.getKey()); - _iter21.getValue().write(oprot); - } - oprot.writeMapEnd(); - } - oprot.writeFieldEnd(); - } - if (is_set_parallelism_hint()) { - oprot.writeFieldBegin(PARALLELISM_HINT_FIELD_DESC); - oprot.writeI32(this.parallelism_hint); - oprot.writeFieldEnd(); - } - if (this.json_conf != null) { - if (is_set_json_conf()) { - oprot.writeFieldBegin(JSON_CONF_FIELD_DESC); - oprot.writeString(this.json_conf); - oprot.writeFieldEnd(); - } - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); } @Override @@ -700,6 +606,7 @@ public class ComponentCommon implements org.apache.thrift.TBase<ComponentCommon, throw new org.apache.thrift.protocol.TProtocolException("Required field 'streams' is unset! Struct:" + toString()); } + // check for sub-struct validity } private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { @@ -713,12 +620,233 @@ public class ComponentCommon implements org.apache.thrift.TBase<ComponentCommon, 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 ComponentCommonStandardSchemeFactory implements SchemeFactory { + public ComponentCommonStandardScheme getScheme() { + return new ComponentCommonStandardScheme(); + } + } + + private static class ComponentCommonStandardScheme extends StandardScheme<ComponentCommon> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, ComponentCommon 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: // INPUTS + if (schemeField.type == org.apache.thrift.protocol.TType.MAP) { + { + org.apache.thrift.protocol.TMap _map24 = iprot.readMapBegin(); + struct.inputs = new HashMap<GlobalStreamId,Grouping>(2*_map24.size); + GlobalStreamId _key25; + Grouping _val26; + for (int _i27 = 0; _i27 < _map24.size; ++_i27) + { + _key25 = new GlobalStreamId(); + _key25.read(iprot); + _val26 = new Grouping(); + _val26.read(iprot); + struct.inputs.put(_key25, _val26); + } + iprot.readMapEnd(); + } + struct.set_inputs_isSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // STREAMS + if (schemeField.type == org.apache.thrift.protocol.TType.MAP) { + { + org.apache.thrift.protocol.TMap _map28 = iprot.readMapBegin(); + struct.streams = new HashMap<String,StreamInfo>(2*_map28.size); + String _key29; + StreamInfo _val30; + for (int _i31 = 0; _i31 < _map28.size; ++_i31) + { + _key29 = iprot.readString(); + _val30 = new StreamInfo(); + _val30.read(iprot); + struct.streams.put(_key29, _val30); + } + iprot.readMapEnd(); + } + struct.set_streams_isSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 3: // PARALLELISM_HINT + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.parallelism_hint = iprot.readI32(); + struct.set_parallelism_hint_isSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 4: // JSON_CONF + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.json_conf = iprot.readString(); + struct.set_json_conf_isSet(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(); + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, ComponentCommon struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.inputs != null) { + oprot.writeFieldBegin(INPUTS_FIELD_DESC); + { + oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRUCT, org.apache.thrift.protocol.TType.STRUCT, struct.inputs.size())); + for (Map.Entry<GlobalStreamId, Grouping> _iter32 : struct.inputs.entrySet()) + { + _iter32.getKey().write(oprot); + _iter32.getValue().write(oprot); + } + oprot.writeMapEnd(); + } + oprot.writeFieldEnd(); + } + if (struct.streams != null) { + oprot.writeFieldBegin(STREAMS_FIELD_DESC); + { + oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRUCT, struct.streams.size())); + for (Map.Entry<String, StreamInfo> _iter33 : struct.streams.entrySet()) + { + oprot.writeString(_iter33.getKey()); + _iter33.getValue().write(oprot); + } + oprot.writeMapEnd(); + } + oprot.writeFieldEnd(); + } + if (struct.is_set_parallelism_hint()) { + oprot.writeFieldBegin(PARALLELISM_HINT_FIELD_DESC); + oprot.writeI32(struct.parallelism_hint); + oprot.writeFieldEnd(); + } + if (struct.json_conf != null) { + if (struct.is_set_json_conf()) { + oprot.writeFieldBegin(JSON_CONF_FIELD_DESC); + oprot.writeString(struct.json_conf); + oprot.writeFieldEnd(); + } + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class ComponentCommonTupleSchemeFactory implements SchemeFactory { + public ComponentCommonTupleScheme getScheme() { + return new ComponentCommonTupleScheme(); + } + } + + private static class ComponentCommonTupleScheme extends TupleScheme<ComponentCommon> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, ComponentCommon struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + { + oprot.writeI32(struct.inputs.size()); + for (Map.Entry<GlobalStreamId, Grouping> _iter34 : struct.inputs.entrySet()) + { + _iter34.getKey().write(oprot); + _iter34.getValue().write(oprot); + } + } + { + oprot.writeI32(struct.streams.size()); + for (Map.Entry<String, StreamInfo> _iter35 : struct.streams.entrySet()) + { + oprot.writeString(_iter35.getKey()); + _iter35.getValue().write(oprot); + } + } + BitSet optionals = new BitSet(); + if (struct.is_set_parallelism_hint()) { + optionals.set(0); + } + if (struct.is_set_json_conf()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.is_set_parallelism_hint()) { + oprot.writeI32(struct.parallelism_hint); + } + if (struct.is_set_json_conf()) { + oprot.writeString(struct.json_conf); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, ComponentCommon struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + { + org.apache.thrift.protocol.TMap _map36 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRUCT, org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.inputs = new HashMap<GlobalStreamId,Grouping>(2*_map36.size); + GlobalStreamId _key37; + Grouping _val38; + for (int _i39 = 0; _i39 < _map36.size; ++_i39) + { + _key37 = new GlobalStreamId(); + _key37.read(iprot); + _val38 = new Grouping(); + _val38.read(iprot); + struct.inputs.put(_key37, _val38); + } + } + struct.set_inputs_isSet(true); + { + org.apache.thrift.protocol.TMap _map40 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.streams = new HashMap<String,StreamInfo>(2*_map40.size); + String _key41; + StreamInfo _val42; + for (int _i43 = 0; _i43 < _map40.size; ++_i43) + { + _key41 = iprot.readString(); + _val42 = new StreamInfo(); + _val42.read(iprot); + struct.streams.put(_key41, _val42); + } + } + struct.set_streams_isSet(true); + BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.parallelism_hint = iprot.readI32(); + struct.set_parallelism_hint_isSet(true); + } + if (incoming.get(1)) { + struct.json_conf = iprot.readString(); + struct.set_json_conf_isSet(true); + } + } + } + }
http://git-wip-us.apache.org/repos/asf/storm/blob/ef51dbee/storm-core/src/jvm/backtype/storm/generated/ComponentObject.java ---------------------------------------------------------------------- diff --git a/storm-core/src/jvm/backtype/storm/generated/ComponentObject.java b/storm-core/src/jvm/backtype/storm/generated/ComponentObject.java index 8581ef7..575069f 100644 --- a/storm-core/src/jvm/backtype/storm/generated/ComponentObject.java +++ b/storm-core/src/jvm/backtype/storm/generated/ComponentObject.java @@ -16,13 +16,24 @@ * limitations under the License. */ /** - * Autogenerated by Thrift Compiler (0.7.0) + * Autogenerated by Thrift Compiler (0.9.2) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated */ package backtype.storm.generated; -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; @@ -35,9 +46,11 @@ 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"}) public class ComponentObject extends org.apache.thrift.TUnion<ComponentObject, ComponentObject._Fields> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ComponentObject"); private static final org.apache.thrift.protocol.TField SERIALIZED_JAVA_FIELD_DESC = new org.apache.thrift.protocol.TField("serialized_java", org.apache.thrift.protocol.TType.STRING, (short)1); @@ -144,7 +157,7 @@ public class ComponentObject extends org.apache.thrift.TUnion<ComponentObject, C public static ComponentObject serialized_java(byte[] value) { ComponentObject x = new ComponentObject(); - x.set_serialized_java(ByteBuffer.wrap(value)); + x.set_serialized_java(ByteBuffer.wrap(Arrays.copyOf(value, value.length))); return x; } @@ -185,7 +198,7 @@ public class ComponentObject extends org.apache.thrift.TUnion<ComponentObject, C } @Override - protected Object readValue(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TField field) throws org.apache.thrift.TException { + protected Object standardSchemeReadValue(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TField field) throws org.apache.thrift.TException { _Fields setField = _Fields.findByThriftId(field.id); if (setField != null) { switch (setField) { @@ -228,7 +241,54 @@ public class ComponentObject extends org.apache.thrift.TUnion<ComponentObject, C } @Override - protected void writeValue(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { + protected void standardSchemeWriteValue(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { + switch (setField_) { + case SERIALIZED_JAVA: + ByteBuffer serialized_java = (ByteBuffer)value_; + oprot.writeBinary(serialized_java); + return; + case SHELL: + ShellComponent shell = (ShellComponent)value_; + shell.write(oprot); + return; + case JAVA_OBJECT: + JavaObject java_object = (JavaObject)value_; + java_object.write(oprot); + return; + default: + throw new IllegalStateException("Cannot write union with unknown field " + setField_); + } + } + + @Override + protected Object tupleSchemeReadValue(org.apache.thrift.protocol.TProtocol iprot, short fieldID) throws org.apache.thrift.TException { + _Fields setField = _Fields.findByThriftId(fieldID); + if (setField != null) { + switch (setField) { + case SERIALIZED_JAVA: + ByteBuffer serialized_java; + serialized_java = iprot.readBinary(); + return serialized_java; + case SHELL: + ShellComponent shell; + shell = new ShellComponent(); + shell.read(iprot); + return shell; + case JAVA_OBJECT: + JavaObject java_object; + java_object = new JavaObject(); + java_object.read(iprot); + return java_object; + default: + throw new IllegalStateException("setField wasn't null, but didn't match any of the case statements!"); + } + } else { + throw new TProtocolException("Couldn't find a field with field id " + fieldID); + } + } + + @Override + protected void tupleSchemeWriteValue(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { switch (setField_) { case SERIALIZED_JAVA: ByteBuffer serialized_java = (ByteBuffer)value_; @@ -284,14 +344,14 @@ public class ComponentObject extends org.apache.thrift.TUnion<ComponentObject, C public ByteBuffer buffer_for_serialized_java() { if (getSetField() == _Fields.SERIALIZED_JAVA) { - return (ByteBuffer)getFieldValue(); + return org.apache.thrift.TBaseHelper.copyBinary((ByteBuffer)getFieldValue()); } else { throw new RuntimeException("Cannot get field 'serialized_java' because union is currently set to " + getFieldDesc(getSetField()).name); } } public void set_serialized_java(byte[] value) { - set_serialized_java(ByteBuffer.wrap(value)); + set_serialized_java(ByteBuffer.wrap(Arrays.copyOf(value, value.length))); } public void set_serialized_java(ByteBuffer value) { @@ -367,19 +427,19 @@ public class ComponentObject extends org.apache.thrift.TUnion<ComponentObject, C @Override public int hashCode() { - HashCodeBuilder hcb = new HashCodeBuilder(); - hcb.append(this.getClass().getName()); + List<Object> list = new ArrayList<Object>(); + list.add(this.getClass().getName()); org.apache.thrift.TFieldIdEnum setField = getSetField(); if (setField != null) { - hcb.append(setField.getThriftFieldId()); + list.add(setField.getThriftFieldId()); Object value = getFieldValue(); if (value instanceof org.apache.thrift.TEnum) { - hcb.append(((org.apache.thrift.TEnum)getFieldValue()).getValue()); + list.add(((org.apache.thrift.TEnum)getFieldValue()).getValue()); } else { - hcb.append(value); + list.add(value); } } - return hcb.toHashCode(); + return list.hashCode(); } private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { try { http://git-wip-us.apache.org/repos/asf/storm/blob/ef51dbee/storm-core/src/jvm/backtype/storm/generated/Credentials.java ---------------------------------------------------------------------- diff --git a/storm-core/src/jvm/backtype/storm/generated/Credentials.java b/storm-core/src/jvm/backtype/storm/generated/Credentials.java index c4563a7..50d63a9 100644 --- a/storm-core/src/jvm/backtype/storm/generated/Credentials.java +++ b/storm-core/src/jvm/backtype/storm/generated/Credentials.java @@ -16,13 +16,24 @@ * limitations under the License. */ /** - * Autogenerated by Thrift Compiler (0.7.0) + * Autogenerated by Thrift Compiler (0.9.2) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated */ package backtype.storm.generated; -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; @@ -35,14 +46,23 @@ 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 Credentials implements org.apache.thrift.TBase<Credentials, Credentials._Fields>, java.io.Serializable, Cloneable { +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) +@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2015-2-2") +public class Credentials implements org.apache.thrift.TBase<Credentials, Credentials._Fields>, java.io.Serializable, Cloneable, Comparable<Credentials> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("Credentials"); private static final org.apache.thrift.protocol.TField CREDS_FIELD_DESC = new org.apache.thrift.protocol.TField("creds", org.apache.thrift.protocol.TType.MAP, (short)1); + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new CredentialsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new CredentialsTupleSchemeFactory()); + } + private Map<String,String> creds; // required /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ @@ -104,7 +124,6 @@ public class Credentials implements org.apache.thrift.TBase<Credentials, Credent } // 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); @@ -131,18 +150,7 @@ public class Credentials implements org.apache.thrift.TBase<Credentials, Credent */ public Credentials(Credentials other) { if (other.is_set_creds()) { - Map<String,String> __this__creds = new HashMap<String,String>(); - for (Map.Entry<String, String> other_element : other.creds.entrySet()) { - - String other_element_key = other_element.getKey(); - String other_element_value = other_element.getValue(); - - String __this__creds_copy_key = other_element_key; - - String __this__creds_copy_value = other_element_value; - - __this__creds.put(__this__creds_copy_key, __this__creds_copy_value); - } + Map<String,String> __this__creds = new HashMap<String,String>(other.creds); this.creds = __this__creds; } } @@ -252,30 +260,30 @@ public class Credentials implements org.apache.thrift.TBase<Credentials, Credent @Override public int hashCode() { - HashCodeBuilder builder = new HashCodeBuilder(); + List<Object> list = new ArrayList<Object>(); boolean present_creds = true && (is_set_creds()); - builder.append(present_creds); + list.add(present_creds); if (present_creds) - builder.append(creds); + list.add(creds); - return builder.toHashCode(); + return list.hashCode(); } + @Override public int compareTo(Credentials other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; - Credentials typedOther = (Credentials)other; - lastComparison = Boolean.valueOf(is_set_creds()).compareTo(typedOther.is_set_creds()); + lastComparison = Boolean.valueOf(is_set_creds()).compareTo(other.is_set_creds()); if (lastComparison != 0) { return lastComparison; } if (is_set_creds()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.creds, typedOther.creds); + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.creds, other.creds); if (lastComparison != 0) { return lastComparison; } @@ -288,62 +296,11 @@ public class Credentials implements org.apache.thrift.TBase<Credentials, Credent } 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: // CREDS - if (field.type == org.apache.thrift.protocol.TType.MAP) { - { - org.apache.thrift.protocol.TMap _map163 = iprot.readMapBegin(); - this.creds = new HashMap<String,String>(2*_map163.size); - for (int _i164 = 0; _i164 < _map163.size; ++_i164) - { - String _key165; // required - String _val166; // required - _key165 = iprot.readString(); - _val166 = iprot.readString(); - this.creds.put(_key165, _val166); - } - 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(); - 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.creds != null) { - oprot.writeFieldBegin(CREDS_FIELD_DESC); - { - oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, this.creds.size())); - for (Map.Entry<String, String> _iter167 : this.creds.entrySet()) - { - oprot.writeString(_iter167.getKey()); - oprot.writeString(_iter167.getValue()); - } - oprot.writeMapEnd(); - } - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); } @Override @@ -368,6 +325,7 @@ public class Credentials implements org.apache.thrift.TBase<Credentials, Credent throw new org.apache.thrift.protocol.TProtocolException("Required field 'creds' is unset! Struct:" + toString()); } + // check for sub-struct validity } private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { @@ -386,5 +344,115 @@ public class Credentials implements org.apache.thrift.TBase<Credentials, Credent } } + private static class CredentialsStandardSchemeFactory implements SchemeFactory { + public CredentialsStandardScheme getScheme() { + return new CredentialsStandardScheme(); + } + } + + private static class CredentialsStandardScheme extends StandardScheme<Credentials> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, Credentials 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: // CREDS + if (schemeField.type == org.apache.thrift.protocol.TType.MAP) { + { + org.apache.thrift.protocol.TMap _map326 = iprot.readMapBegin(); + struct.creds = new HashMap<String,String>(2*_map326.size); + String _key327; + String _val328; + for (int _i329 = 0; _i329 < _map326.size; ++_i329) + { + _key327 = iprot.readString(); + _val328 = iprot.readString(); + struct.creds.put(_key327, _val328); + } + iprot.readMapEnd(); + } + struct.set_creds_isSet(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(); + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, Credentials struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.creds != null) { + oprot.writeFieldBegin(CREDS_FIELD_DESC); + { + oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, struct.creds.size())); + for (Map.Entry<String, String> _iter330 : struct.creds.entrySet()) + { + oprot.writeString(_iter330.getKey()); + oprot.writeString(_iter330.getValue()); + } + oprot.writeMapEnd(); + } + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class CredentialsTupleSchemeFactory implements SchemeFactory { + public CredentialsTupleScheme getScheme() { + return new CredentialsTupleScheme(); + } + } + + private static class CredentialsTupleScheme extends TupleScheme<Credentials> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, Credentials struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + { + oprot.writeI32(struct.creds.size()); + for (Map.Entry<String, String> _iter331 : struct.creds.entrySet()) + { + oprot.writeString(_iter331.getKey()); + oprot.writeString(_iter331.getValue()); + } + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, Credentials struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + { + org.apache.thrift.protocol.TMap _map332 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32()); + struct.creds = new HashMap<String,String>(2*_map332.size); + String _key333; + String _val334; + for (int _i335 = 0; _i335 < _map332.size; ++_i335) + { + _key333 = iprot.readString(); + _val334 = iprot.readString(); + struct.creds.put(_key333, _val334); + } + } + struct.set_creds_isSet(true); + } + } + } http://git-wip-us.apache.org/repos/asf/storm/blob/ef51dbee/storm-core/src/jvm/backtype/storm/generated/DRPCExecutionException.java ---------------------------------------------------------------------- diff --git a/storm-core/src/jvm/backtype/storm/generated/DRPCExecutionException.java b/storm-core/src/jvm/backtype/storm/generated/DRPCExecutionException.java index e40bd94..eb69200 100644 --- a/storm-core/src/jvm/backtype/storm/generated/DRPCExecutionException.java +++ b/storm-core/src/jvm/backtype/storm/generated/DRPCExecutionException.java @@ -16,13 +16,24 @@ * limitations under the License. */ /** - * Autogenerated by Thrift Compiler (0.7.0) + * Autogenerated by Thrift Compiler (0.9.2) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated */ package backtype.storm.generated; -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; @@ -35,14 +46,23 @@ 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 DRPCExecutionException extends Exception implements org.apache.thrift.TBase<DRPCExecutionException, DRPCExecutionException._Fields>, java.io.Serializable, Cloneable { +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) +@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2015-2-2") +public class DRPCExecutionException extends TException implements org.apache.thrift.TBase<DRPCExecutionException, DRPCExecutionException._Fields>, java.io.Serializable, Cloneable, Comparable<DRPCExecutionException> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("DRPCExecutionException"); private static final org.apache.thrift.protocol.TField MSG_FIELD_DESC = new org.apache.thrift.protocol.TField("msg", org.apache.thrift.protocol.TType.STRING, (short)1); + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new DRPCExecutionExceptionStandardSchemeFactory()); + schemes.put(TupleScheme.class, new DRPCExecutionExceptionTupleSchemeFactory()); + } + private String msg; // required /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ @@ -104,7 +124,6 @@ public class DRPCExecutionException extends Exception implements org.apache.thri } // 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); @@ -227,30 +246,30 @@ public class DRPCExecutionException extends Exception implements org.apache.thri @Override public int hashCode() { - HashCodeBuilder builder = new HashCodeBuilder(); + List<Object> list = new ArrayList<Object>(); boolean present_msg = true && (is_set_msg()); - builder.append(present_msg); + list.add(present_msg); if (present_msg) - builder.append(msg); + list.add(msg); - return builder.toHashCode(); + return list.hashCode(); } + @Override public int compareTo(DRPCExecutionException other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; - DRPCExecutionException typedOther = (DRPCExecutionException)other; - lastComparison = Boolean.valueOf(is_set_msg()).compareTo(typedOther.is_set_msg()); + lastComparison = Boolean.valueOf(is_set_msg()).compareTo(other.is_set_msg()); if (lastComparison != 0) { return lastComparison; } if (is_set_msg()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.msg, typedOther.msg); + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.msg, other.msg); if (lastComparison != 0) { return lastComparison; } @@ -263,42 +282,11 @@ public class DRPCExecutionException extends Exception implements org.apache.thri } 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: // MSG - if (field.type == org.apache.thrift.protocol.TType.STRING) { - this.msg = iprot.readString(); - } 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(); - 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.msg != null) { - oprot.writeFieldBegin(MSG_FIELD_DESC); - oprot.writeString(this.msg); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); } @Override @@ -323,6 +311,7 @@ public class DRPCExecutionException extends Exception implements org.apache.thri throw new org.apache.thrift.protocol.TProtocolException("Required field 'msg' is unset! Struct:" + toString()); } + // check for sub-struct validity } private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { @@ -341,5 +330,77 @@ public class DRPCExecutionException extends Exception implements org.apache.thri } } + private static class DRPCExecutionExceptionStandardSchemeFactory implements SchemeFactory { + public DRPCExecutionExceptionStandardScheme getScheme() { + return new DRPCExecutionExceptionStandardScheme(); + } + } + + private static class DRPCExecutionExceptionStandardScheme extends StandardScheme<DRPCExecutionException> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, DRPCExecutionException 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: // MSG + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.msg = iprot.readString(); + struct.set_msg_isSet(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(); + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, DRPCExecutionException struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.msg != null) { + oprot.writeFieldBegin(MSG_FIELD_DESC); + oprot.writeString(struct.msg); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class DRPCExecutionExceptionTupleSchemeFactory implements SchemeFactory { + public DRPCExecutionExceptionTupleScheme getScheme() { + return new DRPCExecutionExceptionTupleScheme(); + } + } + + private static class DRPCExecutionExceptionTupleScheme extends TupleScheme<DRPCExecutionException> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, DRPCExecutionException struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + oprot.writeString(struct.msg); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, DRPCExecutionException struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + struct.msg = iprot.readString(); + struct.set_msg_isSet(true); + } + } + } http://git-wip-us.apache.org/repos/asf/storm/blob/ef51dbee/storm-core/src/jvm/backtype/storm/generated/DRPCRequest.java ---------------------------------------------------------------------- diff --git a/storm-core/src/jvm/backtype/storm/generated/DRPCRequest.java b/storm-core/src/jvm/backtype/storm/generated/DRPCRequest.java index 3b0a660..df8aa84 100644 --- a/storm-core/src/jvm/backtype/storm/generated/DRPCRequest.java +++ b/storm-core/src/jvm/backtype/storm/generated/DRPCRequest.java @@ -16,13 +16,24 @@ * limitations under the License. */ /** - * Autogenerated by Thrift Compiler (0.7.0) + * Autogenerated by Thrift Compiler (0.9.2) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated */ package backtype.storm.generated; -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; @@ -35,15 +46,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 DRPCRequest implements org.apache.thrift.TBase<DRPCRequest, DRPCRequest._Fields>, java.io.Serializable, Cloneable { +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) +@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2015-2-2") +public class DRPCRequest implements org.apache.thrift.TBase<DRPCRequest, DRPCRequest._Fields>, java.io.Serializable, Cloneable, Comparable<DRPCRequest> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("DRPCRequest"); private static final org.apache.thrift.protocol.TField FUNC_ARGS_FIELD_DESC = new org.apache.thrift.protocol.TField("func_args", org.apache.thrift.protocol.TType.STRING, (short)1); private static final org.apache.thrift.protocol.TField REQUEST_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("request_id", 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 DRPCRequestStandardSchemeFactory()); + schemes.put(TupleScheme.class, new DRPCRequestTupleSchemeFactory()); + } + private String func_args; // required private String request_id; // required @@ -109,7 +129,6 @@ public class DRPCRequest implements org.apache.thrift.TBase<DRPCRequest, DRPCReq } // 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); @@ -285,45 +304,45 @@ public class DRPCRequest implements org.apache.thrift.TBase<DRPCRequest, DRPCReq @Override public int hashCode() { - HashCodeBuilder builder = new HashCodeBuilder(); + List<Object> list = new ArrayList<Object>(); boolean present_func_args = true && (is_set_func_args()); - builder.append(present_func_args); + list.add(present_func_args); if (present_func_args) - builder.append(func_args); + list.add(func_args); boolean present_request_id = true && (is_set_request_id()); - builder.append(present_request_id); + list.add(present_request_id); if (present_request_id) - builder.append(request_id); + list.add(request_id); - return builder.toHashCode(); + return list.hashCode(); } + @Override public int compareTo(DRPCRequest other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; - DRPCRequest typedOther = (DRPCRequest)other; - lastComparison = Boolean.valueOf(is_set_func_args()).compareTo(typedOther.is_set_func_args()); + lastComparison = Boolean.valueOf(is_set_func_args()).compareTo(other.is_set_func_args()); if (lastComparison != 0) { return lastComparison; } if (is_set_func_args()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.func_args, typedOther.func_args); + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.func_args, other.func_args); if (lastComparison != 0) { return lastComparison; } } - lastComparison = Boolean.valueOf(is_set_request_id()).compareTo(typedOther.is_set_request_id()); + lastComparison = Boolean.valueOf(is_set_request_id()).compareTo(other.is_set_request_id()); if (lastComparison != 0) { return lastComparison; } if (is_set_request_id()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.request_id, typedOther.request_id); + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.request_id, other.request_id); if (lastComparison != 0) { return lastComparison; } @@ -336,54 +355,11 @@ public class DRPCRequest implements org.apache.thrift.TBase<DRPCRequest, DRPCReq } 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: // FUNC_ARGS - if (field.type == org.apache.thrift.protocol.TType.STRING) { - this.func_args = iprot.readString(); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); - } - break; - case 2: // REQUEST_ID - if (field.type == org.apache.thrift.protocol.TType.STRING) { - this.request_id = iprot.readString(); - } 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(); - 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.func_args != null) { - oprot.writeFieldBegin(FUNC_ARGS_FIELD_DESC); - oprot.writeString(this.func_args); - oprot.writeFieldEnd(); - } - if (this.request_id != null) { - oprot.writeFieldBegin(REQUEST_ID_FIELD_DESC); - oprot.writeString(this.request_id); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); } @Override @@ -420,6 +396,7 @@ public class DRPCRequest implements org.apache.thrift.TBase<DRPCRequest, DRPCReq throw new org.apache.thrift.protocol.TProtocolException("Required field 'request_id' is unset! Struct:" + toString()); } + // check for sub-struct validity } private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { @@ -438,5 +415,93 @@ public class DRPCRequest implements org.apache.thrift.TBase<DRPCRequest, DRPCReq } } + private static class DRPCRequestStandardSchemeFactory implements SchemeFactory { + public DRPCRequestStandardScheme getScheme() { + return new DRPCRequestStandardScheme(); + } + } + + private static class DRPCRequestStandardScheme extends StandardScheme<DRPCRequest> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, DRPCRequest 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: // FUNC_ARGS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.func_args = iprot.readString(); + struct.set_func_args_isSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // REQUEST_ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.request_id = iprot.readString(); + struct.set_request_id_isSet(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(); + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, DRPCRequest struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.func_args != null) { + oprot.writeFieldBegin(FUNC_ARGS_FIELD_DESC); + oprot.writeString(struct.func_args); + oprot.writeFieldEnd(); + } + if (struct.request_id != null) { + oprot.writeFieldBegin(REQUEST_ID_FIELD_DESC); + oprot.writeString(struct.request_id); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class DRPCRequestTupleSchemeFactory implements SchemeFactory { + public DRPCRequestTupleScheme getScheme() { + return new DRPCRequestTupleScheme(); + } + } + + private static class DRPCRequestTupleScheme extends TupleScheme<DRPCRequest> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, DRPCRequest struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + oprot.writeString(struct.func_args); + oprot.writeString(struct.request_id); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, DRPCRequest struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + struct.func_args = iprot.readString(); + struct.set_func_args_isSet(true); + struct.request_id = iprot.readString(); + struct.set_request_id_isSet(true); + } + } + }
