Subversion Repositories SmartDukaan

Rev

Rev 304 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
304 ashish 1
#
2
# Autogenerated by Thrift
3
#
4
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
#
6
 
7
from thrift.Thrift import *
8
from ttypes import *
9
from thrift.Thrift import TProcessor
10
from thrift.transport import TTransport
11
from thrift.protocol import TBinaryProtocol
12
try:
13
  from thrift.protocol import fastbinary
14
except:
15
  fastbinary = None
16
 
17
 
18
class Iface:
765 rajveer 19
  def closeSession(self, ):
20
    pass
21
 
304 ashish 22
  def log(self, messageType, message):
23
    """
24
    Parameters:
25
     - messageType
26
     - message
27
    """
28
    pass
29
 
30
 
31
class Client(Iface):
32
  def __init__(self, iprot, oprot=None):
33
    self._iprot = self._oprot = iprot
34
    if oprot != None:
35
      self._oprot = oprot
36
    self._seqid = 0
37
 
765 rajveer 38
  def closeSession(self, ):
39
    self.send_closeSession()
40
    self.recv_closeSession()
41
 
42
  def send_closeSession(self, ):
43
    self._oprot.writeMessageBegin('closeSession', TMessageType.CALL, self._seqid)
44
    args = closeSession_args()
45
    args.write(self._oprot)
46
    self._oprot.writeMessageEnd()
47
    self._oprot.trans.flush()
48
 
49
  def recv_closeSession(self, ):
50
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
51
    if mtype == TMessageType.EXCEPTION:
52
      x = TApplicationException()
53
      x.read(self._iprot)
54
      self._iprot.readMessageEnd()
55
      raise x
56
    result = closeSession_result()
57
    result.read(self._iprot)
58
    self._iprot.readMessageEnd()
59
    return
60
 
304 ashish 61
  def log(self, messageType, message):
62
    """
63
    Parameters:
64
     - messageType
65
     - message
66
    """
67
    self.send_log(messageType, message)
68
    self.recv_log()
69
 
70
  def send_log(self, messageType, message):
71
    self._oprot.writeMessageBegin('log', TMessageType.CALL, self._seqid)
72
    args = log_args()
73
    args.messageType = messageType
74
    args.message = message
75
    args.write(self._oprot)
76
    self._oprot.writeMessageEnd()
77
    self._oprot.trans.flush()
78
 
79
  def recv_log(self, ):
80
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
81
    if mtype == TMessageType.EXCEPTION:
82
      x = TApplicationException()
83
      x.read(self._iprot)
84
      self._iprot.readMessageEnd()
85
      raise x
86
    result = log_result()
87
    result.read(self._iprot)
88
    self._iprot.readMessageEnd()
89
    return
90
 
91
 
92
class Processor(Iface, TProcessor):
93
  def __init__(self, handler):
94
    self._handler = handler
95
    self._processMap = {}
765 rajveer 96
    self._processMap["closeSession"] = Processor.process_closeSession
304 ashish 97
    self._processMap["log"] = Processor.process_log
98
 
99
  def process(self, iprot, oprot):
100
    (name, type, seqid) = iprot.readMessageBegin()
101
    if name not in self._processMap:
102
      iprot.skip(TType.STRUCT)
103
      iprot.readMessageEnd()
104
      x = TApplicationException(TApplicationException.UNKNOWN_METHOD, 'Unknown function %s' % (name))
105
      oprot.writeMessageBegin(name, TMessageType.EXCEPTION, seqid)
106
      x.write(oprot)
107
      oprot.writeMessageEnd()
108
      oprot.trans.flush()
109
      return
110
    else:
111
      self._processMap[name](self, seqid, iprot, oprot)
112
    return True
113
 
765 rajveer 114
  def process_closeSession(self, seqid, iprot, oprot):
115
    args = closeSession_args()
116
    args.read(iprot)
117
    iprot.readMessageEnd()
118
    result = closeSession_result()
119
    self._handler.closeSession()
120
    oprot.writeMessageBegin("closeSession", TMessageType.REPLY, seqid)
121
    result.write(oprot)
122
    oprot.writeMessageEnd()
123
    oprot.trans.flush()
124
 
304 ashish 125
  def process_log(self, seqid, iprot, oprot):
126
    args = log_args()
127
    args.read(iprot)
128
    iprot.readMessageEnd()
129
    result = log_result()
130
    self._handler.log(args.messageType, args.message)
131
    oprot.writeMessageBegin("log", TMessageType.REPLY, seqid)
132
    result.write(oprot)
133
    oprot.writeMessageEnd()
134
    oprot.trans.flush()
135
 
136
 
137
# HELPER FUNCTIONS AND STRUCTURES
138
 
765 rajveer 139
class closeSession_args:
140
 
141
  thrift_spec = (
142
  )
143
 
144
  def read(self, iprot):
145
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
146
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
147
      return
148
    iprot.readStructBegin()
149
    while True:
150
      (fname, ftype, fid) = iprot.readFieldBegin()
151
      if ftype == TType.STOP:
152
        break
153
      else:
154
        iprot.skip(ftype)
155
      iprot.readFieldEnd()
156
    iprot.readStructEnd()
157
 
158
  def write(self, oprot):
159
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
160
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
161
      return
162
    oprot.writeStructBegin('closeSession_args')
163
    oprot.writeFieldStop()
164
    oprot.writeStructEnd()
165
 
166
  def __repr__(self):
167
    L = ['%s=%r' % (key, value)
168
      for key, value in self.__dict__.iteritems()]
169
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
170
 
171
  def __eq__(self, other):
172
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
173
 
174
  def __ne__(self, other):
175
    return not (self == other)
176
 
177
class closeSession_result:
178
 
179
  thrift_spec = (
180
  )
181
 
182
  def read(self, iprot):
183
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
184
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
185
      return
186
    iprot.readStructBegin()
187
    while True:
188
      (fname, ftype, fid) = iprot.readFieldBegin()
189
      if ftype == TType.STOP:
190
        break
191
      else:
192
        iprot.skip(ftype)
193
      iprot.readFieldEnd()
194
    iprot.readStructEnd()
195
 
196
  def write(self, oprot):
197
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
198
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
199
      return
200
    oprot.writeStructBegin('closeSession_result')
201
    oprot.writeFieldStop()
202
    oprot.writeStructEnd()
203
 
204
  def __repr__(self):
205
    L = ['%s=%r' % (key, value)
206
      for key, value in self.__dict__.iteritems()]
207
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
208
 
209
  def __eq__(self, other):
210
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
211
 
212
  def __ne__(self, other):
213
    return not (self == other)
214
 
304 ashish 215
class log_args:
216
  """
217
  Attributes:
218
   - messageType
219
   - message
220
  """
221
 
222
  thrift_spec = (
223
    None, # 0
224
    (1, TType.I32, 'messageType', None, None, ), # 1
225
    (2, TType.STRING, 'message', None, None, ), # 2
226
  )
227
 
228
  def __init__(self, messageType=None, message=None,):
229
    self.messageType = messageType
230
    self.message = message
231
 
232
  def read(self, iprot):
233
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
234
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
235
      return
236
    iprot.readStructBegin()
237
    while True:
238
      (fname, ftype, fid) = iprot.readFieldBegin()
239
      if ftype == TType.STOP:
240
        break
241
      if fid == 1:
242
        if ftype == TType.I32:
243
          self.messageType = iprot.readI32();
244
        else:
245
          iprot.skip(ftype)
246
      elif fid == 2:
247
        if ftype == TType.STRING:
248
          self.message = iprot.readString();
249
        else:
250
          iprot.skip(ftype)
251
      else:
252
        iprot.skip(ftype)
253
      iprot.readFieldEnd()
254
    iprot.readStructEnd()
255
 
256
  def write(self, oprot):
257
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
258
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
259
      return
260
    oprot.writeStructBegin('log_args')
261
    if self.messageType != None:
262
      oprot.writeFieldBegin('messageType', TType.I32, 1)
263
      oprot.writeI32(self.messageType)
264
      oprot.writeFieldEnd()
265
    if self.message != None:
266
      oprot.writeFieldBegin('message', TType.STRING, 2)
267
      oprot.writeString(self.message)
268
      oprot.writeFieldEnd()
269
    oprot.writeFieldStop()
270
    oprot.writeStructEnd()
271
 
272
  def __repr__(self):
273
    L = ['%s=%r' % (key, value)
274
      for key, value in self.__dict__.iteritems()]
275
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
276
 
277
  def __eq__(self, other):
278
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
279
 
280
  def __ne__(self, other):
281
    return not (self == other)
282
 
283
class log_result:
284
 
285
  thrift_spec = (
286
  )
287
 
288
  def read(self, iprot):
289
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
290
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
291
      return
292
    iprot.readStructBegin()
293
    while True:
294
      (fname, ftype, fid) = iprot.readFieldBegin()
295
      if ftype == TType.STOP:
296
        break
297
      else:
298
        iprot.skip(ftype)
299
      iprot.readFieldEnd()
300
    iprot.readStructEnd()
301
 
302
  def write(self, oprot):
303
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
304
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
305
      return
306
    oprot.writeStructBegin('log_result')
307
    oprot.writeFieldStop()
308
    oprot.writeStructEnd()
309
 
310
  def __repr__(self):
311
    L = ['%s=%r' % (key, value)
312
      for key, value in self.__dict__.iteritems()]
313
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
314
 
315
  def __eq__(self, other):
316
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
317
 
318
  def __ne__(self, other):
319
    return not (self == other)
320
 
321