All Downloads are FREE. Search and download functionalities are using the official Maven repository.

scray.service.qservice.thriftjava.ScrayCombinedStatefulTService Maven / Gradle / Ivy

The newest version!
/**
 * Autogenerated by Thrift
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 */
package scray.service.qservice.thriftjava;

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.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.*;

import com.twitter.util.Future;
import com.twitter.util.Function;
import com.twitter.util.Function2;
import com.twitter.util.Try;
import com.twitter.util.Return;
import com.twitter.util.Throw;
import com.twitter.finagle.thrift.DeserializeCtx;
import com.twitter.finagle.thrift.ThriftClientRequest;

public class ScrayCombinedStatefulTService {
  public interface Iface {
    public List getServiceEndpoints() throws TException;
    public ScrayTServiceEndpoint addServiceEndpoint(ScrayTServiceEndpoint endpoint) throws TException;
    public void refreshServiceEndpoint(scray.service.qmodel.thriftjava.ScrayUUID endpointID) throws TException;
    public boolean ping() throws TException;
    public void shutdown(long waitNanos) throws TException;
    public scray.service.qmodel.thriftjava.ScrayUUID query(scray.service.qmodel.thriftjava.ScrayTQuery query) throws ScrayTException, TException;
    public ScrayTResultFrame getResults(scray.service.qmodel.thriftjava.ScrayUUID queryId) throws ScrayTException, TException;
  }

  public interface AsyncIface {
    public void getServiceEndpoints(AsyncMethodCallback resultHandler) throws TException;
    public void addServiceEndpoint(ScrayTServiceEndpoint endpoint, AsyncMethodCallback resultHandler) throws TException;
    public void refreshServiceEndpoint(scray.service.qmodel.thriftjava.ScrayUUID endpointID, AsyncMethodCallback resultHandler) throws TException;
    public void ping(AsyncMethodCallback resultHandler) throws TException;
    public void shutdown(long waitNanos, AsyncMethodCallback resultHandler) throws TException;
    public void query(scray.service.qmodel.thriftjava.ScrayTQuery query, AsyncMethodCallback resultHandler) throws TException;
    public void getResults(scray.service.qmodel.thriftjava.ScrayUUID queryId, AsyncMethodCallback resultHandler) throws TException;
  }

  public interface ServiceIface {
    public Future> getServiceEndpoints();
    public Future addServiceEndpoint(ScrayTServiceEndpoint endpoint);
    public Future refreshServiceEndpoint(scray.service.qmodel.thriftjava.ScrayUUID endpointID);
    public Future ping();
    public Future shutdown(long waitNanos);
    public Future query(scray.service.qmodel.thriftjava.ScrayTQuery query);
    public Future getResults(scray.service.qmodel.thriftjava.ScrayUUID queryId);
  }

  public static class Client implements TServiceClient, Iface {
    public static class Factory implements TServiceClientFactory {
      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 List getServiceEndpoints() throws TException
    {
      send_getServiceEndpoints();
      return recv_getServiceEndpoints();
    }

    public void send_getServiceEndpoints() throws TException
    {
      oprot_.writeMessageBegin(new TMessage("getServiceEndpoints", TMessageType.CALL, ++seqid_));
      getServiceEndpoints_args __args__ = new getServiceEndpoints_args();
      __args__.write(oprot_);
      oprot_.writeMessageEnd();
      oprot_.getTransport().flush();
    }

    public List recv_getServiceEndpoints() 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, "getServiceEndpoints failed: out of sequence response");
      }
      getServiceEndpoints_result result = new getServiceEndpoints_result();
      result.read(iprot_);
      iprot_.readMessageEnd();
      if (result.isSetSuccess()) {
        return result.success;
      }
      throw new TApplicationException(TApplicationException.MISSING_RESULT, "getServiceEndpoints failed: unknown result");
    }
    public ScrayTServiceEndpoint addServiceEndpoint(ScrayTServiceEndpoint endpoint) throws TException
    {
      send_addServiceEndpoint(endpoint);
      return recv_addServiceEndpoint();
    }

    public void send_addServiceEndpoint(ScrayTServiceEndpoint endpoint) throws TException
    {
      oprot_.writeMessageBegin(new TMessage("addServiceEndpoint", TMessageType.CALL, ++seqid_));
      addServiceEndpoint_args __args__ = new addServiceEndpoint_args();
      __args__.setEndpoint(endpoint);
      __args__.write(oprot_);
      oprot_.writeMessageEnd();
      oprot_.getTransport().flush();
    }

    public ScrayTServiceEndpoint recv_addServiceEndpoint() 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, "addServiceEndpoint failed: out of sequence response");
      }
      addServiceEndpoint_result result = new addServiceEndpoint_result();
      result.read(iprot_);
      iprot_.readMessageEnd();
      if (result.isSetSuccess()) {
        return result.success;
      }
      throw new TApplicationException(TApplicationException.MISSING_RESULT, "addServiceEndpoint failed: unknown result");
    }
    public void refreshServiceEndpoint(scray.service.qmodel.thriftjava.ScrayUUID endpointID) throws TException
    {
      send_refreshServiceEndpoint(endpointID);
      recv_refreshServiceEndpoint();
    }

    public void send_refreshServiceEndpoint(scray.service.qmodel.thriftjava.ScrayUUID endpointID) throws TException
    {
      oprot_.writeMessageBegin(new TMessage("refreshServiceEndpoint", TMessageType.CALL, ++seqid_));
      refreshServiceEndpoint_args __args__ = new refreshServiceEndpoint_args();
      __args__.setEndpointID(endpointID);
      __args__.write(oprot_);
      oprot_.writeMessageEnd();
      oprot_.getTransport().flush();
    }

    public void recv_refreshServiceEndpoint() 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, "refreshServiceEndpoint failed: out of sequence response");
      }
      refreshServiceEndpoint_result result = new refreshServiceEndpoint_result();
      result.read(iprot_);
      iprot_.readMessageEnd();
      return;
    }
    public boolean ping() throws TException
    {
      send_ping();
      return recv_ping();
    }

    public void send_ping() throws TException
    {
      oprot_.writeMessageBegin(new TMessage("ping", TMessageType.CALL, ++seqid_));
      ping_args __args__ = new ping_args();
      __args__.write(oprot_);
      oprot_.writeMessageEnd();
      oprot_.getTransport().flush();
    }

    public boolean recv_ping() 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, "ping failed: out of sequence response");
      }
      ping_result result = new ping_result();
      result.read(iprot_);
      iprot_.readMessageEnd();
      if (result.isSetSuccess()) {
        return result.success;
      }
      throw new TApplicationException(TApplicationException.MISSING_RESULT, "ping failed: unknown result");
    }
    public void shutdown(long waitNanos) throws TException
    {
      send_shutdown(waitNanos);
      recv_shutdown();
    }

    public void send_shutdown(long waitNanos) throws TException
    {
      oprot_.writeMessageBegin(new TMessage("shutdown", TMessageType.CALL, ++seqid_));
      shutdown_args __args__ = new shutdown_args();
      __args__.setWaitNanos(waitNanos);
      __args__.write(oprot_);
      oprot_.writeMessageEnd();
      oprot_.getTransport().flush();
    }

    public void recv_shutdown() 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, "shutdown failed: out of sequence response");
      }
      shutdown_result result = new shutdown_result();
      result.read(iprot_);
      iprot_.readMessageEnd();
      return;
    }
    public scray.service.qmodel.thriftjava.ScrayUUID query(scray.service.qmodel.thriftjava.ScrayTQuery query) throws ScrayTException, TException
    {
      send_query(query);
      return recv_query();
    }

    public void send_query(scray.service.qmodel.thriftjava.ScrayTQuery query) throws TException
    {
      oprot_.writeMessageBegin(new TMessage("query", TMessageType.CALL, ++seqid_));
      query_args __args__ = new query_args();
      __args__.setQuery(query);
      __args__.write(oprot_);
      oprot_.writeMessageEnd();
      oprot_.getTransport().flush();
    }

    public scray.service.qmodel.thriftjava.ScrayUUID recv_query() throws ScrayTException, 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, "query failed: out of sequence response");
      }
      query_result result = new query_result();
      result.read(iprot_);
      iprot_.readMessageEnd();
      if (result.isSetSuccess()) {
        return result.success;
      }
      if (result.ex != null) {
        throw result.ex;
      }
      throw new TApplicationException(TApplicationException.MISSING_RESULT, "query failed: unknown result");
    }
    public ScrayTResultFrame getResults(scray.service.qmodel.thriftjava.ScrayUUID queryId) throws ScrayTException, TException
    {
      send_getResults(queryId);
      return recv_getResults();
    }

    public void send_getResults(scray.service.qmodel.thriftjava.ScrayUUID queryId) throws TException
    {
      oprot_.writeMessageBegin(new TMessage("getResults", TMessageType.CALL, ++seqid_));
      getResults_args __args__ = new getResults_args();
      __args__.setQueryId(queryId);
      __args__.write(oprot_);
      oprot_.writeMessageEnd();
      oprot_.getTransport().flush();
    }

    public ScrayTResultFrame recv_getResults() throws ScrayTException, 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, "getResults failed: out of sequence response");
      }
      getResults_result result = new getResults_result();
      result.read(iprot_);
      iprot_.readMessageEnd();
      if (result.isSetSuccess()) {
        return result.success;
      }
      if (result.ex != null) {
        throw result.ex;
      }
      throw new TApplicationException(TApplicationException.MISSING_RESULT, "getResults failed: unknown result");
    }
  }

  public static class AsyncClient extends TAsyncClient implements AsyncIface {
    public static class Factory implements TAsyncClientFactory {
      private final TAsyncClientManager clientManager;
      private final 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 getServiceEndpoints(AsyncMethodCallback __resultHandler__) throws TException {
      checkReady();
      getServiceEndpoints_call __method_call__ = new getServiceEndpoints_call(__resultHandler__, this, super.protocolFactory, super.transport);
      manager.call(__method_call__);
    }

    public static class getServiceEndpoints_call extends TAsyncMethodCall {

      public getServiceEndpoints_call(AsyncMethodCallback __resultHandler__, TAsyncClient __client__, TProtocolFactory __protocolFactory__, TNonblockingTransport __transport__) throws TException {
        super(__client__, __protocolFactory__, __transport__, __resultHandler__, false);
      }

      public void write_args(TProtocol __prot__) throws TException {
        __prot__.writeMessageBegin(new TMessage("getServiceEndpoints", TMessageType.CALL, 0));
        getServiceEndpoints_args __args__ = new getServiceEndpoints_args();
        __args__.write(__prot__);
        __prot__.writeMessageEnd();
      }

      public List getResult() throws TException {
        if (getState() != State.RESPONSE_READ) {
          throw new IllegalStateException("Method call not finished!");
        }
        TMemoryInputTransport __memoryTransport__ = new TMemoryInputTransport(getFrameBuffer().array());
        TProtocol __prot__ = super.client.getProtocolFactory().getProtocol(__memoryTransport__);
        return (new Client(__prot__)).recv_getServiceEndpoints();
      }
     }
    public void addServiceEndpoint(ScrayTServiceEndpoint endpoint, AsyncMethodCallback __resultHandler__) throws TException {
      checkReady();
      addServiceEndpoint_call __method_call__ = new addServiceEndpoint_call(endpoint, __resultHandler__, this, super.protocolFactory, super.transport);
      manager.call(__method_call__);
    }

    public static class addServiceEndpoint_call extends TAsyncMethodCall {
      private ScrayTServiceEndpoint endpoint;

      public addServiceEndpoint_call(ScrayTServiceEndpoint endpoint, AsyncMethodCallback __resultHandler__, TAsyncClient __client__, TProtocolFactory __protocolFactory__, TNonblockingTransport __transport__) throws TException {
        super(__client__, __protocolFactory__, __transport__, __resultHandler__, false);
        this.endpoint = endpoint;
      }

      public void write_args(TProtocol __prot__) throws TException {
        __prot__.writeMessageBegin(new TMessage("addServiceEndpoint", TMessageType.CALL, 0));
        addServiceEndpoint_args __args__ = new addServiceEndpoint_args();
        __args__.setEndpoint(endpoint);
        __args__.write(__prot__);
        __prot__.writeMessageEnd();
      }

      public ScrayTServiceEndpoint getResult() throws TException {
        if (getState() != State.RESPONSE_READ) {
          throw new IllegalStateException("Method call not finished!");
        }
        TMemoryInputTransport __memoryTransport__ = new TMemoryInputTransport(getFrameBuffer().array());
        TProtocol __prot__ = super.client.getProtocolFactory().getProtocol(__memoryTransport__);
        return (new Client(__prot__)).recv_addServiceEndpoint();
      }
     }
    public void refreshServiceEndpoint(scray.service.qmodel.thriftjava.ScrayUUID endpointID, AsyncMethodCallback __resultHandler__) throws TException {
      checkReady();
      refreshServiceEndpoint_call __method_call__ = new refreshServiceEndpoint_call(endpointID, __resultHandler__, this, super.protocolFactory, super.transport);
      manager.call(__method_call__);
    }

    public static class refreshServiceEndpoint_call extends TAsyncMethodCall {
      private scray.service.qmodel.thriftjava.ScrayUUID endpointID;

      public refreshServiceEndpoint_call(scray.service.qmodel.thriftjava.ScrayUUID endpointID, AsyncMethodCallback __resultHandler__, TAsyncClient __client__, TProtocolFactory __protocolFactory__, TNonblockingTransport __transport__) throws TException {
        super(__client__, __protocolFactory__, __transport__, __resultHandler__, false);
        this.endpointID = endpointID;
      }

      public void write_args(TProtocol __prot__) throws TException {
        __prot__.writeMessageBegin(new TMessage("refreshServiceEndpoint", TMessageType.CALL, 0));
        refreshServiceEndpoint_args __args__ = new refreshServiceEndpoint_args();
        __args__.setEndpointID(endpointID);
        __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__ = super.client.getProtocolFactory().getProtocol(__memoryTransport__);
        (new Client(__prot__)).recv_refreshServiceEndpoint();
      }
     }
    public void ping(AsyncMethodCallback __resultHandler__) throws TException {
      checkReady();
      ping_call __method_call__ = new ping_call(__resultHandler__, this, super.protocolFactory, super.transport);
      manager.call(__method_call__);
    }

    public static class ping_call extends TAsyncMethodCall {

      public ping_call(AsyncMethodCallback __resultHandler__, TAsyncClient __client__, TProtocolFactory __protocolFactory__, TNonblockingTransport __transport__) throws TException {
        super(__client__, __protocolFactory__, __transport__, __resultHandler__, false);
      }

      public void write_args(TProtocol __prot__) throws TException {
        __prot__.writeMessageBegin(new TMessage("ping", TMessageType.CALL, 0));
        ping_args __args__ = new ping_args();
        __args__.write(__prot__);
        __prot__.writeMessageEnd();
      }

      public boolean getResult() throws TException {
        if (getState() != State.RESPONSE_READ) {
          throw new IllegalStateException("Method call not finished!");
        }
        TMemoryInputTransport __memoryTransport__ = new TMemoryInputTransport(getFrameBuffer().array());
        TProtocol __prot__ = super.client.getProtocolFactory().getProtocol(__memoryTransport__);
        return (new Client(__prot__)).recv_ping();
      }
     }
    public void shutdown(long waitNanos, AsyncMethodCallback __resultHandler__) throws TException {
      checkReady();
      shutdown_call __method_call__ = new shutdown_call(waitNanos, __resultHandler__, this, super.protocolFactory, super.transport);
      manager.call(__method_call__);
    }

    public static class shutdown_call extends TAsyncMethodCall {
      private long waitNanos;

      public shutdown_call(long waitNanos, AsyncMethodCallback __resultHandler__, TAsyncClient __client__, TProtocolFactory __protocolFactory__, TNonblockingTransport __transport__) throws TException {
        super(__client__, __protocolFactory__, __transport__, __resultHandler__, false);
        this.waitNanos = waitNanos;
      }

      public void write_args(TProtocol __prot__) throws TException {
        __prot__.writeMessageBegin(new TMessage("shutdown", TMessageType.CALL, 0));
        shutdown_args __args__ = new shutdown_args();
        __args__.setWaitNanos(waitNanos);
        __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__ = super.client.getProtocolFactory().getProtocol(__memoryTransport__);
        (new Client(__prot__)).recv_shutdown();
      }
     }
    public void query(scray.service.qmodel.thriftjava.ScrayTQuery query, AsyncMethodCallback __resultHandler__) throws TException {
      checkReady();
      query_call __method_call__ = new query_call(query, __resultHandler__, this, super.protocolFactory, super.transport);
      manager.call(__method_call__);
    }

    public static class query_call extends TAsyncMethodCall {
      private scray.service.qmodel.thriftjava.ScrayTQuery query;

      public query_call(scray.service.qmodel.thriftjava.ScrayTQuery query, AsyncMethodCallback __resultHandler__, TAsyncClient __client__, TProtocolFactory __protocolFactory__, TNonblockingTransport __transport__) throws TException {
        super(__client__, __protocolFactory__, __transport__, __resultHandler__, false);
        this.query = query;
      }

      public void write_args(TProtocol __prot__) throws TException {
        __prot__.writeMessageBegin(new TMessage("query", TMessageType.CALL, 0));
        query_args __args__ = new query_args();
        __args__.setQuery(query);
        __args__.write(__prot__);
        __prot__.writeMessageEnd();
      }

      public scray.service.qmodel.thriftjava.ScrayUUID getResult() throws ScrayTException, TException {
        if (getState() != State.RESPONSE_READ) {
          throw new IllegalStateException("Method call not finished!");
        }
        TMemoryInputTransport __memoryTransport__ = new TMemoryInputTransport(getFrameBuffer().array());
        TProtocol __prot__ = super.client.getProtocolFactory().getProtocol(__memoryTransport__);
        return (new Client(__prot__)).recv_query();
      }
     }
    public void getResults(scray.service.qmodel.thriftjava.ScrayUUID queryId, AsyncMethodCallback __resultHandler__) throws TException {
      checkReady();
      getResults_call __method_call__ = new getResults_call(queryId, __resultHandler__, this, super.protocolFactory, super.transport);
      manager.call(__method_call__);
    }

    public static class getResults_call extends TAsyncMethodCall {
      private scray.service.qmodel.thriftjava.ScrayUUID queryId;

      public getResults_call(scray.service.qmodel.thriftjava.ScrayUUID queryId, AsyncMethodCallback __resultHandler__, TAsyncClient __client__, TProtocolFactory __protocolFactory__, TNonblockingTransport __transport__) throws TException {
        super(__client__, __protocolFactory__, __transport__, __resultHandler__, false);
        this.queryId = queryId;
      }

      public void write_args(TProtocol __prot__) throws TException {
        __prot__.writeMessageBegin(new TMessage("getResults", TMessageType.CALL, 0));
        getResults_args __args__ = new getResults_args();
        __args__.setQueryId(queryId);
        __args__.write(__prot__);
        __prot__.writeMessageEnd();
      }

      public ScrayTResultFrame getResult() throws ScrayTException, TException {
        if (getState() != State.RESPONSE_READ) {
          throw new IllegalStateException("Method call not finished!");
        }
        TMemoryInputTransport __memoryTransport__ = new TMemoryInputTransport(getFrameBuffer().array());
        TProtocol __prot__ = super.client.getProtocolFactory().getProtocol(__memoryTransport__);
        return (new Client(__prot__)).recv_getResults();
      }
     }
   }


  public static class ServiceToClient implements ServiceIface {
    private final com.twitter.finagle.Service service;
    private final TProtocolFactory protocolFactory;
    private final scala.PartialFunction responseClassifier;

    public ServiceToClient(com.twitter.finagle.Service service, TProtocolFactory protocolFactory, scala.PartialFunction responseClassifier) {
      
      this.service = service;
      this.protocolFactory = protocolFactory;
      this.responseClassifier = responseClassifier;
    }

    public ServiceToClient(com.twitter.finagle.Service service, TProtocolFactory protocolFactory) {
      
      this.service = service;
      this.protocolFactory = protocolFactory;
      this.responseClassifier = com.twitter.finagle.service.ResponseClassifier.Default();
    }

    public Future> getServiceEndpoints() {
      try {
        // TODO: size
        TMemoryBuffer __memoryTransport__ = new TMemoryBuffer(512);
        TProtocol __prot__ = this.protocolFactory.getProtocol(__memoryTransport__);
        __prot__.writeMessageBegin(new TMessage("getServiceEndpoints", TMessageType.CALL, 0));
        getServiceEndpoints_args __args__ = new getServiceEndpoints_args();
        __args__.write(__prot__);
        __prot__.writeMessageEnd();


        byte[] __buffer__ = Arrays.copyOfRange(__memoryTransport__.getArray(), 0, __memoryTransport__.length());
        final ThriftClientRequest __request__ = new ThriftClientRequest(__buffer__, false);

        Function>> replyDeserializer =
          new Function>>() {
            public com.twitter.util.Try> apply(byte[] __buffer__) {
              TMemoryInputTransport __memoryTransport__ = new TMemoryInputTransport(__buffer__);
              TProtocol __prot__ = ServiceToClient.this.protocolFactory.getProtocol(__memoryTransport__);
              try {
                return new com.twitter.util.Return(((new Client(__prot__)).recv_getServiceEndpoints()));
              } catch (Exception e) {
                return new com.twitter.util.Throw(e);
              }
            }
          };
        DeserializeCtx serdeCtx = new DeserializeCtx>(__args__, replyDeserializer);

        return com.twitter.finagle.context.Contexts.local().let(
          DeserializeCtx.Key(),
          serdeCtx,
          new com.twitter.util.Function0>>() {
            public Future> apply() {

              Future __done__ = service.apply(__request__);
              return __done__.flatMap(new Function>>() {
                public Future> apply(byte[] __buffer__) {
                  TMemoryInputTransport __memoryTransport__ = new TMemoryInputTransport(__buffer__);
                  TProtocol __prot__ = ServiceToClient.this.protocolFactory.getProtocol(__memoryTransport__);
                  try {
                    return Future.value((new Client(__prot__)).recv_getServiceEndpoints());
                  } catch (Exception e) {
                    return Future.exception(e);
                  }
                }
              });
            }
          });
      } catch (TException e) {
        return Future.exception(e);
      }
    }
    public Future addServiceEndpoint(ScrayTServiceEndpoint endpoint) {
      try {
        // TODO: size
        TMemoryBuffer __memoryTransport__ = new TMemoryBuffer(512);
        TProtocol __prot__ = this.protocolFactory.getProtocol(__memoryTransport__);
        __prot__.writeMessageBegin(new TMessage("addServiceEndpoint", TMessageType.CALL, 0));
        addServiceEndpoint_args __args__ = new addServiceEndpoint_args();
        __args__.setEndpoint(endpoint);
        __args__.write(__prot__);
        __prot__.writeMessageEnd();


        byte[] __buffer__ = Arrays.copyOfRange(__memoryTransport__.getArray(), 0, __memoryTransport__.length());
        final ThriftClientRequest __request__ = new ThriftClientRequest(__buffer__, false);

        Function> replyDeserializer =
          new Function>() {
            public com.twitter.util.Try apply(byte[] __buffer__) {
              TMemoryInputTransport __memoryTransport__ = new TMemoryInputTransport(__buffer__);
              TProtocol __prot__ = ServiceToClient.this.protocolFactory.getProtocol(__memoryTransport__);
              try {
                return new com.twitter.util.Return(((new Client(__prot__)).recv_addServiceEndpoint()));
              } catch (Exception e) {
                return new com.twitter.util.Throw(e);
              }
            }
          };
        DeserializeCtx serdeCtx = new DeserializeCtx(__args__, replyDeserializer);

        return com.twitter.finagle.context.Contexts.local().let(
          DeserializeCtx.Key(),
          serdeCtx,
          new com.twitter.util.Function0>() {
            public Future apply() {

              Future __done__ = service.apply(__request__);
              return __done__.flatMap(new Function>() {
                public Future apply(byte[] __buffer__) {
                  TMemoryInputTransport __memoryTransport__ = new TMemoryInputTransport(__buffer__);
                  TProtocol __prot__ = ServiceToClient.this.protocolFactory.getProtocol(__memoryTransport__);
                  try {
                    return Future.value((new Client(__prot__)).recv_addServiceEndpoint());
                  } catch (Exception e) {
                    return Future.exception(e);
                  }
                }
              });
            }
          });
      } catch (TException e) {
        return Future.exception(e);
      }
    }
    public Future refreshServiceEndpoint(scray.service.qmodel.thriftjava.ScrayUUID endpointID) {
      try {
        // TODO: size
        TMemoryBuffer __memoryTransport__ = new TMemoryBuffer(512);
        TProtocol __prot__ = this.protocolFactory.getProtocol(__memoryTransport__);
        __prot__.writeMessageBegin(new TMessage("refreshServiceEndpoint", TMessageType.CALL, 0));
        refreshServiceEndpoint_args __args__ = new refreshServiceEndpoint_args();
        __args__.setEndpointID(endpointID);
        __args__.write(__prot__);
        __prot__.writeMessageEnd();


        byte[] __buffer__ = Arrays.copyOfRange(__memoryTransport__.getArray(), 0, __memoryTransport__.length());
        final ThriftClientRequest __request__ = new ThriftClientRequest(__buffer__, false);

        Function> replyDeserializer =
          new Function>() {
            public com.twitter.util.Try apply(byte[] __buffer__) {
              TMemoryInputTransport __memoryTransport__ = new TMemoryInputTransport(__buffer__);
              TProtocol __prot__ = ServiceToClient.this.protocolFactory.getProtocol(__memoryTransport__);
              try {
                (new Client(__prot__)).recv_refreshServiceEndpoint();
                return new com.twitter.util.Return(null);
              } catch (Exception e) {
                return new com.twitter.util.Throw(e);
              }
            }
          };
        DeserializeCtx serdeCtx = new DeserializeCtx(__args__, replyDeserializer);

        return com.twitter.finagle.context.Contexts.local().let(
          DeserializeCtx.Key(),
          serdeCtx,
          new com.twitter.util.Function0>() {
            public Future apply() {

              Future __done__ = service.apply(__request__);
              return __done__.flatMap(new Function>() {
                public Future apply(byte[] __buffer__) {
                  TMemoryInputTransport __memoryTransport__ = new TMemoryInputTransport(__buffer__);
                  TProtocol __prot__ = ServiceToClient.this.protocolFactory.getProtocol(__memoryTransport__);
                  try {
                    (new Client(__prot__)).recv_refreshServiceEndpoint();
                    return Future.value(null);
                  } catch (Exception e) {
                    return Future.exception(e);
                  }
                }
              });
            }
          });
      } catch (TException e) {
        return Future.exception(e);
      }
    }
    public Future ping() {
      try {
        // TODO: size
        TMemoryBuffer __memoryTransport__ = new TMemoryBuffer(512);
        TProtocol __prot__ = this.protocolFactory.getProtocol(__memoryTransport__);
        __prot__.writeMessageBegin(new TMessage("ping", TMessageType.CALL, 0));
        ping_args __args__ = new ping_args();
        __args__.write(__prot__);
        __prot__.writeMessageEnd();


        byte[] __buffer__ = Arrays.copyOfRange(__memoryTransport__.getArray(), 0, __memoryTransport__.length());
        final ThriftClientRequest __request__ = new ThriftClientRequest(__buffer__, false);

        Function> replyDeserializer =
          new Function>() {
            public com.twitter.util.Try apply(byte[] __buffer__) {
              TMemoryInputTransport __memoryTransport__ = new TMemoryInputTransport(__buffer__);
              TProtocol __prot__ = ServiceToClient.this.protocolFactory.getProtocol(__memoryTransport__);
              try {
                return new com.twitter.util.Return(((new Client(__prot__)).recv_ping()));
              } catch (Exception e) {
                return new com.twitter.util.Throw(e);
              }
            }
          };
        DeserializeCtx serdeCtx = new DeserializeCtx(__args__, replyDeserializer);

        return com.twitter.finagle.context.Contexts.local().let(
          DeserializeCtx.Key(),
          serdeCtx,
          new com.twitter.util.Function0>() {
            public Future apply() {

              Future __done__ = service.apply(__request__);
              return __done__.flatMap(new Function>() {
                public Future apply(byte[] __buffer__) {
                  TMemoryInputTransport __memoryTransport__ = new TMemoryInputTransport(__buffer__);
                  TProtocol __prot__ = ServiceToClient.this.protocolFactory.getProtocol(__memoryTransport__);
                  try {
                    return Future.value((new Client(__prot__)).recv_ping());
                  } catch (Exception e) {
                    return Future.exception(e);
                  }
                }
              });
            }
          });
      } catch (TException e) {
        return Future.exception(e);
      }
    }
    public Future shutdown(long waitNanos) {
      try {
        // TODO: size
        TMemoryBuffer __memoryTransport__ = new TMemoryBuffer(512);
        TProtocol __prot__ = this.protocolFactory.getProtocol(__memoryTransport__);
        __prot__.writeMessageBegin(new TMessage("shutdown", TMessageType.CALL, 0));
        shutdown_args __args__ = new shutdown_args();
        __args__.setWaitNanos(waitNanos);
        __args__.write(__prot__);
        __prot__.writeMessageEnd();


        byte[] __buffer__ = Arrays.copyOfRange(__memoryTransport__.getArray(), 0, __memoryTransport__.length());
        final ThriftClientRequest __request__ = new ThriftClientRequest(__buffer__, false);

        Function> replyDeserializer =
          new Function>() {
            public com.twitter.util.Try apply(byte[] __buffer__) {
              TMemoryInputTransport __memoryTransport__ = new TMemoryInputTransport(__buffer__);
              TProtocol __prot__ = ServiceToClient.this.protocolFactory.getProtocol(__memoryTransport__);
              try {
                (new Client(__prot__)).recv_shutdown();
                return new com.twitter.util.Return(null);
              } catch (Exception e) {
                return new com.twitter.util.Throw(e);
              }
            }
          };
        DeserializeCtx serdeCtx = new DeserializeCtx(__args__, replyDeserializer);

        return com.twitter.finagle.context.Contexts.local().let(
          DeserializeCtx.Key(),
          serdeCtx,
          new com.twitter.util.Function0>() {
            public Future apply() {

              Future __done__ = service.apply(__request__);
              return __done__.flatMap(new Function>() {
                public Future apply(byte[] __buffer__) {
                  TMemoryInputTransport __memoryTransport__ = new TMemoryInputTransport(__buffer__);
                  TProtocol __prot__ = ServiceToClient.this.protocolFactory.getProtocol(__memoryTransport__);
                  try {
                    (new Client(__prot__)).recv_shutdown();
                    return Future.value(null);
                  } catch (Exception e) {
                    return Future.exception(e);
                  }
                }
              });
            }
          });
      } catch (TException e) {
        return Future.exception(e);
      }
    }
    public Future query(scray.service.qmodel.thriftjava.ScrayTQuery query) {
      try {
        // TODO: size
        TMemoryBuffer __memoryTransport__ = new TMemoryBuffer(512);
        TProtocol __prot__ = this.protocolFactory.getProtocol(__memoryTransport__);
        __prot__.writeMessageBegin(new TMessage("query", TMessageType.CALL, 0));
        query_args __args__ = new query_args();
        __args__.setQuery(query);
        __args__.write(__prot__);
        __prot__.writeMessageEnd();


        byte[] __buffer__ = Arrays.copyOfRange(__memoryTransport__.getArray(), 0, __memoryTransport__.length());
        final ThriftClientRequest __request__ = new ThriftClientRequest(__buffer__, false);

        Function> replyDeserializer =
          new Function>() {
            public com.twitter.util.Try apply(byte[] __buffer__) {
              TMemoryInputTransport __memoryTransport__ = new TMemoryInputTransport(__buffer__);
              TProtocol __prot__ = ServiceToClient.this.protocolFactory.getProtocol(__memoryTransport__);
              try {
                return new com.twitter.util.Return(((new Client(__prot__)).recv_query()));
              } catch (Exception e) {
                return new com.twitter.util.Throw(e);
              }
            }
          };
        DeserializeCtx serdeCtx = new DeserializeCtx(__args__, replyDeserializer);

        return com.twitter.finagle.context.Contexts.local().let(
          DeserializeCtx.Key(),
          serdeCtx,
          new com.twitter.util.Function0>() {
            public Future apply() {

              Future __done__ = service.apply(__request__);
              return __done__.flatMap(new Function>() {
                public Future apply(byte[] __buffer__) {
                  TMemoryInputTransport __memoryTransport__ = new TMemoryInputTransport(__buffer__);
                  TProtocol __prot__ = ServiceToClient.this.protocolFactory.getProtocol(__memoryTransport__);
                  try {
                    return Future.value((new Client(__prot__)).recv_query());
                  } catch (Exception e) {
                    return Future.exception(e);
                  }
                }
              });
            }
          });
      } catch (TException e) {
        return Future.exception(e);
      }
    }
    public Future getResults(scray.service.qmodel.thriftjava.ScrayUUID queryId) {
      try {
        // TODO: size
        TMemoryBuffer __memoryTransport__ = new TMemoryBuffer(512);
        TProtocol __prot__ = this.protocolFactory.getProtocol(__memoryTransport__);
        __prot__.writeMessageBegin(new TMessage("getResults", TMessageType.CALL, 0));
        getResults_args __args__ = new getResults_args();
        __args__.setQueryId(queryId);
        __args__.write(__prot__);
        __prot__.writeMessageEnd();


        byte[] __buffer__ = Arrays.copyOfRange(__memoryTransport__.getArray(), 0, __memoryTransport__.length());
        final ThriftClientRequest __request__ = new ThriftClientRequest(__buffer__, false);

        Function> replyDeserializer =
          new Function>() {
            public com.twitter.util.Try apply(byte[] __buffer__) {
              TMemoryInputTransport __memoryTransport__ = new TMemoryInputTransport(__buffer__);
              TProtocol __prot__ = ServiceToClient.this.protocolFactory.getProtocol(__memoryTransport__);
              try {
                return new com.twitter.util.Return(((new Client(__prot__)).recv_getResults()));
              } catch (Exception e) {
                return new com.twitter.util.Throw(e);
              }
            }
          };
        DeserializeCtx serdeCtx = new DeserializeCtx(__args__, replyDeserializer);

        return com.twitter.finagle.context.Contexts.local().let(
          DeserializeCtx.Key(),
          serdeCtx,
          new com.twitter.util.Function0>() {
            public Future apply() {

              Future __done__ = service.apply(__request__);
              return __done__.flatMap(new Function>() {
                public Future apply(byte[] __buffer__) {
                  TMemoryInputTransport __memoryTransport__ = new TMemoryInputTransport(__buffer__);
                  TProtocol __prot__ = ServiceToClient.this.protocolFactory.getProtocol(__memoryTransport__);
                  try {
                    return Future.value((new Client(__prot__)).recv_getResults());
                  } catch (Exception e) {
                    return Future.exception(e);
                  }
                }
              });
            }
          });
      } catch (TException e) {
        return Future.exception(e);
      }
    }
  }

  public static class Processor implements TProcessor {
    private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName());
    public Processor(Iface iface)
    {
      iface_ = iface;
      processMap_.put("getServiceEndpoints", new getServiceEndpoints());
      processMap_.put("addServiceEndpoint", new addServiceEndpoint());
      processMap_.put("refreshServiceEndpoint", new refreshServiceEndpoint());
      processMap_.put("ping", new ping());
      processMap_.put("shutdown", new shutdown());
      processMap_.put("query", new query());
      processMap_.put("getResults", new getResults());
    }

    protected static interface ProcessFunction {
      public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException;
    }

    private Iface iface_;
    protected final HashMap processMap_ = new HashMap();

    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 getServiceEndpoints implements ProcessFunction {
      public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
      {
        getServiceEndpoints_args args = new getServiceEndpoints_args();
        try {
          args.read(iprot);
        } catch (TProtocolException e) {
          iprot.readMessageEnd();
          TApplicationException x = new TApplicationException(TApplicationException.PROTOCOL_ERROR, e.getMessage());
          oprot.writeMessageBegin(new TMessage("getServiceEndpoints", TMessageType.EXCEPTION, seqid));
          x.write(oprot);
          oprot.writeMessageEnd();
          oprot.getTransport().flush();
          return;
        }
        iprot.readMessageEnd();
        getServiceEndpoints_result result = new getServiceEndpoints_result();
        result.success = iface_.getServiceEndpoints();
        
        oprot.writeMessageBegin(new TMessage("getServiceEndpoints", TMessageType.REPLY, seqid));
        result.write(oprot);
        oprot.writeMessageEnd();
        oprot.getTransport().flush();
      }
    }
    private class addServiceEndpoint implements ProcessFunction {
      public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
      {
        addServiceEndpoint_args args = new addServiceEndpoint_args();
        try {
          args.read(iprot);
        } catch (TProtocolException e) {
          iprot.readMessageEnd();
          TApplicationException x = new TApplicationException(TApplicationException.PROTOCOL_ERROR, e.getMessage());
          oprot.writeMessageBegin(new TMessage("addServiceEndpoint", TMessageType.EXCEPTION, seqid));
          x.write(oprot);
          oprot.writeMessageEnd();
          oprot.getTransport().flush();
          return;
        }
        iprot.readMessageEnd();
        addServiceEndpoint_result result = new addServiceEndpoint_result();
        result.success = iface_.addServiceEndpoint(args.endpoint);
        
        oprot.writeMessageBegin(new TMessage("addServiceEndpoint", TMessageType.REPLY, seqid));
        result.write(oprot);
        oprot.writeMessageEnd();
        oprot.getTransport().flush();
      }
    }
    private class refreshServiceEndpoint implements ProcessFunction {
      public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
      {
        refreshServiceEndpoint_args args = new refreshServiceEndpoint_args();
        try {
          args.read(iprot);
        } catch (TProtocolException e) {
          iprot.readMessageEnd();
          TApplicationException x = new TApplicationException(TApplicationException.PROTOCOL_ERROR, e.getMessage());
          oprot.writeMessageBegin(new TMessage("refreshServiceEndpoint", TMessageType.EXCEPTION, seqid));
          x.write(oprot);
          oprot.writeMessageEnd();
          oprot.getTransport().flush();
          return;
        }
        iprot.readMessageEnd();
        refreshServiceEndpoint_result result = new refreshServiceEndpoint_result();
        iface_.refreshServiceEndpoint(args.endpointID);
        
        oprot.writeMessageBegin(new TMessage("refreshServiceEndpoint", TMessageType.REPLY, seqid));
        result.write(oprot);
        oprot.writeMessageEnd();
        oprot.getTransport().flush();
      }
    }
    private class ping implements ProcessFunction {
      public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
      {
        ping_args args = new ping_args();
        try {
          args.read(iprot);
        } catch (TProtocolException e) {
          iprot.readMessageEnd();
          TApplicationException x = new TApplicationException(TApplicationException.PROTOCOL_ERROR, e.getMessage());
          oprot.writeMessageBegin(new TMessage("ping", TMessageType.EXCEPTION, seqid));
          x.write(oprot);
          oprot.writeMessageEnd();
          oprot.getTransport().flush();
          return;
        }
        iprot.readMessageEnd();
        ping_result result = new ping_result();
        result.success = iface_.ping();
        result.setSuccessIsSet(true);
        oprot.writeMessageBegin(new TMessage("ping", TMessageType.REPLY, seqid));
        result.write(oprot);
        oprot.writeMessageEnd();
        oprot.getTransport().flush();
      }
    }
    private class shutdown implements ProcessFunction {
      public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
      {
        shutdown_args args = new shutdown_args();
        try {
          args.read(iprot);
        } catch (TProtocolException e) {
          iprot.readMessageEnd();
          TApplicationException x = new TApplicationException(TApplicationException.PROTOCOL_ERROR, e.getMessage());
          oprot.writeMessageBegin(new TMessage("shutdown", TMessageType.EXCEPTION, seqid));
          x.write(oprot);
          oprot.writeMessageEnd();
          oprot.getTransport().flush();
          return;
        }
        iprot.readMessageEnd();
        shutdown_result result = new shutdown_result();
        iface_.shutdown(args.waitNanos);
        
        oprot.writeMessageBegin(new TMessage("shutdown", TMessageType.REPLY, seqid));
        result.write(oprot);
        oprot.writeMessageEnd();
        oprot.getTransport().flush();
      }
    }
    private class query implements ProcessFunction {
      public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
      {
        query_args args = new query_args();
        try {
          args.read(iprot);
        } catch (TProtocolException e) {
          iprot.readMessageEnd();
          TApplicationException x = new TApplicationException(TApplicationException.PROTOCOL_ERROR, e.getMessage());
          oprot.writeMessageBegin(new TMessage("query", TMessageType.EXCEPTION, seqid));
          x.write(oprot);
          oprot.writeMessageEnd();
          oprot.getTransport().flush();
          return;
        }
        iprot.readMessageEnd();
        query_result result = new query_result();
        try {
          result.success = iface_.query(args.query);
          
        } catch (ScrayTException ex) {
          result.ex = ex;
        } catch (Throwable th) {
          LOGGER.error("Internal error processing query", th);
          TApplicationException x = new TApplicationException(TApplicationException.INTERNAL_ERROR, "Internal error processing query");
          oprot.writeMessageBegin(new TMessage("query", TMessageType.EXCEPTION, seqid));
          x.write(oprot);
          oprot.writeMessageEnd();
          oprot.getTransport().flush();
          return;
        }
        oprot.writeMessageBegin(new TMessage("query", TMessageType.REPLY, seqid));
        result.write(oprot);
        oprot.writeMessageEnd();
        oprot.getTransport().flush();
      }
    }
    private class getResults implements ProcessFunction {
      public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
      {
        getResults_args args = new getResults_args();
        try {
          args.read(iprot);
        } catch (TProtocolException e) {
          iprot.readMessageEnd();
          TApplicationException x = new TApplicationException(TApplicationException.PROTOCOL_ERROR, e.getMessage());
          oprot.writeMessageBegin(new TMessage("getResults", TMessageType.EXCEPTION, seqid));
          x.write(oprot);
          oprot.writeMessageEnd();
          oprot.getTransport().flush();
          return;
        }
        iprot.readMessageEnd();
        getResults_result result = new getResults_result();
        try {
          result.success = iface_.getResults(args.queryId);
          
        } catch (ScrayTException ex) {
          result.ex = ex;
        } catch (Throwable th) {
          LOGGER.error("Internal error processing getResults", th);
          TApplicationException x = new TApplicationException(TApplicationException.INTERNAL_ERROR, "Internal error processing getResults");
          oprot.writeMessageBegin(new TMessage("getResults", TMessageType.EXCEPTION, seqid));
          x.write(oprot);
          oprot.writeMessageEnd();
          oprot.getTransport().flush();
          return;
        }
        oprot.writeMessageBegin(new TMessage("getResults", TMessageType.REPLY, seqid));
        result.write(oprot);
        oprot.writeMessageEnd();
        oprot.getTransport().flush();
      }
    }
  }

  public static class Service extends com.twitter.finagle.Service {
    private final ServiceIface iface;
    private final TProtocolFactory protocolFactory;
    protected HashMap>> functionMap = new HashMap>>();
    public Service(final ServiceIface iface, final TProtocolFactory protocolFactory) {
      this.iface = iface;
      this.protocolFactory = protocolFactory;
      functionMap.put("getServiceEndpoints", new Function2>() {
        public Future apply(final TProtocol iprot, final Integer seqid) {
          getServiceEndpoints_args args = new getServiceEndpoints_args();
          try {
            args.read(iprot);
          } catch (TProtocolException e) {
            try {
              iprot.readMessageEnd();
              TApplicationException x = new TApplicationException(TApplicationException.PROTOCOL_ERROR, e.getMessage());
              TMemoryBuffer memoryBuffer = new TMemoryBuffer(512);
              TProtocol oprot = protocolFactory.getProtocol(memoryBuffer);

              oprot.writeMessageBegin(new TMessage("getServiceEndpoints", TMessageType.EXCEPTION, seqid));
              x.write(oprot);
              oprot.writeMessageEnd();
              oprot.getTransport().flush();
              byte[] buffer = Arrays.copyOfRange(memoryBuffer.getArray(), 0, memoryBuffer.length());
              return Future.value(buffer);
            } catch (Exception e1) {
              return Future.exception(e1);
            }
          } catch (Exception e) {
            return Future.exception(e);
          }

          try {
            iprot.readMessageEnd();
          } catch (Exception e) {
            return Future.exception(e);
          }
          Future> future;
          try {
            future = iface.getServiceEndpoints();
          } catch (Exception e) {
            future = Future.exception(e);
          }

          try {
            return future.flatMap(new Function, Future>() {
              public Future apply(List value) {
                getServiceEndpoints_result result = new getServiceEndpoints_result();
                result.success = value;
                result.setSuccessIsSet(true);

                try {
                  TMemoryBuffer memoryBuffer = new TMemoryBuffer(512);
                  TProtocol oprot = protocolFactory.getProtocol(memoryBuffer);

                  oprot.writeMessageBegin(new TMessage("getServiceEndpoints", TMessageType.REPLY, seqid));
                  result.write(oprot);
                  oprot.writeMessageEnd();

                  return Future.value(Arrays.copyOfRange(memoryBuffer.getArray(), 0, memoryBuffer.length()));
                } catch (Exception e) {
                  return Future.exception(e);
                }
              }
            }).rescue(new Function>() {
              public Future apply(Throwable t) {
                return Future.exception(t);
              }
            });
          } catch (Exception e) {
            return Future.exception(e);
          }
        }
      });
      functionMap.put("addServiceEndpoint", new Function2>() {
        public Future apply(final TProtocol iprot, final Integer seqid) {
          addServiceEndpoint_args args = new addServiceEndpoint_args();
          try {
            args.read(iprot);
          } catch (TProtocolException e) {
            try {
              iprot.readMessageEnd();
              TApplicationException x = new TApplicationException(TApplicationException.PROTOCOL_ERROR, e.getMessage());
              TMemoryBuffer memoryBuffer = new TMemoryBuffer(512);
              TProtocol oprot = protocolFactory.getProtocol(memoryBuffer);

              oprot.writeMessageBegin(new TMessage("addServiceEndpoint", TMessageType.EXCEPTION, seqid));
              x.write(oprot);
              oprot.writeMessageEnd();
              oprot.getTransport().flush();
              byte[] buffer = Arrays.copyOfRange(memoryBuffer.getArray(), 0, memoryBuffer.length());
              return Future.value(buffer);
            } catch (Exception e1) {
              return Future.exception(e1);
            }
          } catch (Exception e) {
            return Future.exception(e);
          }

          try {
            iprot.readMessageEnd();
          } catch (Exception e) {
            return Future.exception(e);
          }
          Future future;
          try {
            future = iface.addServiceEndpoint(args.endpoint);
          } catch (Exception e) {
            future = Future.exception(e);
          }

          try {
            return future.flatMap(new Function>() {
              public Future apply(ScrayTServiceEndpoint value) {
                addServiceEndpoint_result result = new addServiceEndpoint_result();
                result.success = value;
                result.setSuccessIsSet(true);

                try {
                  TMemoryBuffer memoryBuffer = new TMemoryBuffer(512);
                  TProtocol oprot = protocolFactory.getProtocol(memoryBuffer);

                  oprot.writeMessageBegin(new TMessage("addServiceEndpoint", TMessageType.REPLY, seqid));
                  result.write(oprot);
                  oprot.writeMessageEnd();

                  return Future.value(Arrays.copyOfRange(memoryBuffer.getArray(), 0, memoryBuffer.length()));
                } catch (Exception e) {
                  return Future.exception(e);
                }
              }
            }).rescue(new Function>() {
              public Future apply(Throwable t) {
                return Future.exception(t);
              }
            });
          } catch (Exception e) {
            return Future.exception(e);
          }
        }
      });
      functionMap.put("refreshServiceEndpoint", new Function2>() {
        public Future apply(final TProtocol iprot, final Integer seqid) {
          refreshServiceEndpoint_args args = new refreshServiceEndpoint_args();
          try {
            args.read(iprot);
          } catch (TProtocolException e) {
            try {
              iprot.readMessageEnd();
              TApplicationException x = new TApplicationException(TApplicationException.PROTOCOL_ERROR, e.getMessage());
              TMemoryBuffer memoryBuffer = new TMemoryBuffer(512);
              TProtocol oprot = protocolFactory.getProtocol(memoryBuffer);

              oprot.writeMessageBegin(new TMessage("refreshServiceEndpoint", TMessageType.EXCEPTION, seqid));
              x.write(oprot);
              oprot.writeMessageEnd();
              oprot.getTransport().flush();
              byte[] buffer = Arrays.copyOfRange(memoryBuffer.getArray(), 0, memoryBuffer.length());
              return Future.value(buffer);
            } catch (Exception e1) {
              return Future.exception(e1);
            }
          } catch (Exception e) {
            return Future.exception(e);
          }

          try {
            iprot.readMessageEnd();
          } catch (Exception e) {
            return Future.exception(e);
          }
          Future future;
          try {
            future = iface.refreshServiceEndpoint(args.endpointID);
          } catch (Exception e) {
            future = Future.exception(e);
          }

          try {
            return future.flatMap(new Function>() {
              public Future apply(Void value) {
                refreshServiceEndpoint_result result = new refreshServiceEndpoint_result();

                try {
                  TMemoryBuffer memoryBuffer = new TMemoryBuffer(512);
                  TProtocol oprot = protocolFactory.getProtocol(memoryBuffer);

                  oprot.writeMessageBegin(new TMessage("refreshServiceEndpoint", TMessageType.REPLY, seqid));
                  result.write(oprot);
                  oprot.writeMessageEnd();

                  return Future.value(Arrays.copyOfRange(memoryBuffer.getArray(), 0, memoryBuffer.length()));
                } catch (Exception e) {
                  return Future.exception(e);
                }
              }
            }).rescue(new Function>() {
              public Future apply(Throwable t) {
                return Future.exception(t);
              }
            });
          } catch (Exception e) {
            return Future.exception(e);
          }
        }
      });
      functionMap.put("ping", new Function2>() {
        public Future apply(final TProtocol iprot, final Integer seqid) {
          ping_args args = new ping_args();
          try {
            args.read(iprot);
          } catch (TProtocolException e) {
            try {
              iprot.readMessageEnd();
              TApplicationException x = new TApplicationException(TApplicationException.PROTOCOL_ERROR, e.getMessage());
              TMemoryBuffer memoryBuffer = new TMemoryBuffer(512);
              TProtocol oprot = protocolFactory.getProtocol(memoryBuffer);

              oprot.writeMessageBegin(new TMessage("ping", TMessageType.EXCEPTION, seqid));
              x.write(oprot);
              oprot.writeMessageEnd();
              oprot.getTransport().flush();
              byte[] buffer = Arrays.copyOfRange(memoryBuffer.getArray(), 0, memoryBuffer.length());
              return Future.value(buffer);
            } catch (Exception e1) {
              return Future.exception(e1);
            }
          } catch (Exception e) {
            return Future.exception(e);
          }

          try {
            iprot.readMessageEnd();
          } catch (Exception e) {
            return Future.exception(e);
          }
          Future future;
          try {
            future = iface.ping();
          } catch (Exception e) {
            future = Future.exception(e);
          }

          try {
            return future.flatMap(new Function>() {
              public Future apply(Boolean value) {
                ping_result result = new ping_result();
                result.success = value;
                result.setSuccessIsSet(true);

                try {
                  TMemoryBuffer memoryBuffer = new TMemoryBuffer(512);
                  TProtocol oprot = protocolFactory.getProtocol(memoryBuffer);

                  oprot.writeMessageBegin(new TMessage("ping", TMessageType.REPLY, seqid));
                  result.write(oprot);
                  oprot.writeMessageEnd();

                  return Future.value(Arrays.copyOfRange(memoryBuffer.getArray(), 0, memoryBuffer.length()));
                } catch (Exception e) {
                  return Future.exception(e);
                }
              }
            }).rescue(new Function>() {
              public Future apply(Throwable t) {
                return Future.exception(t);
              }
            });
          } catch (Exception e) {
            return Future.exception(e);
          }
        }
      });
      functionMap.put("shutdown", new Function2>() {
        public Future apply(final TProtocol iprot, final Integer seqid) {
          shutdown_args args = new shutdown_args();
          try {
            args.read(iprot);
          } catch (TProtocolException e) {
            try {
              iprot.readMessageEnd();
              TApplicationException x = new TApplicationException(TApplicationException.PROTOCOL_ERROR, e.getMessage());
              TMemoryBuffer memoryBuffer = new TMemoryBuffer(512);
              TProtocol oprot = protocolFactory.getProtocol(memoryBuffer);

              oprot.writeMessageBegin(new TMessage("shutdown", TMessageType.EXCEPTION, seqid));
              x.write(oprot);
              oprot.writeMessageEnd();
              oprot.getTransport().flush();
              byte[] buffer = Arrays.copyOfRange(memoryBuffer.getArray(), 0, memoryBuffer.length());
              return Future.value(buffer);
            } catch (Exception e1) {
              return Future.exception(e1);
            }
          } catch (Exception e) {
            return Future.exception(e);
          }

          try {
            iprot.readMessageEnd();
          } catch (Exception e) {
            return Future.exception(e);
          }
          Future future;
          try {
            future = iface.shutdown(args.waitNanos);
          } catch (Exception e) {
            future = Future.exception(e);
          }

          try {
            return future.flatMap(new Function>() {
              public Future apply(Void value) {
                shutdown_result result = new shutdown_result();

                try {
                  TMemoryBuffer memoryBuffer = new TMemoryBuffer(512);
                  TProtocol oprot = protocolFactory.getProtocol(memoryBuffer);

                  oprot.writeMessageBegin(new TMessage("shutdown", TMessageType.REPLY, seqid));
                  result.write(oprot);
                  oprot.writeMessageEnd();

                  return Future.value(Arrays.copyOfRange(memoryBuffer.getArray(), 0, memoryBuffer.length()));
                } catch (Exception e) {
                  return Future.exception(e);
                }
              }
            }).rescue(new Function>() {
              public Future apply(Throwable t) {
                return Future.exception(t);
              }
            });
          } catch (Exception e) {
            return Future.exception(e);
          }
        }
      });
      functionMap.put("query", new Function2>() {
        public Future apply(final TProtocol iprot, final Integer seqid) {
          query_args args = new query_args();
          try {
            args.read(iprot);
          } catch (TProtocolException e) {
            try {
              iprot.readMessageEnd();
              TApplicationException x = new TApplicationException(TApplicationException.PROTOCOL_ERROR, e.getMessage());
              TMemoryBuffer memoryBuffer = new TMemoryBuffer(512);
              TProtocol oprot = protocolFactory.getProtocol(memoryBuffer);

              oprot.writeMessageBegin(new TMessage("query", TMessageType.EXCEPTION, seqid));
              x.write(oprot);
              oprot.writeMessageEnd();
              oprot.getTransport().flush();
              byte[] buffer = Arrays.copyOfRange(memoryBuffer.getArray(), 0, memoryBuffer.length());
              return Future.value(buffer);
            } catch (Exception e1) {
              return Future.exception(e1);
            }
          } catch (Exception e) {
            return Future.exception(e);
          }

          try {
            iprot.readMessageEnd();
          } catch (Exception e) {
            return Future.exception(e);
          }
          Future future;
          try {
            future = iface.query(args.query);
          } catch (Exception e) {
            future = Future.exception(e);
          }

          try {
            return future.flatMap(new Function>() {
              public Future apply(scray.service.qmodel.thriftjava.ScrayUUID value) {
                query_result result = new query_result();
                result.success = value;
                result.setSuccessIsSet(true);

                try {
                  TMemoryBuffer memoryBuffer = new TMemoryBuffer(512);
                  TProtocol oprot = protocolFactory.getProtocol(memoryBuffer);

                  oprot.writeMessageBegin(new TMessage("query", TMessageType.REPLY, seqid));
                  result.write(oprot);
                  oprot.writeMessageEnd();

                  return Future.value(Arrays.copyOfRange(memoryBuffer.getArray(), 0, memoryBuffer.length()));
                } catch (Exception e) {
                  return Future.exception(e);
                }
              }
            }).rescue(new Function>() {
              public Future apply(Throwable t) {
                try {
                  query_result result = new query_result();
                  if (t instanceof ScrayTException) {
                    result.ex = (ScrayTException)t;
                  }
                  else {
                    return Future.exception(t);
                  }
                  TMemoryBuffer memoryBuffer = new TMemoryBuffer(512);
                  TProtocol oprot = protocolFactory.getProtocol(memoryBuffer);
                  oprot.writeMessageBegin(new TMessage("query", TMessageType.REPLY, seqid));
                  result.write(oprot);
                  oprot.writeMessageEnd();
                  oprot.getTransport().flush();
                  return Future.value(Arrays.copyOfRange(memoryBuffer.getArray(), 0, memoryBuffer.length()));
                } catch (Exception e) {
                  return Future.exception(e);
                }
              }
            });
          } catch (Exception e) {
            return Future.exception(e);
          }
        }
      });
      functionMap.put("getResults", new Function2>() {
        public Future apply(final TProtocol iprot, final Integer seqid) {
          getResults_args args = new getResults_args();
          try {
            args.read(iprot);
          } catch (TProtocolException e) {
            try {
              iprot.readMessageEnd();
              TApplicationException x = new TApplicationException(TApplicationException.PROTOCOL_ERROR, e.getMessage());
              TMemoryBuffer memoryBuffer = new TMemoryBuffer(512);
              TProtocol oprot = protocolFactory.getProtocol(memoryBuffer);

              oprot.writeMessageBegin(new TMessage("getResults", TMessageType.EXCEPTION, seqid));
              x.write(oprot);
              oprot.writeMessageEnd();
              oprot.getTransport().flush();
              byte[] buffer = Arrays.copyOfRange(memoryBuffer.getArray(), 0, memoryBuffer.length());
              return Future.value(buffer);
            } catch (Exception e1) {
              return Future.exception(e1);
            }
          } catch (Exception e) {
            return Future.exception(e);
          }

          try {
            iprot.readMessageEnd();
          } catch (Exception e) {
            return Future.exception(e);
          }
          Future future;
          try {
            future = iface.getResults(args.queryId);
          } catch (Exception e) {
            future = Future.exception(e);
          }

          try {
            return future.flatMap(new Function>() {
              public Future apply(ScrayTResultFrame value) {
                getResults_result result = new getResults_result();
                result.success = value;
                result.setSuccessIsSet(true);

                try {
                  TMemoryBuffer memoryBuffer = new TMemoryBuffer(512);
                  TProtocol oprot = protocolFactory.getProtocol(memoryBuffer);

                  oprot.writeMessageBegin(new TMessage("getResults", TMessageType.REPLY, seqid));
                  result.write(oprot);
                  oprot.writeMessageEnd();

                  return Future.value(Arrays.copyOfRange(memoryBuffer.getArray(), 0, memoryBuffer.length()));
                } catch (Exception e) {
                  return Future.exception(e);
                }
              }
            }).rescue(new Function>() {
              public Future apply(Throwable t) {
                try {
                  getResults_result result = new getResults_result();
                  if (t instanceof ScrayTException) {
                    result.ex = (ScrayTException)t;
                  }
                  else {
                    return Future.exception(t);
                  }
                  TMemoryBuffer memoryBuffer = new TMemoryBuffer(512);
                  TProtocol oprot = protocolFactory.getProtocol(memoryBuffer);
                  oprot.writeMessageBegin(new TMessage("getResults", TMessageType.REPLY, seqid));
                  result.write(oprot);
                  oprot.writeMessageEnd();
                  oprot.getTransport().flush();
                  return Future.value(Arrays.copyOfRange(memoryBuffer.getArray(), 0, memoryBuffer.length()));
                } catch (Exception e) {
                  return Future.exception(e);
                }
              }
            });
          } catch (Exception e) {
            return Future.exception(e);
          }
        }
      });
    }

    public Future apply(byte[] request) {
      TTransport inputTransport = new TMemoryInputTransport(request);
      TProtocol iprot = protocolFactory.getProtocol(inputTransport);

      TMessage msg;
      try {
        msg = iprot.readMessageBegin();
      } catch (Exception e) {
        return Future.exception(e);
      }

      Function2> fn = functionMap.get(msg.name);
      if (fn == null) {
        try {
          TProtocolUtil.skip(iprot, TType.STRUCT);
          iprot.readMessageEnd();
          TApplicationException x = new TApplicationException(TApplicationException.UNKNOWN_METHOD, "Invalid method name: '"+msg.name+"'");
          TMemoryBuffer memoryBuffer = new TMemoryBuffer(512);
          TProtocol oprot = protocolFactory.getProtocol(memoryBuffer);
          oprot.writeMessageBegin(new TMessage(msg.name, TMessageType.EXCEPTION, msg.seqid));
          x.write(oprot);
          oprot.writeMessageEnd();
          oprot.getTransport().flush();
          return Future.value(Arrays.copyOfRange(memoryBuffer.getArray(), 0, memoryBuffer.length()));
        } catch (Exception e) {
          return Future.exception(e);
        }
      }

      return fn.apply(iprot, msg.seqid);
    }
  }

  public static class getServiceEndpoints_args implements TBase, java.io.Serializable, Cloneable {
  private static final TStruct STRUCT_DESC = new TStruct("getServiceEndpoints_args");

  



  /** 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 byName = new HashMap();
  
    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(getServiceEndpoints_args.class, metaDataMap);
  }


  public getServiceEndpoints_args() {
  }


  /**
   * Performs a deep copy on other.
   */
  public getServiceEndpoints_args(getServiceEndpoints_args other) {
  }

  public getServiceEndpoints_args deepCopy() {
    return new getServiceEndpoints_args(this);
  }

  @java.lang.Override
  public void clear() {
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    }
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    }
    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) {
    }
    throw new IllegalStateException();
  }

  @java.lang.Override
  public boolean equals(Object that) {
    if (that == null)
      return false;
    if (that instanceof getServiceEndpoints_args)
      return this.equals((getServiceEndpoints_args)that);
    return false;
  }

  public boolean equals(getServiceEndpoints_args that) {
    if (that == null)
      return false;

    return true;
  }

  @java.lang.Override
  public int hashCode() {
    HashCodeBuilder builder = new HashCodeBuilder();
    return builder.toHashCode();
  }

  public int compareTo(getServiceEndpoints_args other) {
    if (!getClass().equals(other.getClass())) {
      return getClass().getName().compareTo(other.getClass().getName());
    }

    int lastComparison = 0;
    getServiceEndpoints_args typedOther = (getServiceEndpoints_args)other;

    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) {
        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);
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }

  @java.lang.Override
  public String toString() {
    StringBuilder sb = new StringBuilder("getServiceEndpoints_args(");
    boolean first = true;
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws TException {
    // check for required fields
  }
}


  public static class getServiceEndpoints_result implements TBase, java.io.Serializable, Cloneable {
  private static final TStruct STRUCT_DESC = new TStruct("getServiceEndpoints_result");

  private static final TField SUCCESS_FIELD_DESC = new TField("success", TType.LIST, (short)0);


  public List 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 byName = new HashMap();
  
    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 ListMetaData(TType.LIST,
                new StructMetaData(TType.STRUCT, ScrayTServiceEndpoint.class))));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    FieldMetaData.addStructMetaDataMap(getServiceEndpoints_result.class, metaDataMap);
  }


  public getServiceEndpoints_result() {
  }

  public getServiceEndpoints_result(
    List success)
  {
    this();
    this.success = success;
  }

  /**
   * Performs a deep copy on other.
   */
  public getServiceEndpoints_result(getServiceEndpoints_result other) {
    if (other.isSetSuccess()) {
      List __this__success = new ArrayList();
      for (ScrayTServiceEndpoint other_element : other.success) {
        __this__success.add(new ScrayTServiceEndpoint(other_element));
      }
      this.success = __this__success;
    }
  }

  public getServiceEndpoints_result deepCopy() {
    return new getServiceEndpoints_result(this);
  }

  @java.lang.Override
  public void clear() {
    this.success = null;
  }

  public int getSuccessSize() {
    return (this.success == null) ? 0 : this.success.size();
  }

  public java.util.Iterator getSuccessIterator() {
    return (this.success == null) ? null : this.success.iterator();
  }

  public void addToSuccess(ScrayTServiceEndpoint elem) {
    if (this.success == null) {
      this.success = new ArrayList();
    }
    this.success.add(elem);
  }

  public List getSuccess() {
    return this.success;
  }

  public getServiceEndpoints_result setSuccess(List success) {
    this.success = success;
    
    return this;
  }

  public void unsetSuccess() {
    this.success = null;
  }

  /** Returns true if field success is set (has been asigned a value) and false otherwise */
  public boolean isSetSuccess() {
    return this.success != null;
  }

  public void setSuccessIsSet(boolean value) {
    if (!value) {
      this.success = null;
    }
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case SUCCESS:
      if (value == null) {
        unsetSuccess();
      } else {
        setSuccess((List)value);
      }
      break;
    }
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case SUCCESS:
      return getSuccess();
    }
    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 isSetSuccess();
    }
    throw new IllegalStateException();
  }

  @java.lang.Override
  public boolean equals(Object that) {
    if (that == null)
      return false;
    if (that instanceof getServiceEndpoints_result)
      return this.equals((getServiceEndpoints_result)that);
    return false;
  }

  public boolean equals(getServiceEndpoints_result that) {
    if (that == null)
      return false;
    boolean this_present_success = true && this.isSetSuccess();
    boolean that_present_success = true && that.isSetSuccess();
    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;
  }

  @java.lang.Override
  public int hashCode() {
    HashCodeBuilder builder = new HashCodeBuilder();
    boolean present_success = true && (isSetSuccess());
    builder.append(present_success);
    if (present_success)
      builder.append(success);
    return builder.toHashCode();
  }

  public int compareTo(getServiceEndpoints_result other) {
    if (!getClass().equals(other.getClass())) {
      return getClass().getName().compareTo(other.getClass().getName());
    }

    int lastComparison = 0;
    getServiceEndpoints_result typedOther = (getServiceEndpoints_result)other;

    lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetSuccess()) {
      lastComparison = TBaseHelper.compareTo(this.success, typedOther.success);
      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.LIST) {
            {
            TList _list8 = iprot.readListBegin();
            this.success = new ArrayList(_list8.size);
            for (int _i9 = 0; _i9 < _list8.size; ++_i9)
            {
              ScrayTServiceEndpoint _elem10;
              _elem10 = new ScrayTServiceEndpoint();
              _elem10.read(iprot);
              this.success.add(_elem10);
            }
            iprot.readListEnd();
            }
          } 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.isSetSuccess()) {
      oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
      {
      oprot.writeListBegin(new TList(TType.STRUCT, this.success.size()));
      for (ScrayTServiceEndpoint _iter11 : this.success)
      {
        _iter11.write(oprot);
      }
      oprot.writeListEnd();
    }
      oprot.writeFieldEnd();
    }
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }

  @java.lang.Override
  public String toString() {
    StringBuilder sb = new StringBuilder("getServiceEndpoints_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 addServiceEndpoint_args implements TBase, java.io.Serializable, Cloneable {
  private static final TStruct STRUCT_DESC = new TStruct("addServiceEndpoint_args");

  private static final TField ENDPOINT_FIELD_DESC = new TField("endpoint", TType.STRUCT, (short)-1);


  public ScrayTServiceEndpoint endpoint;

  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  public enum _Fields implements TFieldIdEnum {
    ENDPOINT((short)-1, "endpoint");
  
    private static final Map byName = new HashMap();
  
    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: // ENDPOINT
          return ENDPOINT;
        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.ENDPOINT, new FieldMetaData("endpoint", TFieldRequirementType.DEFAULT,
      new StructMetaData(TType.STRUCT, ScrayTServiceEndpoint.class)));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    FieldMetaData.addStructMetaDataMap(addServiceEndpoint_args.class, metaDataMap);
  }


  public addServiceEndpoint_args() {
  }

  public addServiceEndpoint_args(
    ScrayTServiceEndpoint endpoint)
  {
    this();
    this.endpoint = endpoint;
  }

  /**
   * Performs a deep copy on other.
   */
  public addServiceEndpoint_args(addServiceEndpoint_args other) {
    if (other.isSetEndpoint()) {
      this.endpoint = new ScrayTServiceEndpoint(other.endpoint);
    }
  }

  public addServiceEndpoint_args deepCopy() {
    return new addServiceEndpoint_args(this);
  }

  @java.lang.Override
  public void clear() {
    this.endpoint = null;
  }

  public ScrayTServiceEndpoint getEndpoint() {
    return this.endpoint;
  }

  public addServiceEndpoint_args setEndpoint(ScrayTServiceEndpoint endpoint) {
    this.endpoint = endpoint;
    
    return this;
  }

  public void unsetEndpoint() {
    this.endpoint = null;
  }

  /** Returns true if field endpoint is set (has been asigned a value) and false otherwise */
  public boolean isSetEndpoint() {
    return this.endpoint != null;
  }

  public void setEndpointIsSet(boolean value) {
    if (!value) {
      this.endpoint = null;
    }
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case ENDPOINT:
      if (value == null) {
        unsetEndpoint();
      } else {
        setEndpoint((ScrayTServiceEndpoint)value);
      }
      break;
    }
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case ENDPOINT:
      return getEndpoint();
    }
    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 ENDPOINT:
      return isSetEndpoint();
    }
    throw new IllegalStateException();
  }

  @java.lang.Override
  public boolean equals(Object that) {
    if (that == null)
      return false;
    if (that instanceof addServiceEndpoint_args)
      return this.equals((addServiceEndpoint_args)that);
    return false;
  }

  public boolean equals(addServiceEndpoint_args that) {
    if (that == null)
      return false;
    boolean this_present_endpoint = true && this.isSetEndpoint();
    boolean that_present_endpoint = true && that.isSetEndpoint();
    if (this_present_endpoint || that_present_endpoint) {
      if (!(this_present_endpoint && that_present_endpoint))
        return false;
      if (!this.endpoint.equals(that.endpoint))
        return false;
    }

    return true;
  }

  @java.lang.Override
  public int hashCode() {
    HashCodeBuilder builder = new HashCodeBuilder();
    boolean present_endpoint = true && (isSetEndpoint());
    builder.append(present_endpoint);
    if (present_endpoint)
      builder.append(endpoint);
    return builder.toHashCode();
  }

  public int compareTo(addServiceEndpoint_args other) {
    if (!getClass().equals(other.getClass())) {
      return getClass().getName().compareTo(other.getClass().getName());
    }

    int lastComparison = 0;
    addServiceEndpoint_args typedOther = (addServiceEndpoint_args)other;

    lastComparison = Boolean.valueOf(isSetEndpoint()).compareTo(typedOther.isSetEndpoint());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetEndpoint()) {
      lastComparison = TBaseHelper.compareTo(this.endpoint, typedOther.endpoint);
      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: // ENDPOINT
          if (field.type == TType.STRUCT) {
            this.endpoint = new ScrayTServiceEndpoint();
            this.endpoint.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 {
    validate();
    
    oprot.writeStructBegin(STRUCT_DESC);
    if (this.endpoint != null) {
      oprot.writeFieldBegin(ENDPOINT_FIELD_DESC);
      this.endpoint.write(oprot);
      oprot.writeFieldEnd();
    }
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }

  @java.lang.Override
  public String toString() {
    StringBuilder sb = new StringBuilder("addServiceEndpoint_args(");
    boolean first = true;
    sb.append("endpoint:");
    if (this.endpoint == null) {
      sb.append("null");
    } else {
      sb.append(this.endpoint);
    }
    first = false;
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws TException {
    // check for required fields
  }
}


  public static class addServiceEndpoint_result implements TBase, java.io.Serializable, Cloneable {
  private static final TStruct STRUCT_DESC = new TStruct("addServiceEndpoint_result");

  private static final TField SUCCESS_FIELD_DESC = new TField("success", TType.STRUCT, (short)0);


  public ScrayTServiceEndpoint 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 byName = new HashMap();
  
    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 StructMetaData(TType.STRUCT, ScrayTServiceEndpoint.class)));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    FieldMetaData.addStructMetaDataMap(addServiceEndpoint_result.class, metaDataMap);
  }


  public addServiceEndpoint_result() {
  }

  public addServiceEndpoint_result(
    ScrayTServiceEndpoint success)
  {
    this();
    this.success = success;
  }

  /**
   * Performs a deep copy on other.
   */
  public addServiceEndpoint_result(addServiceEndpoint_result other) {
    if (other.isSetSuccess()) {
      this.success = new ScrayTServiceEndpoint(other.success);
    }
  }

  public addServiceEndpoint_result deepCopy() {
    return new addServiceEndpoint_result(this);
  }

  @java.lang.Override
  public void clear() {
    this.success = null;
  }

  public ScrayTServiceEndpoint getSuccess() {
    return this.success;
  }

  public addServiceEndpoint_result setSuccess(ScrayTServiceEndpoint success) {
    this.success = success;
    
    return this;
  }

  public void unsetSuccess() {
    this.success = null;
  }

  /** Returns true if field success is set (has been asigned a value) and false otherwise */
  public boolean isSetSuccess() {
    return this.success != null;
  }

  public void setSuccessIsSet(boolean value) {
    if (!value) {
      this.success = null;
    }
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case SUCCESS:
      if (value == null) {
        unsetSuccess();
      } else {
        setSuccess((ScrayTServiceEndpoint)value);
      }
      break;
    }
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case SUCCESS:
      return getSuccess();
    }
    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 isSetSuccess();
    }
    throw new IllegalStateException();
  }

  @java.lang.Override
  public boolean equals(Object that) {
    if (that == null)
      return false;
    if (that instanceof addServiceEndpoint_result)
      return this.equals((addServiceEndpoint_result)that);
    return false;
  }

  public boolean equals(addServiceEndpoint_result that) {
    if (that == null)
      return false;
    boolean this_present_success = true && this.isSetSuccess();
    boolean that_present_success = true && that.isSetSuccess();
    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;
  }

  @java.lang.Override
  public int hashCode() {
    HashCodeBuilder builder = new HashCodeBuilder();
    boolean present_success = true && (isSetSuccess());
    builder.append(present_success);
    if (present_success)
      builder.append(success);
    return builder.toHashCode();
  }

  public int compareTo(addServiceEndpoint_result other) {
    if (!getClass().equals(other.getClass())) {
      return getClass().getName().compareTo(other.getClass().getName());
    }

    int lastComparison = 0;
    addServiceEndpoint_result typedOther = (addServiceEndpoint_result)other;

    lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetSuccess()) {
      lastComparison = TBaseHelper.compareTo(this.success, typedOther.success);
      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.STRUCT) {
            this.success = new ScrayTServiceEndpoint();
            this.success.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.isSetSuccess()) {
      oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
      this.success.write(oprot);
      oprot.writeFieldEnd();
    }
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }

  @java.lang.Override
  public String toString() {
    StringBuilder sb = new StringBuilder("addServiceEndpoint_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 refreshServiceEndpoint_args implements TBase, java.io.Serializable, Cloneable {
  private static final TStruct STRUCT_DESC = new TStruct("refreshServiceEndpoint_args");

  private static final TField ENDPOINT_ID_FIELD_DESC = new TField("endpointID", TType.STRUCT, (short)-1);


  public scray.service.qmodel.thriftjava.ScrayUUID endpointID;

  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  public enum _Fields implements TFieldIdEnum {
    ENDPOINT_ID((short)-1, "endpointID");
  
    private static final Map byName = new HashMap();
  
    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: // ENDPOINT_ID
          return ENDPOINT_ID;
        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.ENDPOINT_ID, new FieldMetaData("endpointID", TFieldRequirementType.DEFAULT,
      new StructMetaData(TType.STRUCT, scray.service.qmodel.thriftjava.ScrayUUID.class)));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    FieldMetaData.addStructMetaDataMap(refreshServiceEndpoint_args.class, metaDataMap);
  }


  public refreshServiceEndpoint_args() {
  }

  public refreshServiceEndpoint_args(
    scray.service.qmodel.thriftjava.ScrayUUID endpointID)
  {
    this();
    this.endpointID = endpointID;
  }

  /**
   * Performs a deep copy on other.
   */
  public refreshServiceEndpoint_args(refreshServiceEndpoint_args other) {
    if (other.isSetEndpointID()) {
      this.endpointID = new scray.service.qmodel.thriftjava.ScrayUUID(other.endpointID);
    }
  }

  public refreshServiceEndpoint_args deepCopy() {
    return new refreshServiceEndpoint_args(this);
  }

  @java.lang.Override
  public void clear() {
    this.endpointID = null;
  }

  public scray.service.qmodel.thriftjava.ScrayUUID getEndpointID() {
    return this.endpointID;
  }

  public refreshServiceEndpoint_args setEndpointID(scray.service.qmodel.thriftjava.ScrayUUID endpointID) {
    this.endpointID = endpointID;
    
    return this;
  }

  public void unsetEndpointID() {
    this.endpointID = null;
  }

  /** Returns true if field endpointID is set (has been asigned a value) and false otherwise */
  public boolean isSetEndpointID() {
    return this.endpointID != null;
  }

  public void setEndpointIDIsSet(boolean value) {
    if (!value) {
      this.endpointID = null;
    }
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case ENDPOINT_ID:
      if (value == null) {
        unsetEndpointID();
      } else {
        setEndpointID((scray.service.qmodel.thriftjava.ScrayUUID)value);
      }
      break;
    }
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case ENDPOINT_ID:
      return getEndpointID();
    }
    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 ENDPOINT_ID:
      return isSetEndpointID();
    }
    throw new IllegalStateException();
  }

  @java.lang.Override
  public boolean equals(Object that) {
    if (that == null)
      return false;
    if (that instanceof refreshServiceEndpoint_args)
      return this.equals((refreshServiceEndpoint_args)that);
    return false;
  }

  public boolean equals(refreshServiceEndpoint_args that) {
    if (that == null)
      return false;
    boolean this_present_endpointID = true && this.isSetEndpointID();
    boolean that_present_endpointID = true && that.isSetEndpointID();
    if (this_present_endpointID || that_present_endpointID) {
      if (!(this_present_endpointID && that_present_endpointID))
        return false;
      if (!this.endpointID.equals(that.endpointID))
        return false;
    }

    return true;
  }

  @java.lang.Override
  public int hashCode() {
    HashCodeBuilder builder = new HashCodeBuilder();
    boolean present_endpointID = true && (isSetEndpointID());
    builder.append(present_endpointID);
    if (present_endpointID)
      builder.append(endpointID);
    return builder.toHashCode();
  }

  public int compareTo(refreshServiceEndpoint_args other) {
    if (!getClass().equals(other.getClass())) {
      return getClass().getName().compareTo(other.getClass().getName());
    }

    int lastComparison = 0;
    refreshServiceEndpoint_args typedOther = (refreshServiceEndpoint_args)other;

    lastComparison = Boolean.valueOf(isSetEndpointID()).compareTo(typedOther.isSetEndpointID());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetEndpointID()) {
      lastComparison = TBaseHelper.compareTo(this.endpointID, typedOther.endpointID);
      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: // ENDPOINT_ID
          if (field.type == TType.STRUCT) {
            this.endpointID = new scray.service.qmodel.thriftjava.ScrayUUID();
            this.endpointID.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 {
    validate();
    
    oprot.writeStructBegin(STRUCT_DESC);
    if (this.endpointID != null) {
      oprot.writeFieldBegin(ENDPOINT_ID_FIELD_DESC);
      this.endpointID.write(oprot);
      oprot.writeFieldEnd();
    }
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }

  @java.lang.Override
  public String toString() {
    StringBuilder sb = new StringBuilder("refreshServiceEndpoint_args(");
    boolean first = true;
    sb.append("endpointID:");
    if (this.endpointID == null) {
      sb.append("null");
    } else {
      sb.append(this.endpointID);
    }
    first = false;
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws TException {
    // check for required fields
  }
}


  public static class refreshServiceEndpoint_result implements TBase, java.io.Serializable, Cloneable {
  private static final TStruct STRUCT_DESC = new TStruct("refreshServiceEndpoint_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 byName = new HashMap();
  
    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(refreshServiceEndpoint_result.class, metaDataMap);
  }


  public refreshServiceEndpoint_result() {
  }


  /**
   * Performs a deep copy on other.
   */
  public refreshServiceEndpoint_result(refreshServiceEndpoint_result other) {
  }

  public refreshServiceEndpoint_result deepCopy() {
    return new refreshServiceEndpoint_result(this);
  }

  @java.lang.Override
  public void clear() {
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    }
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    }
    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) {
    }
    throw new IllegalStateException();
  }

  @java.lang.Override
  public boolean equals(Object that) {
    if (that == null)
      return false;
    if (that instanceof refreshServiceEndpoint_result)
      return this.equals((refreshServiceEndpoint_result)that);
    return false;
  }

  public boolean equals(refreshServiceEndpoint_result that) {
    if (that == null)
      return false;

    return true;
  }

  @java.lang.Override
  public int hashCode() {
    HashCodeBuilder builder = new HashCodeBuilder();
    return builder.toHashCode();
  }

  public int compareTo(refreshServiceEndpoint_result other) {
    if (!getClass().equals(other.getClass())) {
      return getClass().getName().compareTo(other.getClass().getName());
    }

    int lastComparison = 0;
    refreshServiceEndpoint_result typedOther = (refreshServiceEndpoint_result)other;

    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) {
        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);
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }

  @java.lang.Override
  public String toString() {
    StringBuilder sb = new StringBuilder("refreshServiceEndpoint_result(");
    boolean first = true;
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws TException {
    // check for required fields
  }
}



  public static class ping_args implements TBase, java.io.Serializable, Cloneable {
  private static final TStruct STRUCT_DESC = new TStruct("ping_args");

  



  /** 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 byName = new HashMap();
  
    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(ping_args.class, metaDataMap);
  }


  public ping_args() {
  }


  /**
   * Performs a deep copy on other.
   */
  public ping_args(ping_args other) {
  }

  public ping_args deepCopy() {
    return new ping_args(this);
  }

  @java.lang.Override
  public void clear() {
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    }
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    }
    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) {
    }
    throw new IllegalStateException();
  }

  @java.lang.Override
  public boolean equals(Object that) {
    if (that == null)
      return false;
    if (that instanceof ping_args)
      return this.equals((ping_args)that);
    return false;
  }

  public boolean equals(ping_args that) {
    if (that == null)
      return false;

    return true;
  }

  @java.lang.Override
  public int hashCode() {
    HashCodeBuilder builder = new HashCodeBuilder();
    return builder.toHashCode();
  }

  public int compareTo(ping_args other) {
    if (!getClass().equals(other.getClass())) {
      return getClass().getName().compareTo(other.getClass().getName());
    }

    int lastComparison = 0;
    ping_args typedOther = (ping_args)other;

    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) {
        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);
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }

  @java.lang.Override
  public String toString() {
    StringBuilder sb = new StringBuilder("ping_args(");
    boolean first = true;
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws TException {
    // check for required fields
  }
}


  public static class ping_result implements TBase, java.io.Serializable, Cloneable {
  private static final TStruct STRUCT_DESC = new TStruct("ping_result");

  private static final TField SUCCESS_FIELD_DESC = new TField("success", TType.BOOL, (short)0);


  public boolean 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 byName = new HashMap();
  
    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
  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.BOOL)));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    FieldMetaData.addStructMetaDataMap(ping_result.class, metaDataMap);
  }


  public ping_result() {
  }

  public ping_result(
    boolean success)
  {
    this();
    this.success = success;
    setSuccessIsSet(true);
  }

  /**
   * Performs a deep copy on other.
   */
  public ping_result(ping_result other) {
    __isset_bit_vector.clear();
    __isset_bit_vector.or(other.__isset_bit_vector);
    this.success = other.success;
  }

  public ping_result deepCopy() {
    return new ping_result(this);
  }

  @java.lang.Override
  public void clear() {
    setSuccessIsSet(false);
    this.success = false;
  }

  public boolean isSuccess() {
    return this.success;
  }

  public ping_result setSuccess(boolean success) {
    this.success = success;
    setSuccessIsSet(true);

    return this;
  }

  public void unsetSuccess() {
  __isset_bit_vector.clear(__SUCCESS_ISSET_ID);
  }

  /** Returns true if field success is set (has been asigned a value) and false otherwise */
  public boolean isSetSuccess() {
    return __isset_bit_vector.get(__SUCCESS_ISSET_ID);
  }

  public void setSuccessIsSet(boolean value) {
    __isset_bit_vector.set(__SUCCESS_ISSET_ID, value);
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case SUCCESS:
      if (value == null) {
        unsetSuccess();
      } else {
        setSuccess((Boolean)value);
      }
      break;
    }
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case SUCCESS:
      return new Boolean(isSuccess());
    }
    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 isSetSuccess();
    }
    throw new IllegalStateException();
  }

  @java.lang.Override
  public boolean equals(Object that) {
    if (that == null)
      return false;
    if (that instanceof ping_result)
      return this.equals((ping_result)that);
    return false;
  }

  public boolean equals(ping_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;
    }

    return true;
  }

  @java.lang.Override
  public int hashCode() {
    HashCodeBuilder builder = new HashCodeBuilder();
    boolean present_success = true;
    builder.append(present_success);
    if (present_success)
      builder.append(success);
    return builder.toHashCode();
  }

  public int compareTo(ping_result other) {
    if (!getClass().equals(other.getClass())) {
      return getClass().getName().compareTo(other.getClass().getName());
    }

    int lastComparison = 0;
    ping_result typedOther = (ping_result)other;

    lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetSuccess()) {
      lastComparison = TBaseHelper.compareTo(this.success, typedOther.success);
      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.BOOL) {
            this.success = iprot.readBool();
            setSuccessIsSet(true);
          } 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.isSetSuccess()) {
      oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
      oprot.writeBool(this.success);
      oprot.writeFieldEnd();
    }
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }

  @java.lang.Override
  public String toString() {
    StringBuilder sb = new StringBuilder("ping_result(");
    boolean first = true;
    sb.append("success:");
    sb.append(this.success);
    first = false;
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws TException {
    // check for required fields
  }
}



  public static class shutdown_args implements TBase, java.io.Serializable, Cloneable {
  private static final TStruct STRUCT_DESC = new TStruct("shutdown_args");

  private static final TField WAIT_NANOS_FIELD_DESC = new TField("waitNanos", TType.I64, (short)-1);


  public long waitNanos;

  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  public enum _Fields implements TFieldIdEnum {
    WAIT_NANOS((short)-1, "waitNanos");
  
    private static final Map byName = new HashMap();
  
    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: // WAIT_NANOS
          return WAIT_NANOS;
        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 __WAITNANOS_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.WAIT_NANOS, new FieldMetaData("waitNanos", TFieldRequirementType.DEFAULT,
      new FieldValueMetaData(TType.I64)));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    FieldMetaData.addStructMetaDataMap(shutdown_args.class, metaDataMap);
  }


  public shutdown_args() {
  }

  public shutdown_args(
    long waitNanos)
  {
    this();
    this.waitNanos = waitNanos;
    setWaitNanosIsSet(true);
  }

  /**
   * Performs a deep copy on other.
   */
  public shutdown_args(shutdown_args other) {
    __isset_bit_vector.clear();
    __isset_bit_vector.or(other.__isset_bit_vector);
    this.waitNanos = other.waitNanos;
  }

  public shutdown_args deepCopy() {
    return new shutdown_args(this);
  }

  @java.lang.Override
  public void clear() {
    setWaitNanosIsSet(false);
    this.waitNanos = 0;
  }

  public long getWaitNanos() {
    return this.waitNanos;
  }

  public shutdown_args setWaitNanos(long waitNanos) {
    this.waitNanos = waitNanos;
    setWaitNanosIsSet(true);

    return this;
  }

  public void unsetWaitNanos() {
  __isset_bit_vector.clear(__WAITNANOS_ISSET_ID);
  }

  /** Returns true if field waitNanos is set (has been asigned a value) and false otherwise */
  public boolean isSetWaitNanos() {
    return __isset_bit_vector.get(__WAITNANOS_ISSET_ID);
  }

  public void setWaitNanosIsSet(boolean value) {
    __isset_bit_vector.set(__WAITNANOS_ISSET_ID, value);
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case WAIT_NANOS:
      if (value == null) {
        unsetWaitNanos();
      } else {
        setWaitNanos((Long)value);
      }
      break;
    }
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case WAIT_NANOS:
      return new Long(getWaitNanos());
    }
    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 WAIT_NANOS:
      return isSetWaitNanos();
    }
    throw new IllegalStateException();
  }

  @java.lang.Override
  public boolean equals(Object that) {
    if (that == null)
      return false;
    if (that instanceof shutdown_args)
      return this.equals((shutdown_args)that);
    return false;
  }

  public boolean equals(shutdown_args that) {
    if (that == null)
      return false;
    boolean this_present_waitNanos = true;
    boolean that_present_waitNanos = true;
    if (this_present_waitNanos || that_present_waitNanos) {
      if (!(this_present_waitNanos && that_present_waitNanos))
        return false;
      if (this.waitNanos != that.waitNanos)
        return false;
    }

    return true;
  }

  @java.lang.Override
  public int hashCode() {
    HashCodeBuilder builder = new HashCodeBuilder();
    boolean present_waitNanos = true;
    builder.append(present_waitNanos);
    if (present_waitNanos)
      builder.append(waitNanos);
    return builder.toHashCode();
  }

  public int compareTo(shutdown_args other) {
    if (!getClass().equals(other.getClass())) {
      return getClass().getName().compareTo(other.getClass().getName());
    }

    int lastComparison = 0;
    shutdown_args typedOther = (shutdown_args)other;

    lastComparison = Boolean.valueOf(isSetWaitNanos()).compareTo(typedOther.isSetWaitNanos());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetWaitNanos()) {
      lastComparison = TBaseHelper.compareTo(this.waitNanos, typedOther.waitNanos);
      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: // WAIT_NANOS
          if (field.type == TType.I64) {
            this.waitNanos = iprot.readI64();
            setWaitNanosIsSet(true);
          } 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);
    oprot.writeFieldBegin(WAIT_NANOS_FIELD_DESC);
    oprot.writeI64(this.waitNanos);
    oprot.writeFieldEnd();
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }

  @java.lang.Override
  public String toString() {
    StringBuilder sb = new StringBuilder("shutdown_args(");
    boolean first = true;
    sb.append("waitNanos:");
    sb.append(this.waitNanos);
    first = false;
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws TException {
    // check for required fields
  }
}


  public static class shutdown_result implements TBase, java.io.Serializable, Cloneable {
  private static final TStruct STRUCT_DESC = new TStruct("shutdown_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 byName = new HashMap();
  
    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(shutdown_result.class, metaDataMap);
  }


  public shutdown_result() {
  }


  /**
   * Performs a deep copy on other.
   */
  public shutdown_result(shutdown_result other) {
  }

  public shutdown_result deepCopy() {
    return new shutdown_result(this);
  }

  @java.lang.Override
  public void clear() {
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    }
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    }
    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) {
    }
    throw new IllegalStateException();
  }

  @java.lang.Override
  public boolean equals(Object that) {
    if (that == null)
      return false;
    if (that instanceof shutdown_result)
      return this.equals((shutdown_result)that);
    return false;
  }

  public boolean equals(shutdown_result that) {
    if (that == null)
      return false;

    return true;
  }

  @java.lang.Override
  public int hashCode() {
    HashCodeBuilder builder = new HashCodeBuilder();
    return builder.toHashCode();
  }

  public int compareTo(shutdown_result other) {
    if (!getClass().equals(other.getClass())) {
      return getClass().getName().compareTo(other.getClass().getName());
    }

    int lastComparison = 0;
    shutdown_result typedOther = (shutdown_result)other;

    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) {
        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);
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }

  @java.lang.Override
  public String toString() {
    StringBuilder sb = new StringBuilder("shutdown_result(");
    boolean first = true;
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws TException {
    // check for required fields
  }
}



  public static class query_args implements TBase, java.io.Serializable, Cloneable {
  private static final TStruct STRUCT_DESC = new TStruct("query_args");

  private static final TField QUERY_FIELD_DESC = new TField("query", TType.STRUCT, (short)1);


  public scray.service.qmodel.thriftjava.ScrayTQuery query;

  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  public enum _Fields implements TFieldIdEnum {
    QUERY((short)1, "query");
  
    private static final Map byName = new HashMap();
  
    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: // QUERY
          return QUERY;
        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.QUERY, new FieldMetaData("query", TFieldRequirementType.DEFAULT,
      new StructMetaData(TType.STRUCT, scray.service.qmodel.thriftjava.ScrayTQuery.class)));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    FieldMetaData.addStructMetaDataMap(query_args.class, metaDataMap);
  }


  public query_args() {
  }

  public query_args(
    scray.service.qmodel.thriftjava.ScrayTQuery query)
  {
    this();
    this.query = query;
  }

  /**
   * Performs a deep copy on other.
   */
  public query_args(query_args other) {
    if (other.isSetQuery()) {
      this.query = new scray.service.qmodel.thriftjava.ScrayTQuery(other.query);
    }
  }

  public query_args deepCopy() {
    return new query_args(this);
  }

  @java.lang.Override
  public void clear() {
    this.query = null;
  }

  public scray.service.qmodel.thriftjava.ScrayTQuery getQuery() {
    return this.query;
  }

  public query_args setQuery(scray.service.qmodel.thriftjava.ScrayTQuery query) {
    this.query = query;
    
    return this;
  }

  public void unsetQuery() {
    this.query = null;
  }

  /** Returns true if field query is set (has been asigned a value) and false otherwise */
  public boolean isSetQuery() {
    return this.query != null;
  }

  public void setQueryIsSet(boolean value) {
    if (!value) {
      this.query = null;
    }
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case QUERY:
      if (value == null) {
        unsetQuery();
      } else {
        setQuery((scray.service.qmodel.thriftjava.ScrayTQuery)value);
      }
      break;
    }
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case QUERY:
      return getQuery();
    }
    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 QUERY:
      return isSetQuery();
    }
    throw new IllegalStateException();
  }

  @java.lang.Override
  public boolean equals(Object that) {
    if (that == null)
      return false;
    if (that instanceof query_args)
      return this.equals((query_args)that);
    return false;
  }

  public boolean equals(query_args that) {
    if (that == null)
      return false;
    boolean this_present_query = true && this.isSetQuery();
    boolean that_present_query = true && that.isSetQuery();
    if (this_present_query || that_present_query) {
      if (!(this_present_query && that_present_query))
        return false;
      if (!this.query.equals(that.query))
        return false;
    }

    return true;
  }

  @java.lang.Override
  public int hashCode() {
    HashCodeBuilder builder = new HashCodeBuilder();
    boolean present_query = true && (isSetQuery());
    builder.append(present_query);
    if (present_query)
      builder.append(query);
    return builder.toHashCode();
  }

  public int compareTo(query_args other) {
    if (!getClass().equals(other.getClass())) {
      return getClass().getName().compareTo(other.getClass().getName());
    }

    int lastComparison = 0;
    query_args typedOther = (query_args)other;

    lastComparison = Boolean.valueOf(isSetQuery()).compareTo(typedOther.isSetQuery());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetQuery()) {
      lastComparison = TBaseHelper.compareTo(this.query, typedOther.query);
      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: // QUERY
          if (field.type == TType.STRUCT) {
            this.query = new scray.service.qmodel.thriftjava.ScrayTQuery();
            this.query.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 {
    validate();
    
    oprot.writeStructBegin(STRUCT_DESC);
    if (this.query != null) {
      oprot.writeFieldBegin(QUERY_FIELD_DESC);
      this.query.write(oprot);
      oprot.writeFieldEnd();
    }
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }

  @java.lang.Override
  public String toString() {
    StringBuilder sb = new StringBuilder("query_args(");
    boolean first = true;
    sb.append("query:");
    if (this.query == null) {
      sb.append("null");
    } else {
      sb.append(this.query);
    }
    first = false;
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws TException {
    // check for required fields
  }
}


  public static class query_result implements TBase, java.io.Serializable, Cloneable {
  private static final TStruct STRUCT_DESC = new TStruct("query_result");

  private static final TField SUCCESS_FIELD_DESC = new TField("success", TType.STRUCT, (short)0);
  private static final TField EX_FIELD_DESC = new TField("ex", TType.STRUCT, (short)1);


  public scray.service.qmodel.thriftjava.ScrayUUID success;
  public ScrayTException ex;

  /** 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"),
    EX((short)1, "ex");
  
    private static final Map byName = new HashMap();
  
    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: // EX
          return EX;
        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 StructMetaData(TType.STRUCT, scray.service.qmodel.thriftjava.ScrayUUID.class)));
    tmpMap.put(_Fields.EX, new FieldMetaData("ex", TFieldRequirementType.DEFAULT,
      new StructMetaData(TType.STRUCT, ScrayTException.class)));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    FieldMetaData.addStructMetaDataMap(query_result.class, metaDataMap);
  }


  public query_result() {
  }

  public query_result(
    scray.service.qmodel.thriftjava.ScrayUUID success,
    ScrayTException ex)
  {
    this();
    this.success = success;
    this.ex = ex;
  }

  /**
   * Performs a deep copy on other.
   */
  public query_result(query_result other) {
    if (other.isSetSuccess()) {
      this.success = new scray.service.qmodel.thriftjava.ScrayUUID(other.success);
    }
    if (other.isSetEx()) {
      this.ex = new ScrayTException(other.ex);
    }
  }

  public query_result deepCopy() {
    return new query_result(this);
  }

  @java.lang.Override
  public void clear() {
    this.success = null;
    this.ex = null;
  }

  public scray.service.qmodel.thriftjava.ScrayUUID getSuccess() {
    return this.success;
  }

  public query_result setSuccess(scray.service.qmodel.thriftjava.ScrayUUID success) {
    this.success = success;
    
    return this;
  }

  public void unsetSuccess() {
    this.success = null;
  }

  /** Returns true if field success is set (has been asigned a value) and false otherwise */
  public boolean isSetSuccess() {
    return this.success != null;
  }

  public void setSuccessIsSet(boolean value) {
    if (!value) {
      this.success = null;
    }
  }

  public ScrayTException getEx() {
    return this.ex;
  }

  public query_result setEx(ScrayTException ex) {
    this.ex = ex;
    
    return this;
  }

  public void unsetEx() {
    this.ex = null;
  }

  /** Returns true if field ex is set (has been asigned a value) and false otherwise */
  public boolean isSetEx() {
    return this.ex != null;
  }

  public void setExIsSet(boolean value) {
    if (!value) {
      this.ex = null;
    }
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case SUCCESS:
      if (value == null) {
        unsetSuccess();
      } else {
        setSuccess((scray.service.qmodel.thriftjava.ScrayUUID)value);
      }
      break;
    case EX:
      if (value == null) {
        unsetEx();
      } else {
        setEx((ScrayTException)value);
      }
      break;
    }
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case SUCCESS:
      return getSuccess();
    case EX:
      return getEx();
    }
    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 isSetSuccess();
    case EX:
      return isSetEx();
    }
    throw new IllegalStateException();
  }

  @java.lang.Override
  public boolean equals(Object that) {
    if (that == null)
      return false;
    if (that instanceof query_result)
      return this.equals((query_result)that);
    return false;
  }

  public boolean equals(query_result that) {
    if (that == null)
      return false;
    boolean this_present_success = true && this.isSetSuccess();
    boolean that_present_success = true && that.isSetSuccess();
    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_ex = true && this.isSetEx();
    boolean that_present_ex = true && that.isSetEx();
    if (this_present_ex || that_present_ex) {
      if (!(this_present_ex && that_present_ex))
        return false;
      if (!this.ex.equals(that.ex))
        return false;
    }

    return true;
  }

  @java.lang.Override
  public int hashCode() {
    HashCodeBuilder builder = new HashCodeBuilder();
    boolean present_success = true && (isSetSuccess());
    builder.append(present_success);
    if (present_success)
      builder.append(success);
    boolean present_ex = true && (isSetEx());
    builder.append(present_ex);
    if (present_ex)
      builder.append(ex);
    return builder.toHashCode();
  }

  public int compareTo(query_result other) {
    if (!getClass().equals(other.getClass())) {
      return getClass().getName().compareTo(other.getClass().getName());
    }

    int lastComparison = 0;
    query_result typedOther = (query_result)other;

    lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetSuccess()) {
      lastComparison = TBaseHelper.compareTo(this.success, typedOther.success);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetEx()).compareTo(typedOther.isSetEx());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetEx()) {
      lastComparison = TBaseHelper.compareTo(this.ex, typedOther.ex);
      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.STRUCT) {
            this.success = new scray.service.qmodel.thriftjava.ScrayUUID();
            this.success.read(iprot);
          } else {
            TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 1: // EX
          if (field.type == TType.STRUCT) {
            this.ex = new ScrayTException();
            this.ex.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.isSetSuccess()) {
      oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
      this.success.write(oprot);
      oprot.writeFieldEnd();
    } else if (this.isSetEx()) {
      oprot.writeFieldBegin(EX_FIELD_DESC);
      this.ex.write(oprot);
      oprot.writeFieldEnd();
    }
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }

  @java.lang.Override
  public String toString() {
    StringBuilder sb = new StringBuilder("query_result(");
    boolean first = true;
    sb.append("success:");
    if (this.success == null) {
      sb.append("null");
    } else {
      sb.append(this.success);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("ex:");
    if (this.ex == null) {
      sb.append("null");
    } else {
      sb.append(this.ex);
    }
    first = false;
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws TException {
    // check for required fields
  }
}



  public static class getResults_args implements TBase, java.io.Serializable, Cloneable {
  private static final TStruct STRUCT_DESC = new TStruct("getResults_args");

  private static final TField QUERY_ID_FIELD_DESC = new TField("queryId", TType.STRUCT, (short)1);


  public scray.service.qmodel.thriftjava.ScrayUUID queryId;

  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  public enum _Fields implements TFieldIdEnum {
    QUERY_ID((short)1, "queryId");
  
    private static final Map byName = new HashMap();
  
    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: // QUERY_ID
          return QUERY_ID;
        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.QUERY_ID, new FieldMetaData("queryId", TFieldRequirementType.DEFAULT,
      new StructMetaData(TType.STRUCT, scray.service.qmodel.thriftjava.ScrayUUID.class)));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    FieldMetaData.addStructMetaDataMap(getResults_args.class, metaDataMap);
  }


  public getResults_args() {
  }

  public getResults_args(
    scray.service.qmodel.thriftjava.ScrayUUID queryId)
  {
    this();
    this.queryId = queryId;
  }

  /**
   * Performs a deep copy on other.
   */
  public getResults_args(getResults_args other) {
    if (other.isSetQueryId()) {
      this.queryId = new scray.service.qmodel.thriftjava.ScrayUUID(other.queryId);
    }
  }

  public getResults_args deepCopy() {
    return new getResults_args(this);
  }

  @java.lang.Override
  public void clear() {
    this.queryId = null;
  }

  public scray.service.qmodel.thriftjava.ScrayUUID getQueryId() {
    return this.queryId;
  }

  public getResults_args setQueryId(scray.service.qmodel.thriftjava.ScrayUUID queryId) {
    this.queryId = queryId;
    
    return this;
  }

  public void unsetQueryId() {
    this.queryId = null;
  }

  /** Returns true if field queryId is set (has been asigned a value) and false otherwise */
  public boolean isSetQueryId() {
    return this.queryId != null;
  }

  public void setQueryIdIsSet(boolean value) {
    if (!value) {
      this.queryId = null;
    }
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case QUERY_ID:
      if (value == null) {
        unsetQueryId();
      } else {
        setQueryId((scray.service.qmodel.thriftjava.ScrayUUID)value);
      }
      break;
    }
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case QUERY_ID:
      return getQueryId();
    }
    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 QUERY_ID:
      return isSetQueryId();
    }
    throw new IllegalStateException();
  }

  @java.lang.Override
  public boolean equals(Object that) {
    if (that == null)
      return false;
    if (that instanceof getResults_args)
      return this.equals((getResults_args)that);
    return false;
  }

  public boolean equals(getResults_args that) {
    if (that == null)
      return false;
    boolean this_present_queryId = true && this.isSetQueryId();
    boolean that_present_queryId = true && that.isSetQueryId();
    if (this_present_queryId || that_present_queryId) {
      if (!(this_present_queryId && that_present_queryId))
        return false;
      if (!this.queryId.equals(that.queryId))
        return false;
    }

    return true;
  }

  @java.lang.Override
  public int hashCode() {
    HashCodeBuilder builder = new HashCodeBuilder();
    boolean present_queryId = true && (isSetQueryId());
    builder.append(present_queryId);
    if (present_queryId)
      builder.append(queryId);
    return builder.toHashCode();
  }

  public int compareTo(getResults_args other) {
    if (!getClass().equals(other.getClass())) {
      return getClass().getName().compareTo(other.getClass().getName());
    }

    int lastComparison = 0;
    getResults_args typedOther = (getResults_args)other;

    lastComparison = Boolean.valueOf(isSetQueryId()).compareTo(typedOther.isSetQueryId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetQueryId()) {
      lastComparison = TBaseHelper.compareTo(this.queryId, typedOther.queryId);
      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: // QUERY_ID
          if (field.type == TType.STRUCT) {
            this.queryId = new scray.service.qmodel.thriftjava.ScrayUUID();
            this.queryId.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 {
    validate();
    
    oprot.writeStructBegin(STRUCT_DESC);
    if (this.queryId != null) {
      oprot.writeFieldBegin(QUERY_ID_FIELD_DESC);
      this.queryId.write(oprot);
      oprot.writeFieldEnd();
    }
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }

  @java.lang.Override
  public String toString() {
    StringBuilder sb = new StringBuilder("getResults_args(");
    boolean first = true;
    sb.append("queryId:");
    if (this.queryId == null) {
      sb.append("null");
    } else {
      sb.append(this.queryId);
    }
    first = false;
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws TException {
    // check for required fields
  }
}


  public static class getResults_result implements TBase, java.io.Serializable, Cloneable {
  private static final TStruct STRUCT_DESC = new TStruct("getResults_result");

  private static final TField SUCCESS_FIELD_DESC = new TField("success", TType.STRUCT, (short)0);
  private static final TField EX_FIELD_DESC = new TField("ex", TType.STRUCT, (short)1);


  public ScrayTResultFrame success;
  public ScrayTException ex;

  /** 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"),
    EX((short)1, "ex");
  
    private static final Map byName = new HashMap();
  
    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: // EX
          return EX;
        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 StructMetaData(TType.STRUCT, ScrayTResultFrame.class)));
    tmpMap.put(_Fields.EX, new FieldMetaData("ex", TFieldRequirementType.DEFAULT,
      new StructMetaData(TType.STRUCT, ScrayTException.class)));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    FieldMetaData.addStructMetaDataMap(getResults_result.class, metaDataMap);
  }


  public getResults_result() {
  }

  public getResults_result(
    ScrayTResultFrame success,
    ScrayTException ex)
  {
    this();
    this.success = success;
    this.ex = ex;
  }

  /**
   * Performs a deep copy on other.
   */
  public getResults_result(getResults_result other) {
    if (other.isSetSuccess()) {
      this.success = new ScrayTResultFrame(other.success);
    }
    if (other.isSetEx()) {
      this.ex = new ScrayTException(other.ex);
    }
  }

  public getResults_result deepCopy() {
    return new getResults_result(this);
  }

  @java.lang.Override
  public void clear() {
    this.success = null;
    this.ex = null;
  }

  public ScrayTResultFrame getSuccess() {
    return this.success;
  }

  public getResults_result setSuccess(ScrayTResultFrame success) {
    this.success = success;
    
    return this;
  }

  public void unsetSuccess() {
    this.success = null;
  }

  /** Returns true if field success is set (has been asigned a value) and false otherwise */
  public boolean isSetSuccess() {
    return this.success != null;
  }

  public void setSuccessIsSet(boolean value) {
    if (!value) {
      this.success = null;
    }
  }

  public ScrayTException getEx() {
    return this.ex;
  }

  public getResults_result setEx(ScrayTException ex) {
    this.ex = ex;
    
    return this;
  }

  public void unsetEx() {
    this.ex = null;
  }

  /** Returns true if field ex is set (has been asigned a value) and false otherwise */
  public boolean isSetEx() {
    return this.ex != null;
  }

  public void setExIsSet(boolean value) {
    if (!value) {
      this.ex = null;
    }
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case SUCCESS:
      if (value == null) {
        unsetSuccess();
      } else {
        setSuccess((ScrayTResultFrame)value);
      }
      break;
    case EX:
      if (value == null) {
        unsetEx();
      } else {
        setEx((ScrayTException)value);
      }
      break;
    }
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case SUCCESS:
      return getSuccess();
    case EX:
      return getEx();
    }
    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 isSetSuccess();
    case EX:
      return isSetEx();
    }
    throw new IllegalStateException();
  }

  @java.lang.Override
  public boolean equals(Object that) {
    if (that == null)
      return false;
    if (that instanceof getResults_result)
      return this.equals((getResults_result)that);
    return false;
  }

  public boolean equals(getResults_result that) {
    if (that == null)
      return false;
    boolean this_present_success = true && this.isSetSuccess();
    boolean that_present_success = true && that.isSetSuccess();
    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_ex = true && this.isSetEx();
    boolean that_present_ex = true && that.isSetEx();
    if (this_present_ex || that_present_ex) {
      if (!(this_present_ex && that_present_ex))
        return false;
      if (!this.ex.equals(that.ex))
        return false;
    }

    return true;
  }

  @java.lang.Override
  public int hashCode() {
    HashCodeBuilder builder = new HashCodeBuilder();
    boolean present_success = true && (isSetSuccess());
    builder.append(present_success);
    if (present_success)
      builder.append(success);
    boolean present_ex = true && (isSetEx());
    builder.append(present_ex);
    if (present_ex)
      builder.append(ex);
    return builder.toHashCode();
  }

  public int compareTo(getResults_result other) {
    if (!getClass().equals(other.getClass())) {
      return getClass().getName().compareTo(other.getClass().getName());
    }

    int lastComparison = 0;
    getResults_result typedOther = (getResults_result)other;

    lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetSuccess()) {
      lastComparison = TBaseHelper.compareTo(this.success, typedOther.success);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetEx()).compareTo(typedOther.isSetEx());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetEx()) {
      lastComparison = TBaseHelper.compareTo(this.ex, typedOther.ex);
      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.STRUCT) {
            this.success = new ScrayTResultFrame();
            this.success.read(iprot);
          } else {
            TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 1: // EX
          if (field.type == TType.STRUCT) {
            this.ex = new ScrayTException();
            this.ex.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.isSetSuccess()) {
      oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
      this.success.write(oprot);
      oprot.writeFieldEnd();
    } else if (this.isSetEx()) {
      oprot.writeFieldBegin(EX_FIELD_DESC);
      this.ex.write(oprot);
      oprot.writeFieldEnd();
    }
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }

  @java.lang.Override
  public String toString() {
    StringBuilder sb = new StringBuilder("getResults_result(");
    boolean first = true;
    sb.append("success:");
    if (this.success == null) {
      sb.append("null");
    } else {
      sb.append(this.success);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("ex:");
    if (this.ex == null) {
      sb.append("null");
    } else {
      sb.append(this.ex);
    }
    first = false;
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws TException {
    // check for required fields
  }
}



}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy