Subversion Repositories SmartDukaan

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
3376 rajveer 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:
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
35
    if oprot != None:
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()
63
    if result.success != None:
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
 
168
  def __repr__(self):
169
    L = ['%s=%r' % (key, value)
170
      for key, value in self.__dict__.iteritems()]
171
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
172
 
173
  def __eq__(self, other):
174
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
175
 
176
  def __ne__(self, other):
177
    return not (self == other)
178
 
179
class isAlive_result:
180
  """
181
  Attributes:
182
   - success
183
  """
184
 
185
  thrift_spec = (
186
    (0, TType.BOOL, 'success', None, None, ), # 0
187
  )
188
 
189
  def __init__(self, success=None,):
190
    self.success = success
191
 
192
  def read(self, iprot):
193
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
194
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
195
      return
196
    iprot.readStructBegin()
197
    while True:
198
      (fname, ftype, fid) = iprot.readFieldBegin()
199
      if ftype == TType.STOP:
200
        break
201
      if fid == 0:
202
        if ftype == TType.BOOL:
203
          self.success = iprot.readBool();
204
        else:
205
          iprot.skip(ftype)
206
      else:
207
        iprot.skip(ftype)
208
      iprot.readFieldEnd()
209
    iprot.readStructEnd()
210
 
211
  def write(self, oprot):
212
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
213
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
214
      return
215
    oprot.writeStructBegin('isAlive_result')
216
    if self.success != None:
217
      oprot.writeFieldBegin('success', TType.BOOL, 0)
218
      oprot.writeBool(self.success)
219
      oprot.writeFieldEnd()
220
    oprot.writeFieldStop()
221
    oprot.writeStructEnd()
222
 
223
  def __repr__(self):
224
    L = ['%s=%r' % (key, value)
225
      for key, value in self.__dict__.iteritems()]
226
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
227
 
228
  def __eq__(self, other):
229
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
230
 
231
  def __ne__(self, other):
232
    return not (self == other)
233
 
234
class closeSession_args:
235
 
236
  thrift_spec = (
237
  )
238
 
239
  def read(self, iprot):
240
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
241
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
242
      return
243
    iprot.readStructBegin()
244
    while True:
245
      (fname, ftype, fid) = iprot.readFieldBegin()
246
      if ftype == TType.STOP:
247
        break
248
      else:
249
        iprot.skip(ftype)
250
      iprot.readFieldEnd()
251
    iprot.readStructEnd()
252
 
253
  def write(self, oprot):
254
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
255
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
256
      return
257
    oprot.writeStructBegin('closeSession_args')
258
    oprot.writeFieldStop()
259
    oprot.writeStructEnd()
260
 
261
  def __repr__(self):
262
    L = ['%s=%r' % (key, value)
263
      for key, value in self.__dict__.iteritems()]
264
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
265
 
266
  def __eq__(self, other):
267
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
268
 
269
  def __ne__(self, other):
270
    return not (self == other)
271
 
272
class closeSession_result:
273
 
274
  thrift_spec = (
275
  )
276
 
277
  def read(self, iprot):
278
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
279
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
280
      return
281
    iprot.readStructBegin()
282
    while True:
283
      (fname, ftype, fid) = iprot.readFieldBegin()
284
      if ftype == TType.STOP:
285
        break
286
      else:
287
        iprot.skip(ftype)
288
      iprot.readFieldEnd()
289
    iprot.readStructEnd()
290
 
291
  def write(self, oprot):
292
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
293
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
294
      return
295
    oprot.writeStructBegin('closeSession_result')
296
    oprot.writeFieldStop()
297
    oprot.writeStructEnd()
298
 
299
  def __repr__(self):
300
    L = ['%s=%r' % (key, value)
301
      for key, value in self.__dict__.iteritems()]
302
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
303
 
304
  def __eq__(self, other):
305
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
306
 
307
  def __ne__(self, other):
308
    return not (self == other)
309
 
310