/** * Autogenerated by Thrift * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING */ package com.flaptor.indextank.rpc; import java.util.List; import java.util.ArrayList; import java.util.Map; import java.util.HashMap; import java.util.EnumMap; import java.util.Set; import java.util.HashSet; import java.util.EnumSet; import java.util.Collections; import java.util.BitSet; import java.nio.ByteBuffer; import java.util.Arrays; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.apache.thrift.*; import org.apache.thrift.async.*; import org.apache.thrift.meta_data.*; import org.apache.thrift.transport.*; import org.apache.thrift.protocol.*; @SuppressWarnings("all") public class WorkerManager { public interface Iface { public int add_worker(String instance_type) throws NebuException, TException; public int remove_worker(String instance_name) throws NebuException, TException; public int update_status(String instance_name) throws NebuException, TException; } public interface AsyncIface { public void add_worker(String instance_type, AsyncMethodCallback<AsyncClient.add_worker_call> resultHandler) throws TException; public void remove_worker(String instance_name, AsyncMethodCallback<AsyncClient.remove_worker_call> resultHandler) throws TException; public void update_status(String instance_name, AsyncMethodCallback<AsyncClient.update_status_call> resultHandler) throws TException; } public static class Client implements TServiceClient, Iface { public static class Factory implements TServiceClientFactory<Client> { public Factory() {} public Client getClient(TProtocol prot) { return new Client(prot); } public Client getClient(TProtocol iprot, TProtocol oprot) { return new Client(iprot, oprot); } } public Client(TProtocol prot) { this(prot, prot); } public Client(TProtocol iprot, TProtocol oprot) { iprot_ = iprot; oprot_ = oprot; } protected TProtocol iprot_; protected TProtocol oprot_; protected int seqid_; public TProtocol getInputProtocol() { return this.iprot_; } public TProtocol getOutputProtocol() { return this.oprot_; } public int add_worker(String instance_type) throws NebuException, TException { send_add_worker(instance_type); return recv_add_worker(); } public void send_add_worker(String instance_type) throws TException { oprot_.writeMessageBegin(new TMessage("add_worker", TMessageType.CALL, ++seqid_)); add_worker_args args = new add_worker_args(); args.set_instance_type(instance_type); args.write(oprot_); oprot_.writeMessageEnd(); oprot_.getTransport().flush(); } public int recv_add_worker() throws NebuException, TException { TMessage msg = iprot_.readMessageBegin(); if (msg.type == TMessageType.EXCEPTION) { TApplicationException x = TApplicationException.read(iprot_); iprot_.readMessageEnd(); throw x; } if (msg.seqid != seqid_) { throw new TApplicationException(TApplicationException.BAD_SEQUENCE_ID, "add_worker failed: out of sequence response"); } add_worker_result result = new add_worker_result(); result.read(iprot_); iprot_.readMessageEnd(); if (result.is_set_success()) { return result.success; } if (result.ne != null) { throw result.ne; } throw new TApplicationException(TApplicationException.MISSING_RESULT, "add_worker failed: unknown result"); } public int remove_worker(String instance_name) throws NebuException, TException { send_remove_worker(instance_name); return recv_remove_worker(); } public void send_remove_worker(String instance_name) throws TException { oprot_.writeMessageBegin(new TMessage("remove_worker", TMessageType.CALL, ++seqid_)); remove_worker_args args = new remove_worker_args(); args.set_instance_name(instance_name); args.write(oprot_); oprot_.writeMessageEnd(); oprot_.getTransport().flush(); } public int recv_remove_worker() throws NebuException, TException { TMessage msg = iprot_.readMessageBegin(); if (msg.type == TMessageType.EXCEPTION) { TApplicationException x = TApplicationException.read(iprot_); iprot_.readMessageEnd(); throw x; } if (msg.seqid != seqid_) { throw new TApplicationException(TApplicationException.BAD_SEQUENCE_ID, "remove_worker failed: out of sequence response"); } remove_worker_result result = new remove_worker_result(); result.read(iprot_); iprot_.readMessageEnd(); if (result.is_set_success()) { return result.success; } if (result.ne != null) { throw result.ne; } throw new TApplicationException(TApplicationException.MISSING_RESULT, "remove_worker failed: unknown result"); } public int update_status(String instance_name) throws NebuException, TException { send_update_status(instance_name); return recv_update_status(); } public void send_update_status(String instance_name) throws TException { oprot_.writeMessageBegin(new TMessage("update_status", TMessageType.CALL, ++seqid_)); update_status_args args = new update_status_args(); args.set_instance_name(instance_name); args.write(oprot_); oprot_.writeMessageEnd(); oprot_.getTransport().flush(); } public int recv_update_status() throws NebuException, TException { TMessage msg = iprot_.readMessageBegin(); if (msg.type == TMessageType.EXCEPTION) { TApplicationException x = TApplicationException.read(iprot_); iprot_.readMessageEnd(); throw x; } if (msg.seqid != seqid_) { throw new TApplicationException(TApplicationException.BAD_SEQUENCE_ID, "update_status failed: out of sequence response"); } update_status_result result = new update_status_result(); result.read(iprot_); iprot_.readMessageEnd(); if (result.is_set_success()) { return result.success; } if (result.ne != null) { throw result.ne; } throw new TApplicationException(TApplicationException.MISSING_RESULT, "update_status failed: unknown result"); } } public static class AsyncClient extends TAsyncClient implements AsyncIface { public static class Factory implements TAsyncClientFactory<AsyncClient> { private TAsyncClientManager clientManager; private TProtocolFactory protocolFactory; public Factory(TAsyncClientManager clientManager, TProtocolFactory protocolFactory) { this.clientManager = clientManager; this.protocolFactory = protocolFactory; } public AsyncClient getAsyncClient(TNonblockingTransport transport) { return new AsyncClient(protocolFactory, clientManager, transport); } } public AsyncClient(TProtocolFactory protocolFactory, TAsyncClientManager clientManager, TNonblockingTransport transport) { super(protocolFactory, clientManager, transport); } public void add_worker(String instance_type, AsyncMethodCallback<add_worker_call> resultHandler) throws TException { checkReady(); add_worker_call method_call = new add_worker_call(instance_type, resultHandler, this, protocolFactory, transport); manager.call(method_call); } public static class add_worker_call extends TAsyncMethodCall { private String instance_type; public add_worker_call(String instance_type, AsyncMethodCallback<add_worker_call> resultHandler, TAsyncClient client, TProtocolFactory protocolFactory, TNonblockingTransport transport) throws TException { super(client, protocolFactory, transport, resultHandler, false); this.instance_type = instance_type; } public void write_args(TProtocol prot) throws TException { prot.writeMessageBegin(new TMessage("add_worker", TMessageType.CALL, 0)); add_worker_args args = new add_worker_args(); args.set_instance_type(instance_type); args.write(prot); prot.writeMessageEnd(); } public int getResult() throws NebuException, TException { if (getState() != State.RESPONSE_READ) { throw new IllegalStateException("Method call not finished!"); } TMemoryInputTransport memoryTransport = new TMemoryInputTransport(getFrameBuffer().array()); TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); return (new Client(prot)).recv_add_worker(); } } public void remove_worker(String instance_name, AsyncMethodCallback<remove_worker_call> resultHandler) throws TException { checkReady(); remove_worker_call method_call = new remove_worker_call(instance_name, resultHandler, this, protocolFactory, transport); manager.call(method_call); } public static class remove_worker_call extends TAsyncMethodCall { private String instance_name; public remove_worker_call(String instance_name, AsyncMethodCallback<remove_worker_call> resultHandler, TAsyncClient client, TProtocolFactory protocolFactory, TNonblockingTransport transport) throws TException { super(client, protocolFactory, transport, resultHandler, false); this.instance_name = instance_name; } public void write_args(TProtocol prot) throws TException { prot.writeMessageBegin(new TMessage("remove_worker", TMessageType.CALL, 0)); remove_worker_args args = new remove_worker_args(); args.set_instance_name(instance_name); args.write(prot); prot.writeMessageEnd(); } public int getResult() throws NebuException, TException { if (getState() != State.RESPONSE_READ) { throw new IllegalStateException("Method call not finished!"); } TMemoryInputTransport memoryTransport = new TMemoryInputTransport(getFrameBuffer().array()); TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); return (new Client(prot)).recv_remove_worker(); } } public void update_status(String instance_name, AsyncMethodCallback<update_status_call> resultHandler) throws TException { checkReady(); update_status_call method_call = new update_status_call(instance_name, resultHandler, this, protocolFactory, transport); manager.call(method_call); } public static class update_status_call extends TAsyncMethodCall { private String instance_name; public update_status_call(String instance_name, AsyncMethodCallback<update_status_call> resultHandler, TAsyncClient client, TProtocolFactory protocolFactory, TNonblockingTransport transport) throws TException { super(client, protocolFactory, transport, resultHandler, false); this.instance_name = instance_name; } public void write_args(TProtocol prot) throws TException { prot.writeMessageBegin(new TMessage("update_status", TMessageType.CALL, 0)); update_status_args args = new update_status_args(); args.set_instance_name(instance_name); args.write(prot); prot.writeMessageEnd(); } public int getResult() throws NebuException, TException { if (getState() != State.RESPONSE_READ) { throw new IllegalStateException("Method call not finished!"); } TMemoryInputTransport memoryTransport = new TMemoryInputTransport(getFrameBuffer().array()); TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); return (new Client(prot)).recv_update_status(); } } } public static class Processor implements TProcessor { private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName()); public Processor(Iface iface) { iface_ = iface; processMap_.put("add_worker", new add_worker()); processMap_.put("remove_worker", new remove_worker()); processMap_.put("update_status", new update_status()); } protected static interface ProcessFunction { public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException; } private Iface iface_; protected final HashMap<String,ProcessFunction> processMap_ = new HashMap<String,ProcessFunction>(); public boolean process(TProtocol iprot, TProtocol oprot) throws TException { TMessage msg = iprot.readMessageBegin(); ProcessFunction fn = processMap_.get(msg.name); if (fn == null) { TProtocolUtil.skip(iprot, TType.STRUCT); iprot.readMessageEnd(); TApplicationException x = new TApplicationException(TApplicationException.UNKNOWN_METHOD, "Invalid method name: '"+msg.name+"'"); oprot.writeMessageBegin(new TMessage(msg.name, TMessageType.EXCEPTION, msg.seqid)); x.write(oprot); oprot.writeMessageEnd(); oprot.getTransport().flush(); return true; } fn.process(msg.seqid, iprot, oprot); return true; } private class add_worker implements ProcessFunction { public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException { add_worker_args args = new add_worker_args(); try { args.read(iprot); } catch (TProtocolException e) { iprot.readMessageEnd(); TApplicationException x = new TApplicationException(TApplicationException.PROTOCOL_ERROR, e.getMessage()); oprot.writeMessageBegin(new TMessage("add_worker", TMessageType.EXCEPTION, seqid)); x.write(oprot); oprot.writeMessageEnd(); oprot.getTransport().flush(); return; } iprot.readMessageEnd(); add_worker_result result = new add_worker_result(); try { result.success = iface_.add_worker(args.instance_type); result.set_success_isSet(true); } catch (NebuException ne) { result.ne = ne; } catch (Throwable th) { LOGGER.error("Internal error processing add_worker", th); TApplicationException x = new TApplicationException(TApplicationException.INTERNAL_ERROR, "Internal error processing add_worker"); oprot.writeMessageBegin(new TMessage("add_worker", TMessageType.EXCEPTION, seqid)); x.write(oprot); oprot.writeMessageEnd(); oprot.getTransport().flush(); return; } oprot.writeMessageBegin(new TMessage("add_worker", TMessageType.REPLY, seqid)); result.write(oprot); oprot.writeMessageEnd(); oprot.getTransport().flush(); } } private class remove_worker implements ProcessFunction { public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException { remove_worker_args args = new remove_worker_args(); try { args.read(iprot); } catch (TProtocolException e) { iprot.readMessageEnd(); TApplicationException x = new TApplicationException(TApplicationException.PROTOCOL_ERROR, e.getMessage()); oprot.writeMessageBegin(new TMessage("remove_worker", TMessageType.EXCEPTION, seqid)); x.write(oprot); oprot.writeMessageEnd(); oprot.getTransport().flush(); return; } iprot.readMessageEnd(); remove_worker_result result = new remove_worker_result(); try { result.success = iface_.remove_worker(args.instance_name); result.set_success_isSet(true); } catch (NebuException ne) { result.ne = ne; } catch (Throwable th) { LOGGER.error("Internal error processing remove_worker", th); TApplicationException x = new TApplicationException(TApplicationException.INTERNAL_ERROR, "Internal error processing remove_worker"); oprot.writeMessageBegin(new TMessage("remove_worker", TMessageType.EXCEPTION, seqid)); x.write(oprot); oprot.writeMessageEnd(); oprot.getTransport().flush(); return; } oprot.writeMessageBegin(new TMessage("remove_worker", TMessageType.REPLY, seqid)); result.write(oprot); oprot.writeMessageEnd(); oprot.getTransport().flush(); } } private class update_status implements ProcessFunction { public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException { update_status_args args = new update_status_args(); try { args.read(iprot); } catch (TProtocolException e) { iprot.readMessageEnd(); TApplicationException x = new TApplicationException(TApplicationException.PROTOCOL_ERROR, e.getMessage()); oprot.writeMessageBegin(new TMessage("update_status", TMessageType.EXCEPTION, seqid)); x.write(oprot); oprot.writeMessageEnd(); oprot.getTransport().flush(); return; } iprot.readMessageEnd(); update_status_result result = new update_status_result(); try { result.success = iface_.update_status(args.instance_name); result.set_success_isSet(true); } catch (NebuException ne) { result.ne = ne; } catch (Throwable th) { LOGGER.error("Internal error processing update_status", th); TApplicationException x = new TApplicationException(TApplicationException.INTERNAL_ERROR, "Internal error processing update_status"); oprot.writeMessageBegin(new TMessage("update_status", TMessageType.EXCEPTION, seqid)); x.write(oprot); oprot.writeMessageEnd(); oprot.getTransport().flush(); return; } oprot.writeMessageBegin(new TMessage("update_status", TMessageType.REPLY, seqid)); result.write(oprot); oprot.writeMessageEnd(); oprot.getTransport().flush(); } } } public static class add_worker_args implements TBase<add_worker_args, add_worker_args._Fields>, java.io.Serializable, Cloneable { private static final TStruct STRUCT_DESC = new TStruct("add_worker_args"); private static final TField INSTANCE_TYPE_FIELD_DESC = new TField("instance_type", TType.STRING, (short)1); private String instance_type; /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements TFieldIdEnum { INSTANCE_TYPE((short)1, "instance_type"); private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); static { for (_Fields field : EnumSet.allOf(_Fields.class)) { byName.put(field.getFieldName(), field); } } /** * Find the _Fields constant that matches fieldId, or null if its not found. */ public static _Fields findByThriftId(int fieldId) { switch(fieldId) { case 1: // INSTANCE_TYPE return INSTANCE_TYPE; 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 IllegalArgumentException("Field " + fieldId + " doesn't exist!"); return fields; } /** * Find the _Fields constant that matches name, or null if its not found. */ public static _Fields findByName(String name) { return byName.get(name); } private final short _thriftId; private final String _fieldName; _Fields(short thriftId, String fieldName) { _thriftId = thriftId; _fieldName = fieldName; } public short getThriftFieldId() { return _thriftId; } public String getFieldName() { return _fieldName; } } // isset id assignments public static final Map<_Fields, FieldMetaData> metaDataMap; static { Map<_Fields, FieldMetaData> tmpMap = new EnumMap<_Fields, FieldMetaData>(_Fields.class); tmpMap.put(_Fields.INSTANCE_TYPE, new FieldMetaData("instance_type", TFieldRequirementType.DEFAULT, new FieldValueMetaData(TType.STRING))); metaDataMap = Collections.unmodifiableMap(tmpMap); FieldMetaData.addStructMetaDataMap(add_worker_args.class, metaDataMap); } public add_worker_args() { this.instance_type = "m1.large"; } public add_worker_args( String instance_type) { this(); this.instance_type = instance_type; } /** * Performs a deep copy on <i>other</i>. */ public add_worker_args(add_worker_args other) { if (other.is_set_instance_type()) { this.instance_type = other.instance_type; } } public add_worker_args deepCopy() { return new add_worker_args(this); } @Override public void clear() { this.instance_type = "m1.large"; } public String get_instance_type() { return this.instance_type; } public add_worker_args set_instance_type(String instance_type) { this.instance_type = instance_type; return this; } public void unset_instance_type() { this.instance_type = null; } /** Returns true if field instance_type is set (has been asigned a value) and false otherwise */ public boolean is_set_instance_type() { return this.instance_type != null; } public void set_instance_type_isSet(boolean value) { if (!value) { this.instance_type = null; } } public void setFieldValue(_Fields field, Object value) { switch (field) { case INSTANCE_TYPE: if (value == null) { unset_instance_type(); } else { set_instance_type((String)value); } break; } } public Object getFieldValue(_Fields field) { switch (field) { case INSTANCE_TYPE: return get_instance_type(); } throw new IllegalStateException(); } /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */ public boolean isSet(_Fields field) { if (field == null) { throw new IllegalArgumentException(); } switch (field) { case INSTANCE_TYPE: return is_set_instance_type(); } throw new IllegalStateException(); } @Override public boolean equals(Object that) { if (that == null) return false; if (that instanceof add_worker_args) return this.equals((add_worker_args)that); return false; } public boolean equals(add_worker_args that) { if (that == null) return false; boolean this_present_instance_type = true && this.is_set_instance_type(); boolean that_present_instance_type = true && that.is_set_instance_type(); if (this_present_instance_type || that_present_instance_type) { if (!(this_present_instance_type && that_present_instance_type)) return false; if (!this.instance_type.equals(that.instance_type)) return false; } return true; } @Override public int hashCode() { return 0; } public int compareTo(add_worker_args other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; add_worker_args typedOther = (add_worker_args)other; lastComparison = Boolean.valueOf(is_set_instance_type()).compareTo(typedOther.is_set_instance_type()); if (lastComparison != 0) { return lastComparison; } if (is_set_instance_type()) { lastComparison = TBaseHelper.compareTo(this.instance_type, typedOther.instance_type); if (lastComparison != 0) { return lastComparison; } } return 0; } public _Fields fieldForId(int fieldId) { return _Fields.findByThriftId(fieldId); } public void read(TProtocol iprot) throws TException { TField field; iprot.readStructBegin(); while (true) { field = iprot.readFieldBegin(); if (field.type == TType.STOP) { break; } switch (field.id) { case 1: // INSTANCE_TYPE if (field.type == TType.STRING) { this.instance_type = iprot.readString(); } else { TProtocolUtil.skip(iprot, field.type); } break; default: TProtocolUtil.skip(iprot, field.type); } iprot.readFieldEnd(); } iprot.readStructEnd(); // check for required fields of primitive type, which can't be checked in the validate method validate(); } public void write(TProtocol oprot) throws TException { validate(); oprot.writeStructBegin(STRUCT_DESC); if (this.instance_type != null) { oprot.writeFieldBegin(INSTANCE_TYPE_FIELD_DESC); oprot.writeString(this.instance_type); oprot.writeFieldEnd(); } oprot.writeFieldStop(); oprot.writeStructEnd(); } @Override public String toString() { StringBuilder sb = new StringBuilder("add_worker_args("); boolean first = true; sb.append("instance_type:"); if (this.instance_type == null) { sb.append("null"); } else { sb.append(this.instance_type); } first = false; sb.append(")"); return sb.toString(); } public void validate() throws TException { // check for required fields } } public static class add_worker_result implements TBase<add_worker_result, add_worker_result._Fields>, java.io.Serializable, Cloneable { private static final TStruct STRUCT_DESC = new TStruct("add_worker_result"); private static final TField SUCCESS_FIELD_DESC = new TField("success", TType.I32, (short)0); private static final TField NE_FIELD_DESC = new TField("ne", TType.STRUCT, (short)1); private int success; private NebuException ne; /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements TFieldIdEnum { SUCCESS((short)0, "success"), NE((short)1, "ne"); private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); static { for (_Fields field : EnumSet.allOf(_Fields.class)) { byName.put(field.getFieldName(), field); } } /** * Find the _Fields constant that matches fieldId, or null if its not found. */ public static _Fields findByThriftId(int fieldId) { switch(fieldId) { case 0: // SUCCESS return SUCCESS; case 1: // NE return NE; 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 IllegalArgumentException("Field " + fieldId + " doesn't exist!"); return fields; } /** * Find the _Fields constant that matches name, or null if its not found. */ public static _Fields findByName(String name) { return byName.get(name); } private final short _thriftId; private final String _fieldName; _Fields(short thriftId, String fieldName) { _thriftId = thriftId; _fieldName = fieldName; } public short getThriftFieldId() { return _thriftId; } public String getFieldName() { return _fieldName; } } // isset id assignments private static final int __SUCCESS_ISSET_ID = 0; private BitSet __isset_bit_vector = new BitSet(1); public static final Map<_Fields, FieldMetaData> metaDataMap; static { Map<_Fields, FieldMetaData> tmpMap = new EnumMap<_Fields, FieldMetaData>(_Fields.class); tmpMap.put(_Fields.SUCCESS, new FieldMetaData("success", TFieldRequirementType.DEFAULT, new FieldValueMetaData(TType.I32))); tmpMap.put(_Fields.NE, new FieldMetaData("ne", TFieldRequirementType.DEFAULT, new FieldValueMetaData(TType.STRUCT))); metaDataMap = Collections.unmodifiableMap(tmpMap); FieldMetaData.addStructMetaDataMap(add_worker_result.class, metaDataMap); } public add_worker_result() { } public add_worker_result( int success, NebuException ne) { this(); this.success = success; set_success_isSet(true); this.ne = ne; } /** * Performs a deep copy on <i>other</i>. */ public add_worker_result(add_worker_result other) { __isset_bit_vector.clear(); __isset_bit_vector.or(other.__isset_bit_vector); this.success = other.success; if (other.is_set_ne()) { this.ne = new NebuException(other.ne); } } public add_worker_result deepCopy() { return new add_worker_result(this); } @Override public void clear() { set_success_isSet(false); this.success = 0; this.ne = null; } public int get_success() { return this.success; } public add_worker_result set_success(int success) { this.success = success; set_success_isSet(true); return this; } public void unset_success() { __isset_bit_vector.clear(__SUCCESS_ISSET_ID); } /** Returns true if field success is set (has been asigned a value) and false otherwise */ public boolean is_set_success() { return __isset_bit_vector.get(__SUCCESS_ISSET_ID); } public void set_success_isSet(boolean value) { __isset_bit_vector.set(__SUCCESS_ISSET_ID, value); } public NebuException get_ne() { return this.ne; } public add_worker_result set_ne(NebuException ne) { this.ne = ne; return this; } public void unset_ne() { this.ne = null; } /** Returns true if field ne is set (has been asigned a value) and false otherwise */ public boolean is_set_ne() { return this.ne != null; } public void set_ne_isSet(boolean value) { if (!value) { this.ne = null; } } public void setFieldValue(_Fields field, Object value) { switch (field) { case SUCCESS: if (value == null) { unset_success(); } else { set_success((Integer)value); } break; case NE: if (value == null) { unset_ne(); } else { set_ne((NebuException)value); } break; } } public Object getFieldValue(_Fields field) { switch (field) { case SUCCESS: return new Integer(get_success()); case NE: return get_ne(); } throw new IllegalStateException(); } /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */ public boolean isSet(_Fields field) { if (field == null) { throw new IllegalArgumentException(); } switch (field) { case SUCCESS: return is_set_success(); case NE: return is_set_ne(); } throw new IllegalStateException(); } @Override public boolean equals(Object that) { if (that == null) return false; if (that instanceof add_worker_result) return this.equals((add_worker_result)that); return false; } public boolean equals(add_worker_result that) { if (that == null) return false; boolean this_present_success = true; boolean that_present_success = true; if (this_present_success || that_present_success) { if (!(this_present_success && that_present_success)) return false; if (this.success != that.success) return false; } boolean this_present_ne = true && this.is_set_ne(); boolean that_present_ne = true && that.is_set_ne(); if (this_present_ne || that_present_ne) { if (!(this_present_ne && that_present_ne)) return false; if (!this.ne.equals(that.ne)) return false; } return true; } @Override public int hashCode() { return 0; } public int compareTo(add_worker_result other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; add_worker_result typedOther = (add_worker_result)other; lastComparison = Boolean.valueOf(is_set_success()).compareTo(typedOther.is_set_success()); if (lastComparison != 0) { return lastComparison; } if (is_set_success()) { lastComparison = TBaseHelper.compareTo(this.success, typedOther.success); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(is_set_ne()).compareTo(typedOther.is_set_ne()); if (lastComparison != 0) { return lastComparison; } if (is_set_ne()) { lastComparison = TBaseHelper.compareTo(this.ne, typedOther.ne); if (lastComparison != 0) { return lastComparison; } } return 0; } public _Fields fieldForId(int fieldId) { return _Fields.findByThriftId(fieldId); } public void read(TProtocol iprot) throws TException { TField field; iprot.readStructBegin(); while (true) { field = iprot.readFieldBegin(); if (field.type == TType.STOP) { break; } switch (field.id) { case 0: // SUCCESS if (field.type == TType.I32) { this.success = iprot.readI32(); set_success_isSet(true); } else { TProtocolUtil.skip(iprot, field.type); } break; case 1: // NE if (field.type == TType.STRUCT) { this.ne = new NebuException(); this.ne.read(iprot); } else { TProtocolUtil.skip(iprot, field.type); } break; default: TProtocolUtil.skip(iprot, field.type); } iprot.readFieldEnd(); } iprot.readStructEnd(); // check for required fields of primitive type, which can't be checked in the validate method validate(); } public void write(TProtocol oprot) throws TException { oprot.writeStructBegin(STRUCT_DESC); if (this.is_set_success()) { oprot.writeFieldBegin(SUCCESS_FIELD_DESC); oprot.writeI32(this.success); oprot.writeFieldEnd(); } else if (this.is_set_ne()) { oprot.writeFieldBegin(NE_FIELD_DESC); this.ne.write(oprot); oprot.writeFieldEnd(); } oprot.writeFieldStop(); oprot.writeStructEnd(); } @Override public String toString() { StringBuilder sb = new StringBuilder("add_worker_result("); boolean first = true; sb.append("success:"); sb.append(this.success); first = false; if (!first) sb.append(", "); sb.append("ne:"); if (this.ne == null) { sb.append("null"); } else { sb.append(this.ne); } first = false; sb.append(")"); return sb.toString(); } public void validate() throws TException { // check for required fields } } public static class remove_worker_args implements TBase<remove_worker_args, remove_worker_args._Fields>, java.io.Serializable, Cloneable { private static final TStruct STRUCT_DESC = new TStruct("remove_worker_args"); private static final TField INSTANCE_NAME_FIELD_DESC = new TField("instance_name", TType.STRING, (short)1); private String instance_name; /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements TFieldIdEnum { INSTANCE_NAME((short)1, "instance_name"); private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); static { for (_Fields field : EnumSet.allOf(_Fields.class)) { byName.put(field.getFieldName(), field); } } /** * Find the _Fields constant that matches fieldId, or null if its not found. */ public static _Fields findByThriftId(int fieldId) { switch(fieldId) { case 1: // INSTANCE_NAME return INSTANCE_NAME; 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 IllegalArgumentException("Field " + fieldId + " doesn't exist!"); return fields; } /** * Find the _Fields constant that matches name, or null if its not found. */ public static _Fields findByName(String name) { return byName.get(name); } private final short _thriftId; private final String _fieldName; _Fields(short thriftId, String fieldName) { _thriftId = thriftId; _fieldName = fieldName; } public short getThriftFieldId() { return _thriftId; } public String getFieldName() { return _fieldName; } } // isset id assignments public static final Map<_Fields, FieldMetaData> metaDataMap; static { Map<_Fields, FieldMetaData> tmpMap = new EnumMap<_Fields, FieldMetaData>(_Fields.class); tmpMap.put(_Fields.INSTANCE_NAME, new FieldMetaData("instance_name", TFieldRequirementType.DEFAULT, new FieldValueMetaData(TType.STRING))); metaDataMap = Collections.unmodifiableMap(tmpMap); FieldMetaData.addStructMetaDataMap(remove_worker_args.class, metaDataMap); } public remove_worker_args() { } public remove_worker_args( String instance_name) { this(); this.instance_name = instance_name; } /** * Performs a deep copy on <i>other</i>. */ public remove_worker_args(remove_worker_args other) { if (other.is_set_instance_name()) { this.instance_name = other.instance_name; } } public remove_worker_args deepCopy() { return new remove_worker_args(this); } @Override public void clear() { this.instance_name = null; } public String get_instance_name() { return this.instance_name; } public remove_worker_args set_instance_name(String instance_name) { this.instance_name = instance_name; return this; } public void unset_instance_name() { this.instance_name = null; } /** Returns true if field instance_name is set (has been asigned a value) and false otherwise */ public boolean is_set_instance_name() { return this.instance_name != null; } public void set_instance_name_isSet(boolean value) { if (!value) { this.instance_name = null; } } public void setFieldValue(_Fields field, Object value) { switch (field) { case INSTANCE_NAME: if (value == null) { unset_instance_name(); } else { set_instance_name((String)value); } break; } } public Object getFieldValue(_Fields field) { switch (field) { case INSTANCE_NAME: return get_instance_name(); } throw new IllegalStateException(); } /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */ public boolean isSet(_Fields field) { if (field == null) { throw new IllegalArgumentException(); } switch (field) { case INSTANCE_NAME: return is_set_instance_name(); } throw new IllegalStateException(); } @Override public boolean equals(Object that) { if (that == null) return false; if (that instanceof remove_worker_args) return this.equals((remove_worker_args)that); return false; } public boolean equals(remove_worker_args that) { if (that == null) return false; boolean this_present_instance_name = true && this.is_set_instance_name(); boolean that_present_instance_name = true && that.is_set_instance_name(); if (this_present_instance_name || that_present_instance_name) { if (!(this_present_instance_name && that_present_instance_name)) return false; if (!this.instance_name.equals(that.instance_name)) return false; } return true; } @Override public int hashCode() { return 0; } public int compareTo(remove_worker_args other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; remove_worker_args typedOther = (remove_worker_args)other; lastComparison = Boolean.valueOf(is_set_instance_name()).compareTo(typedOther.is_set_instance_name()); if (lastComparison != 0) { return lastComparison; } if (is_set_instance_name()) { lastComparison = TBaseHelper.compareTo(this.instance_name, typedOther.instance_name); if (lastComparison != 0) { return lastComparison; } } return 0; } public _Fields fieldForId(int fieldId) { return _Fields.findByThriftId(fieldId); } public void read(TProtocol iprot) throws TException { TField field; iprot.readStructBegin(); while (true) { field = iprot.readFieldBegin(); if (field.type == TType.STOP) { break; } switch (field.id) { case 1: // INSTANCE_NAME if (field.type == TType.STRING) { this.instance_name = iprot.readString(); } else { TProtocolUtil.skip(iprot, field.type); } break; default: TProtocolUtil.skip(iprot, field.type); } iprot.readFieldEnd(); } iprot.readStructEnd(); // check for required fields of primitive type, which can't be checked in the validate method validate(); } public void write(TProtocol oprot) throws TException { validate(); oprot.writeStructBegin(STRUCT_DESC); if (this.instance_name != null) { oprot.writeFieldBegin(INSTANCE_NAME_FIELD_DESC); oprot.writeString(this.instance_name); oprot.writeFieldEnd(); } oprot.writeFieldStop(); oprot.writeStructEnd(); } @Override public String toString() { StringBuilder sb = new StringBuilder("remove_worker_args("); boolean first = true; sb.append("instance_name:"); if (this.instance_name == null) { sb.append("null"); } else { sb.append(this.instance_name); } first = false; sb.append(")"); return sb.toString(); } public void validate() throws TException { // check for required fields } } public static class remove_worker_result implements TBase<remove_worker_result, remove_worker_result._Fields>, java.io.Serializable, Cloneable { private static final TStruct STRUCT_DESC = new TStruct("remove_worker_result"); private static final TField SUCCESS_FIELD_DESC = new TField("success", TType.I32, (short)0); private static final TField NE_FIELD_DESC = new TField("ne", TType.STRUCT, (short)1); private int success; private NebuException ne; /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements TFieldIdEnum { SUCCESS((short)0, "success"), NE((short)1, "ne"); private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); static { for (_Fields field : EnumSet.allOf(_Fields.class)) { byName.put(field.getFieldName(), field); } } /** * Find the _Fields constant that matches fieldId, or null if its not found. */ public static _Fields findByThriftId(int fieldId) { switch(fieldId) { case 0: // SUCCESS return SUCCESS; case 1: // NE return NE; 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 IllegalArgumentException("Field " + fieldId + " doesn't exist!"); return fields; } /** * Find the _Fields constant that matches name, or null if its not found. */ public static _Fields findByName(String name) { return byName.get(name); } private final short _thriftId; private final String _fieldName; _Fields(short thriftId, String fieldName) { _thriftId = thriftId; _fieldName = fieldName; } public short getThriftFieldId() { return _thriftId; } public String getFieldName() { return _fieldName; } } // isset id assignments private static final int __SUCCESS_ISSET_ID = 0; private BitSet __isset_bit_vector = new BitSet(1); public static final Map<_Fields, FieldMetaData> metaDataMap; static { Map<_Fields, FieldMetaData> tmpMap = new EnumMap<_Fields, FieldMetaData>(_Fields.class); tmpMap.put(_Fields.SUCCESS, new FieldMetaData("success", TFieldRequirementType.DEFAULT, new FieldValueMetaData(TType.I32))); tmpMap.put(_Fields.NE, new FieldMetaData("ne", TFieldRequirementType.DEFAULT, new FieldValueMetaData(TType.STRUCT))); metaDataMap = Collections.unmodifiableMap(tmpMap); FieldMetaData.addStructMetaDataMap(remove_worker_result.class, metaDataMap); } public remove_worker_result() { } public remove_worker_result( int success, NebuException ne) { this(); this.success = success; set_success_isSet(true); this.ne = ne; } /** * Performs a deep copy on <i>other</i>. */ public remove_worker_result(remove_worker_result other) { __isset_bit_vector.clear(); __isset_bit_vector.or(other.__isset_bit_vector); this.success = other.success; if (other.is_set_ne()) { this.ne = new NebuException(other.ne); } } public remove_worker_result deepCopy() { return new remove_worker_result(this); } @Override public void clear() { set_success_isSet(false); this.success = 0; this.ne = null; } public int get_success() { return this.success; } public remove_worker_result set_success(int success) { this.success = success; set_success_isSet(true); return this; } public void unset_success() { __isset_bit_vector.clear(__SUCCESS_ISSET_ID); } /** Returns true if field success is set (has been asigned a value) and false otherwise */ public boolean is_set_success() { return __isset_bit_vector.get(__SUCCESS_ISSET_ID); } public void set_success_isSet(boolean value) { __isset_bit_vector.set(__SUCCESS_ISSET_ID, value); } public NebuException get_ne() { return this.ne; } public remove_worker_result set_ne(NebuException ne) { this.ne = ne; return this; } public void unset_ne() { this.ne = null; } /** Returns true if field ne is set (has been asigned a value) and false otherwise */ public boolean is_set_ne() { return this.ne != null; } public void set_ne_isSet(boolean value) { if (!value) { this.ne = null; } } public void setFieldValue(_Fields field, Object value) { switch (field) { case SUCCESS: if (value == null) { unset_success(); } else { set_success((Integer)value); } break; case NE: if (value == null) { unset_ne(); } else { set_ne((NebuException)value); } break; } } public Object getFieldValue(_Fields field) { switch (field) { case SUCCESS: return new Integer(get_success()); case NE: return get_ne(); } throw new IllegalStateException(); } /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */ public boolean isSet(_Fields field) { if (field == null) { throw new IllegalArgumentException(); } switch (field) { case SUCCESS: return is_set_success(); case NE: return is_set_ne(); } throw new IllegalStateException(); } @Override public boolean equals(Object that) { if (that == null) return false; if (that instanceof remove_worker_result) return this.equals((remove_worker_result)that); return false; } public boolean equals(remove_worker_result that) { if (that == null) return false; boolean this_present_success = true; boolean that_present_success = true; if (this_present_success || that_present_success) { if (!(this_present_success && that_present_success)) return false; if (this.success != that.success) return false; } boolean this_present_ne = true && this.is_set_ne(); boolean that_present_ne = true && that.is_set_ne(); if (this_present_ne || that_present_ne) { if (!(this_present_ne && that_present_ne)) return false; if (!this.ne.equals(that.ne)) return false; } return true; } @Override public int hashCode() { return 0; } public int compareTo(remove_worker_result other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; remove_worker_result typedOther = (remove_worker_result)other; lastComparison = Boolean.valueOf(is_set_success()).compareTo(typedOther.is_set_success()); if (lastComparison != 0) { return lastComparison; } if (is_set_success()) { lastComparison = TBaseHelper.compareTo(this.success, typedOther.success); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(is_set_ne()).compareTo(typedOther.is_set_ne()); if (lastComparison != 0) { return lastComparison; } if (is_set_ne()) { lastComparison = TBaseHelper.compareTo(this.ne, typedOther.ne); if (lastComparison != 0) { return lastComparison; } } return 0; } public _Fields fieldForId(int fieldId) { return _Fields.findByThriftId(fieldId); } public void read(TProtocol iprot) throws TException { TField field; iprot.readStructBegin(); while (true) { field = iprot.readFieldBegin(); if (field.type == TType.STOP) { break; } switch (field.id) { case 0: // SUCCESS if (field.type == TType.I32) { this.success = iprot.readI32(); set_success_isSet(true); } else { TProtocolUtil.skip(iprot, field.type); } break; case 1: // NE if (field.type == TType.STRUCT) { this.ne = new NebuException(); this.ne.read(iprot); } else { TProtocolUtil.skip(iprot, field.type); } break; default: TProtocolUtil.skip(iprot, field.type); } iprot.readFieldEnd(); } iprot.readStructEnd(); // check for required fields of primitive type, which can't be checked in the validate method validate(); } public void write(TProtocol oprot) throws TException { oprot.writeStructBegin(STRUCT_DESC); if (this.is_set_success()) { oprot.writeFieldBegin(SUCCESS_FIELD_DESC); oprot.writeI32(this.success); oprot.writeFieldEnd(); } else if (this.is_set_ne()) { oprot.writeFieldBegin(NE_FIELD_DESC); this.ne.write(oprot); oprot.writeFieldEnd(); } oprot.writeFieldStop(); oprot.writeStructEnd(); } @Override public String toString() { StringBuilder sb = new StringBuilder("remove_worker_result("); boolean first = true; sb.append("success:"); sb.append(this.success); first = false; if (!first) sb.append(", "); sb.append("ne:"); if (this.ne == null) { sb.append("null"); } else { sb.append(this.ne); } first = false; sb.append(")"); return sb.toString(); } public void validate() throws TException { // check for required fields } } public static class update_status_args implements TBase<update_status_args, update_status_args._Fields>, java.io.Serializable, Cloneable { private static final TStruct STRUCT_DESC = new TStruct("update_status_args"); private static final TField INSTANCE_NAME_FIELD_DESC = new TField("instance_name", TType.STRING, (short)1); private String instance_name; /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements TFieldIdEnum { INSTANCE_NAME((short)1, "instance_name"); private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); static { for (_Fields field : EnumSet.allOf(_Fields.class)) { byName.put(field.getFieldName(), field); } } /** * Find the _Fields constant that matches fieldId, or null if its not found. */ public static _Fields findByThriftId(int fieldId) { switch(fieldId) { case 1: // INSTANCE_NAME return INSTANCE_NAME; 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 IllegalArgumentException("Field " + fieldId + " doesn't exist!"); return fields; } /** * Find the _Fields constant that matches name, or null if its not found. */ public static _Fields findByName(String name) { return byName.get(name); } private final short _thriftId; private final String _fieldName; _Fields(short thriftId, String fieldName) { _thriftId = thriftId; _fieldName = fieldName; } public short getThriftFieldId() { return _thriftId; } public String getFieldName() { return _fieldName; } } // isset id assignments public static final Map<_Fields, FieldMetaData> metaDataMap; static { Map<_Fields, FieldMetaData> tmpMap = new EnumMap<_Fields, FieldMetaData>(_Fields.class); tmpMap.put(_Fields.INSTANCE_NAME, new FieldMetaData("instance_name", TFieldRequirementType.DEFAULT, new FieldValueMetaData(TType.STRING))); metaDataMap = Collections.unmodifiableMap(tmpMap); FieldMetaData.addStructMetaDataMap(update_status_args.class, metaDataMap); } public update_status_args() { } public update_status_args( String instance_name) { this(); this.instance_name = instance_name; } /** * Performs a deep copy on <i>other</i>. */ public update_status_args(update_status_args other) { if (other.is_set_instance_name()) { this.instance_name = other.instance_name; } } public update_status_args deepCopy() { return new update_status_args(this); } @Override public void clear() { this.instance_name = null; } public String get_instance_name() { return this.instance_name; } public update_status_args set_instance_name(String instance_name) { this.instance_name = instance_name; return this; } public void unset_instance_name() { this.instance_name = null; } /** Returns true if field instance_name is set (has been asigned a value) and false otherwise */ public boolean is_set_instance_name() { return this.instance_name != null; } public void set_instance_name_isSet(boolean value) { if (!value) { this.instance_name = null; } } public void setFieldValue(_Fields field, Object value) { switch (field) { case INSTANCE_NAME: if (value == null) { unset_instance_name(); } else { set_instance_name((String)value); } break; } } public Object getFieldValue(_Fields field) { switch (field) { case INSTANCE_NAME: return get_instance_name(); } throw new IllegalStateException(); } /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */ public boolean isSet(_Fields field) { if (field == null) { throw new IllegalArgumentException(); } switch (field) { case INSTANCE_NAME: return is_set_instance_name(); } throw new IllegalStateException(); } @Override public boolean equals(Object that) { if (that == null) return false; if (that instanceof update_status_args) return this.equals((update_status_args)that); return false; } public boolean equals(update_status_args that) { if (that == null) return false; boolean this_present_instance_name = true && this.is_set_instance_name(); boolean that_present_instance_name = true && that.is_set_instance_name(); if (this_present_instance_name || that_present_instance_name) { if (!(this_present_instance_name && that_present_instance_name)) return false; if (!this.instance_name.equals(that.instance_name)) return false; } return true; } @Override public int hashCode() { return 0; } public int compareTo(update_status_args other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; update_status_args typedOther = (update_status_args)other; lastComparison = Boolean.valueOf(is_set_instance_name()).compareTo(typedOther.is_set_instance_name()); if (lastComparison != 0) { return lastComparison; } if (is_set_instance_name()) { lastComparison = TBaseHelper.compareTo(this.instance_name, typedOther.instance_name); if (lastComparison != 0) { return lastComparison; } } return 0; } public _Fields fieldForId(int fieldId) { return _Fields.findByThriftId(fieldId); } public void read(TProtocol iprot) throws TException { TField field; iprot.readStructBegin(); while (true) { field = iprot.readFieldBegin(); if (field.type == TType.STOP) { break; } switch (field.id) { case 1: // INSTANCE_NAME if (field.type == TType.STRING) { this.instance_name = iprot.readString(); } else { TProtocolUtil.skip(iprot, field.type); } break; default: TProtocolUtil.skip(iprot, field.type); } iprot.readFieldEnd(); } iprot.readStructEnd(); // check for required fields of primitive type, which can't be checked in the validate method validate(); } public void write(TProtocol oprot) throws TException { validate(); oprot.writeStructBegin(STRUCT_DESC); if (this.instance_name != null) { oprot.writeFieldBegin(INSTANCE_NAME_FIELD_DESC); oprot.writeString(this.instance_name); oprot.writeFieldEnd(); } oprot.writeFieldStop(); oprot.writeStructEnd(); } @Override public String toString() { StringBuilder sb = new StringBuilder("update_status_args("); boolean first = true; sb.append("instance_name:"); if (this.instance_name == null) { sb.append("null"); } else { sb.append(this.instance_name); } first = false; sb.append(")"); return sb.toString(); } public void validate() throws TException { // check for required fields } } public static class update_status_result implements TBase<update_status_result, update_status_result._Fields>, java.io.Serializable, Cloneable { private static final TStruct STRUCT_DESC = new TStruct("update_status_result"); private static final TField SUCCESS_FIELD_DESC = new TField("success", TType.I32, (short)0); private static final TField NE_FIELD_DESC = new TField("ne", TType.STRUCT, (short)1); private int success; private NebuException ne; /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements TFieldIdEnum { SUCCESS((short)0, "success"), NE((short)1, "ne"); private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); static { for (_Fields field : EnumSet.allOf(_Fields.class)) { byName.put(field.getFieldName(), field); } } /** * Find the _Fields constant that matches fieldId, or null if its not found. */ public static _Fields findByThriftId(int fieldId) { switch(fieldId) { case 0: // SUCCESS return SUCCESS; case 1: // NE return NE; 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 IllegalArgumentException("Field " + fieldId + " doesn't exist!"); return fields; } /** * Find the _Fields constant that matches name, or null if its not found. */ public static _Fields findByName(String name) { return byName.get(name); } private final short _thriftId; private final String _fieldName; _Fields(short thriftId, String fieldName) { _thriftId = thriftId; _fieldName = fieldName; } public short getThriftFieldId() { return _thriftId; } public String getFieldName() { return _fieldName; } } // isset id assignments private static final int __SUCCESS_ISSET_ID = 0; private BitSet __isset_bit_vector = new BitSet(1); public static final Map<_Fields, FieldMetaData> metaDataMap; static { Map<_Fields, FieldMetaData> tmpMap = new EnumMap<_Fields, FieldMetaData>(_Fields.class); tmpMap.put(_Fields.SUCCESS, new FieldMetaData("success", TFieldRequirementType.DEFAULT, new FieldValueMetaData(TType.I32))); tmpMap.put(_Fields.NE, new FieldMetaData("ne", TFieldRequirementType.DEFAULT, new FieldValueMetaData(TType.STRUCT))); metaDataMap = Collections.unmodifiableMap(tmpMap); FieldMetaData.addStructMetaDataMap(update_status_result.class, metaDataMap); } public update_status_result() { } public update_status_result( int success, NebuException ne) { this(); this.success = success; set_success_isSet(true); this.ne = ne; } /** * Performs a deep copy on <i>other</i>. */ public update_status_result(update_status_result other) { __isset_bit_vector.clear(); __isset_bit_vector.or(other.__isset_bit_vector); this.success = other.success; if (other.is_set_ne()) { this.ne = new NebuException(other.ne); } } public update_status_result deepCopy() { return new update_status_result(this); } @Override public void clear() { set_success_isSet(false); this.success = 0; this.ne = null; } public int get_success() { return this.success; } public update_status_result set_success(int success) { this.success = success; set_success_isSet(true); return this; } public void unset_success() { __isset_bit_vector.clear(__SUCCESS_ISSET_ID); } /** Returns true if field success is set (has been asigned a value) and false otherwise */ public boolean is_set_success() { return __isset_bit_vector.get(__SUCCESS_ISSET_ID); } public void set_success_isSet(boolean value) { __isset_bit_vector.set(__SUCCESS_ISSET_ID, value); } public NebuException get_ne() { return this.ne; } public update_status_result set_ne(NebuException ne) { this.ne = ne; return this; } public void unset_ne() { this.ne = null; } /** Returns true if field ne is set (has been asigned a value) and false otherwise */ public boolean is_set_ne() { return this.ne != null; } public void set_ne_isSet(boolean value) { if (!value) { this.ne = null; } } public void setFieldValue(_Fields field, Object value) { switch (field) { case SUCCESS: if (value == null) { unset_success(); } else { set_success((Integer)value); } break; case NE: if (value == null) { unset_ne(); } else { set_ne((NebuException)value); } break; } } public Object getFieldValue(_Fields field) { switch (field) { case SUCCESS: return new Integer(get_success()); case NE: return get_ne(); } throw new IllegalStateException(); } /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */ public boolean isSet(_Fields field) { if (field == null) { throw new IllegalArgumentException(); } switch (field) { case SUCCESS: return is_set_success(); case NE: return is_set_ne(); } throw new IllegalStateException(); } @Override public boolean equals(Object that) { if (that == null) return false; if (that instanceof update_status_result) return this.equals((update_status_result)that); return false; } public boolean equals(update_status_result that) { if (that == null) return false; boolean this_present_success = true; boolean that_present_success = true; if (this_present_success || that_present_success) { if (!(this_present_success && that_present_success)) return false; if (this.success != that.success) return false; } boolean this_present_ne = true && this.is_set_ne(); boolean that_present_ne = true && that.is_set_ne(); if (this_present_ne || that_present_ne) { if (!(this_present_ne && that_present_ne)) return false; if (!this.ne.equals(that.ne)) return false; } return true; } @Override public int hashCode() { return 0; } public int compareTo(update_status_result other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; update_status_result typedOther = (update_status_result)other; lastComparison = Boolean.valueOf(is_set_success()).compareTo(typedOther.is_set_success()); if (lastComparison != 0) { return lastComparison; } if (is_set_success()) { lastComparison = TBaseHelper.compareTo(this.success, typedOther.success); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(is_set_ne()).compareTo(typedOther.is_set_ne()); if (lastComparison != 0) { return lastComparison; } if (is_set_ne()) { lastComparison = TBaseHelper.compareTo(this.ne, typedOther.ne); if (lastComparison != 0) { return lastComparison; } } return 0; } public _Fields fieldForId(int fieldId) { return _Fields.findByThriftId(fieldId); } public void read(TProtocol iprot) throws TException { TField field; iprot.readStructBegin(); while (true) { field = iprot.readFieldBegin(); if (field.type == TType.STOP) { break; } switch (field.id) { case 0: // SUCCESS if (field.type == TType.I32) { this.success = iprot.readI32(); set_success_isSet(true); } else { TProtocolUtil.skip(iprot, field.type); } break; case 1: // NE if (field.type == TType.STRUCT) { this.ne = new NebuException(); this.ne.read(iprot); } else { TProtocolUtil.skip(iprot, field.type); } break; default: TProtocolUtil.skip(iprot, field.type); } iprot.readFieldEnd(); } iprot.readStructEnd(); // check for required fields of primitive type, which can't be checked in the validate method validate(); } public void write(TProtocol oprot) throws TException { oprot.writeStructBegin(STRUCT_DESC); if (this.is_set_success()) { oprot.writeFieldBegin(SUCCESS_FIELD_DESC); oprot.writeI32(this.success); oprot.writeFieldEnd(); } else if (this.is_set_ne()) { oprot.writeFieldBegin(NE_FIELD_DESC); this.ne.write(oprot); oprot.writeFieldEnd(); } oprot.writeFieldStop(); oprot.writeStructEnd(); } @Override public String toString() { StringBuilder sb = new StringBuilder("update_status_result("); boolean first = true; sb.append("success:"); sb.append(this.success); first = false; if (!first) sb.append(", "); sb.append("ne:"); if (this.ne == null) { sb.append("null"); } else { sb.append(this.ne); } first = false; sb.append(")"); return sb.toString(); } public void validate() throws TException { // check for required fields } } }