/** * Autogenerated by Thrift * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING */ package com.dgrid.gen; import java.util.List; import java.util.ArrayList; import java.util.Map; import java.util.HashMap; import java.util.Set; import java.util.HashSet; import com.facebook.thrift.*; import com.facebook.thrift.protocol.*; import com.facebook.thrift.transport.*; public class SyncJobService { public interface Iface { public HostState status(String apiKey) throws InvalidApiKey, TException; public JobletResult execute(String apiKey, Joblet joblet) throws InvalidApiKey, TException; } public static class Client implements Iface { 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 HostState status(String apiKey) throws InvalidApiKey, TException { send_status(apiKey); return recv_status(); } public void send_status(String apiKey) throws TException { oprot_.writeMessageBegin(new TMessage("status", TMessageType.CALL, seqid_)); status_args args = new status_args(); args.apiKey = apiKey; args.write(oprot_); oprot_.writeMessageEnd(); oprot_.getTransport().flush(); } public HostState recv_status() throws InvalidApiKey, TException { TMessage msg = iprot_.readMessageBegin(); if (msg.type == TMessageType.EXCEPTION) { TApplicationException x = TApplicationException.read(iprot_); iprot_.readMessageEnd(); throw x; } status_result result = new status_result(); result.read(iprot_); iprot_.readMessageEnd(); if (result.__isset.success) { return result.success; } if (result.__isset.apiKeyException) { throw result.apiKeyException; } throw new TApplicationException(TApplicationException.MISSING_RESULT, "status failed: unknown result"); } public JobletResult execute(String apiKey, Joblet joblet) throws InvalidApiKey, TException { send_execute(apiKey, joblet); return recv_execute(); } public void send_execute(String apiKey, Joblet joblet) throws TException { oprot_.writeMessageBegin(new TMessage("execute", TMessageType.CALL, seqid_)); execute_args args = new execute_args(); args.apiKey = apiKey; args.joblet = joblet; args.write(oprot_); oprot_.writeMessageEnd(); oprot_.getTransport().flush(); } public JobletResult recv_execute() throws InvalidApiKey, TException { TMessage msg = iprot_.readMessageBegin(); if (msg.type == TMessageType.EXCEPTION) { TApplicationException x = TApplicationException.read(iprot_); iprot_.readMessageEnd(); throw x; } execute_result result = new execute_result(); result.read(iprot_); iprot_.readMessageEnd(); if (result.__isset.success) { return result.success; } if (result.__isset.apiKeyException) { throw result.apiKeyException; } throw new TApplicationException(TApplicationException.MISSING_RESULT, "execute failed: unknown result"); } } public static class Processor implements TProcessor { public Processor(Iface iface) { iface_ = iface; processMap_.put("status", new status()); processMap_.put("execute", new execute()); } 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 status implements ProcessFunction { public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException { status_args args = new status_args(); args.read(iprot); iprot.readMessageEnd(); status_result result = new status_result(); try { result.success = iface_.status(args.apiKey); result.__isset.success = true; } catch (InvalidApiKey apiKeyException) { result.apiKeyException = apiKeyException; result.__isset.apiKeyException = true; } oprot.writeMessageBegin(new TMessage("status", TMessageType.REPLY, seqid)); result.write(oprot); oprot.writeMessageEnd(); oprot.getTransport().flush(); } } private class execute implements ProcessFunction { public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException { execute_args args = new execute_args(); args.read(iprot); iprot.readMessageEnd(); execute_result result = new execute_result(); try { result.success = iface_.execute(args.apiKey, args.joblet); result.__isset.success = true; } catch (InvalidApiKey apiKeyException) { result.apiKeyException = apiKeyException; result.__isset.apiKeyException = true; } oprot.writeMessageBegin(new TMessage("execute", TMessageType.REPLY, seqid)); result.write(oprot); oprot.writeMessageEnd(); oprot.getTransport().flush(); } } } public static class status_args implements TBase, java.io.Serializable { private String apiKey; public final Isset __isset = new Isset(); public static final class Isset implements java.io.Serializable { public boolean apiKey = false; } public status_args() { } public status_args( String apiKey) { this(); this.apiKey = apiKey; this.__isset.apiKey = true; } public String getApiKey() { return this.apiKey; } public void setApiKey(String apiKey) { this.apiKey = apiKey; this.__isset.apiKey = true; } public void unsetApiKey() { this.__isset.apiKey = false; } public boolean equals(Object that) { if (that == null) return false; if (that instanceof status_args) return this.equals((status_args)that); return false; } public boolean equals(status_args that) { if (that == null) return false; boolean this_present_apiKey = true && (this.apiKey != null); boolean that_present_apiKey = true && (that.apiKey != null); if (this_present_apiKey || that_present_apiKey) { if (!(this_present_apiKey && that_present_apiKey)) return false; if (!this.apiKey.equals(that.apiKey)) return false; } return true; } public int hashCode() { 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: if (field.type == TType.STRING) { this.apiKey = iprot.readString(); this.__isset.apiKey = true; } else { TProtocolUtil.skip(iprot, field.type); } break; default: TProtocolUtil.skip(iprot, field.type); break; } iprot.readFieldEnd(); } iprot.readStructEnd(); } public void write(TProtocol oprot) throws TException { TStruct struct = new TStruct("status_args"); oprot.writeStructBegin(struct); TField field = new TField(); if (this.apiKey != null) { field.name = "apiKey"; field.type = TType.STRING; field.id = 1; oprot.writeFieldBegin(field); oprot.writeString(this.apiKey); oprot.writeFieldEnd(); } oprot.writeFieldStop(); oprot.writeStructEnd(); } public String toString() { StringBuilder sb = new StringBuilder("status_args("); sb.append("apiKey:"); sb.append(this.apiKey); sb.append(")"); return sb.toString(); } } public static class status_result implements TBase, java.io.Serializable { private HostState success; private InvalidApiKey apiKeyException; public final Isset __isset = new Isset(); public static final class Isset implements java.io.Serializable { public boolean success = false; public boolean apiKeyException = false; } public status_result() { } public status_result( HostState success, InvalidApiKey apiKeyException) { this(); this.success = success; this.__isset.success = true; this.apiKeyException = apiKeyException; this.__isset.apiKeyException = true; } public HostState getSuccess() { return this.success; } public void setSuccess(HostState success) { this.success = success; this.__isset.success = true; } public void unsetSuccess() { this.success = null; this.__isset.success = false; } public InvalidApiKey getApiKeyException() { return this.apiKeyException; } public void setApiKeyException(InvalidApiKey apiKeyException) { this.apiKeyException = apiKeyException; this.__isset.apiKeyException = true; } public void unsetApiKeyException() { this.apiKeyException = null; this.__isset.apiKeyException = false; } public boolean equals(Object that) { if (that == null) return false; if (that instanceof status_result) return this.equals((status_result)that); return false; } public boolean equals(status_result that) { if (that == null) return false; boolean this_present_success = true && (this.success != null); boolean that_present_success = true && (that.success != null); if (this_present_success || that_present_success) { if (!(this_present_success && that_present_success)) return false; if (!this.success.equals(that.success)) return false; } boolean this_present_apiKeyException = true && (this.apiKeyException != null); boolean that_present_apiKeyException = true && (that.apiKeyException != null); if (this_present_apiKeyException || that_present_apiKeyException) { if (!(this_present_apiKeyException && that_present_apiKeyException)) return false; if (!this.apiKeyException.equals(that.apiKeyException)) return false; } return true; } public int hashCode() { 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: if (field.type == TType.STRUCT) { this.success = new HostState(); this.success.read(iprot); this.__isset.success = true; } else { TProtocolUtil.skip(iprot, field.type); } break; case 1: if (field.type == TType.STRUCT) { this.apiKeyException = new InvalidApiKey(); this.apiKeyException.read(iprot); this.__isset.apiKeyException = true; } else { TProtocolUtil.skip(iprot, field.type); } break; default: TProtocolUtil.skip(iprot, field.type); break; } iprot.readFieldEnd(); } iprot.readStructEnd(); } public void write(TProtocol oprot) throws TException { TStruct struct = new TStruct("status_result"); oprot.writeStructBegin(struct); TField field = new TField(); if (this.__isset.success) { if (this.success != null) { field.name = "success"; field.type = TType.STRUCT; field.id = 0; oprot.writeFieldBegin(field); this.success.write(oprot); oprot.writeFieldEnd(); } } else if (this.__isset.apiKeyException) { if (this.apiKeyException != null) { field.name = "apiKeyException"; field.type = TType.STRUCT; field.id = 1; oprot.writeFieldBegin(field); this.apiKeyException.write(oprot); oprot.writeFieldEnd(); } } oprot.writeFieldStop(); oprot.writeStructEnd(); } public String toString() { StringBuilder sb = new StringBuilder("status_result("); sb.append("success:"); sb.append(this.success); sb.append(",apiKeyException:"); sb.append(this.apiKeyException); sb.append(")"); return sb.toString(); } } public static class execute_args implements TBase, java.io.Serializable { private String apiKey; private Joblet joblet; public final Isset __isset = new Isset(); public static final class Isset implements java.io.Serializable { public boolean apiKey = false; public boolean joblet = false; } public execute_args() { } public execute_args( String apiKey, Joblet joblet) { this(); this.apiKey = apiKey; this.__isset.apiKey = true; this.joblet = joblet; this.__isset.joblet = true; } public String getApiKey() { return this.apiKey; } public void setApiKey(String apiKey) { this.apiKey = apiKey; this.__isset.apiKey = true; } public void unsetApiKey() { this.__isset.apiKey = false; } public Joblet getJoblet() { return this.joblet; } public void setJoblet(Joblet joblet) { this.joblet = joblet; this.__isset.joblet = true; } public void unsetJoblet() { this.joblet = null; this.__isset.joblet = false; } 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_apiKey = true && (this.apiKey != null); boolean that_present_apiKey = true && (that.apiKey != null); if (this_present_apiKey || that_present_apiKey) { if (!(this_present_apiKey && that_present_apiKey)) return false; if (!this.apiKey.equals(that.apiKey)) return false; } boolean this_present_joblet = true && (this.joblet != null); boolean that_present_joblet = true && (that.joblet != null); if (this_present_joblet || that_present_joblet) { if (!(this_present_joblet && that_present_joblet)) return false; if (!this.joblet.equals(that.joblet)) return false; } return true; } public int hashCode() { 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: if (field.type == TType.STRING) { this.apiKey = iprot.readString(); this.__isset.apiKey = true; } else { TProtocolUtil.skip(iprot, field.type); } break; case 2: if (field.type == TType.STRUCT) { this.joblet = new Joblet(); this.joblet.read(iprot); this.__isset.joblet = true; } else { TProtocolUtil.skip(iprot, field.type); } break; default: TProtocolUtil.skip(iprot, field.type); break; } iprot.readFieldEnd(); } iprot.readStructEnd(); } public void write(TProtocol oprot) throws TException { TStruct struct = new TStruct("execute_args"); oprot.writeStructBegin(struct); TField field = new TField(); if (this.apiKey != null) { field.name = "apiKey"; field.type = TType.STRING; field.id = 1; oprot.writeFieldBegin(field); oprot.writeString(this.apiKey); oprot.writeFieldEnd(); } if (this.joblet != null) { field.name = "joblet"; field.type = TType.STRUCT; field.id = 2; oprot.writeFieldBegin(field); this.joblet.write(oprot); oprot.writeFieldEnd(); } oprot.writeFieldStop(); oprot.writeStructEnd(); } public String toString() { StringBuilder sb = new StringBuilder("execute_args("); sb.append("apiKey:"); sb.append(this.apiKey); sb.append(",joblet:"); sb.append(this.joblet); sb.append(")"); return sb.toString(); } } public static class execute_result implements TBase, java.io.Serializable { private JobletResult success; private InvalidApiKey apiKeyException; public final Isset __isset = new Isset(); public static final class Isset implements java.io.Serializable { public boolean success = false; public boolean apiKeyException = false; } public execute_result() { } public execute_result( JobletResult success, InvalidApiKey apiKeyException) { this(); this.success = success; this.__isset.success = true; this.apiKeyException = apiKeyException; this.__isset.apiKeyException = true; } public JobletResult getSuccess() { return this.success; } public void setSuccess(JobletResult success) { this.success = success; this.__isset.success = true; } public void unsetSuccess() { this.success = null; this.__isset.success = false; } public InvalidApiKey getApiKeyException() { return this.apiKeyException; } public void setApiKeyException(InvalidApiKey apiKeyException) { this.apiKeyException = apiKeyException; this.__isset.apiKeyException = true; } public void unsetApiKeyException() { this.apiKeyException = null; this.__isset.apiKeyException = false; } 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.success != null); boolean that_present_success = true && (that.success != null); if (this_present_success || that_present_success) { if (!(this_present_success && that_present_success)) return false; if (!this.success.equals(that.success)) return false; } boolean this_present_apiKeyException = true && (this.apiKeyException != null); boolean that_present_apiKeyException = true && (that.apiKeyException != null); if (this_present_apiKeyException || that_present_apiKeyException) { if (!(this_present_apiKeyException && that_present_apiKeyException)) return false; if (!this.apiKeyException.equals(that.apiKeyException)) return false; } return true; } public int hashCode() { 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: if (field.type == TType.STRUCT) { this.success = new JobletResult(); this.success.read(iprot); this.__isset.success = true; } else { TProtocolUtil.skip(iprot, field.type); } break; case 1: if (field.type == TType.STRUCT) { this.apiKeyException = new InvalidApiKey(); this.apiKeyException.read(iprot); this.__isset.apiKeyException = true; } else { TProtocolUtil.skip(iprot, field.type); } break; default: TProtocolUtil.skip(iprot, field.type); break; } iprot.readFieldEnd(); } iprot.readStructEnd(); } public void write(TProtocol oprot) throws TException { TStruct struct = new TStruct("execute_result"); oprot.writeStructBegin(struct); TField field = new TField(); if (this.__isset.success) { if (this.success != null) { field.name = "success"; field.type = TType.STRUCT; field.id = 0; oprot.writeFieldBegin(field); this.success.write(oprot); oprot.writeFieldEnd(); } } else if (this.__isset.apiKeyException) { if (this.apiKeyException != null) { field.name = "apiKeyException"; field.type = TType.STRUCT; field.id = 1; oprot.writeFieldBegin(field); this.apiKeyException.write(oprot); oprot.writeFieldEnd(); } } oprot.writeFieldStop(); oprot.writeStructEnd(); } public String toString() { StringBuilder sb = new StringBuilder("execute_result("); sb.append("success:"); sb.append(this.success); sb.append(",apiKeyException:"); sb.append(this.apiKeyException); sb.append(")"); return sb.toString(); } } }