blob: 935cb66cd20f64df5b0c4ff15dc1bff9b46c6030 [file] [log] [blame]
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Autogenerated by Thrift Compiler (0.12.0)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package org.apache.storm.generated;
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.12.0)")
public class WorkerMetrics implements org.apache.storm.thrift.TBase<WorkerMetrics, WorkerMetrics._Fields>, java.io.Serializable, Cloneable, Comparable<WorkerMetrics> {
private static final org.apache.storm.thrift.protocol.TStruct STRUCT_DESC = new org.apache.storm.thrift.protocol.TStruct("WorkerMetrics");
private static final org.apache.storm.thrift.protocol.TField TOPOLOGY_ID_FIELD_DESC = new org.apache.storm.thrift.protocol.TField("topologyId", org.apache.storm.thrift.protocol.TType.STRING, (short)1);
private static final org.apache.storm.thrift.protocol.TField PORT_FIELD_DESC = new org.apache.storm.thrift.protocol.TField("port", org.apache.storm.thrift.protocol.TType.I32, (short)2);
private static final org.apache.storm.thrift.protocol.TField HOSTNAME_FIELD_DESC = new org.apache.storm.thrift.protocol.TField("hostname", org.apache.storm.thrift.protocol.TType.STRING, (short)3);
private static final org.apache.storm.thrift.protocol.TField METRIC_LIST_FIELD_DESC = new org.apache.storm.thrift.protocol.TField("metricList", org.apache.storm.thrift.protocol.TType.STRUCT, (short)4);
private static final org.apache.storm.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new WorkerMetricsStandardSchemeFactory();
private static final org.apache.storm.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new WorkerMetricsTupleSchemeFactory();
private @org.apache.storm.thrift.annotation.Nullable java.lang.String topologyId; // required
private int port; // required
private @org.apache.storm.thrift.annotation.Nullable java.lang.String hostname; // required
private @org.apache.storm.thrift.annotation.Nullable WorkerMetricList metricList; // required
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.storm.thrift.TFieldIdEnum {
TOPOLOGY_ID((short)1, "topologyId"),
PORT((short)2, "port"),
HOSTNAME((short)3, "hostname"),
METRIC_LIST((short)4, "metricList");
private static final java.util.Map<java.lang.String, _Fields> byName = new java.util.HashMap<java.lang.String, _Fields>();
static {
for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) {
byName.put(field.getFieldName(), field);
}
}
/**
* Find the _Fields constant that matches fieldId, or null if its not found.
*/
@org.apache.storm.thrift.annotation.Nullable
public static _Fields findByThriftId(int fieldId) {
switch(fieldId) {
case 1: // TOPOLOGY_ID
return TOPOLOGY_ID;
case 2: // PORT
return PORT;
case 3: // HOSTNAME
return HOSTNAME;
case 4: // METRIC_LIST
return METRIC_LIST;
default:
return null;
}
}
/**
* Find the _Fields constant that matches fieldId, throwing an exception
* if it is not found.
*/
public static _Fields findByThriftIdOrThrow(int fieldId) {
_Fields fields = findByThriftId(fieldId);
if (fields == null) throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!");
return fields;
}
/**
* Find the _Fields constant that matches name, or null if its not found.
*/
@org.apache.storm.thrift.annotation.Nullable
public static _Fields findByName(java.lang.String name) {
return byName.get(name);
}
private final short _thriftId;
private final java.lang.String _fieldName;
_Fields(short thriftId, java.lang.String fieldName) {
_thriftId = thriftId;
_fieldName = fieldName;
}
public short getThriftFieldId() {
return _thriftId;
}
public java.lang.String getFieldName() {
return _fieldName;
}
}
// isset id assignments
private static final int __PORT_ISSET_ID = 0;
private byte __isset_bitfield = 0;
public static final java.util.Map<_Fields, org.apache.storm.thrift.meta_data.FieldMetaData> metaDataMap;
static {
java.util.Map<_Fields, org.apache.storm.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.storm.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.TOPOLOGY_ID, new org.apache.storm.thrift.meta_data.FieldMetaData("topologyId", org.apache.storm.thrift.TFieldRequirementType.REQUIRED,
new org.apache.storm.thrift.meta_data.FieldValueMetaData(org.apache.storm.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.PORT, new org.apache.storm.thrift.meta_data.FieldMetaData("port", org.apache.storm.thrift.TFieldRequirementType.REQUIRED,
new org.apache.storm.thrift.meta_data.FieldValueMetaData(org.apache.storm.thrift.protocol.TType.I32)));
tmpMap.put(_Fields.HOSTNAME, new org.apache.storm.thrift.meta_data.FieldMetaData("hostname", org.apache.storm.thrift.TFieldRequirementType.REQUIRED,
new org.apache.storm.thrift.meta_data.FieldValueMetaData(org.apache.storm.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.METRIC_LIST, new org.apache.storm.thrift.meta_data.FieldMetaData("metricList", org.apache.storm.thrift.TFieldRequirementType.REQUIRED,
new org.apache.storm.thrift.meta_data.StructMetaData(org.apache.storm.thrift.protocol.TType.STRUCT, WorkerMetricList.class)));
metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
org.apache.storm.thrift.meta_data.FieldMetaData.addStructMetaDataMap(WorkerMetrics.class, metaDataMap);
}
public WorkerMetrics() {
}
public WorkerMetrics(
java.lang.String topologyId,
int port,
java.lang.String hostname,
WorkerMetricList metricList)
{
this();
this.topologyId = topologyId;
this.port = port;
set_port_isSet(true);
this.hostname = hostname;
this.metricList = metricList;
}
/**
* Performs a deep copy on <i>other</i>.
*/
public WorkerMetrics(WorkerMetrics other) {
__isset_bitfield = other.__isset_bitfield;
if (other.is_set_topologyId()) {
this.topologyId = other.topologyId;
}
this.port = other.port;
if (other.is_set_hostname()) {
this.hostname = other.hostname;
}
if (other.is_set_metricList()) {
this.metricList = new WorkerMetricList(other.metricList);
}
}
public WorkerMetrics deepCopy() {
return new WorkerMetrics(this);
}
@Override
public void clear() {
this.topologyId = null;
set_port_isSet(false);
this.port = 0;
this.hostname = null;
this.metricList = null;
}
@org.apache.storm.thrift.annotation.Nullable
public java.lang.String get_topologyId() {
return this.topologyId;
}
public void set_topologyId(@org.apache.storm.thrift.annotation.Nullable java.lang.String topologyId) {
this.topologyId = topologyId;
}
public void unset_topologyId() {
this.topologyId = null;
}
/** Returns true if field topologyId is set (has been assigned a value) and false otherwise */
public boolean is_set_topologyId() {
return this.topologyId != null;
}
public void set_topologyId_isSet(boolean value) {
if (!value) {
this.topologyId = null;
}
}
public int get_port() {
return this.port;
}
public void set_port(int port) {
this.port = port;
set_port_isSet(true);
}
public void unset_port() {
__isset_bitfield = org.apache.storm.thrift.EncodingUtils.clearBit(__isset_bitfield, __PORT_ISSET_ID);
}
/** Returns true if field port is set (has been assigned a value) and false otherwise */
public boolean is_set_port() {
return org.apache.storm.thrift.EncodingUtils.testBit(__isset_bitfield, __PORT_ISSET_ID);
}
public void set_port_isSet(boolean value) {
__isset_bitfield = org.apache.storm.thrift.EncodingUtils.setBit(__isset_bitfield, __PORT_ISSET_ID, value);
}
@org.apache.storm.thrift.annotation.Nullable
public java.lang.String get_hostname() {
return this.hostname;
}
public void set_hostname(@org.apache.storm.thrift.annotation.Nullable java.lang.String hostname) {
this.hostname = hostname;
}
public void unset_hostname() {
this.hostname = null;
}
/** Returns true if field hostname is set (has been assigned a value) and false otherwise */
public boolean is_set_hostname() {
return this.hostname != null;
}
public void set_hostname_isSet(boolean value) {
if (!value) {
this.hostname = null;
}
}
@org.apache.storm.thrift.annotation.Nullable
public WorkerMetricList get_metricList() {
return this.metricList;
}
public void set_metricList(@org.apache.storm.thrift.annotation.Nullable WorkerMetricList metricList) {
this.metricList = metricList;
}
public void unset_metricList() {
this.metricList = null;
}
/** Returns true if field metricList is set (has been assigned a value) and false otherwise */
public boolean is_set_metricList() {
return this.metricList != null;
}
public void set_metricList_isSet(boolean value) {
if (!value) {
this.metricList = null;
}
}
public void setFieldValue(_Fields field, @org.apache.storm.thrift.annotation.Nullable java.lang.Object value) {
switch (field) {
case TOPOLOGY_ID:
if (value == null) {
unset_topologyId();
} else {
set_topologyId((java.lang.String)value);
}
break;
case PORT:
if (value == null) {
unset_port();
} else {
set_port((java.lang.Integer)value);
}
break;
case HOSTNAME:
if (value == null) {
unset_hostname();
} else {
set_hostname((java.lang.String)value);
}
break;
case METRIC_LIST:
if (value == null) {
unset_metricList();
} else {
set_metricList((WorkerMetricList)value);
}
break;
}
}
@org.apache.storm.thrift.annotation.Nullable
public java.lang.Object getFieldValue(_Fields field) {
switch (field) {
case TOPOLOGY_ID:
return get_topologyId();
case PORT:
return get_port();
case HOSTNAME:
return get_hostname();
case METRIC_LIST:
return get_metricList();
}
throw new java.lang.IllegalStateException();
}
/** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
public boolean isSet(_Fields field) {
if (field == null) {
throw new java.lang.IllegalArgumentException();
}
switch (field) {
case TOPOLOGY_ID:
return is_set_topologyId();
case PORT:
return is_set_port();
case HOSTNAME:
return is_set_hostname();
case METRIC_LIST:
return is_set_metricList();
}
throw new java.lang.IllegalStateException();
}
@Override
public boolean equals(java.lang.Object that) {
if (that == null)
return false;
if (that instanceof WorkerMetrics)
return this.equals((WorkerMetrics)that);
return false;
}
public boolean equals(WorkerMetrics that) {
if (that == null)
return false;
if (this == that)
return true;
boolean this_present_topologyId = true && this.is_set_topologyId();
boolean that_present_topologyId = true && that.is_set_topologyId();
if (this_present_topologyId || that_present_topologyId) {
if (!(this_present_topologyId && that_present_topologyId))
return false;
if (!this.topologyId.equals(that.topologyId))
return false;
}
boolean this_present_port = true;
boolean that_present_port = true;
if (this_present_port || that_present_port) {
if (!(this_present_port && that_present_port))
return false;
if (this.port != that.port)
return false;
}
boolean this_present_hostname = true && this.is_set_hostname();
boolean that_present_hostname = true && that.is_set_hostname();
if (this_present_hostname || that_present_hostname) {
if (!(this_present_hostname && that_present_hostname))
return false;
if (!this.hostname.equals(that.hostname))
return false;
}
boolean this_present_metricList = true && this.is_set_metricList();
boolean that_present_metricList = true && that.is_set_metricList();
if (this_present_metricList || that_present_metricList) {
if (!(this_present_metricList && that_present_metricList))
return false;
if (!this.metricList.equals(that.metricList))
return false;
}
return true;
}
@Override
public int hashCode() {
int hashCode = 1;
hashCode = hashCode * 8191 + ((is_set_topologyId()) ? 131071 : 524287);
if (is_set_topologyId())
hashCode = hashCode * 8191 + topologyId.hashCode();
hashCode = hashCode * 8191 + port;
hashCode = hashCode * 8191 + ((is_set_hostname()) ? 131071 : 524287);
if (is_set_hostname())
hashCode = hashCode * 8191 + hostname.hashCode();
hashCode = hashCode * 8191 + ((is_set_metricList()) ? 131071 : 524287);
if (is_set_metricList())
hashCode = hashCode * 8191 + metricList.hashCode();
return hashCode;
}
@Override
public int compareTo(WorkerMetrics other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
lastComparison = java.lang.Boolean.valueOf(is_set_topologyId()).compareTo(other.is_set_topologyId());
if (lastComparison != 0) {
return lastComparison;
}
if (is_set_topologyId()) {
lastComparison = org.apache.storm.thrift.TBaseHelper.compareTo(this.topologyId, other.topologyId);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = java.lang.Boolean.valueOf(is_set_port()).compareTo(other.is_set_port());
if (lastComparison != 0) {
return lastComparison;
}
if (is_set_port()) {
lastComparison = org.apache.storm.thrift.TBaseHelper.compareTo(this.port, other.port);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = java.lang.Boolean.valueOf(is_set_hostname()).compareTo(other.is_set_hostname());
if (lastComparison != 0) {
return lastComparison;
}
if (is_set_hostname()) {
lastComparison = org.apache.storm.thrift.TBaseHelper.compareTo(this.hostname, other.hostname);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = java.lang.Boolean.valueOf(is_set_metricList()).compareTo(other.is_set_metricList());
if (lastComparison != 0) {
return lastComparison;
}
if (is_set_metricList()) {
lastComparison = org.apache.storm.thrift.TBaseHelper.compareTo(this.metricList, other.metricList);
if (lastComparison != 0) {
return lastComparison;
}
}
return 0;
}
@org.apache.storm.thrift.annotation.Nullable
public _Fields fieldForId(int fieldId) {
return _Fields.findByThriftId(fieldId);
}
public void read(org.apache.storm.thrift.protocol.TProtocol iprot) throws org.apache.storm.thrift.TException {
scheme(iprot).read(iprot, this);
}
public void write(org.apache.storm.thrift.protocol.TProtocol oprot) throws org.apache.storm.thrift.TException {
scheme(oprot).write(oprot, this);
}
@Override
public java.lang.String toString() {
java.lang.StringBuilder sb = new java.lang.StringBuilder("WorkerMetrics(");
boolean first = true;
sb.append("topologyId:");
if (this.topologyId == null) {
sb.append("null");
} else {
sb.append(this.topologyId);
}
first = false;
if (!first) sb.append(", ");
sb.append("port:");
sb.append(this.port);
first = false;
if (!first) sb.append(", ");
sb.append("hostname:");
if (this.hostname == null) {
sb.append("null");
} else {
sb.append(this.hostname);
}
first = false;
if (!first) sb.append(", ");
sb.append("metricList:");
if (this.metricList == null) {
sb.append("null");
} else {
sb.append(this.metricList);
}
first = false;
sb.append(")");
return sb.toString();
}
public void validate() throws org.apache.storm.thrift.TException {
// check for required fields
if (!is_set_topologyId()) {
throw new org.apache.storm.thrift.protocol.TProtocolException("Required field 'topologyId' is unset! Struct:" + toString());
}
if (!is_set_port()) {
throw new org.apache.storm.thrift.protocol.TProtocolException("Required field 'port' is unset! Struct:" + toString());
}
if (!is_set_hostname()) {
throw new org.apache.storm.thrift.protocol.TProtocolException("Required field 'hostname' is unset! Struct:" + toString());
}
if (!is_set_metricList()) {
throw new org.apache.storm.thrift.protocol.TProtocolException("Required field 'metricList' is unset! Struct:" + toString());
}
// check for sub-struct validity
if (metricList != null) {
metricList.validate();
}
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
try {
write(new org.apache.storm.thrift.protocol.TCompactProtocol(new org.apache.storm.thrift.transport.TIOStreamTransport(out)));
} catch (org.apache.storm.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.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_bitfield = 0;
read(new org.apache.storm.thrift.protocol.TCompactProtocol(new org.apache.storm.thrift.transport.TIOStreamTransport(in)));
} catch (org.apache.storm.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private static class WorkerMetricsStandardSchemeFactory implements org.apache.storm.thrift.scheme.SchemeFactory {
public WorkerMetricsStandardScheme getScheme() {
return new WorkerMetricsStandardScheme();
}
}
private static class WorkerMetricsStandardScheme extends org.apache.storm.thrift.scheme.StandardScheme<WorkerMetrics> {
public void read(org.apache.storm.thrift.protocol.TProtocol iprot, WorkerMetrics struct) throws org.apache.storm.thrift.TException {
org.apache.storm.thrift.protocol.TField schemeField;
iprot.readStructBegin();
while (true)
{
schemeField = iprot.readFieldBegin();
if (schemeField.type == org.apache.storm.thrift.protocol.TType.STOP) {
break;
}
switch (schemeField.id) {
case 1: // TOPOLOGY_ID
if (schemeField.type == org.apache.storm.thrift.protocol.TType.STRING) {
struct.topologyId = iprot.readString();
struct.set_topologyId_isSet(true);
} else {
org.apache.storm.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 2: // PORT
if (schemeField.type == org.apache.storm.thrift.protocol.TType.I32) {
struct.port = iprot.readI32();
struct.set_port_isSet(true);
} else {
org.apache.storm.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 3: // HOSTNAME
if (schemeField.type == org.apache.storm.thrift.protocol.TType.STRING) {
struct.hostname = iprot.readString();
struct.set_hostname_isSet(true);
} else {
org.apache.storm.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 4: // METRIC_LIST
if (schemeField.type == org.apache.storm.thrift.protocol.TType.STRUCT) {
struct.metricList = new WorkerMetricList();
struct.metricList.read(iprot);
struct.set_metricList_isSet(true);
} else {
org.apache.storm.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
default:
org.apache.storm.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
iprot.readFieldEnd();
}
iprot.readStructEnd();
struct.validate();
}
public void write(org.apache.storm.thrift.protocol.TProtocol oprot, WorkerMetrics struct) throws org.apache.storm.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
if (struct.topologyId != null) {
oprot.writeFieldBegin(TOPOLOGY_ID_FIELD_DESC);
oprot.writeString(struct.topologyId);
oprot.writeFieldEnd();
}
oprot.writeFieldBegin(PORT_FIELD_DESC);
oprot.writeI32(struct.port);
oprot.writeFieldEnd();
if (struct.hostname != null) {
oprot.writeFieldBegin(HOSTNAME_FIELD_DESC);
oprot.writeString(struct.hostname);
oprot.writeFieldEnd();
}
if (struct.metricList != null) {
oprot.writeFieldBegin(METRIC_LIST_FIELD_DESC);
struct.metricList.write(oprot);
oprot.writeFieldEnd();
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class WorkerMetricsTupleSchemeFactory implements org.apache.storm.thrift.scheme.SchemeFactory {
public WorkerMetricsTupleScheme getScheme() {
return new WorkerMetricsTupleScheme();
}
}
private static class WorkerMetricsTupleScheme extends org.apache.storm.thrift.scheme.TupleScheme<WorkerMetrics> {
@Override
public void write(org.apache.storm.thrift.protocol.TProtocol prot, WorkerMetrics struct) throws org.apache.storm.thrift.TException {
org.apache.storm.thrift.protocol.TTupleProtocol oprot = (org.apache.storm.thrift.protocol.TTupleProtocol) prot;
oprot.writeString(struct.topologyId);
oprot.writeI32(struct.port);
oprot.writeString(struct.hostname);
struct.metricList.write(oprot);
}
@Override
public void read(org.apache.storm.thrift.protocol.TProtocol prot, WorkerMetrics struct) throws org.apache.storm.thrift.TException {
org.apache.storm.thrift.protocol.TTupleProtocol iprot = (org.apache.storm.thrift.protocol.TTupleProtocol) prot;
struct.topologyId = iprot.readString();
struct.set_topologyId_isSet(true);
struct.port = iprot.readI32();
struct.set_port_isSet(true);
struct.hostname = iprot.readString();
struct.set_hostname_isSet(true);
struct.metricList = new WorkerMetricList();
struct.metricList.read(iprot);
struct.set_metricList_isSet(true);
}
}
private static <S extends org.apache.storm.thrift.scheme.IScheme> S scheme(org.apache.storm.thrift.protocol.TProtocol proto) {
return (org.apache.storm.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme();
}
}