http://git-wip-us.apache.org/repos/asf/storm/blob/ef51dbee/storm-core/src/jvm/backtype/storm/generated/NotAliveException.java ---------------------------------------------------------------------- diff --git a/storm-core/src/jvm/backtype/storm/generated/NotAliveException.java b/storm-core/src/jvm/backtype/storm/generated/NotAliveException.java index ce03d91..1337697 100644 --- a/storm-core/src/jvm/backtype/storm/generated/NotAliveException.java +++ b/storm-core/src/jvm/backtype/storm/generated/NotAliveException.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 NotAliveException extends Exception implements org.apache.thrift.TBase<NotAliveException, NotAliveException._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 NotAliveException extends TException implements org.apache.thrift.TBase<NotAliveException, NotAliveException._Fields>, java.io.Serializable, Cloneable, Comparable<NotAliveException> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("NotAliveException"); 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 NotAliveExceptionStandardSchemeFactory()); + schemes.put(TupleScheme.class, new NotAliveExceptionTupleSchemeFactory()); + } + 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 NotAliveException extends Exception implements org.apache.thrift.TB } // 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 NotAliveException extends Exception implements org.apache.thrift.TB @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(NotAliveException other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; - NotAliveException typedOther = (NotAliveException)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 NotAliveException extends Exception implements org.apache.thrift.TB } 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 NotAliveException extends Exception implements org.apache.thrift.TB 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 NotAliveException extends Exception implements org.apache.thrift.TB } } + private static class NotAliveExceptionStandardSchemeFactory implements SchemeFactory { + public NotAliveExceptionStandardScheme getScheme() { + return new NotAliveExceptionStandardScheme(); + } + } + + private static class NotAliveExceptionStandardScheme extends StandardScheme<NotAliveException> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, NotAliveException 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, NotAliveException 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 NotAliveExceptionTupleSchemeFactory implements SchemeFactory { + public NotAliveExceptionTupleScheme getScheme() { + return new NotAliveExceptionTupleScheme(); + } + } + + private static class NotAliveExceptionTupleScheme extends TupleScheme<NotAliveException> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, NotAliveException struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + oprot.writeString(struct.msg); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, NotAliveException 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/NullStruct.java ---------------------------------------------------------------------- diff --git a/storm-core/src/jvm/backtype/storm/generated/NullStruct.java b/storm-core/src/jvm/backtype/storm/generated/NullStruct.java index 960c3b2..c72112e 100644 --- a/storm-core/src/jvm/backtype/storm/generated/NullStruct.java +++ b/storm-core/src/jvm/backtype/storm/generated/NullStruct.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,13 +46,22 @@ 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 NullStruct implements org.apache.thrift.TBase<NullStruct, NullStruct._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 NullStruct implements org.apache.thrift.TBase<NullStruct, NullStruct._Fields>, java.io.Serializable, Cloneable, Comparable<NullStruct> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("NullStruct"); + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new NullStructStandardSchemeFactory()); + schemes.put(TupleScheme.class, new NullStructTupleSchemeFactory()); + } + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements org.apache.thrift.TFieldIdEnum { @@ -162,18 +182,18 @@ public class NullStruct implements org.apache.thrift.TBase<NullStruct, NullStruc @Override public int hashCode() { - HashCodeBuilder builder = new HashCodeBuilder(); + List<Object> list = new ArrayList<Object>(); - return builder.toHashCode(); + return list.hashCode(); } + @Override public int compareTo(NullStruct other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; - NullStruct typedOther = (NullStruct)other; return 0; } @@ -183,30 +203,11 @@ public class NullStruct implements org.apache.thrift.TBase<NullStruct, NullStruc } 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(); - 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 @@ -220,6 +221,7 @@ public class NullStruct implements org.apache.thrift.TBase<NullStruct, NullStruc 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 { @@ -238,5 +240,61 @@ public class NullStruct implements org.apache.thrift.TBase<NullStruct, NullStruc } } + private static class NullStructStandardSchemeFactory implements SchemeFactory { + public NullStructStandardScheme getScheme() { + return new NullStructStandardScheme(); + } + } + + private static class NullStructStandardScheme extends StandardScheme<NullStruct> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, NullStruct 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(); + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, NullStruct struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class NullStructTupleSchemeFactory implements SchemeFactory { + public NullStructTupleScheme getScheme() { + return new NullStructTupleScheme(); + } + } + + private static class NullStructTupleScheme extends TupleScheme<NullStruct> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, NullStruct struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, NullStruct struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + } + } + } http://git-wip-us.apache.org/repos/asf/storm/blob/ef51dbee/storm-core/src/jvm/backtype/storm/generated/RebalanceOptions.java ---------------------------------------------------------------------- diff --git a/storm-core/src/jvm/backtype/storm/generated/RebalanceOptions.java b/storm-core/src/jvm/backtype/storm/generated/RebalanceOptions.java index 9f3cbf1..690428d 100644 --- a/storm-core/src/jvm/backtype/storm/generated/RebalanceOptions.java +++ b/storm-core/src/jvm/backtype/storm/generated/RebalanceOptions.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,19 +46,28 @@ 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 RebalanceOptions implements org.apache.thrift.TBase<RebalanceOptions, RebalanceOptions._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 RebalanceOptions implements org.apache.thrift.TBase<RebalanceOptions, RebalanceOptions._Fields>, java.io.Serializable, Cloneable, Comparable<RebalanceOptions> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("RebalanceOptions"); private static final org.apache.thrift.protocol.TField WAIT_SECS_FIELD_DESC = new org.apache.thrift.protocol.TField("wait_secs", org.apache.thrift.protocol.TType.I32, (short)1); private static final org.apache.thrift.protocol.TField NUM_WORKERS_FIELD_DESC = new org.apache.thrift.protocol.TField("num_workers", org.apache.thrift.protocol.TType.I32, (short)2); private static final org.apache.thrift.protocol.TField NUM_EXECUTORS_FIELD_DESC = new org.apache.thrift.protocol.TField("num_executors", org.apache.thrift.protocol.TType.MAP, (short)3); - private int wait_secs; // required - private int num_workers; // required - private Map<String,Integer> num_executors; // required + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new RebalanceOptionsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new RebalanceOptionsTupleSchemeFactory()); + } + + private int wait_secs; // optional + private int num_workers; // optional + private Map<String,Integer> num_executors; // 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 { @@ -116,8 +136,8 @@ public class RebalanceOptions implements org.apache.thrift.TBase<RebalanceOption // isset id assignments private static final int __WAIT_SECS_ISSET_ID = 0; private static final int __NUM_WORKERS_ISSET_ID = 1; - private BitSet __isset_bit_vector = new BitSet(2); - + private byte __isset_bitfield = 0; + private static final _Fields optionals[] = {_Fields.WAIT_SECS,_Fields.NUM_WORKERS,_Fields.NUM_EXECUTORS}; 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); @@ -140,23 +160,11 @@ public class RebalanceOptions implements org.apache.thrift.TBase<RebalanceOption * Performs a deep copy on <i>other</i>. */ public RebalanceOptions(RebalanceOptions other) { - __isset_bit_vector.clear(); - __isset_bit_vector.or(other.__isset_bit_vector); + __isset_bitfield = other.__isset_bitfield; this.wait_secs = other.wait_secs; this.num_workers = other.num_workers; if (other.is_set_num_executors()) { - Map<String,Integer> __this__num_executors = new HashMap<String,Integer>(); - for (Map.Entry<String, Integer> other_element : other.num_executors.entrySet()) { - - String other_element_key = other_element.getKey(); - Integer other_element_value = other_element.getValue(); - - String __this__num_executors_copy_key = other_element_key; - - Integer __this__num_executors_copy_value = other_element_value; - - __this__num_executors.put(__this__num_executors_copy_key, __this__num_executors_copy_value); - } + Map<String,Integer> __this__num_executors = new HashMap<String,Integer>(other.num_executors); this.num_executors = __this__num_executors; } } @@ -184,16 +192,16 @@ public class RebalanceOptions implements org.apache.thrift.TBase<RebalanceOption } public void unset_wait_secs() { - __isset_bit_vector.clear(__WAIT_SECS_ISSET_ID); + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __WAIT_SECS_ISSET_ID); } /** Returns true if field wait_secs is set (has been assigned a value) and false otherwise */ public boolean is_set_wait_secs() { - return __isset_bit_vector.get(__WAIT_SECS_ISSET_ID); + return EncodingUtils.testBit(__isset_bitfield, __WAIT_SECS_ISSET_ID); } public void set_wait_secs_isSet(boolean value) { - __isset_bit_vector.set(__WAIT_SECS_ISSET_ID, value); + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __WAIT_SECS_ISSET_ID, value); } public int get_num_workers() { @@ -206,16 +214,16 @@ public class RebalanceOptions implements org.apache.thrift.TBase<RebalanceOption } public void unset_num_workers() { - __isset_bit_vector.clear(__NUM_WORKERS_ISSET_ID); + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __NUM_WORKERS_ISSET_ID); } /** Returns true if field num_workers is set (has been assigned a value) and false otherwise */ public boolean is_set_num_workers() { - return __isset_bit_vector.get(__NUM_WORKERS_ISSET_ID); + return EncodingUtils.testBit(__isset_bitfield, __NUM_WORKERS_ISSET_ID); } public void set_num_workers_isSet(boolean value) { - __isset_bit_vector.set(__NUM_WORKERS_ISSET_ID, value); + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __NUM_WORKERS_ISSET_ID, value); } public int get_num_executors_size() { @@ -358,60 +366,60 @@ public class RebalanceOptions implements org.apache.thrift.TBase<RebalanceOption @Override public int hashCode() { - HashCodeBuilder builder = new HashCodeBuilder(); + List<Object> list = new ArrayList<Object>(); boolean present_wait_secs = true && (is_set_wait_secs()); - builder.append(present_wait_secs); + list.add(present_wait_secs); if (present_wait_secs) - builder.append(wait_secs); + list.add(wait_secs); boolean present_num_workers = true && (is_set_num_workers()); - builder.append(present_num_workers); + list.add(present_num_workers); if (present_num_workers) - builder.append(num_workers); + list.add(num_workers); boolean present_num_executors = true && (is_set_num_executors()); - builder.append(present_num_executors); + list.add(present_num_executors); if (present_num_executors) - builder.append(num_executors); + list.add(num_executors); - return builder.toHashCode(); + return list.hashCode(); } + @Override public int compareTo(RebalanceOptions other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; - RebalanceOptions typedOther = (RebalanceOptions)other; - lastComparison = Boolean.valueOf(is_set_wait_secs()).compareTo(typedOther.is_set_wait_secs()); + lastComparison = Boolean.valueOf(is_set_wait_secs()).compareTo(other.is_set_wait_secs()); if (lastComparison != 0) { return lastComparison; } if (is_set_wait_secs()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.wait_secs, typedOther.wait_secs); + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.wait_secs, other.wait_secs); if (lastComparison != 0) { return lastComparison; } } - lastComparison = Boolean.valueOf(is_set_num_workers()).compareTo(typedOther.is_set_num_workers()); + lastComparison = Boolean.valueOf(is_set_num_workers()).compareTo(other.is_set_num_workers()); if (lastComparison != 0) { return lastComparison; } if (is_set_num_workers()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.num_workers, typedOther.num_workers); + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.num_workers, other.num_workers); if (lastComparison != 0) { return lastComparison; } } - lastComparison = Boolean.valueOf(is_set_num_executors()).compareTo(typedOther.is_set_num_executors()); + lastComparison = Boolean.valueOf(is_set_num_executors()).compareTo(other.is_set_num_executors()); if (lastComparison != 0) { return lastComparison; } if (is_set_num_executors()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.num_executors, typedOther.num_executors); + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.num_executors, other.num_executors); if (lastComparison != 0) { return lastComparison; } @@ -424,90 +432,11 @@ public class RebalanceOptions implements org.apache.thrift.TBase<RebalanceOption } 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: // WAIT_SECS - if (field.type == org.apache.thrift.protocol.TType.I32) { - this.wait_secs = iprot.readI32(); - set_wait_secs_isSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); - } - break; - case 2: // NUM_WORKERS - if (field.type == org.apache.thrift.protocol.TType.I32) { - this.num_workers = iprot.readI32(); - set_num_workers_isSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); - } - break; - case 3: // NUM_EXECUTORS - if (field.type == org.apache.thrift.protocol.TType.MAP) { - { - org.apache.thrift.protocol.TMap _map158 = iprot.readMapBegin(); - this.num_executors = new HashMap<String,Integer>(2*_map158.size); - for (int _i159 = 0; _i159 < _map158.size; ++_i159) - { - String _key160; // required - int _val161; // required - _key160 = iprot.readString(); - _val161 = iprot.readI32(); - this.num_executors.put(_key160, _val161); - } - 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 (is_set_wait_secs()) { - oprot.writeFieldBegin(WAIT_SECS_FIELD_DESC); - oprot.writeI32(this.wait_secs); - oprot.writeFieldEnd(); - } - if (is_set_num_workers()) { - oprot.writeFieldBegin(NUM_WORKERS_FIELD_DESC); - oprot.writeI32(this.num_workers); - oprot.writeFieldEnd(); - } - if (this.num_executors != null) { - if (is_set_num_executors()) { - oprot.writeFieldBegin(NUM_EXECUTORS_FIELD_DESC); - { - oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.I32, this.num_executors.size())); - for (Map.Entry<String, Integer> _iter162 : this.num_executors.entrySet()) - { - oprot.writeString(_iter162.getKey()); - oprot.writeI32(_iter162.getValue()); - } - oprot.writeMapEnd(); - } - oprot.writeFieldEnd(); - } - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); } @Override @@ -542,6 +471,7 @@ public class RebalanceOptions implements org.apache.thrift.TBase<RebalanceOption 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 { @@ -555,12 +485,180 @@ public class RebalanceOptions implements org.apache.thrift.TBase<RebalanceOption 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 RebalanceOptionsStandardSchemeFactory implements SchemeFactory { + public RebalanceOptionsStandardScheme getScheme() { + return new RebalanceOptionsStandardScheme(); + } + } + + private static class RebalanceOptionsStandardScheme extends StandardScheme<RebalanceOptions> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, RebalanceOptions 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: // WAIT_SECS + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.wait_secs = iprot.readI32(); + struct.set_wait_secs_isSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // NUM_WORKERS + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.num_workers = iprot.readI32(); + struct.set_num_workers_isSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 3: // NUM_EXECUTORS + if (schemeField.type == org.apache.thrift.protocol.TType.MAP) { + { + org.apache.thrift.protocol.TMap _map316 = iprot.readMapBegin(); + struct.num_executors = new HashMap<String,Integer>(2*_map316.size); + String _key317; + int _val318; + for (int _i319 = 0; _i319 < _map316.size; ++_i319) + { + _key317 = iprot.readString(); + _val318 = iprot.readI32(); + struct.num_executors.put(_key317, _val318); + } + iprot.readMapEnd(); + } + struct.set_num_executors_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, RebalanceOptions struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.is_set_wait_secs()) { + oprot.writeFieldBegin(WAIT_SECS_FIELD_DESC); + oprot.writeI32(struct.wait_secs); + oprot.writeFieldEnd(); + } + if (struct.is_set_num_workers()) { + oprot.writeFieldBegin(NUM_WORKERS_FIELD_DESC); + oprot.writeI32(struct.num_workers); + oprot.writeFieldEnd(); + } + if (struct.num_executors != null) { + if (struct.is_set_num_executors()) { + oprot.writeFieldBegin(NUM_EXECUTORS_FIELD_DESC); + { + oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.I32, struct.num_executors.size())); + for (Map.Entry<String, Integer> _iter320 : struct.num_executors.entrySet()) + { + oprot.writeString(_iter320.getKey()); + oprot.writeI32(_iter320.getValue()); + } + oprot.writeMapEnd(); + } + oprot.writeFieldEnd(); + } + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class RebalanceOptionsTupleSchemeFactory implements SchemeFactory { + public RebalanceOptionsTupleScheme getScheme() { + return new RebalanceOptionsTupleScheme(); + } + } + + private static class RebalanceOptionsTupleScheme extends TupleScheme<RebalanceOptions> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, RebalanceOptions struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.is_set_wait_secs()) { + optionals.set(0); + } + if (struct.is_set_num_workers()) { + optionals.set(1); + } + if (struct.is_set_num_executors()) { + optionals.set(2); + } + oprot.writeBitSet(optionals, 3); + if (struct.is_set_wait_secs()) { + oprot.writeI32(struct.wait_secs); + } + if (struct.is_set_num_workers()) { + oprot.writeI32(struct.num_workers); + } + if (struct.is_set_num_executors()) { + { + oprot.writeI32(struct.num_executors.size()); + for (Map.Entry<String, Integer> _iter321 : struct.num_executors.entrySet()) + { + oprot.writeString(_iter321.getKey()); + oprot.writeI32(_iter321.getValue()); + } + } + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, RebalanceOptions struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(3); + if (incoming.get(0)) { + struct.wait_secs = iprot.readI32(); + struct.set_wait_secs_isSet(true); + } + if (incoming.get(1)) { + struct.num_workers = iprot.readI32(); + struct.set_num_workers_isSet(true); + } + if (incoming.get(2)) { + { + org.apache.thrift.protocol.TMap _map322 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.I32, iprot.readI32()); + struct.num_executors = new HashMap<String,Integer>(2*_map322.size); + String _key323; + int _val324; + for (int _i325 = 0; _i325 < _map322.size; ++_i325) + { + _key323 = iprot.readString(); + _val324 = iprot.readI32(); + struct.num_executors.put(_key323, _val324); + } + } + struct.set_num_executors_isSet(true); + } + } + } + } http://git-wip-us.apache.org/repos/asf/storm/blob/ef51dbee/storm-core/src/jvm/backtype/storm/generated/ShellComponent.java ---------------------------------------------------------------------- diff --git a/storm-core/src/jvm/backtype/storm/generated/ShellComponent.java b/storm-core/src/jvm/backtype/storm/generated/ShellComponent.java index 6390d5a..083294c 100644 --- a/storm-core/src/jvm/backtype/storm/generated/ShellComponent.java +++ b/storm-core/src/jvm/backtype/storm/generated/ShellComponent.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 ShellComponent implements org.apache.thrift.TBase<ShellComponent, ShellComponent._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 ShellComponent implements org.apache.thrift.TBase<ShellComponent, ShellComponent._Fields>, java.io.Serializable, Cloneable, Comparable<ShellComponent> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ShellComponent"); private static final org.apache.thrift.protocol.TField EXECUTION_COMMAND_FIELD_DESC = new org.apache.thrift.protocol.TField("execution_command", org.apache.thrift.protocol.TType.STRING, (short)1); private static final org.apache.thrift.protocol.TField SCRIPT_FIELD_DESC = new org.apache.thrift.protocol.TField("script", 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 ShellComponentStandardSchemeFactory()); + schemes.put(TupleScheme.class, new ShellComponentTupleSchemeFactory()); + } + private String execution_command; // required private String script; // required @@ -109,7 +129,6 @@ public class ShellComponent implements org.apache.thrift.TBase<ShellComponent, S } // 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 ShellComponent implements org.apache.thrift.TBase<ShellComponent, S @Override public int hashCode() { - HashCodeBuilder builder = new HashCodeBuilder(); + List<Object> list = new ArrayList<Object>(); boolean present_execution_command = true && (is_set_execution_command()); - builder.append(present_execution_command); + list.add(present_execution_command); if (present_execution_command) - builder.append(execution_command); + list.add(execution_command); boolean present_script = true && (is_set_script()); - builder.append(present_script); + list.add(present_script); if (present_script) - builder.append(script); + list.add(script); - return builder.toHashCode(); + return list.hashCode(); } + @Override public int compareTo(ShellComponent other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; - ShellComponent typedOther = (ShellComponent)other; - lastComparison = Boolean.valueOf(is_set_execution_command()).compareTo(typedOther.is_set_execution_command()); + lastComparison = Boolean.valueOf(is_set_execution_command()).compareTo(other.is_set_execution_command()); if (lastComparison != 0) { return lastComparison; } if (is_set_execution_command()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.execution_command, typedOther.execution_command); + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.execution_command, other.execution_command); if (lastComparison != 0) { return lastComparison; } } - lastComparison = Boolean.valueOf(is_set_script()).compareTo(typedOther.is_set_script()); + lastComparison = Boolean.valueOf(is_set_script()).compareTo(other.is_set_script()); if (lastComparison != 0) { return lastComparison; } if (is_set_script()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.script, typedOther.script); + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.script, other.script); if (lastComparison != 0) { return lastComparison; } @@ -336,54 +355,11 @@ public class ShellComponent implements org.apache.thrift.TBase<ShellComponent, S } 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: // EXECUTION_COMMAND - if (field.type == org.apache.thrift.protocol.TType.STRING) { - this.execution_command = iprot.readString(); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); - } - break; - case 2: // SCRIPT - if (field.type == org.apache.thrift.protocol.TType.STRING) { - this.script = 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.execution_command != null) { - oprot.writeFieldBegin(EXECUTION_COMMAND_FIELD_DESC); - oprot.writeString(this.execution_command); - oprot.writeFieldEnd(); - } - if (this.script != null) { - oprot.writeFieldBegin(SCRIPT_FIELD_DESC); - oprot.writeString(this.script); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); } @Override @@ -412,6 +388,7 @@ public class ShellComponent implements org.apache.thrift.TBase<ShellComponent, S 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 { @@ -430,5 +407,110 @@ public class ShellComponent implements org.apache.thrift.TBase<ShellComponent, S } } + private static class ShellComponentStandardSchemeFactory implements SchemeFactory { + public ShellComponentStandardScheme getScheme() { + return new ShellComponentStandardScheme(); + } + } + + private static class ShellComponentStandardScheme extends StandardScheme<ShellComponent> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, ShellComponent 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: // EXECUTION_COMMAND + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.execution_command = iprot.readString(); + struct.set_execution_command_isSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // SCRIPT + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.script = iprot.readString(); + struct.set_script_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, ShellComponent struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.execution_command != null) { + oprot.writeFieldBegin(EXECUTION_COMMAND_FIELD_DESC); + oprot.writeString(struct.execution_command); + oprot.writeFieldEnd(); + } + if (struct.script != null) { + oprot.writeFieldBegin(SCRIPT_FIELD_DESC); + oprot.writeString(struct.script); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class ShellComponentTupleSchemeFactory implements SchemeFactory { + public ShellComponentTupleScheme getScheme() { + return new ShellComponentTupleScheme(); + } + } + + private static class ShellComponentTupleScheme extends TupleScheme<ShellComponent> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, ShellComponent struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.is_set_execution_command()) { + optionals.set(0); + } + if (struct.is_set_script()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.is_set_execution_command()) { + oprot.writeString(struct.execution_command); + } + if (struct.is_set_script()) { + oprot.writeString(struct.script); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, ShellComponent struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.execution_command = iprot.readString(); + struct.set_execution_command_isSet(true); + } + if (incoming.get(1)) { + struct.script = iprot.readString(); + struct.set_script_isSet(true); + } + } + } + } http://git-wip-us.apache.org/repos/asf/storm/blob/ef51dbee/storm-core/src/jvm/backtype/storm/generated/SpoutSpec.java ---------------------------------------------------------------------- diff --git a/storm-core/src/jvm/backtype/storm/generated/SpoutSpec.java b/storm-core/src/jvm/backtype/storm/generated/SpoutSpec.java index 60028e7..16931ac 100644 --- a/storm-core/src/jvm/backtype/storm/generated/SpoutSpec.java +++ b/storm-core/src/jvm/backtype/storm/generated/SpoutSpec.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 SpoutSpec implements org.apache.thrift.TBase<SpoutSpec, SpoutSpec._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 SpoutSpec implements org.apache.thrift.TBase<SpoutSpec, SpoutSpec._Fields>, java.io.Serializable, Cloneable, Comparable<SpoutSpec> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("SpoutSpec"); private static final org.apache.thrift.protocol.TField SPOUT_OBJECT_FIELD_DESC = new org.apache.thrift.protocol.TField("spout_object", org.apache.thrift.protocol.TType.STRUCT, (short)1); private static final org.apache.thrift.protocol.TField COMMON_FIELD_DESC = new org.apache.thrift.protocol.TField("common", org.apache.thrift.protocol.TType.STRUCT, (short)2); + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new SpoutSpecStandardSchemeFactory()); + schemes.put(TupleScheme.class, new SpoutSpecTupleSchemeFactory()); + } + private ComponentObject spout_object; // required private ComponentCommon common; // required @@ -109,7 +129,6 @@ public class SpoutSpec implements org.apache.thrift.TBase<SpoutSpec, SpoutSpec._ } // 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 SpoutSpec implements org.apache.thrift.TBase<SpoutSpec, SpoutSpec._ @Override public int hashCode() { - HashCodeBuilder builder = new HashCodeBuilder(); + List<Object> list = new ArrayList<Object>(); boolean present_spout_object = true && (is_set_spout_object()); - builder.append(present_spout_object); + list.add(present_spout_object); if (present_spout_object) - builder.append(spout_object); + list.add(spout_object); boolean present_common = true && (is_set_common()); - builder.append(present_common); + list.add(present_common); if (present_common) - builder.append(common); + list.add(common); - return builder.toHashCode(); + return list.hashCode(); } + @Override public int compareTo(SpoutSpec other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; - SpoutSpec typedOther = (SpoutSpec)other; - lastComparison = Boolean.valueOf(is_set_spout_object()).compareTo(typedOther.is_set_spout_object()); + lastComparison = Boolean.valueOf(is_set_spout_object()).compareTo(other.is_set_spout_object()); if (lastComparison != 0) { return lastComparison; } if (is_set_spout_object()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.spout_object, typedOther.spout_object); + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.spout_object, other.spout_object); if (lastComparison != 0) { return lastComparison; } } - lastComparison = Boolean.valueOf(is_set_common()).compareTo(typedOther.is_set_common()); + lastComparison = Boolean.valueOf(is_set_common()).compareTo(other.is_set_common()); if (lastComparison != 0) { return lastComparison; } if (is_set_common()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.common, typedOther.common); + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.common, other.common); if (lastComparison != 0) { return lastComparison; } @@ -336,56 +355,11 @@ public class SpoutSpec implements org.apache.thrift.TBase<SpoutSpec, SpoutSpec._ } 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: // SPOUT_OBJECT - if (field.type == org.apache.thrift.protocol.TType.STRUCT) { - this.spout_object = new ComponentObject(); - this.spout_object.read(iprot); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); - } - break; - case 2: // COMMON - if (field.type == org.apache.thrift.protocol.TType.STRUCT) { - this.common = new ComponentCommon(); - this.common.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(); - 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.spout_object != null) { - oprot.writeFieldBegin(SPOUT_OBJECT_FIELD_DESC); - this.spout_object.write(oprot); - oprot.writeFieldEnd(); - } - if (this.common != null) { - oprot.writeFieldBegin(COMMON_FIELD_DESC); - this.common.write(oprot); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); } @Override @@ -422,6 +396,10 @@ public class SpoutSpec implements org.apache.thrift.TBase<SpoutSpec, SpoutSpec._ throw new org.apache.thrift.protocol.TProtocolException("Required field 'common' is unset! Struct:" + toString()); } + // check for sub-struct validity + if (common != null) { + common.validate(); + } } private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { @@ -440,5 +418,97 @@ public class SpoutSpec implements org.apache.thrift.TBase<SpoutSpec, SpoutSpec._ } } + private static class SpoutSpecStandardSchemeFactory implements SchemeFactory { + public SpoutSpecStandardScheme getScheme() { + return new SpoutSpecStandardScheme(); + } + } + + private static class SpoutSpecStandardScheme extends StandardScheme<SpoutSpec> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, SpoutSpec 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: // SPOUT_OBJECT + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.spout_object = new ComponentObject(); + struct.spout_object.read(iprot); + struct.set_spout_object_isSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // COMMON + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.common = new ComponentCommon(); + struct.common.read(iprot); + struct.set_common_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, SpoutSpec struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.spout_object != null) { + oprot.writeFieldBegin(SPOUT_OBJECT_FIELD_DESC); + struct.spout_object.write(oprot); + oprot.writeFieldEnd(); + } + if (struct.common != null) { + oprot.writeFieldBegin(COMMON_FIELD_DESC); + struct.common.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class SpoutSpecTupleSchemeFactory implements SchemeFactory { + public SpoutSpecTupleScheme getScheme() { + return new SpoutSpecTupleScheme(); + } + } + + private static class SpoutSpecTupleScheme extends TupleScheme<SpoutSpec> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, SpoutSpec struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + struct.spout_object.write(oprot); + struct.common.write(oprot); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, SpoutSpec struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + struct.spout_object = new ComponentObject(); + struct.spout_object.read(iprot); + struct.set_spout_object_isSet(true); + struct.common = new ComponentCommon(); + struct.common.read(iprot); + struct.set_common_isSet(true); + } + } + }
