1 /**
2  * Autogenerated by Thrift
3  *
4  * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5  *  @generated
6  */
7 import java.util.List;
8 import java.util.ArrayList;
9 import java.util.Map;
10 import java.util.HashMap;
11 import java.util.Set;
12 import java.util.HashSet;
13 import java.util.Collections;
14 import java.util.BitSet;
15 import java.util.Arrays;
16 import org.slf4j.Logger;
17 import org.slf4j.LoggerFactory;
18 
19 import com.facebook.thrift.*;
20 import com.facebook.thrift.annotations.*;
21 import com.facebook.thrift.async.*;
22 import com.facebook.thrift.meta_data.*;
23 import com.facebook.thrift.server.*;
24 import com.facebook.thrift.transport.*;
25 import com.facebook.thrift.protocol.*;
26 
27 @SuppressWarnings({ "unused", "serial" })
28 public class SinkService {
29 
30   public interface Iface {
31 
32   }
33 
34   public interface AsyncIface {
35 
36   }
37 
38   public static class Client extends EventHandlerBase implements Iface, TClientIf {
Client(TProtocol prot)39     public Client(TProtocol prot)
40     {
41       this(prot, prot);
42     }
43 
Client(TProtocol iprot, TProtocol oprot)44     public Client(TProtocol iprot, TProtocol oprot)
45     {
46       iprot_ = iprot;
47       oprot_ = oprot;
48     }
49 
50     protected TProtocol iprot_;
51     protected TProtocol oprot_;
52 
53     protected int seqid_;
54 
55     @Override
getInputProtocol()56     public TProtocol getInputProtocol()
57     {
58       return this.iprot_;
59     }
60 
61     @Override
getOutputProtocol()62     public TProtocol getOutputProtocol()
63     {
64       return this.oprot_;
65     }
66 
67   }
68   public static class AsyncClient extends TAsyncClient implements AsyncIface {
69     public static class Factory implements TAsyncClientFactory<AsyncClient> {
70       private TAsyncClientManager clientManager;
71       private TProtocolFactory protocolFactory;
Factory(TAsyncClientManager clientManager, TProtocolFactory protocolFactory)72       public Factory(TAsyncClientManager clientManager, TProtocolFactory protocolFactory) {
73         this.clientManager = clientManager;
74         this.protocolFactory = protocolFactory;
75       }
getAsyncClient(TNonblockingTransport transport)76       public AsyncClient getAsyncClient(TNonblockingTransport transport) {
77         return new AsyncClient(protocolFactory, clientManager, transport);
78       }
79     }
80 
AsyncClient(TProtocolFactory protocolFactory, TAsyncClientManager clientManager, TNonblockingTransport transport)81     public AsyncClient(TProtocolFactory protocolFactory, TAsyncClientManager clientManager, TNonblockingTransport transport) {
82       super(protocolFactory, clientManager, transport);
83     }
84 
85   }
86 
87   public static class Processor implements TProcessor {
88     private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName());
Processor(Iface iface)89     public Processor(Iface iface)
90     {
91       iface_ = iface;
92       event_handler_ = new TProcessorEventHandler(); // Empty handler
93     }
94 
95     protected static interface ProcessFunction {
process(int seqid, TProtocol iprot, TProtocol oprot, TConnectionContext server_ctx)96       public void process(int seqid, TProtocol iprot, TProtocol oprot, TConnectionContext server_ctx) throws TException;
97     }
98 
setEventHandler(TProcessorEventHandler handler)99     public void setEventHandler(TProcessorEventHandler handler) {
100       this.event_handler_ = handler;
101     }
102 
103     private Iface iface_;
104     protected TProcessorEventHandler event_handler_;
105     protected final HashMap<String,ProcessFunction> processMap_ = new HashMap<String,ProcessFunction>();
106 
process(TProtocol iprot, TProtocol oprot, TConnectionContext server_ctx)107     public boolean process(TProtocol iprot, TProtocol oprot, TConnectionContext server_ctx) throws TException
108     {
109       TMessage msg = iprot.readMessageBegin();
110       ProcessFunction fn = processMap_.get(msg.name);
111       if (fn == null) {
112         TProtocolUtil.skip(iprot, TType.STRUCT);
113         iprot.readMessageEnd();
114         TApplicationException x = new TApplicationException(TApplicationException.UNKNOWN_METHOD, "Invalid method name: '"+msg.name+"'");
115         oprot.writeMessageBegin(new TMessage(msg.name, TMessageType.EXCEPTION, msg.seqid));
116         x.write(oprot);
117         oprot.writeMessageEnd();
118         oprot.getTransport().flush();
119         return true;
120       }
121       fn.process(msg.seqid, iprot, oprot, server_ctx);
122       return true;
123     }
124 
125   }
126 
127 }
128