Subversion Repositories SmartDukaan

Rev

Rev 765 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
304 ashish 1
#
3431 rajveer 2
# Autogenerated by Thrift Compiler (0.7.0)
304 ashish 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
3431 rajveer 11
from thrift.protocol import TBinaryProtocol, TProtocol
304 ashish 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
3431 rajveer 34
    if oprot is not None:
304 ashish 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
 
3431 rajveer 166
  def validate(self):
167
    return
168
 
169
 
765 rajveer 170
  def __repr__(self):
171
    L = ['%s=%r' % (key, value)
172
      for key, value in self.__dict__.iteritems()]
173
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
174
 
175
  def __eq__(self, other):
176
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
177
 
178
  def __ne__(self, other):
179
    return not (self == other)
180
 
181
class closeSession_result:
182
 
183
  thrift_spec = (
184
  )
185
 
186
  def read(self, iprot):
187
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
188
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
189
      return
190
    iprot.readStructBegin()
191
    while True:
192
      (fname, ftype, fid) = iprot.readFieldBegin()
193
      if ftype == TType.STOP:
194
        break
195
      else:
196
        iprot.skip(ftype)
197
      iprot.readFieldEnd()
198
    iprot.readStructEnd()
199
 
200
  def write(self, oprot):
201
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
202
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
203
      return
204
    oprot.writeStructBegin('closeSession_result')
205
    oprot.writeFieldStop()
206
    oprot.writeStructEnd()
207
 
3431 rajveer 208
  def validate(self):
209
    return
210
 
211
 
765 rajveer 212
  def __repr__(self):
213
    L = ['%s=%r' % (key, value)
214
      for key, value in self.__dict__.iteritems()]
215
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
216
 
217
  def __eq__(self, other):
218
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
219
 
220
  def __ne__(self, other):
221
    return not (self == other)
222
 
304 ashish 223
class log_args:
224
  """
225
  Attributes:
226
   - messageType
227
   - message
228
  """
229
 
230
  thrift_spec = (
231
    None, # 0
232
    (1, TType.I32, 'messageType', None, None, ), # 1
233
    (2, TType.STRING, 'message', None, None, ), # 2
234
  )
235
 
236
  def __init__(self, messageType=None, message=None,):
237
    self.messageType = messageType
238
    self.message = message
239
 
240
  def read(self, iprot):
241
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
242
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
243
      return
244
    iprot.readStructBegin()
245
    while True:
246
      (fname, ftype, fid) = iprot.readFieldBegin()
247
      if ftype == TType.STOP:
248
        break
249
      if fid == 1:
250
        if ftype == TType.I32:
251
          self.messageType = iprot.readI32();
252
        else:
253
          iprot.skip(ftype)
254
      elif fid == 2:
255
        if ftype == TType.STRING:
256
          self.message = iprot.readString();
257
        else:
258
          iprot.skip(ftype)
259
      else:
260
        iprot.skip(ftype)
261
      iprot.readFieldEnd()
262
    iprot.readStructEnd()
263
 
264
  def write(self, oprot):
265
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
266
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
267
      return
268
    oprot.writeStructBegin('log_args')
3431 rajveer 269
    if self.messageType is not None:
304 ashish 270
      oprot.writeFieldBegin('messageType', TType.I32, 1)
271
      oprot.writeI32(self.messageType)
272
      oprot.writeFieldEnd()
3431 rajveer 273
    if self.message is not None:
304 ashish 274
      oprot.writeFieldBegin('message', TType.STRING, 2)
275
      oprot.writeString(self.message)
276
      oprot.writeFieldEnd()
277
    oprot.writeFieldStop()
278
    oprot.writeStructEnd()
279
 
3431 rajveer 280
  def validate(self):
281
    return
282
 
283
 
304 ashish 284
  def __repr__(self):
285
    L = ['%s=%r' % (key, value)
286
      for key, value in self.__dict__.iteritems()]
287
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
288
 
289
  def __eq__(self, other):
290
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
291
 
292
  def __ne__(self, other):
293
    return not (self == other)
294
 
295
class log_result:
296
 
297
  thrift_spec = (
298
  )
299
 
300
  def read(self, iprot):
301
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
302
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
303
      return
304
    iprot.readStructBegin()
305
    while True:
306
      (fname, ftype, fid) = iprot.readFieldBegin()
307
      if ftype == TType.STOP:
308
        break
309
      else:
310
        iprot.skip(ftype)
311
      iprot.readFieldEnd()
312
    iprot.readStructEnd()
313
 
314
  def write(self, oprot):
315
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
316
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
317
      return
318
    oprot.writeStructBegin('log_result')
319
    oprot.writeFieldStop()
320
    oprot.writeStructEnd()
321
 
3431 rajveer 322
  def validate(self):
323
    return
324
 
325
 
304 ashish 326
  def __repr__(self):
327
    L = ['%s=%r' % (key, value)
328
      for key, value in self.__dict__.iteritems()]
329
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
330
 
331
  def __eq__(self, other):
332
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
333
 
334
  def __ne__(self, other):
335
    return not (self == other)