http://git-wip-us.apache.org/repos/asf/storm/blob/ef51dbee/storm-core/src/jvm/backtype/storm/generated/TopologySummary.java ---------------------------------------------------------------------- diff --git a/storm-core/src/jvm/backtype/storm/generated/TopologySummary.java b/storm-core/src/jvm/backtype/storm/generated/TopologySummary.java index fea2137..d129889 100644 --- a/storm-core/src/jvm/backtype/storm/generated/TopologySummary.java +++ b/storm-core/src/jvm/backtype/storm/generated/TopologySummary.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 TopologySummary implements org.apache.thrift.TBase<TopologySummary, TopologySummary._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 TopologySummary implements org.apache.thrift.TBase<TopologySummary, TopologySummary._Fields>, java.io.Serializable, Cloneable, Comparable<TopologySummary> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TopologySummary"); private static final org.apache.thrift.protocol.TField ID_FIELD_DESC = new org.apache.thrift.protocol.TField("id", org.apache.thrift.protocol.TType.STRING, (short)1); @@ -51,6 +65,12 @@ public class TopologySummary implements org.apache.thrift.TBase<TopologySummary, private static final org.apache.thrift.protocol.TField SCHED_STATUS_FIELD_DESC = new org.apache.thrift.protocol.TField("sched_status", org.apache.thrift.protocol.TType.STRING, (short)513); private static final org.apache.thrift.protocol.TField OWNER_FIELD_DESC = new org.apache.thrift.protocol.TField("owner", org.apache.thrift.protocol.TType.STRING, (short)514); + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new TopologySummaryStandardSchemeFactory()); + schemes.put(TupleScheme.class, new TopologySummaryTupleSchemeFactory()); + } + private String id; // required private String name; // required private int num_tasks; // required @@ -58,8 +78,8 @@ public class TopologySummary implements org.apache.thrift.TBase<TopologySummary, private int num_workers; // required private int uptime_secs; // required private String status; // required - private String sched_status; // required - private String owner; // required + private String sched_status; // optional + private String owner; // 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 { @@ -148,8 +168,8 @@ public class TopologySummary implements org.apache.thrift.TBase<TopologySummary, private static final int __NUM_EXECUTORS_ISSET_ID = 1; private static final int __NUM_WORKERS_ISSET_ID = 2; private static final int __UPTIME_SECS_ISSET_ID = 3; - private BitSet __isset_bit_vector = new BitSet(4); - + private byte __isset_bitfield = 0; + private static final _Fields optionals[] = {_Fields.SCHED_STATUS,_Fields.OWNER}; 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); @@ -205,8 +225,7 @@ public class TopologySummary implements org.apache.thrift.TBase<TopologySummary, * Performs a deep copy on <i>other</i>. */ public TopologySummary(TopologySummary other) { - __isset_bit_vector.clear(); - __isset_bit_vector.or(other.__isset_bit_vector); + __isset_bitfield = other.__isset_bitfield; if (other.is_set_id()) { this.id = other.id; } @@ -305,16 +324,16 @@ public class TopologySummary implements org.apache.thrift.TBase<TopologySummary, } public void unset_num_tasks() { - __isset_bit_vector.clear(__NUM_TASKS_ISSET_ID); + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __NUM_TASKS_ISSET_ID); } /** Returns true if field num_tasks is set (has been assigned a value) and false otherwise */ public boolean is_set_num_tasks() { - return __isset_bit_vector.get(__NUM_TASKS_ISSET_ID); + return EncodingUtils.testBit(__isset_bitfield, __NUM_TASKS_ISSET_ID); } public void set_num_tasks_isSet(boolean value) { - __isset_bit_vector.set(__NUM_TASKS_ISSET_ID, value); + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __NUM_TASKS_ISSET_ID, value); } public int get_num_executors() { @@ -327,16 +346,16 @@ public class TopologySummary implements org.apache.thrift.TBase<TopologySummary, } public void unset_num_executors() { - __isset_bit_vector.clear(__NUM_EXECUTORS_ISSET_ID); + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __NUM_EXECUTORS_ISSET_ID); } /** Returns true if field num_executors is set (has been assigned a value) and false otherwise */ public boolean is_set_num_executors() { - return __isset_bit_vector.get(__NUM_EXECUTORS_ISSET_ID); + return EncodingUtils.testBit(__isset_bitfield, __NUM_EXECUTORS_ISSET_ID); } public void set_num_executors_isSet(boolean value) { - __isset_bit_vector.set(__NUM_EXECUTORS_ISSET_ID, value); + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __NUM_EXECUTORS_ISSET_ID, value); } public int get_num_workers() { @@ -349,16 +368,16 @@ public class TopologySummary implements org.apache.thrift.TBase<TopologySummary, } 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_uptime_secs() { @@ -371,16 +390,16 @@ public class TopologySummary implements org.apache.thrift.TBase<TopologySummary, } public void unset_uptime_secs() { - __isset_bit_vector.clear(__UPTIME_SECS_ISSET_ID); + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __UPTIME_SECS_ISSET_ID); } /** Returns true if field uptime_secs is set (has been assigned a value) and false otherwise */ public boolean is_set_uptime_secs() { - return __isset_bit_vector.get(__UPTIME_SECS_ISSET_ID); + return EncodingUtils.testBit(__isset_bitfield, __UPTIME_SECS_ISSET_ID); } public void set_uptime_secs_isSet(boolean value) { - __isset_bit_vector.set(__UPTIME_SECS_ISSET_ID, value); + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __UPTIME_SECS_ISSET_ID, value); } public String get_status() { @@ -690,150 +709,150 @@ public class TopologySummary implements org.apache.thrift.TBase<TopologySummary, @Override public int hashCode() { - HashCodeBuilder builder = new HashCodeBuilder(); + List<Object> list = new ArrayList<Object>(); boolean present_id = true && (is_set_id()); - builder.append(present_id); + list.add(present_id); if (present_id) - builder.append(id); + list.add(id); boolean present_name = true && (is_set_name()); - builder.append(present_name); + list.add(present_name); if (present_name) - builder.append(name); + list.add(name); boolean present_num_tasks = true; - builder.append(present_num_tasks); + list.add(present_num_tasks); if (present_num_tasks) - builder.append(num_tasks); + list.add(num_tasks); boolean present_num_executors = true; - builder.append(present_num_executors); + list.add(present_num_executors); if (present_num_executors) - builder.append(num_executors); + list.add(num_executors); boolean present_num_workers = true; - builder.append(present_num_workers); + list.add(present_num_workers); if (present_num_workers) - builder.append(num_workers); + list.add(num_workers); boolean present_uptime_secs = true; - builder.append(present_uptime_secs); + list.add(present_uptime_secs); if (present_uptime_secs) - builder.append(uptime_secs); + list.add(uptime_secs); boolean present_status = true && (is_set_status()); - builder.append(present_status); + list.add(present_status); if (present_status) - builder.append(status); + list.add(status); boolean present_sched_status = true && (is_set_sched_status()); - builder.append(present_sched_status); + list.add(present_sched_status); if (present_sched_status) - builder.append(sched_status); + list.add(sched_status); boolean present_owner = true && (is_set_owner()); - builder.append(present_owner); + list.add(present_owner); if (present_owner) - builder.append(owner); + list.add(owner); - return builder.toHashCode(); + return list.hashCode(); } + @Override public int compareTo(TopologySummary other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; - TopologySummary typedOther = (TopologySummary)other; - lastComparison = Boolean.valueOf(is_set_id()).compareTo(typedOther.is_set_id()); + lastComparison = Boolean.valueOf(is_set_id()).compareTo(other.is_set_id()); if (lastComparison != 0) { return lastComparison; } if (is_set_id()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.id, typedOther.id); + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.id, other.id); if (lastComparison != 0) { return lastComparison; } } - lastComparison = Boolean.valueOf(is_set_name()).compareTo(typedOther.is_set_name()); + lastComparison = Boolean.valueOf(is_set_name()).compareTo(other.is_set_name()); if (lastComparison != 0) { return lastComparison; } if (is_set_name()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, typedOther.name); + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, other.name); if (lastComparison != 0) { return lastComparison; } } - lastComparison = Boolean.valueOf(is_set_num_tasks()).compareTo(typedOther.is_set_num_tasks()); + lastComparison = Boolean.valueOf(is_set_num_tasks()).compareTo(other.is_set_num_tasks()); if (lastComparison != 0) { return lastComparison; } if (is_set_num_tasks()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.num_tasks, typedOther.num_tasks); + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.num_tasks, other.num_tasks); 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; } } - 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_uptime_secs()).compareTo(typedOther.is_set_uptime_secs()); + lastComparison = Boolean.valueOf(is_set_uptime_secs()).compareTo(other.is_set_uptime_secs()); if (lastComparison != 0) { return lastComparison; } if (is_set_uptime_secs()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.uptime_secs, typedOther.uptime_secs); + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.uptime_secs, other.uptime_secs); if (lastComparison != 0) { return lastComparison; } } - lastComparison = Boolean.valueOf(is_set_status()).compareTo(typedOther.is_set_status()); + lastComparison = Boolean.valueOf(is_set_status()).compareTo(other.is_set_status()); if (lastComparison != 0) { return lastComparison; } if (is_set_status()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.status, typedOther.status); + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.status, other.status); if (lastComparison != 0) { return lastComparison; } } - lastComparison = Boolean.valueOf(is_set_sched_status()).compareTo(typedOther.is_set_sched_status()); + lastComparison = Boolean.valueOf(is_set_sched_status()).compareTo(other.is_set_sched_status()); if (lastComparison != 0) { return lastComparison; } if (is_set_sched_status()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.sched_status, typedOther.sched_status); + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.sched_status, other.sched_status); if (lastComparison != 0) { return lastComparison; } } - lastComparison = Boolean.valueOf(is_set_owner()).compareTo(typedOther.is_set_owner()); + lastComparison = Boolean.valueOf(is_set_owner()).compareTo(other.is_set_owner()); if (lastComparison != 0) { return lastComparison; } if (is_set_owner()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.owner, typedOther.owner); + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.owner, other.owner); if (lastComparison != 0) { return lastComparison; } @@ -846,138 +865,11 @@ public class TopologySummary implements org.apache.thrift.TBase<TopologySummary, } 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: // ID - if (field.type == org.apache.thrift.protocol.TType.STRING) { - this.id = iprot.readString(); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); - } - break; - case 2: // NAME - if (field.type == org.apache.thrift.protocol.TType.STRING) { - this.name = iprot.readString(); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); - } - break; - case 3: // NUM_TASKS - if (field.type == org.apache.thrift.protocol.TType.I32) { - this.num_tasks = iprot.readI32(); - set_num_tasks_isSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); - } - break; - case 4: // NUM_EXECUTORS - if (field.type == org.apache.thrift.protocol.TType.I32) { - this.num_executors = iprot.readI32(); - set_num_executors_isSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); - } - break; - case 5: // 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 6: // UPTIME_SECS - if (field.type == org.apache.thrift.protocol.TType.I32) { - this.uptime_secs = iprot.readI32(); - set_uptime_secs_isSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); - } - break; - case 7: // STATUS - if (field.type == org.apache.thrift.protocol.TType.STRING) { - this.status = iprot.readString(); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); - } - break; - case 513: // SCHED_STATUS - if (field.type == org.apache.thrift.protocol.TType.STRING) { - this.sched_status = iprot.readString(); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); - } - break; - case 514: // OWNER - if (field.type == org.apache.thrift.protocol.TType.STRING) { - this.owner = 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.id != null) { - oprot.writeFieldBegin(ID_FIELD_DESC); - oprot.writeString(this.id); - oprot.writeFieldEnd(); - } - if (this.name != null) { - oprot.writeFieldBegin(NAME_FIELD_DESC); - oprot.writeString(this.name); - oprot.writeFieldEnd(); - } - oprot.writeFieldBegin(NUM_TASKS_FIELD_DESC); - oprot.writeI32(this.num_tasks); - oprot.writeFieldEnd(); - oprot.writeFieldBegin(NUM_EXECUTORS_FIELD_DESC); - oprot.writeI32(this.num_executors); - oprot.writeFieldEnd(); - oprot.writeFieldBegin(NUM_WORKERS_FIELD_DESC); - oprot.writeI32(this.num_workers); - oprot.writeFieldEnd(); - oprot.writeFieldBegin(UPTIME_SECS_FIELD_DESC); - oprot.writeI32(this.uptime_secs); - oprot.writeFieldEnd(); - if (this.status != null) { - oprot.writeFieldBegin(STATUS_FIELD_DESC); - oprot.writeString(this.status); - oprot.writeFieldEnd(); - } - if (this.sched_status != null) { - if (is_set_sched_status()) { - oprot.writeFieldBegin(SCHED_STATUS_FIELD_DESC); - oprot.writeString(this.sched_status); - oprot.writeFieldEnd(); - } - } - if (this.owner != null) { - if (is_set_owner()) { - oprot.writeFieldBegin(OWNER_FIELD_DESC); - oprot.writeString(this.owner); - oprot.writeFieldEnd(); - } - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); } @Override @@ -1078,6 +970,7 @@ public class TopologySummary implements org.apache.thrift.TBase<TopologySummary, throw new org.apache.thrift.protocol.TProtocolException("Required field 'status' is unset! Struct:" + toString()); } + // check for sub-struct validity } private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { @@ -1091,12 +984,225 @@ public class TopologySummary implements org.apache.thrift.TBase<TopologySummary, 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 TopologySummaryStandardSchemeFactory implements SchemeFactory { + public TopologySummaryStandardScheme getScheme() { + return new TopologySummaryStandardScheme(); + } + } + + private static class TopologySummaryStandardScheme extends StandardScheme<TopologySummary> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, TopologySummary 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: // ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.id = iprot.readString(); + struct.set_id_isSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.name = iprot.readString(); + struct.set_name_isSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 3: // NUM_TASKS + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.num_tasks = iprot.readI32(); + struct.set_num_tasks_isSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 4: // NUM_EXECUTORS + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.num_executors = iprot.readI32(); + struct.set_num_executors_isSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 5: // 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 6: // UPTIME_SECS + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.uptime_secs = iprot.readI32(); + struct.set_uptime_secs_isSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 7: // STATUS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.status = iprot.readString(); + struct.set_status_isSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 513: // SCHED_STATUS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.sched_status = iprot.readString(); + struct.set_sched_status_isSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 514: // OWNER + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.owner = iprot.readString(); + struct.set_owner_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, TopologySummary struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.id != null) { + oprot.writeFieldBegin(ID_FIELD_DESC); + oprot.writeString(struct.id); + oprot.writeFieldEnd(); + } + if (struct.name != null) { + oprot.writeFieldBegin(NAME_FIELD_DESC); + oprot.writeString(struct.name); + oprot.writeFieldEnd(); + } + oprot.writeFieldBegin(NUM_TASKS_FIELD_DESC); + oprot.writeI32(struct.num_tasks); + oprot.writeFieldEnd(); + oprot.writeFieldBegin(NUM_EXECUTORS_FIELD_DESC); + oprot.writeI32(struct.num_executors); + oprot.writeFieldEnd(); + oprot.writeFieldBegin(NUM_WORKERS_FIELD_DESC); + oprot.writeI32(struct.num_workers); + oprot.writeFieldEnd(); + oprot.writeFieldBegin(UPTIME_SECS_FIELD_DESC); + oprot.writeI32(struct.uptime_secs); + oprot.writeFieldEnd(); + if (struct.status != null) { + oprot.writeFieldBegin(STATUS_FIELD_DESC); + oprot.writeString(struct.status); + oprot.writeFieldEnd(); + } + if (struct.sched_status != null) { + if (struct.is_set_sched_status()) { + oprot.writeFieldBegin(SCHED_STATUS_FIELD_DESC); + oprot.writeString(struct.sched_status); + oprot.writeFieldEnd(); + } + } + if (struct.owner != null) { + if (struct.is_set_owner()) { + oprot.writeFieldBegin(OWNER_FIELD_DESC); + oprot.writeString(struct.owner); + oprot.writeFieldEnd(); + } + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class TopologySummaryTupleSchemeFactory implements SchemeFactory { + public TopologySummaryTupleScheme getScheme() { + return new TopologySummaryTupleScheme(); + } + } + + private static class TopologySummaryTupleScheme extends TupleScheme<TopologySummary> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, TopologySummary struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + oprot.writeString(struct.id); + oprot.writeString(struct.name); + oprot.writeI32(struct.num_tasks); + oprot.writeI32(struct.num_executors); + oprot.writeI32(struct.num_workers); + oprot.writeI32(struct.uptime_secs); + oprot.writeString(struct.status); + BitSet optionals = new BitSet(); + if (struct.is_set_sched_status()) { + optionals.set(0); + } + if (struct.is_set_owner()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.is_set_sched_status()) { + oprot.writeString(struct.sched_status); + } + if (struct.is_set_owner()) { + oprot.writeString(struct.owner); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, TopologySummary struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + struct.id = iprot.readString(); + struct.set_id_isSet(true); + struct.name = iprot.readString(); + struct.set_name_isSet(true); + struct.num_tasks = iprot.readI32(); + struct.set_num_tasks_isSet(true); + struct.num_executors = iprot.readI32(); + struct.set_num_executors_isSet(true); + struct.num_workers = iprot.readI32(); + struct.set_num_workers_isSet(true); + struct.uptime_secs = iprot.readI32(); + struct.set_uptime_secs_isSet(true); + struct.status = iprot.readString(); + struct.set_status_isSet(true); + BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.sched_status = iprot.readString(); + struct.set_sched_status_isSet(true); + } + if (incoming.get(1)) { + struct.owner = iprot.readString(); + struct.set_owner_isSet(true); + } + } + } + }
http://git-wip-us.apache.org/repos/asf/storm/blob/ef51dbee/storm-core/src/jvm/backtype/storm/security/auth/SimpleTransportPlugin.java ---------------------------------------------------------------------- diff --git a/storm-core/src/jvm/backtype/storm/security/auth/SimpleTransportPlugin.java b/storm-core/src/jvm/backtype/storm/security/auth/SimpleTransportPlugin.java index f0905e2..0e1a365 100644 --- a/storm-core/src/jvm/backtype/storm/security/auth/SimpleTransportPlugin.java +++ b/storm-core/src/jvm/backtype/storm/security/auth/SimpleTransportPlugin.java @@ -76,7 +76,7 @@ public class SimpleTransportPlugin implements ITransportPlugin { THsHaServer.Args server_args = new THsHaServer.Args(serverTransport). processor(new SimpleWrapProcessor(processor)). workerThreads(numWorkerThreads). - protocolFactory(new TBinaryProtocol.Factory(false, true, maxBufferSize)); + protocolFactory(new TBinaryProtocol.Factory(false, true, maxBufferSize, -1)); if (queueSize != null) { server_args.executorService(new ThreadPoolExecutor(numWorkerThreads, numWorkerThreads, http://git-wip-us.apache.org/repos/asf/storm/blob/ef51dbee/storm-core/src/jvm/storm/trident/drpc/ReturnResultsReducer.java ---------------------------------------------------------------------- diff --git a/storm-core/src/jvm/storm/trident/drpc/ReturnResultsReducer.java b/storm-core/src/jvm/storm/trident/drpc/ReturnResultsReducer.java index d49371a..849fb10 100644 --- a/storm-core/src/jvm/storm/trident/drpc/ReturnResultsReducer.java +++ b/storm-core/src/jvm/storm/trident/drpc/ReturnResultsReducer.java @@ -103,10 +103,10 @@ public class ReturnResultsReducer implements MultiReducer<ReturnResultsState> { try { client.result(id, result); - } catch(TException e) { - collector.reportError(e); } catch (AuthorizationException aze) { collector.reportError(aze); + } catch(TException e) { + collector.reportError(e); } } } http://git-wip-us.apache.org/repos/asf/storm/blob/ef51dbee/storm-core/src/py/storm/DistributedRPC-remote ---------------------------------------------------------------------- diff --git a/storm-core/src/py/storm/DistributedRPC-remote b/storm-core/src/py/storm/DistributedRPC-remote index 41f8e72..3d06d07 100755 --- a/storm-core/src/py/storm/DistributedRPC-remote +++ b/storm-core/src/py/storm/DistributedRPC-remote @@ -18,29 +18,32 @@ #!/usr/bin/env python # -# 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 # +# options string: py:utf8strings +# import sys import pprint from urlparse import urlparse from thrift.transport import TTransport from thrift.transport import TSocket +from thrift.transport import TSSLSocket from thrift.transport import THttpClient from thrift.protocol import TBinaryProtocol -import DistributedRPC -from ttypes import * +from storm import DistributedRPC +from storm.ttypes import * if len(sys.argv) <= 1 or sys.argv[1] == '--help': - print '' - print 'Usage: ' + sys.argv[0] + ' [-h host:port] [-u url] [-f[ramed]] function [arg1 [arg2...]]' - print '' - print 'Functions:' - print ' string execute(string functionName, string funcArgs)' - print '' + print('') + print('Usage: ' + sys.argv[0] + ' [-h host[:port]] [-u url] [-f[ramed]] [-s[sl]] function [arg1 [arg2...]]') + print('') + print('Functions:') + print(' string execute(string functionName, string funcArgs)') + print('') sys.exit(0) pp = pprint.PrettyPrinter(indent = 2) @@ -48,13 +51,15 @@ host = 'localhost' port = 9090 uri = '' framed = False +ssl = False http = False argi = 1 if sys.argv[argi] == '-h': parts = sys.argv[argi+1].split(':') host = parts[0] - port = int(parts[1]) + if len(parts) > 1: + port = int(parts[1]) argi += 2 if sys.argv[argi] == '-u': @@ -75,13 +80,17 @@ if sys.argv[argi] == '-f' or sys.argv[argi] == '-framed': framed = True argi += 1 +if sys.argv[argi] == '-s' or sys.argv[argi] == '-ssl': + ssl = True + argi += 1 + cmd = sys.argv[argi] args = sys.argv[argi+1:] if http: transport = THttpClient.THttpClient(host, port, uri) else: - socket = TSocket.TSocket(host, port) + socket = TSSLSocket.TSSLSocket(host, port, validate=False) if ssl else TSocket.TSocket(host, port) if framed: transport = TTransport.TFramedTransport(socket) else: @@ -92,12 +101,12 @@ transport.open() if cmd == 'execute': if len(args) != 2: - print 'execute requires 2 args' + print('execute requires 2 args') sys.exit(1) pp.pprint(client.execute(args[0],args[1],)) else: - print 'Unrecognized method %s' % cmd + print('Unrecognized method %s' % cmd) sys.exit(1) transport.close() http://git-wip-us.apache.org/repos/asf/storm/blob/ef51dbee/storm-core/src/py/storm/DistributedRPC.py ---------------------------------------------------------------------- diff --git a/storm-core/src/py/storm/DistributedRPC.py b/storm-core/src/py/storm/DistributedRPC.py index 21a9796..1728434 100644 --- a/storm-core/src/py/storm/DistributedRPC.py +++ b/storm-core/src/py/storm/DistributedRPC.py @@ -15,12 +15,14 @@ # 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 # +# options string: py:utf8strings +# -from thrift.Thrift import * +from thrift.Thrift import TType, TMessageType, TException, TApplicationException from ttypes import * from thrift.Thrift import TProcessor from thrift.transport import TTransport @@ -66,16 +68,17 @@ class Client(Iface): self._oprot.writeMessageEnd() self._oprot.trans.flush() - def recv_execute(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() + def recv_execute(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() if mtype == TMessageType.EXCEPTION: x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() + x.read(iprot) + iprot.readMessageEnd() raise x result = execute_result() - result.read(self._iprot) - self._iprot.readMessageEnd() + result.read(iprot) + iprot.readMessageEnd() if result.success is not None: return result.success if result.e is not None: @@ -138,9 +141,6 @@ class execute_args: (2, TType.STRING, 'funcArgs', None, None, ), # 2 ) - def __hash__(self): - return 0 + hash(self.functionName) + hash(self.funcArgs) - def __init__(self, functionName=None, funcArgs=None,): self.functionName = functionName self.funcArgs = funcArgs @@ -189,6 +189,12 @@ class execute_args: return + def __hash__(self): + value = 17 + value = (value * 31) ^ hash(self.functionName) + value = (value * 31) ^ hash(self.funcArgs) + return value + def __repr__(self): L = ['%s=%r' % (key, value) for key, value in self.__dict__.iteritems()] @@ -214,9 +220,6 @@ class execute_result: (2, TType.STRUCT, 'aze', (AuthorizationException, AuthorizationException.thrift_spec), None, ), # 2 ) - def __hash__(self): - return 0 + hash(self.success) + hash(self.e) + hash(self.aze) - def __init__(self, success=None, e=None, aze=None,): self.success = success self.e = e @@ -277,6 +280,13 @@ class execute_result: return + def __hash__(self): + value = 17 + value = (value * 31) ^ hash(self.success) + value = (value * 31) ^ hash(self.e) + value = (value * 31) ^ hash(self.aze) + return value + def __repr__(self): L = ['%s=%r' % (key, value) for key, value in self.__dict__.iteritems()] http://git-wip-us.apache.org/repos/asf/storm/blob/ef51dbee/storm-core/src/py/storm/DistributedRPCInvocations-remote ---------------------------------------------------------------------- diff --git a/storm-core/src/py/storm/DistributedRPCInvocations-remote b/storm-core/src/py/storm/DistributedRPCInvocations-remote index 37f0cb5..9dd50cd 100755 --- a/storm-core/src/py/storm/DistributedRPCInvocations-remote +++ b/storm-core/src/py/storm/DistributedRPCInvocations-remote @@ -18,31 +18,34 @@ #!/usr/bin/env python # -# 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 # +# options string: py:utf8strings +# import sys import pprint from urlparse import urlparse from thrift.transport import TTransport from thrift.transport import TSocket +from thrift.transport import TSSLSocket from thrift.transport import THttpClient from thrift.protocol import TBinaryProtocol -import DistributedRPCInvocations -from ttypes import * +from storm import DistributedRPCInvocations +from storm.ttypes import * if len(sys.argv) <= 1 or sys.argv[1] == '--help': - print '' - print 'Usage: ' + sys.argv[0] + ' [-h host:port] [-u url] [-f[ramed]] function [arg1 [arg2...]]' - print '' - print 'Functions:' - print ' void result(string id, string result)' - print ' DRPCRequest fetchRequest(string functionName)' - print ' void failRequest(string id)' - print '' + print('') + print('Usage: ' + sys.argv[0] + ' [-h host[:port]] [-u url] [-f[ramed]] [-s[sl]] function [arg1 [arg2...]]') + print('') + print('Functions:') + print(' void result(string id, string result)') + print(' DRPCRequest fetchRequest(string functionName)') + print(' void failRequest(string id)') + print('') sys.exit(0) pp = pprint.PrettyPrinter(indent = 2) @@ -50,13 +53,15 @@ host = 'localhost' port = 9090 uri = '' framed = False +ssl = False http = False argi = 1 if sys.argv[argi] == '-h': parts = sys.argv[argi+1].split(':') host = parts[0] - port = int(parts[1]) + if len(parts) > 1: + port = int(parts[1]) argi += 2 if sys.argv[argi] == '-u': @@ -77,13 +82,17 @@ if sys.argv[argi] == '-f' or sys.argv[argi] == '-framed': framed = True argi += 1 +if sys.argv[argi] == '-s' or sys.argv[argi] == '-ssl': + ssl = True + argi += 1 + cmd = sys.argv[argi] args = sys.argv[argi+1:] if http: transport = THttpClient.THttpClient(host, port, uri) else: - socket = TSocket.TSocket(host, port) + socket = TSSLSocket.TSSLSocket(host, port, validate=False) if ssl else TSocket.TSocket(host, port) if framed: transport = TTransport.TFramedTransport(socket) else: @@ -94,24 +103,24 @@ transport.open() if cmd == 'result': if len(args) != 2: - print 'result requires 2 args' + print('result requires 2 args') sys.exit(1) pp.pprint(client.result(args[0],args[1],)) elif cmd == 'fetchRequest': if len(args) != 1: - print 'fetchRequest requires 1 args' + print('fetchRequest requires 1 args') sys.exit(1) pp.pprint(client.fetchRequest(args[0],)) elif cmd == 'failRequest': if len(args) != 1: - print 'failRequest requires 1 args' + print('failRequest requires 1 args') sys.exit(1) pp.pprint(client.failRequest(args[0],)) else: - print 'Unrecognized method %s' % cmd + print('Unrecognized method %s' % cmd) sys.exit(1) transport.close() http://git-wip-us.apache.org/repos/asf/storm/blob/ef51dbee/storm-core/src/py/storm/DistributedRPCInvocations.py ---------------------------------------------------------------------- diff --git a/storm-core/src/py/storm/DistributedRPCInvocations.py b/storm-core/src/py/storm/DistributedRPCInvocations.py index 5120f4d..fddbbe5 100644 --- a/storm-core/src/py/storm/DistributedRPCInvocations.py +++ b/storm-core/src/py/storm/DistributedRPCInvocations.py @@ -15,12 +15,14 @@ # 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 # +# options string: py:utf8strings +# -from thrift.Thrift import * +from thrift.Thrift import TType, TMessageType, TException, TApplicationException from ttypes import * from thrift.Thrift import TProcessor from thrift.transport import TTransport @@ -80,16 +82,17 @@ class Client(Iface): self._oprot.writeMessageEnd() self._oprot.trans.flush() - def recv_result(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() + def recv_result(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() if mtype == TMessageType.EXCEPTION: x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() + x.read(iprot) + iprot.readMessageEnd() raise x result = result_result() - result.read(self._iprot) - self._iprot.readMessageEnd() + result.read(iprot) + iprot.readMessageEnd() if result.aze is not None: raise result.aze return @@ -110,16 +113,17 @@ class Client(Iface): self._oprot.writeMessageEnd() self._oprot.trans.flush() - def recv_fetchRequest(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() + def recv_fetchRequest(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() if mtype == TMessageType.EXCEPTION: x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() + x.read(iprot) + iprot.readMessageEnd() raise x result = fetchRequest_result() - result.read(self._iprot) - self._iprot.readMessageEnd() + result.read(iprot) + iprot.readMessageEnd() if result.success is not None: return result.success if result.aze is not None: @@ -142,16 +146,17 @@ class Client(Iface): self._oprot.writeMessageEnd() self._oprot.trans.flush() - def recv_failRequest(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() + def recv_failRequest(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() if mtype == TMessageType.EXCEPTION: x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() + x.read(iprot) + iprot.readMessageEnd() raise x result = failRequest_result() - result.read(self._iprot) - self._iprot.readMessageEnd() + result.read(iprot) + iprot.readMessageEnd() if result.aze is not None: raise result.aze return @@ -238,9 +243,6 @@ class result_args: (2, TType.STRING, 'result', None, None, ), # 2 ) - def __hash__(self): - return 0 + hash(self.id) + hash(self.result) - def __init__(self, id=None, result=None,): self.id = id self.result = result @@ -289,6 +291,12 @@ class result_args: return + def __hash__(self): + value = 17 + value = (value * 31) ^ hash(self.id) + value = (value * 31) ^ hash(self.result) + return value + def __repr__(self): L = ['%s=%r' % (key, value) for key, value in self.__dict__.iteritems()] @@ -311,9 +319,6 @@ class result_result: (1, TType.STRUCT, 'aze', (AuthorizationException, AuthorizationException.thrift_spec), None, ), # 1 ) - def __hash__(self): - return 0 + hash(self.aze) - def __init__(self, aze=None,): self.aze = aze @@ -353,6 +358,11 @@ class result_result: return + def __hash__(self): + value = 17 + value = (value * 31) ^ hash(self.aze) + return value + def __repr__(self): L = ['%s=%r' % (key, value) for key, value in self.__dict__.iteritems()] @@ -375,9 +385,6 @@ class fetchRequest_args: (1, TType.STRING, 'functionName', None, None, ), # 1 ) - def __hash__(self): - return 0 + hash(self.functionName) - def __init__(self, functionName=None,): self.functionName = functionName @@ -416,6 +423,11 @@ class fetchRequest_args: return + def __hash__(self): + value = 17 + value = (value * 31) ^ hash(self.functionName) + return value + def __repr__(self): L = ['%s=%r' % (key, value) for key, value in self.__dict__.iteritems()] @@ -439,9 +451,6 @@ class fetchRequest_result: (1, TType.STRUCT, 'aze', (AuthorizationException, AuthorizationException.thrift_spec), None, ), # 1 ) - def __hash__(self): - return 0 + hash(self.success) + hash(self.aze) - def __init__(self, success=None, aze=None,): self.success = success self.aze = aze @@ -492,6 +501,12 @@ class fetchRequest_result: return + def __hash__(self): + value = 17 + value = (value * 31) ^ hash(self.success) + value = (value * 31) ^ hash(self.aze) + return value + def __repr__(self): L = ['%s=%r' % (key, value) for key, value in self.__dict__.iteritems()] @@ -514,9 +529,6 @@ class failRequest_args: (1, TType.STRING, 'id', None, None, ), # 1 ) - def __hash__(self): - return 0 + hash(self.id) - def __init__(self, id=None,): self.id = id @@ -555,6 +567,11 @@ class failRequest_args: return + def __hash__(self): + value = 17 + value = (value * 31) ^ hash(self.id) + return value + def __repr__(self): L = ['%s=%r' % (key, value) for key, value in self.__dict__.iteritems()] @@ -577,9 +594,6 @@ class failRequest_result: (1, TType.STRUCT, 'aze', (AuthorizationException, AuthorizationException.thrift_spec), None, ), # 1 ) - def __hash__(self): - return 0 + hash(self.aze) - def __init__(self, aze=None,): self.aze = aze @@ -619,6 +633,11 @@ class failRequest_result: return + def __hash__(self): + value = 17 + value = (value * 31) ^ hash(self.aze) + return value + def __repr__(self): L = ['%s=%r' % (key, value) for key, value in self.__dict__.iteritems()] http://git-wip-us.apache.org/repos/asf/storm/blob/ef51dbee/storm-core/src/py/storm/Nimbus-remote ---------------------------------------------------------------------- diff --git a/storm-core/src/py/storm/Nimbus-remote b/storm-core/src/py/storm/Nimbus-remote index efd9220..4e487c9 100755 --- a/storm-core/src/py/storm/Nimbus-remote +++ b/storm-core/src/py/storm/Nimbus-remote @@ -18,47 +18,50 @@ #!/usr/bin/env python # -# 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 # +# options string: py:utf8strings +# import sys import pprint from urlparse import urlparse from thrift.transport import TTransport from thrift.transport import TSocket +from thrift.transport import TSSLSocket from thrift.transport import THttpClient from thrift.protocol import TBinaryProtocol -import Nimbus -from ttypes import * +from storm import Nimbus +from storm.ttypes import * if len(sys.argv) <= 1 or sys.argv[1] == '--help': - print '' - print 'Usage: ' + sys.argv[0] + ' [-h host:port] [-u url] [-f[ramed]] function [arg1 [arg2...]]' - print '' - print 'Functions:' - print ' void submitTopology(string name, string uploadedJarLocation, string jsonConf, StormTopology topology)' - print ' void submitTopologyWithOpts(string name, string uploadedJarLocation, string jsonConf, StormTopology topology, SubmitOptions options)' - print ' void killTopology(string name)' - print ' void killTopologyWithOpts(string name, KillOptions options)' - print ' void activate(string name)' - print ' void deactivate(string name)' - print ' void rebalance(string name, RebalanceOptions options)' - print ' void uploadNewCredentials(string name, Credentials creds)' - print ' string beginFileUpload()' - print ' void uploadChunk(string location, string chunk)' - print ' void finishFileUpload(string location)' - print ' string beginFileDownload(string file)' - print ' string downloadChunk(string id)' - print ' string getNimbusConf()' - print ' ClusterSummary getClusterInfo()' - print ' TopologyInfo getTopologyInfo(string id)' - print ' string getTopologyConf(string id)' - print ' StormTopology getTopology(string id)' - print ' StormTopology getUserTopology(string id)' - print '' + print('') + print('Usage: ' + sys.argv[0] + ' [-h host[:port]] [-u url] [-f[ramed]] [-s[sl]] function [arg1 [arg2...]]') + print('') + print('Functions:') + print(' void submitTopology(string name, string uploadedJarLocation, string jsonConf, StormTopology topology)') + print(' void submitTopologyWithOpts(string name, string uploadedJarLocation, string jsonConf, StormTopology topology, SubmitOptions options)') + print(' void killTopology(string name)') + print(' void killTopologyWithOpts(string name, KillOptions options)') + print(' void activate(string name)') + print(' void deactivate(string name)') + print(' void rebalance(string name, RebalanceOptions options)') + print(' void uploadNewCredentials(string name, Credentials creds)') + print(' string beginFileUpload()') + print(' void uploadChunk(string location, string chunk)') + print(' void finishFileUpload(string location)') + print(' string beginFileDownload(string file)') + print(' string downloadChunk(string id)') + print(' string getNimbusConf()') + print(' ClusterSummary getClusterInfo()') + print(' TopologyInfo getTopologyInfo(string id)') + print(' string getTopologyConf(string id)') + print(' StormTopology getTopology(string id)') + print(' StormTopology getUserTopology(string id)') + print('') sys.exit(0) pp = pprint.PrettyPrinter(indent = 2) @@ -66,13 +69,15 @@ host = 'localhost' port = 9090 uri = '' framed = False +ssl = False http = False argi = 1 if sys.argv[argi] == '-h': parts = sys.argv[argi+1].split(':') host = parts[0] - port = int(parts[1]) + if len(parts) > 1: + port = int(parts[1]) argi += 2 if sys.argv[argi] == '-u': @@ -93,13 +98,17 @@ if sys.argv[argi] == '-f' or sys.argv[argi] == '-framed': framed = True argi += 1 +if sys.argv[argi] == '-s' or sys.argv[argi] == '-ssl': + ssl = True + argi += 1 + cmd = sys.argv[argi] args = sys.argv[argi+1:] if http: transport = THttpClient.THttpClient(host, port, uri) else: - socket = TSocket.TSocket(host, port) + socket = TSSLSocket.TSSLSocket(host, port, validate=False) if ssl else TSocket.TSocket(host, port) if framed: transport = TTransport.TFramedTransport(socket) else: @@ -110,120 +119,120 @@ transport.open() if cmd == 'submitTopology': if len(args) != 4: - print 'submitTopology requires 4 args' + print('submitTopology requires 4 args') sys.exit(1) pp.pprint(client.submitTopology(args[0],args[1],args[2],eval(args[3]),)) elif cmd == 'submitTopologyWithOpts': if len(args) != 5: - print 'submitTopologyWithOpts requires 5 args' + print('submitTopologyWithOpts requires 5 args') sys.exit(1) pp.pprint(client.submitTopologyWithOpts(args[0],args[1],args[2],eval(args[3]),eval(args[4]),)) elif cmd == 'killTopology': if len(args) != 1: - print 'killTopology requires 1 args' + print('killTopology requires 1 args') sys.exit(1) pp.pprint(client.killTopology(args[0],)) elif cmd == 'killTopologyWithOpts': if len(args) != 2: - print 'killTopologyWithOpts requires 2 args' + print('killTopologyWithOpts requires 2 args') sys.exit(1) pp.pprint(client.killTopologyWithOpts(args[0],eval(args[1]),)) elif cmd == 'activate': if len(args) != 1: - print 'activate requires 1 args' + print('activate requires 1 args') sys.exit(1) pp.pprint(client.activate(args[0],)) elif cmd == 'deactivate': if len(args) != 1: - print 'deactivate requires 1 args' + print('deactivate requires 1 args') sys.exit(1) pp.pprint(client.deactivate(args[0],)) elif cmd == 'rebalance': if len(args) != 2: - print 'rebalance requires 2 args' + print('rebalance requires 2 args') sys.exit(1) pp.pprint(client.rebalance(args[0],eval(args[1]),)) elif cmd == 'uploadNewCredentials': if len(args) != 2: - print 'uploadNewCredentials requires 2 args' + print('uploadNewCredentials requires 2 args') sys.exit(1) pp.pprint(client.uploadNewCredentials(args[0],eval(args[1]),)) elif cmd == 'beginFileUpload': if len(args) != 0: - print 'beginFileUpload requires 0 args' + print('beginFileUpload requires 0 args') sys.exit(1) pp.pprint(client.beginFileUpload()) elif cmd == 'uploadChunk': if len(args) != 2: - print 'uploadChunk requires 2 args' + print('uploadChunk requires 2 args') sys.exit(1) pp.pprint(client.uploadChunk(args[0],args[1],)) elif cmd == 'finishFileUpload': if len(args) != 1: - print 'finishFileUpload requires 1 args' + print('finishFileUpload requires 1 args') sys.exit(1) pp.pprint(client.finishFileUpload(args[0],)) elif cmd == 'beginFileDownload': if len(args) != 1: - print 'beginFileDownload requires 1 args' + print('beginFileDownload requires 1 args') sys.exit(1) pp.pprint(client.beginFileDownload(args[0],)) elif cmd == 'downloadChunk': if len(args) != 1: - print 'downloadChunk requires 1 args' + print('downloadChunk requires 1 args') sys.exit(1) pp.pprint(client.downloadChunk(args[0],)) elif cmd == 'getNimbusConf': if len(args) != 0: - print 'getNimbusConf requires 0 args' + print('getNimbusConf requires 0 args') sys.exit(1) pp.pprint(client.getNimbusConf()) elif cmd == 'getClusterInfo': if len(args) != 0: - print 'getClusterInfo requires 0 args' + print('getClusterInfo requires 0 args') sys.exit(1) pp.pprint(client.getClusterInfo()) elif cmd == 'getTopologyInfo': if len(args) != 1: - print 'getTopologyInfo requires 1 args' + print('getTopologyInfo requires 1 args') sys.exit(1) pp.pprint(client.getTopologyInfo(args[0],)) elif cmd == 'getTopologyConf': if len(args) != 1: - print 'getTopologyConf requires 1 args' + print('getTopologyConf requires 1 args') sys.exit(1) pp.pprint(client.getTopologyConf(args[0],)) elif cmd == 'getTopology': if len(args) != 1: - print 'getTopology requires 1 args' + print('getTopology requires 1 args') sys.exit(1) pp.pprint(client.getTopology(args[0],)) elif cmd == 'getUserTopology': if len(args) != 1: - print 'getUserTopology requires 1 args' + print('getUserTopology requires 1 args') sys.exit(1) pp.pprint(client.getUserTopology(args[0],)) else: - print 'Unrecognized method %s' % cmd + print('Unrecognized method %s' % cmd) sys.exit(1) transport.close()
