| /** |
| * Autogenerated by Thrift |
| * |
| * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING |
| */ |
| package backtype.storm.generated; |
| |
| import org.apache.commons.lang.builder.HashCodeBuilder; |
| 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.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.*; |
| |
| public class DistributedRPC { |
| |
| public interface Iface { |
| |
| public String execute(String functionName, String funcArgs) throws TException; |
| |
| public void result(String id, String result) throws TException; |
| |
| } |
| |
| public interface AsyncIface { |
| |
| public void execute(String functionName, String funcArgs, AsyncMethodCallback<AsyncClient.execute_call> resultHandler) throws TException; |
| |
| public void result(String id, String result, AsyncMethodCallback<AsyncClient.result_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 String execute(String functionName, String funcArgs) throws TException |
| { |
| send_execute(functionName, funcArgs); |
| return recv_execute(); |
| } |
| |
| public void send_execute(String functionName, String funcArgs) throws TException |
| { |
| oprot_.writeMessageBegin(new TMessage("execute", TMessageType.CALL, ++seqid_)); |
| execute_args args = new execute_args(); |
| args.set_functionName(functionName); |
| args.set_funcArgs(funcArgs); |
| args.write(oprot_); |
| oprot_.writeMessageEnd(); |
| oprot_.getTransport().flush(); |
| } |
| |
| public String recv_execute() throws 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, "execute failed: out of sequence response"); |
| } |
| execute_result result = new execute_result(); |
| result.read(iprot_); |
| iprot_.readMessageEnd(); |
| if (result.is_set_success()) { |
| return result.success; |
| } |
| throw new TApplicationException(TApplicationException.MISSING_RESULT, "execute failed: unknown result"); |
| } |
| |
| public void result(String id, String result) throws TException |
| { |
| send_result(id, result); |
| recv_result(); |
| } |
| |
| public void send_result(String id, String result) throws TException |
| { |
| oprot_.writeMessageBegin(new TMessage("result", TMessageType.CALL, ++seqid_)); |
| result_args args = new result_args(); |
| args.set_id(id); |
| args.set_result(result); |
| args.write(oprot_); |
| oprot_.writeMessageEnd(); |
| oprot_.getTransport().flush(); |
| } |
| |
| public void recv_result() throws 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, "result failed: out of sequence response"); |
| } |
| result_result result = new result_result(); |
| result.read(iprot_); |
| iprot_.readMessageEnd(); |
| return; |
| } |
| |
| } |
| 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 execute(String functionName, String funcArgs, AsyncMethodCallback<execute_call> resultHandler) throws TException { |
| checkReady(); |
| execute_call method_call = new execute_call(functionName, funcArgs, resultHandler, this, protocolFactory, transport); |
| manager.call(method_call); |
| } |
| |
| public static class execute_call extends TAsyncMethodCall { |
| private String functionName; |
| private String funcArgs; |
| public execute_call(String functionName, String funcArgs, AsyncMethodCallback<execute_call> resultHandler, TAsyncClient client, TProtocolFactory protocolFactory, TNonblockingTransport transport) throws TException { |
| super(client, protocolFactory, transport, resultHandler, false); |
| this.functionName = functionName; |
| this.funcArgs = funcArgs; |
| } |
| |
| public void write_args(TProtocol prot) throws TException { |
| prot.writeMessageBegin(new TMessage("execute", TMessageType.CALL, 0)); |
| execute_args args = new execute_args(); |
| args.set_functionName(functionName); |
| args.set_funcArgs(funcArgs); |
| args.write(prot); |
| prot.writeMessageEnd(); |
| } |
| |
| public String getResult() throws 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_execute(); |
| } |
| } |
| |
| public void result(String id, String result, AsyncMethodCallback<result_call> resultHandler) throws TException { |
| checkReady(); |
| result_call method_call = new result_call(id, result, resultHandler, this, protocolFactory, transport); |
| manager.call(method_call); |
| } |
| |
| public static class result_call extends TAsyncMethodCall { |
| private String id; |
| private String result; |
| public result_call(String id, String result, AsyncMethodCallback<result_call> resultHandler, TAsyncClient client, TProtocolFactory protocolFactory, TNonblockingTransport transport) throws TException { |
| super(client, protocolFactory, transport, resultHandler, false); |
| this.id = id; |
| this.result = result; |
| } |
| |
| public void write_args(TProtocol prot) throws TException { |
| prot.writeMessageBegin(new TMessage("result", TMessageType.CALL, 0)); |
| result_args args = new result_args(); |
| args.set_id(id); |
| args.set_result(result); |
| args.write(prot); |
| prot.writeMessageEnd(); |
| } |
| |
| public void getResult() throws 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); |
| (new Client(prot)).recv_result(); |
| } |
| } |
| |
| } |
| |
| public static class Processor implements TProcessor { |
| private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName()); |
| public Processor(Iface iface) |
| { |
| iface_ = iface; |
| processMap_.put("execute", new execute()); |
| processMap_.put("result", new result()); |
| } |
| |
| 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 execute implements ProcessFunction { |
| public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException |
| { |
| execute_args args = new execute_args(); |
| try { |
| args.read(iprot); |
| } catch (TProtocolException e) { |
| iprot.readMessageEnd(); |
| TApplicationException x = new TApplicationException(TApplicationException.PROTOCOL_ERROR, e.getMessage()); |
| oprot.writeMessageBegin(new TMessage("execute", TMessageType.EXCEPTION, seqid)); |
| x.write(oprot); |
| oprot.writeMessageEnd(); |
| oprot.getTransport().flush(); |
| return; |
| } |
| iprot.readMessageEnd(); |
| execute_result result = new execute_result(); |
| result.success = iface_.execute(args.functionName, args.funcArgs); |
| oprot.writeMessageBegin(new TMessage("execute", TMessageType.REPLY, seqid)); |
| result.write(oprot); |
| oprot.writeMessageEnd(); |
| oprot.getTransport().flush(); |
| } |
| |
| } |
| |
| private class result implements ProcessFunction { |
| public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException |
| { |
| result_args args = new result_args(); |
| try { |
| args.read(iprot); |
| } catch (TProtocolException e) { |
| iprot.readMessageEnd(); |
| TApplicationException x = new TApplicationException(TApplicationException.PROTOCOL_ERROR, e.getMessage()); |
| oprot.writeMessageBegin(new TMessage("result", TMessageType.EXCEPTION, seqid)); |
| x.write(oprot); |
| oprot.writeMessageEnd(); |
| oprot.getTransport().flush(); |
| return; |
| } |
| iprot.readMessageEnd(); |
| result_result result = new result_result(); |
| iface_.result(args.id, args.result); |
| oprot.writeMessageBegin(new TMessage("result", TMessageType.REPLY, seqid)); |
| result.write(oprot); |
| oprot.writeMessageEnd(); |
| oprot.getTransport().flush(); |
| } |
| |
| } |
| |
| } |
| |
| public static class execute_args implements TBase<execute_args, execute_args._Fields>, java.io.Serializable, Cloneable { |
| private static final TStruct STRUCT_DESC = new TStruct("execute_args"); |
| |
| private static final TField FUNCTION_NAME_FIELD_DESC = new TField("functionName", TType.STRING, (short)1); |
| private static final TField FUNC_ARGS_FIELD_DESC = new TField("funcArgs", TType.STRING, (short)2); |
| |
| private String functionName; |
| private String funcArgs; |
| |
| /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ |
| public enum _Fields implements TFieldIdEnum { |
| FUNCTION_NAME((short)1, "functionName"), |
| FUNC_ARGS((short)2, "funcArgs"); |
| |
| 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: // FUNCTION_NAME |
| return FUNCTION_NAME; |
| case 2: // FUNC_ARGS |
| return FUNC_ARGS; |
| 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.FUNCTION_NAME, new FieldMetaData("functionName", TFieldRequirementType.DEFAULT, |
| new FieldValueMetaData(TType.STRING))); |
| tmpMap.put(_Fields.FUNC_ARGS, new FieldMetaData("funcArgs", TFieldRequirementType.DEFAULT, |
| new FieldValueMetaData(TType.STRING))); |
| metaDataMap = Collections.unmodifiableMap(tmpMap); |
| FieldMetaData.addStructMetaDataMap(execute_args.class, metaDataMap); |
| } |
| |
| public execute_args() { |
| } |
| |
| public execute_args( |
| String functionName, |
| String funcArgs) |
| { |
| this(); |
| this.functionName = functionName; |
| this.funcArgs = funcArgs; |
| } |
| |
| /** |
| * Performs a deep copy on <i>other</i>. |
| */ |
| public execute_args(execute_args other) { |
| if (other.is_set_functionName()) { |
| this.functionName = other.functionName; |
| } |
| if (other.is_set_funcArgs()) { |
| this.funcArgs = other.funcArgs; |
| } |
| } |
| |
| public execute_args deepCopy() { |
| return new execute_args(this); |
| } |
| |
| @Deprecated |
| public execute_args clone() { |
| return new execute_args(this); |
| } |
| |
| public String get_functionName() { |
| return this.functionName; |
| } |
| |
| public void set_functionName(String functionName) { |
| this.functionName = functionName; |
| } |
| |
| public void unset_functionName() { |
| this.functionName = null; |
| } |
| |
| /** Returns true if field functionName is set (has been asigned a value) and false otherwise */ |
| public boolean is_set_functionName() { |
| return this.functionName != null; |
| } |
| |
| public void set_functionName_isSet(boolean value) { |
| if (!value) { |
| this.functionName = null; |
| } |
| } |
| |
| public String get_funcArgs() { |
| return this.funcArgs; |
| } |
| |
| public void set_funcArgs(String funcArgs) { |
| this.funcArgs = funcArgs; |
| } |
| |
| public void unset_funcArgs() { |
| this.funcArgs = null; |
| } |
| |
| /** Returns true if field funcArgs is set (has been asigned a value) and false otherwise */ |
| public boolean is_set_funcArgs() { |
| return this.funcArgs != null; |
| } |
| |
| public void set_funcArgs_isSet(boolean value) { |
| if (!value) { |
| this.funcArgs = null; |
| } |
| } |
| |
| public void setFieldValue(_Fields field, Object value) { |
| switch (field) { |
| case FUNCTION_NAME: |
| if (value == null) { |
| unset_functionName(); |
| } else { |
| set_functionName((String)value); |
| } |
| break; |
| |
| case FUNC_ARGS: |
| if (value == null) { |
| unset_funcArgs(); |
| } else { |
| set_funcArgs((String)value); |
| } |
| break; |
| |
| } |
| } |
| |
| public void setFieldValue(int fieldID, Object value) { |
| setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value); |
| } |
| |
| public Object getFieldValue(_Fields field) { |
| switch (field) { |
| case FUNCTION_NAME: |
| return get_functionName(); |
| |
| case FUNC_ARGS: |
| return get_funcArgs(); |
| |
| } |
| throw new IllegalStateException(); |
| } |
| |
| public Object getFieldValue(int fieldId) { |
| return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId)); |
| } |
| |
| /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */ |
| public boolean isSet(_Fields field) { |
| switch (field) { |
| case FUNCTION_NAME: |
| return is_set_functionName(); |
| case FUNC_ARGS: |
| return is_set_funcArgs(); |
| } |
| throw new IllegalStateException(); |
| } |
| |
| public boolean isSet(int fieldID) { |
| return isSet(_Fields.findByThriftIdOrThrow(fieldID)); |
| } |
| |
| @Override |
| public boolean equals(Object that) { |
| if (that == null) |
| return false; |
| if (that instanceof execute_args) |
| return this.equals((execute_args)that); |
| return false; |
| } |
| |
| public boolean equals(execute_args that) { |
| if (that == null) |
| return false; |
| |
| boolean this_present_functionName = true && this.is_set_functionName(); |
| boolean that_present_functionName = true && that.is_set_functionName(); |
| if (this_present_functionName || that_present_functionName) { |
| if (!(this_present_functionName && that_present_functionName)) |
| return false; |
| if (!this.functionName.equals(that.functionName)) |
| return false; |
| } |
| |
| boolean this_present_funcArgs = true && this.is_set_funcArgs(); |
| boolean that_present_funcArgs = true && that.is_set_funcArgs(); |
| if (this_present_funcArgs || that_present_funcArgs) { |
| if (!(this_present_funcArgs && that_present_funcArgs)) |
| return false; |
| if (!this.funcArgs.equals(that.funcArgs)) |
| return false; |
| } |
| |
| return true; |
| } |
| |
| @Override |
| public int hashCode() { |
| HashCodeBuilder builder = new HashCodeBuilder(); |
| |
| boolean present_functionName = true && (is_set_functionName()); |
| builder.append(present_functionName); |
| if (present_functionName) |
| builder.append(functionName); |
| |
| boolean present_funcArgs = true && (is_set_funcArgs()); |
| builder.append(present_funcArgs); |
| if (present_funcArgs) |
| builder.append(funcArgs); |
| |
| return builder.toHashCode(); |
| } |
| |
| public int compareTo(execute_args other) { |
| if (!getClass().equals(other.getClass())) { |
| return getClass().getName().compareTo(other.getClass().getName()); |
| } |
| |
| int lastComparison = 0; |
| execute_args typedOther = (execute_args)other; |
| |
| lastComparison = Boolean.valueOf(is_set_functionName()).compareTo(typedOther.is_set_functionName()); |
| if (lastComparison != 0) { |
| return lastComparison; |
| } |
| if (is_set_functionName()) { lastComparison = TBaseHelper.compareTo(this.functionName, typedOther.functionName); |
| if (lastComparison != 0) { |
| return lastComparison; |
| } |
| } |
| lastComparison = Boolean.valueOf(is_set_funcArgs()).compareTo(typedOther.is_set_funcArgs()); |
| if (lastComparison != 0) { |
| return lastComparison; |
| } |
| if (is_set_funcArgs()) { lastComparison = TBaseHelper.compareTo(this.funcArgs, typedOther.funcArgs); |
| if (lastComparison != 0) { |
| return lastComparison; |
| } |
| } |
| return 0; |
| } |
| |
| 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: // FUNCTION_NAME |
| if (field.type == TType.STRING) { |
| this.functionName = iprot.readString(); |
| } else { |
| TProtocolUtil.skip(iprot, field.type); |
| } |
| break; |
| case 2: // FUNC_ARGS |
| if (field.type == TType.STRING) { |
| this.funcArgs = iprot.readString(); |
| } else { |
| TProtocolUtil.skip(iprot, field.type); |
| } |
| break; |
| default: |
| TProtocolUtil.skip(iprot, field.type); |
| } |
| iprot.readFieldEnd(); |
| } |
| iprot.readStructEnd(); |
| validate(); |
| } |
| |
| public void write(TProtocol oprot) throws TException { |
| validate(); |
| |
| oprot.writeStructBegin(STRUCT_DESC); |
| if (this.functionName != null) { |
| oprot.writeFieldBegin(FUNCTION_NAME_FIELD_DESC); |
| oprot.writeString(this.functionName); |
| oprot.writeFieldEnd(); |
| } |
| if (this.funcArgs != null) { |
| oprot.writeFieldBegin(FUNC_ARGS_FIELD_DESC); |
| oprot.writeString(this.funcArgs); |
| oprot.writeFieldEnd(); |
| } |
| oprot.writeFieldStop(); |
| oprot.writeStructEnd(); |
| } |
| |
| @Override |
| public String toString() { |
| StringBuilder sb = new StringBuilder("execute_args("); |
| boolean first = true; |
| |
| sb.append("functionName:"); |
| if (this.functionName == null) { |
| sb.append("null"); |
| } else { |
| sb.append(this.functionName); |
| } |
| first = false; |
| if (!first) sb.append(", "); |
| sb.append("funcArgs:"); |
| if (this.funcArgs == null) { |
| sb.append("null"); |
| } else { |
| sb.append(this.funcArgs); |
| } |
| first = false; |
| sb.append(")"); |
| return sb.toString(); |
| } |
| |
| public void validate() throws TException { |
| // check for required fields |
| } |
| |
| } |
| |
| public static class execute_result implements TBase<execute_result, execute_result._Fields>, java.io.Serializable, Cloneable { |
| private static final TStruct STRUCT_DESC = new TStruct("execute_result"); |
| |
| private static final TField SUCCESS_FIELD_DESC = new TField("success", TType.STRING, (short)0); |
| |
| private String success; |
| |
| /** 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"); |
| |
| 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; |
| 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.SUCCESS, new FieldMetaData("success", TFieldRequirementType.DEFAULT, |
| new FieldValueMetaData(TType.STRING))); |
| metaDataMap = Collections.unmodifiableMap(tmpMap); |
| FieldMetaData.addStructMetaDataMap(execute_result.class, metaDataMap); |
| } |
| |
| public execute_result() { |
| } |
| |
| public execute_result( |
| String success) |
| { |
| this(); |
| this.success = success; |
| } |
| |
| /** |
| * Performs a deep copy on <i>other</i>. |
| */ |
| public execute_result(execute_result other) { |
| if (other.is_set_success()) { |
| this.success = other.success; |
| } |
| } |
| |
| public execute_result deepCopy() { |
| return new execute_result(this); |
| } |
| |
| @Deprecated |
| public execute_result clone() { |
| return new execute_result(this); |
| } |
| |
| public String get_success() { |
| return this.success; |
| } |
| |
| public void set_success(String success) { |
| this.success = success; |
| } |
| |
| public void unset_success() { |
| this.success = null; |
| } |
| |
| /** Returns true if field success is set (has been asigned a value) and false otherwise */ |
| public boolean is_set_success() { |
| return this.success != null; |
| } |
| |
| public void set_success_isSet(boolean value) { |
| if (!value) { |
| this.success = null; |
| } |
| } |
| |
| public void setFieldValue(_Fields field, Object value) { |
| switch (field) { |
| case SUCCESS: |
| if (value == null) { |
| unset_success(); |
| } else { |
| set_success((String)value); |
| } |
| break; |
| |
| } |
| } |
| |
| public void setFieldValue(int fieldID, Object value) { |
| setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value); |
| } |
| |
| public Object getFieldValue(_Fields field) { |
| switch (field) { |
| case SUCCESS: |
| return get_success(); |
| |
| } |
| throw new IllegalStateException(); |
| } |
| |
| public Object getFieldValue(int fieldId) { |
| return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId)); |
| } |
| |
| /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */ |
| public boolean isSet(_Fields field) { |
| switch (field) { |
| case SUCCESS: |
| return is_set_success(); |
| } |
| throw new IllegalStateException(); |
| } |
| |
| public boolean isSet(int fieldID) { |
| return isSet(_Fields.findByThriftIdOrThrow(fieldID)); |
| } |
| |
| @Override |
| public boolean equals(Object that) { |
| if (that == null) |
| return false; |
| if (that instanceof execute_result) |
| return this.equals((execute_result)that); |
| return false; |
| } |
| |
| public boolean equals(execute_result that) { |
| if (that == null) |
| return false; |
| |
| boolean this_present_success = true && this.is_set_success(); |
| boolean that_present_success = true && that.is_set_success(); |
| if (this_present_success || that_present_success) { |
| if (!(this_present_success && that_present_success)) |
| return false; |
| if (!this.success.equals(that.success)) |
| return false; |
| } |
| |
| return true; |
| } |
| |
| @Override |
| public int hashCode() { |
| HashCodeBuilder builder = new HashCodeBuilder(); |
| |
| boolean present_success = true && (is_set_success()); |
| builder.append(present_success); |
| if (present_success) |
| builder.append(success); |
| |
| return builder.toHashCode(); |
| } |
| |
| public int compareTo(execute_result other) { |
| if (!getClass().equals(other.getClass())) { |
| return getClass().getName().compareTo(other.getClass().getName()); |
| } |
| |
| int lastComparison = 0; |
| execute_result typedOther = (execute_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; |
| } |
| } |
| return 0; |
| } |
| |
| 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.STRING) { |
| this.success = iprot.readString(); |
| } else { |
| TProtocolUtil.skip(iprot, field.type); |
| } |
| break; |
| default: |
| TProtocolUtil.skip(iprot, field.type); |
| } |
| iprot.readFieldEnd(); |
| } |
| iprot.readStructEnd(); |
| validate(); |
| } |
| |
| public void write(TProtocol oprot) throws TException { |
| oprot.writeStructBegin(STRUCT_DESC); |
| |
| if (this.is_set_success()) { |
| oprot.writeFieldBegin(SUCCESS_FIELD_DESC); |
| oprot.writeString(this.success); |
| oprot.writeFieldEnd(); |
| } |
| oprot.writeFieldStop(); |
| oprot.writeStructEnd(); |
| } |
| |
| @Override |
| public String toString() { |
| StringBuilder sb = new StringBuilder("execute_result("); |
| boolean first = true; |
| |
| sb.append("success:"); |
| if (this.success == null) { |
| sb.append("null"); |
| } else { |
| sb.append(this.success); |
| } |
| first = false; |
| sb.append(")"); |
| return sb.toString(); |
| } |
| |
| public void validate() throws TException { |
| // check for required fields |
| } |
| |
| } |
| |
| public static class result_args implements TBase<result_args, result_args._Fields>, java.io.Serializable, Cloneable { |
| private static final TStruct STRUCT_DESC = new TStruct("result_args"); |
| |
| private static final TField ID_FIELD_DESC = new TField("id", TType.STRING, (short)1); |
| private static final TField RESULT_FIELD_DESC = new TField("result", TType.STRING, (short)2); |
| |
| private String id; |
| private String result; |
| |
| /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ |
| public enum _Fields implements TFieldIdEnum { |
| ID((short)1, "id"), |
| RESULT((short)2, "result"); |
| |
| 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: // ID |
| return ID; |
| case 2: // RESULT |
| return RESULT; |
| 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.ID, new FieldMetaData("id", TFieldRequirementType.DEFAULT, |
| new FieldValueMetaData(TType.STRING))); |
| tmpMap.put(_Fields.RESULT, new FieldMetaData("result", TFieldRequirementType.DEFAULT, |
| new FieldValueMetaData(TType.STRING))); |
| metaDataMap = Collections.unmodifiableMap(tmpMap); |
| FieldMetaData.addStructMetaDataMap(result_args.class, metaDataMap); |
| } |
| |
| public result_args() { |
| } |
| |
| public result_args( |
| String id, |
| String result) |
| { |
| this(); |
| this.id = id; |
| this.result = result; |
| } |
| |
| /** |
| * Performs a deep copy on <i>other</i>. |
| */ |
| public result_args(result_args other) { |
| if (other.is_set_id()) { |
| this.id = other.id; |
| } |
| if (other.is_set_result()) { |
| this.result = other.result; |
| } |
| } |
| |
| public result_args deepCopy() { |
| return new result_args(this); |
| } |
| |
| @Deprecated |
| public result_args clone() { |
| return new result_args(this); |
| } |
| |
| public String get_id() { |
| return this.id; |
| } |
| |
| public void set_id(String id) { |
| this.id = id; |
| } |
| |
| public void unset_id() { |
| this.id = null; |
| } |
| |
| /** Returns true if field id is set (has been asigned a value) and false otherwise */ |
| public boolean is_set_id() { |
| return this.id != null; |
| } |
| |
| public void set_id_isSet(boolean value) { |
| if (!value) { |
| this.id = null; |
| } |
| } |
| |
| public String get_result() { |
| return this.result; |
| } |
| |
| public void set_result(String result) { |
| this.result = result; |
| } |
| |
| public void unset_result() { |
| this.result = null; |
| } |
| |
| /** Returns true if field result is set (has been asigned a value) and false otherwise */ |
| public boolean is_set_result() { |
| return this.result != null; |
| } |
| |
| public void set_result_isSet(boolean value) { |
| if (!value) { |
| this.result = null; |
| } |
| } |
| |
| public void setFieldValue(_Fields field, Object value) { |
| switch (field) { |
| case ID: |
| if (value == null) { |
| unset_id(); |
| } else { |
| set_id((String)value); |
| } |
| break; |
| |
| case RESULT: |
| if (value == null) { |
| unset_result(); |
| } else { |
| set_result((String)value); |
| } |
| break; |
| |
| } |
| } |
| |
| public void setFieldValue(int fieldID, Object value) { |
| setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value); |
| } |
| |
| public Object getFieldValue(_Fields field) { |
| switch (field) { |
| case ID: |
| return get_id(); |
| |
| case RESULT: |
| return get_result(); |
| |
| } |
| throw new IllegalStateException(); |
| } |
| |
| public Object getFieldValue(int fieldId) { |
| return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId)); |
| } |
| |
| /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */ |
| public boolean isSet(_Fields field) { |
| switch (field) { |
| case ID: |
| return is_set_id(); |
| case RESULT: |
| return is_set_result(); |
| } |
| throw new IllegalStateException(); |
| } |
| |
| public boolean isSet(int fieldID) { |
| return isSet(_Fields.findByThriftIdOrThrow(fieldID)); |
| } |
| |
| @Override |
| public boolean equals(Object that) { |
| if (that == null) |
| return false; |
| if (that instanceof result_args) |
| return this.equals((result_args)that); |
| return false; |
| } |
| |
| public boolean equals(result_args that) { |
| if (that == null) |
| return false; |
| |
| boolean this_present_id = true && this.is_set_id(); |
| boolean that_present_id = true && that.is_set_id(); |
| if (this_present_id || that_present_id) { |
| if (!(this_present_id && that_present_id)) |
| return false; |
| if (!this.id.equals(that.id)) |
| return false; |
| } |
| |
| boolean this_present_result = true && this.is_set_result(); |
| boolean that_present_result = true && that.is_set_result(); |
| if (this_present_result || that_present_result) { |
| if (!(this_present_result && that_present_result)) |
| return false; |
| if (!this.result.equals(that.result)) |
| return false; |
| } |
| |
| return true; |
| } |
| |
| @Override |
| public int hashCode() { |
| HashCodeBuilder builder = new HashCodeBuilder(); |
| |
| boolean present_id = true && (is_set_id()); |
| builder.append(present_id); |
| if (present_id) |
| builder.append(id); |
| |
| boolean present_result = true && (is_set_result()); |
| builder.append(present_result); |
| if (present_result) |
| builder.append(result); |
| |
| return builder.toHashCode(); |
| } |
| |
| public int compareTo(result_args other) { |
| if (!getClass().equals(other.getClass())) { |
| return getClass().getName().compareTo(other.getClass().getName()); |
| } |
| |
| int lastComparison = 0; |
| result_args typedOther = (result_args)other; |
| |
| lastComparison = Boolean.valueOf(is_set_id()).compareTo(typedOther.is_set_id()); |
| if (lastComparison != 0) { |
| return lastComparison; |
| } |
| if (is_set_id()) { lastComparison = TBaseHelper.compareTo(this.id, typedOther.id); |
| if (lastComparison != 0) { |
| return lastComparison; |
| } |
| } |
| lastComparison = Boolean.valueOf(is_set_result()).compareTo(typedOther.is_set_result()); |
| if (lastComparison != 0) { |
| return lastComparison; |
| } |
| if (is_set_result()) { lastComparison = TBaseHelper.compareTo(this.result, typedOther.result); |
| if (lastComparison != 0) { |
| return lastComparison; |
| } |
| } |
| return 0; |
| } |
| |
| 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: // ID |
| if (field.type == TType.STRING) { |
| this.id = iprot.readString(); |
| } else { |
| TProtocolUtil.skip(iprot, field.type); |
| } |
| break; |
| case 2: // RESULT |
| if (field.type == TType.STRING) { |
| this.result = iprot.readString(); |
| } else { |
| TProtocolUtil.skip(iprot, field.type); |
| } |
| break; |
| default: |
| TProtocolUtil.skip(iprot, field.type); |
| } |
| iprot.readFieldEnd(); |
| } |
| iprot.readStructEnd(); |
| validate(); |
| } |
| |
| public void write(TProtocol oprot) throws TException { |
| validate(); |
| |
| oprot.writeStructBegin(STRUCT_DESC); |
| if (this.id != null) { |
| oprot.writeFieldBegin(ID_FIELD_DESC); |
| oprot.writeString(this.id); |
| oprot.writeFieldEnd(); |
| } |
| if (this.result != null) { |
| oprot.writeFieldBegin(RESULT_FIELD_DESC); |
| oprot.writeString(this.result); |
| oprot.writeFieldEnd(); |
| } |
| oprot.writeFieldStop(); |
| oprot.writeStructEnd(); |
| } |
| |
| @Override |
| public String toString() { |
| StringBuilder sb = new StringBuilder("result_args("); |
| boolean first = true; |
| |
| sb.append("id:"); |
| if (this.id == null) { |
| sb.append("null"); |
| } else { |
| sb.append(this.id); |
| } |
| first = false; |
| if (!first) sb.append(", "); |
| sb.append("result:"); |
| if (this.result == null) { |
| sb.append("null"); |
| } else { |
| sb.append(this.result); |
| } |
| first = false; |
| sb.append(")"); |
| return sb.toString(); |
| } |
| |
| public void validate() throws TException { |
| // check for required fields |
| } |
| |
| } |
| |
| public static class result_result implements TBase<result_result, result_result._Fields>, java.io.Serializable, Cloneable { |
| private static final TStruct STRUCT_DESC = new TStruct("result_result"); |
| |
| |
| |
| /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ |
| public enum _Fields implements TFieldIdEnum { |
| ; |
| |
| 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) { |
| 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; |
| } |
| } |
| public static final Map<_Fields, FieldMetaData> metaDataMap; |
| static { |
| Map<_Fields, FieldMetaData> tmpMap = new EnumMap<_Fields, FieldMetaData>(_Fields.class); |
| metaDataMap = Collections.unmodifiableMap(tmpMap); |
| FieldMetaData.addStructMetaDataMap(result_result.class, metaDataMap); |
| } |
| |
| public result_result() { |
| } |
| |
| /** |
| * Performs a deep copy on <i>other</i>. |
| */ |
| public result_result(result_result other) { |
| } |
| |
| public result_result deepCopy() { |
| return new result_result(this); |
| } |
| |
| @Deprecated |
| public result_result clone() { |
| return new result_result(this); |
| } |
| |
| public void setFieldValue(_Fields field, Object value) { |
| switch (field) { |
| } |
| } |
| |
| public void setFieldValue(int fieldID, Object value) { |
| setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value); |
| } |
| |
| public Object getFieldValue(_Fields field) { |
| switch (field) { |
| } |
| throw new IllegalStateException(); |
| } |
| |
| public Object getFieldValue(int fieldId) { |
| return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId)); |
| } |
| |
| /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */ |
| public boolean isSet(_Fields field) { |
| switch (field) { |
| } |
| throw new IllegalStateException(); |
| } |
| |
| public boolean isSet(int fieldID) { |
| return isSet(_Fields.findByThriftIdOrThrow(fieldID)); |
| } |
| |
| @Override |
| public boolean equals(Object that) { |
| if (that == null) |
| return false; |
| if (that instanceof result_result) |
| return this.equals((result_result)that); |
| return false; |
| } |
| |
| public boolean equals(result_result that) { |
| if (that == null) |
| return false; |
| |
| return true; |
| } |
| |
| @Override |
| public int hashCode() { |
| HashCodeBuilder builder = new HashCodeBuilder(); |
| |
| return builder.toHashCode(); |
| } |
| |
| public int compareTo(result_result other) { |
| if (!getClass().equals(other.getClass())) { |
| return getClass().getName().compareTo(other.getClass().getName()); |
| } |
| |
| int lastComparison = 0; |
| result_result typedOther = (result_result)other; |
| |
| return 0; |
| } |
| |
| 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) { |
| default: |
| TProtocolUtil.skip(iprot, field.type); |
| } |
| iprot.readFieldEnd(); |
| } |
| iprot.readStructEnd(); |
| validate(); |
| } |
| |
| public void write(TProtocol oprot) throws TException { |
| oprot.writeStructBegin(STRUCT_DESC); |
| |
| oprot.writeFieldStop(); |
| oprot.writeStructEnd(); |
| } |
| |
| @Override |
| public String toString() { |
| StringBuilder sb = new StringBuilder("result_result("); |
| boolean first = true; |
| |
| sb.append(")"); |
| return sb.toString(); |
| } |
| |
| public void validate() throws TException { |
| // check for required fields |
| } |
| |
| } |
| |
| } |