Subversion Repositories SmartDukaan

Rev

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

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