blob: 3e70b11e94cd9717c1905073b4a8d3d0be2ea9e9 [file] [log] [blame]
David Reiss7f42bcf2008-01-11 20:59:12 +00001//
2// TServer.cs
3//
4// Begin: Dec 3, 2007
5// Authors:
6// Will Palmeri <wpalmeri@imeem.com>
7//
8// Distributed under the Thrift Software License
9//
10// See accompanying file LICENSE or visit the Thrift site at:
11// http://developers.facebook.com/thrift/using
12
13using System;
14using System.Collections.Generic;
15using Thrift.Protocol;
16using Thrift.Transport;
17
18namespace Thrift.Server
19{
20 public abstract class TServer
21 {
22 /**
23 * Core processor
24 */
25 protected TProcessor processor;
26
27 /**
28 * Server transport
29 */
30 protected TServerTransport serverTransport;
31
32 /**
33 * Input Transport Factory
34 */
35 protected TTransportFactory inputTransportFactory;
36
37 /**
38 * Output Transport Factory
39 */
40 protected TTransportFactory outputTransportFactory;
41
42 /**
43 * Input Protocol Factory
44 */
45 protected TProtocolFactory inputProtocolFactory;
46
47 /**
48 * Output Protocol Factory
49 */
50 protected TProtocolFactory outputProtocolFactory;
51
52 /**
53 * Default constructors.
54 */
55
56 public TServer(TProcessor processor,
57 TServerTransport serverTransport)
58 :this(processor, serverTransport, new TTransportFactory(), new TTransportFactory(), new TBinaryProtocol.Factory(), new TBinaryProtocol.Factory())
59 {
60 }
61
62 public TServer(TProcessor processor,
63 TServerTransport serverTransport,
64 TTransportFactory transportFactory)
65 :this(processor,
66 serverTransport,
67 transportFactory,
68 transportFactory,
69 new TBinaryProtocol.Factory(),
70 new TBinaryProtocol.Factory())
71 {
72 }
73
74 public TServer(TProcessor processor,
75 TServerTransport serverTransport,
76 TTransportFactory transportFactory,
77 TProtocolFactory protocolFactory)
78 :this(processor,
79 serverTransport,
80 transportFactory,
81 transportFactory,
82 protocolFactory,
83 protocolFactory)
84 {
85 }
86
87 public TServer(TProcessor processor,
88 TServerTransport serverTransport,
89 TTransportFactory inputTransportFactory,
90 TTransportFactory outputTransportFactory,
91 TProtocolFactory inputProtocolFactory,
92 TProtocolFactory outputProtocolFactory)
93 {
94 this.processor = processor;
95 this.serverTransport = serverTransport;
96 this.inputTransportFactory = inputTransportFactory;
97 this.outputTransportFactory = outputTransportFactory;
98 this.inputProtocolFactory = inputProtocolFactory;
99 this.outputProtocolFactory = outputProtocolFactory;
100 }
101
102 /**
103 * The run method fires up the server and gets things going.
104 */
105 public abstract void Serve();
106 }
107}
108