Refactored thrift communication module Added databridge additional classes Completed log publishing from agent
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/700a6d26 Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/700a6d26 Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/700a6d26 Branch: refs/heads/master Commit: 700a6d26780b5e54975f65aa0c392e048845f3bd Parents: f4b2b5c Author: Chamila de Alwis <[email protected]> Authored: Wed Oct 1 02:40:14 2014 +0530 Committer: Chamila de Alwis <[email protected]> Committed: Thu Oct 9 15:40:12 2014 +0530 ---------------------------------------------------------------------- .../cartridge-agent/agent.py | 37 +- .../modules/databridge/__init__.py | 0 .../cartridge-agent/modules/databridge/agent.py | 164 ++ .../modules/databridge/thrift/__init__.py | 0 .../databridge/thrift/gen-py/Data/__init__.py | 1 + .../databridge/thrift/gen-py/Data/constants.py | 8 + .../databridge/thrift/gen-py/Data/ttypes.py | 320 ++++ .../thrift/gen-py/Exception/__init__.py | 1 + .../thrift/gen-py/Exception/constants.py | 8 + .../thrift/gen-py/Exception/ttypes.py | 473 ++++++ .../ThriftEventTransmissionService-remote | 117 ++ .../ThriftEventTransmissionService.py | 1143 ++++++++++++++ .../ThriftEventTransmissionService/__init__.py | 1 + .../ThriftEventTransmissionService/constants.py | 8 + .../ThriftEventTransmissionService/ttypes.py | 21 + .../ThriftSecureEventTransmissionService-remote | 131 ++ .../ThriftSecureEventTransmissionService.py | 1493 +++++++++++++++++ .../__init__.py | 1 + .../constants.py | 8 + .../ttypes.py | 21 + .../databridge/thrift/gen-py/__init__.py | 0 .../modules/databridge/thrift/publisher.py | 94 ++ .../modules/databridge/thrift/thrift/TSCons.py | 35 + .../databridge/thrift/thrift/TSerialization.py | 38 + .../databridge/thrift/thrift/TTornado.py | 153 ++ .../modules/databridge/thrift/thrift/Thrift.py | 170 ++ .../databridge/thrift/thrift/__init__.py | 20 + .../databridge/thrift/thrift/protocol/TBase.py | 81 + .../thrift/thrift/protocol/TBinaryProtocol.py | 261 +++ .../thrift/thrift/protocol/TCompactProtocol.py | 405 +++++ .../thrift/thrift/protocol/TJSONProtocol.py | 552 +++++++ .../thrift/thrift/protocol/TProtocol.py | 406 +++++ .../thrift/thrift/protocol/__init__.py | 20 + .../thrift/thrift/protocol/fastbinary.c | 1219 ++++++++++++++ .../thrift/thrift/server/THttpServer.py | 87 + .../thrift/thrift/server/TNonblockingServer.py | 346 ++++ .../thrift/thrift/server/TProcessPoolServer.py | 118 ++ .../databridge/thrift/thrift/server/TServer.py | 269 ++++ .../databridge/thrift/thrift/server/__init__.py | 20 + .../thrift/thrift/transport/THttpClient.py | 147 ++ .../thrift/thrift/transport/TSSLSocket.py | 214 +++ .../thrift/thrift/transport/TSocket.py | 176 +++ .../thrift/thrift/transport/TTransport.py | 330 ++++ .../thrift/thrift/transport/TTwisted.py | 221 +++ .../thrift/thrift/transport/TZlibTransport.py | 249 +++ .../thrift/thrift/transport/__init__.py | 20 + .../modules/datapublisher/__init__.py | 1 + .../modules/datapublisher/exception/__init__.py | 1 + .../exception/datapublisherexception.py | 13 + .../modules/datapublisher/logpublisher.py | 238 +++ .../modules/logpublisher/__init__.py | 1 - .../modules/logpublisher/logpublisher.py | 71 - .../modules/thriftcom/Publisher.py | 94 -- .../modules/thriftcom/__init__.py | 0 .../modules/thriftcom/gen-py/Data/__init__.py | 1 - .../modules/thriftcom/gen-py/Data/constants.py | 11 - .../modules/thriftcom/gen-py/Data/ttypes.py | 320 ---- .../thriftcom/gen-py/Exception/__init__.py | 1 - .../thriftcom/gen-py/Exception/constants.py | 11 - .../thriftcom/gen-py/Exception/ttypes.py | 473 ------ .../ThriftEventTransmissionService-remote | 116 -- .../ThriftEventTransmissionService.py | 1144 -------------- .../ThriftEventTransmissionService/__init__.py | 1 - .../ThriftEventTransmissionService/constants.py | 11 - .../ThriftEventTransmissionService/ttypes.py | 21 - .../ThriftSecureEventTransmissionService-remote | 130 -- .../ThriftSecureEventTransmissionService.py | 1494 ------------------ .../__init__.py | 1 - .../constants.py | 11 - .../ttypes.py | 21 - .../modules/thriftcom/gen-py/__init__.py | 0 .../modules/thriftcom/thrift/TSCons.py | 35 - .../modules/thriftcom/thrift/TSerialization.py | 38 - .../modules/thriftcom/thrift/TTornado.py | 153 -- .../modules/thriftcom/thrift/Thrift.py | 170 -- .../modules/thriftcom/thrift/__init__.py | 20 - .../modules/thriftcom/thrift/protocol/TBase.py | 81 - .../thrift/protocol/TBinaryProtocol.py | 260 --- .../thrift/protocol/TCompactProtocol.py | 403 ----- .../thriftcom/thrift/protocol/TJSONProtocol.py | 550 ------- .../thriftcom/thrift/protocol/TProtocol.py | 406 ----- .../thriftcom/thrift/protocol/__init__.py | 20 - .../thriftcom/thrift/protocol/fastbinary.c | 1219 -------------- .../thriftcom/thrift/server/THttpServer.py | 87 - .../thrift/server/TNonblockingServer.py | 346 ---- .../thrift/server/TProcessPoolServer.py | 118 -- .../modules/thriftcom/thrift/server/TServer.py | 269 ---- .../modules/thriftcom/thrift/server/__init__.py | 20 - .../thriftcom/thrift/transport/THttpClient.py | 149 -- .../thriftcom/thrift/transport/TSSLSocket.py | 214 --- .../thriftcom/thrift/transport/TSocket.py | 176 --- .../thriftcom/thrift/transport/TTransport.py | 330 ---- .../thriftcom/thrift/transport/TTwisted.py | 221 --- .../thrift/transport/TZlibTransport.py | 248 --- .../thriftcom/thrift/transport/__init__.py | 20 - 95 files changed, 9855 insertions(+), 9491 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/stratos/blob/700a6d26/tools/python-cartridge-agent/cartridge-agent/agent.py ---------------------------------------------------------------------- diff --git a/tools/python-cartridge-agent/cartridge-agent/agent.py b/tools/python-cartridge-agent/cartridge-agent/agent.py index ae85a5d..5ae7664 100644 --- a/tools/python-cartridge-agent/cartridge-agent/agent.py +++ b/tools/python-cartridge-agent/cartridge-agent/agent.py @@ -13,6 +13,7 @@ from modules.event.tenant.events import * from modules.event.topology.events import * from modules.tenant.tenantcontext import * from modules.topology.topologycontext import * +from modules.datapublisher.logpublisher import * class CartridgeAgent(threading.Thread): @@ -32,6 +33,10 @@ class CartridgeAgent(threading.Thread): self.__tenant_context_initialized = False self.__topology_context_initialized = False + self.log_publish_manager = None + + self.terminated = False + def run(self): self.log.info("Starting Cartridge Agent...") @@ -77,14 +82,33 @@ class CartridgeAgent(threading.Thread): if persistence_mappping_payload is not None: self.extension_handler.volume_mount_extension(persistence_mappping_payload) - # TODO: logpublisher shceduled event + # start log publishing thread + if DataPublisherConfiguration.get_instance().enabled: + log_file_paths = CartridgeAgentConfiguration.log_file_paths + if log_file_paths is None: + self.log.exception("No valid log file paths found, no logs will be published") + else: + self.log_publish_manager = LogPublisherManager(log_file_paths) + self.log_publish_manager.start() + + while not self.terminated: + time.sleep(1) + + if DataPublisherConfiguration.get_instance().enabled: + self.log_publish_manager.terminate_all_publishers() - #TODO: wait until terminated is true + def terminate(self): + """ + Allows the CartridgeAgent thread to be terminated + + :return: void + """ + self.terminated = True def validate_required_properties(self): """ Checks if required properties are set - :return: True if + :return: void """ # JNDI_PROPERTIES_DIR try: @@ -256,8 +280,11 @@ class CartridgeAgent(threading.Thread): def main(): - cartridge_agent = CartridgeAgent() - cartridge_agent.start() + try: + cartridge_agent = CartridgeAgent() + cartridge_agent.start() + except: + cartridge_agent.terminate() if __name__ == "__main__": http://git-wip-us.apache.org/repos/asf/stratos/blob/700a6d26/tools/python-cartridge-agent/cartridge-agent/modules/databridge/__init__.py ---------------------------------------------------------------------- diff --git a/tools/python-cartridge-agent/cartridge-agent/modules/databridge/__init__.py b/tools/python-cartridge-agent/cartridge-agent/modules/databridge/__init__.py new file mode 100644 index 0000000..e69de29 http://git-wip-us.apache.org/repos/asf/stratos/blob/700a6d26/tools/python-cartridge-agent/cartridge-agent/modules/databridge/agent.py ---------------------------------------------------------------------- diff --git a/tools/python-cartridge-agent/cartridge-agent/modules/databridge/agent.py b/tools/python-cartridge-agent/cartridge-agent/modules/databridge/agent.py new file mode 100644 index 0000000..03d5f31 --- /dev/null +++ b/tools/python-cartridge-agent/cartridge-agent/modules/databridge/agent.py @@ -0,0 +1,164 @@ +from thrift.publisher import * +import logging + + +class StreamDefinition: + """ + Represents a BAM/CEP stream definition + """ + def __init__(self): + self.name = None + """:type : str""" + self.version = None + """:type : str""" + self.nickname = None + """:type : str""" + self.description = None + """:type : str""" + self.meta_data = [] + """:type : list[str]""" + self.correlation_data = [] + """:type : list[str]""" + self.payload_data = [] + """:type : list[str]""" + + def add_metadata_attribute(self, name, type): + self.meta_data.append({"name": name, "type": type}) + + def add_payloaddata_attribute(self, name, type): + self.payload_data.append({"name": name, "type": type}) + + def add_correlationdata_attribute(self, name, type): + self.correlation_data.append({"name": name, "type": type}) + + def __str__(self): + """ + To string override + """ + + json_str = "{" + json_str += "\"name\":\"" + self.name + "\"," + json_str += "\"version\":\"" + self.version + "\"," + json_str += "\"nickName\":\"" + self.nickname + "\"," + json_str += "\"description\":\"" + self.description + "\"," + + # add metadata attributes if exists + if len(self.meta_data > 0): + json_str += "\"metaData\":[" + for metadatum in self.meta_data: + json_str += "{\"name\":\"" + metadatum["name"] + ", \"type\": \"" + metadatum["type"] + "\"}," + + json_str = json_str[:-1] + "]," + + # add correlationdata attributes if exists + if len(self.correlation_data > 0): + json_str += "\"correlationData\":[" + for coredatum in self.correlation_data: + json_str += "{\"name\":\"" + coredatum["name"] + ", \"type\": \"" + coredatum["type"] + "\"}," + + json_str = json_str[:-1] + "]," + + # add payloaddata attributes if exists + if len(self.payload_data > 0): + json_str += "\"payloadData\":[" + for payloaddatum in self.payload_data: + json_str += "{\"name\":\"" + payloaddatum["name"] + ", \"type\": \"" + payloaddatum["type"] + "\"}," + + json_str = json_str[:-1] + "]," + + json_str = json_str[:-1] + "}" + + return json_str + + +class LogEvent: + """ + Represents an event to be published to a BAM/CEP monitoring server + """ + def __init__(self): + self.metaData = [] + """:type : list[str]""" + self.correlationData = [] + """:type : list[str]""" + self.payloadData = [] + """:type : list[str]""" + + +class ThriftPublisher: + """ + Handles publishing events to BAM/CEP through thrift using the provided address and credentials + """ + logging.basicConfig(level=logging.DEBUG) + log = logging.getLogger(__name__) + + def __init__(self, ip, port, username, password, stream_definition): + """ + Initializes a ThriftPublisher object. + + At initialization a ThriftPublisher connects and defines a stream definition. A connection + should be disconnected after all the publishing has been done. + + :param str ip: IP address of the monitoring server + :param str port: Port of the monitoring server + :param str username: Username + :param str password: Password + :param StreamDefinition stream_definition: StreamDefinition object for this particular connection + :return: ThriftPublisher object + :rtype: ThriftPublisher + """ + self.__publisher = Publisher(ip, port) + self.__publisher.connect(username, password) + self.__publisher.defineStream(str(stream_definition)) + + def publish(self, event): + """ + Publishes the given event by creating the event bundle from the log event + + :param LogEvent event: The log event to be published + :return: void + """ + event_bundler = EventBundle() + ThriftPublisher.assign_attributes(event.metaData, event_bundler) + ThriftPublisher.assign_attributes(event.correlationData, event_bundler) + ThriftPublisher.assign_attributes(event.payloadData, event_bundler) + + self.__publisher.publish(event) + + def disconnect(self): + """ + Disconnect the thrift publisher + :return: void + """ + self.__publisher.disconnect() + + @staticmethod + def assign_attributes(attributes, event_bundler): + """ + Adds the given attributes to the given event bundler according to type of each attribute + :param list attributes: attributes to be assigned + :param EventBundle event_bundler: Event bundle to assign attributes to + :return: void + """ + + # __intAttributeList = [] + # __longAttributeList = [] + # __doubleAttributeList = [] + # __boolAttributeList = [] + # __stringAttributeList = [] + + if attributes is not None and len(attributes) > 0: + for attrib in attributes: + if isinstance(attrib, int): + event_bundler.addIntAttribute(attrib) + elif isinstance(attrib, long): + event_bundler.addLongAttribute(attrib) + elif isinstance(attrib, float): + event_bundler.addDoubleAttribute(attrib) + elif isinstance(attrib, bool): + event_bundler.addBoolAttribute(attrib) + elif isinstance(attrib, str): + event_bundler.addStringAttribute(attrib) + else: + ThriftPublisher.log.error("Undefined attribute type: %r" % attrib) + + ThriftPublisher.log.debug("Empty attribute list") http://git-wip-us.apache.org/repos/asf/stratos/blob/700a6d26/tools/python-cartridge-agent/cartridge-agent/modules/databridge/thrift/__init__.py ---------------------------------------------------------------------- diff --git a/tools/python-cartridge-agent/cartridge-agent/modules/databridge/thrift/__init__.py b/tools/python-cartridge-agent/cartridge-agent/modules/databridge/thrift/__init__.py new file mode 100644 index 0000000..e69de29 http://git-wip-us.apache.org/repos/asf/stratos/blob/700a6d26/tools/python-cartridge-agent/cartridge-agent/modules/databridge/thrift/gen-py/Data/__init__.py ---------------------------------------------------------------------- diff --git a/tools/python-cartridge-agent/cartridge-agent/modules/databridge/thrift/gen-py/Data/__init__.py b/tools/python-cartridge-agent/cartridge-agent/modules/databridge/thrift/gen-py/Data/__init__.py new file mode 100644 index 0000000..adefd8e --- /dev/null +++ b/tools/python-cartridge-agent/cartridge-agent/modules/databridge/thrift/gen-py/Data/__init__.py @@ -0,0 +1 @@ +__all__ = ['ttypes', 'constants'] http://git-wip-us.apache.org/repos/asf/stratos/blob/700a6d26/tools/python-cartridge-agent/cartridge-agent/modules/databridge/thrift/gen-py/Data/constants.py ---------------------------------------------------------------------- diff --git a/tools/python-cartridge-agent/cartridge-agent/modules/databridge/thrift/gen-py/Data/constants.py b/tools/python-cartridge-agent/cartridge-agent/modules/databridge/thrift/gen-py/Data/constants.py new file mode 100644 index 0000000..36943ba --- /dev/null +++ b/tools/python-cartridge-agent/cartridge-agent/modules/databridge/thrift/gen-py/Data/constants.py @@ -0,0 +1,8 @@ +# +# Autogenerated by Thrift Compiler (0.9.1) +# +# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING +# +# options string: py +# + http://git-wip-us.apache.org/repos/asf/stratos/blob/700a6d26/tools/python-cartridge-agent/cartridge-agent/modules/databridge/thrift/gen-py/Data/ttypes.py ---------------------------------------------------------------------- diff --git a/tools/python-cartridge-agent/cartridge-agent/modules/databridge/thrift/gen-py/Data/ttypes.py b/tools/python-cartridge-agent/cartridge-agent/modules/databridge/thrift/gen-py/Data/ttypes.py new file mode 100644 index 0000000..642c550 --- /dev/null +++ b/tools/python-cartridge-agent/cartridge-agent/modules/databridge/thrift/gen-py/Data/ttypes.py @@ -0,0 +1,320 @@ +# +# Autogenerated by Thrift Compiler (0.9.1) +# +# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING +# +# options string: py +# + +from thrift.Thrift import TType, TMessageType, TException, TApplicationException + +from thrift.transport import TTransport +from thrift.protocol import TBinaryProtocol, TProtocol +try: + from thrift.protocol import fastbinary +except: + fastbinary = None + + +class ThriftAttributeType: + INT = 0 + LONG = 1 + FLOAT = 2 + DOUBLE = 3 + BOOL = 4 + STRING = 5 + + _VALUES_TO_NAMES = { + 0: "INT", + 1: "LONG", + 2: "FLOAT", + 3: "DOUBLE", + 4: "BOOL", + 5: "STRING", + } + + _NAMES_TO_VALUES = { + "INT": 0, + "LONG": 1, + "FLOAT": 2, + "DOUBLE": 3, + "BOOL": 4, + "STRING": 5, + } + + +class ThriftAttribute: + """ + Attributes: + - name + - attributeType + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRING, 'name', None, None, ), # 1 + (2, TType.I32, 'attributeType', None, None, ), # 2 + ) + + def __init__(self, name=None, attributeType=None,): + self.name = name + self.attributeType = attributeType + + def read(self, iprot): + if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None: + fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRING: + self.name = iprot.readString(); + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.I32: + self.attributeType = iprot.readI32(); + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None: + oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('ThriftAttribute') + if self.name is not None: + oprot.writeFieldBegin('name', TType.STRING, 1) + oprot.writeString(self.name) + oprot.writeFieldEnd() + if self.attributeType is not None: + oprot.writeFieldBegin('attributeType', TType.I32, 2) + oprot.writeI32(self.attributeType) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.iteritems()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + +class ThriftEventBundle: + """ + Attributes: + - sessionId + - eventNum + - intAttributeList + - longAttributeList + - doubleAttributeList + - boolAttributeList + - stringAttributeList + - arbitraryDataMapMap + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRING, 'sessionId', None, None, ), # 1 + (2, TType.I32, 'eventNum', None, None, ), # 2 + (3, TType.LIST, 'intAttributeList', (TType.I32,None), None, ), # 3 + (4, TType.LIST, 'longAttributeList', (TType.I64,None), None, ), # 4 + (5, TType.LIST, 'doubleAttributeList', (TType.DOUBLE,None), None, ), # 5 + (6, TType.LIST, 'boolAttributeList', (TType.BOOL,None), None, ), # 6 + (7, TType.LIST, 'stringAttributeList', (TType.STRING,None), None, ), # 7 + (8, TType.MAP, 'arbitraryDataMapMap', (TType.I32,None,TType.MAP,(TType.STRING,None,TType.STRING,None)), None, ), # 8 + ) + + def __init__(self, sessionId=None, eventNum=None, intAttributeList=None, longAttributeList=None, doubleAttributeList=None, boolAttributeList=None, stringAttributeList=None, arbitraryDataMapMap=None,): + self.sessionId = sessionId + self.eventNum = eventNum + self.intAttributeList = intAttributeList + self.longAttributeList = longAttributeList + self.doubleAttributeList = doubleAttributeList + self.boolAttributeList = boolAttributeList + self.stringAttributeList = stringAttributeList + self.arbitraryDataMapMap = arbitraryDataMapMap + + def read(self, iprot): + if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None: + fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRING: + self.sessionId = iprot.readString(); + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.I32: + self.eventNum = iprot.readI32(); + else: + iprot.skip(ftype) + elif fid == 3: + if ftype == TType.LIST: + self.intAttributeList = [] + (_etype3, _size0) = iprot.readListBegin() + for _i4 in xrange(_size0): + _elem5 = iprot.readI32(); + self.intAttributeList.append(_elem5) + iprot.readListEnd() + else: + iprot.skip(ftype) + elif fid == 4: + if ftype == TType.LIST: + self.longAttributeList = [] + (_etype9, _size6) = iprot.readListBegin() + for _i10 in xrange(_size6): + _elem11 = iprot.readI64(); + self.longAttributeList.append(_elem11) + iprot.readListEnd() + else: + iprot.skip(ftype) + elif fid == 5: + if ftype == TType.LIST: + self.doubleAttributeList = [] + (_etype15, _size12) = iprot.readListBegin() + for _i16 in xrange(_size12): + _elem17 = iprot.readDouble(); + self.doubleAttributeList.append(_elem17) + iprot.readListEnd() + else: + iprot.skip(ftype) + elif fid == 6: + if ftype == TType.LIST: + self.boolAttributeList = [] + (_etype21, _size18) = iprot.readListBegin() + for _i22 in xrange(_size18): + _elem23 = iprot.readBool(); + self.boolAttributeList.append(_elem23) + iprot.readListEnd() + else: + iprot.skip(ftype) + elif fid == 7: + if ftype == TType.LIST: + self.stringAttributeList = [] + (_etype27, _size24) = iprot.readListBegin() + for _i28 in xrange(_size24): + _elem29 = iprot.readString(); + self.stringAttributeList.append(_elem29) + iprot.readListEnd() + else: + iprot.skip(ftype) + elif fid == 8: + if ftype == TType.MAP: + self.arbitraryDataMapMap = {} + (_ktype31, _vtype32, _size30 ) = iprot.readMapBegin() + for _i34 in xrange(_size30): + _key35 = iprot.readI32(); + _val36 = {} + (_ktype38, _vtype39, _size37 ) = iprot.readMapBegin() + for _i41 in xrange(_size37): + _key42 = iprot.readString(); + _val43 = iprot.readString(); + _val36[_key42] = _val43 + iprot.readMapEnd() + self.arbitraryDataMapMap[_key35] = _val36 + iprot.readMapEnd() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None: + oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('ThriftEventBundle') + if self.sessionId is not None: + oprot.writeFieldBegin('sessionId', TType.STRING, 1) + oprot.writeString(self.sessionId) + oprot.writeFieldEnd() + if self.eventNum is not None: + oprot.writeFieldBegin('eventNum', TType.I32, 2) + oprot.writeI32(self.eventNum) + oprot.writeFieldEnd() + if self.intAttributeList is not None: + oprot.writeFieldBegin('intAttributeList', TType.LIST, 3) + oprot.writeListBegin(TType.I32, len(self.intAttributeList)) + for iter44 in self.intAttributeList: + oprot.writeI32(iter44) + oprot.writeListEnd() + oprot.writeFieldEnd() + if self.longAttributeList is not None: + oprot.writeFieldBegin('longAttributeList', TType.LIST, 4) + oprot.writeListBegin(TType.I64, len(self.longAttributeList)) + for iter45 in self.longAttributeList: + oprot.writeI64(iter45) + oprot.writeListEnd() + oprot.writeFieldEnd() + if self.doubleAttributeList is not None: + oprot.writeFieldBegin('doubleAttributeList', TType.LIST, 5) + oprot.writeListBegin(TType.DOUBLE, len(self.doubleAttributeList)) + for iter46 in self.doubleAttributeList: + oprot.writeDouble(iter46) + oprot.writeListEnd() + oprot.writeFieldEnd() + if self.boolAttributeList is not None: + oprot.writeFieldBegin('boolAttributeList', TType.LIST, 6) + oprot.writeListBegin(TType.BOOL, len(self.boolAttributeList)) + for iter47 in self.boolAttributeList: + oprot.writeBool(iter47) + oprot.writeListEnd() + oprot.writeFieldEnd() + if self.stringAttributeList is not None: + oprot.writeFieldBegin('stringAttributeList', TType.LIST, 7) + oprot.writeListBegin(TType.STRING, len(self.stringAttributeList)) + for iter48 in self.stringAttributeList: + oprot.writeString(iter48) + oprot.writeListEnd() + oprot.writeFieldEnd() + if self.arbitraryDataMapMap is not None: + oprot.writeFieldBegin('arbitraryDataMapMap', TType.MAP, 8) + oprot.writeMapBegin(TType.I32, TType.MAP, len(self.arbitraryDataMapMap)) + for kiter49,viter50 in self.arbitraryDataMapMap.items(): + oprot.writeI32(kiter49) + oprot.writeMapBegin(TType.STRING, TType.STRING, len(viter50)) + for kiter51,viter52 in viter50.items(): + oprot.writeString(kiter51) + oprot.writeString(viter52) + oprot.writeMapEnd() + oprot.writeMapEnd() + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.iteritems()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) http://git-wip-us.apache.org/repos/asf/stratos/blob/700a6d26/tools/python-cartridge-agent/cartridge-agent/modules/databridge/thrift/gen-py/Exception/__init__.py ---------------------------------------------------------------------- diff --git a/tools/python-cartridge-agent/cartridge-agent/modules/databridge/thrift/gen-py/Exception/__init__.py b/tools/python-cartridge-agent/cartridge-agent/modules/databridge/thrift/gen-py/Exception/__init__.py new file mode 100644 index 0000000..adefd8e --- /dev/null +++ b/tools/python-cartridge-agent/cartridge-agent/modules/databridge/thrift/gen-py/Exception/__init__.py @@ -0,0 +1 @@ +__all__ = ['ttypes', 'constants'] http://git-wip-us.apache.org/repos/asf/stratos/blob/700a6d26/tools/python-cartridge-agent/cartridge-agent/modules/databridge/thrift/gen-py/Exception/constants.py ---------------------------------------------------------------------- diff --git a/tools/python-cartridge-agent/cartridge-agent/modules/databridge/thrift/gen-py/Exception/constants.py b/tools/python-cartridge-agent/cartridge-agent/modules/databridge/thrift/gen-py/Exception/constants.py new file mode 100644 index 0000000..36943ba --- /dev/null +++ b/tools/python-cartridge-agent/cartridge-agent/modules/databridge/thrift/gen-py/Exception/constants.py @@ -0,0 +1,8 @@ +# +# Autogenerated by Thrift Compiler (0.9.1) +# +# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING +# +# options string: py +# + http://git-wip-us.apache.org/repos/asf/stratos/blob/700a6d26/tools/python-cartridge-agent/cartridge-agent/modules/databridge/thrift/gen-py/Exception/ttypes.py ---------------------------------------------------------------------- diff --git a/tools/python-cartridge-agent/cartridge-agent/modules/databridge/thrift/gen-py/Exception/ttypes.py b/tools/python-cartridge-agent/cartridge-agent/modules/databridge/thrift/gen-py/Exception/ttypes.py new file mode 100644 index 0000000..c69fb5e --- /dev/null +++ b/tools/python-cartridge-agent/cartridge-agent/modules/databridge/thrift/gen-py/Exception/ttypes.py @@ -0,0 +1,473 @@ +# +# Autogenerated by Thrift Compiler (0.9.1) +# +# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING +# +# options string: py +# + +from thrift.Thrift import TType, TMessageType, TException, TApplicationException + +from thrift.transport import TTransport +from thrift.protocol import TBinaryProtocol, TProtocol +try: + from thrift.protocol import fastbinary +except: + fastbinary = None + + + +class ThriftStreamDefinitionException(TException): + """ + Attributes: + - message + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRING, 'message', None, None, ), # 1 + ) + + def __init__(self, message=None,): + self.message = message + + def read(self, iprot): + if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None: + fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRING: + self.message = iprot.readString(); + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None: + oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('ThriftStreamDefinitionException') + if self.message is not None: + oprot.writeFieldBegin('message', TType.STRING, 1) + oprot.writeString(self.message) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.message is None: + raise TProtocol.TProtocolException(message='Required field message is unset!') + return + + + def __str__(self): + return repr(self) + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.iteritems()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + +class ThriftNoStreamDefinitionExistException(TException): + """ + Attributes: + - message + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRING, 'message', None, None, ), # 1 + ) + + def __init__(self, message=None,): + self.message = message + + def read(self, iprot): + if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None: + fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRING: + self.message = iprot.readString(); + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None: + oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('ThriftNoStreamDefinitionExistException') + if self.message is not None: + oprot.writeFieldBegin('message', TType.STRING, 1) + oprot.writeString(self.message) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.message is None: + raise TProtocol.TProtocolException(message='Required field message is unset!') + return + + + def __str__(self): + return repr(self) + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.iteritems()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + +class ThriftDifferentStreamDefinitionAlreadyDefinedException(TException): + """ + Attributes: + - message + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRING, 'message', None, None, ), # 1 + ) + + def __init__(self, message=None,): + self.message = message + + def read(self, iprot): + if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None: + fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRING: + self.message = iprot.readString(); + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None: + oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('ThriftDifferentStreamDefinitionAlreadyDefinedException') + if self.message is not None: + oprot.writeFieldBegin('message', TType.STRING, 1) + oprot.writeString(self.message) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.message is None: + raise TProtocol.TProtocolException(message='Required field message is unset!') + return + + + def __str__(self): + return repr(self) + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.iteritems()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + +class ThriftMalformedStreamDefinitionException(TException): + """ + Attributes: + - message + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRING, 'message', None, None, ), # 1 + ) + + def __init__(self, message=None,): + self.message = message + + def read(self, iprot): + if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None: + fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRING: + self.message = iprot.readString(); + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None: + oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('ThriftMalformedStreamDefinitionException') + if self.message is not None: + oprot.writeFieldBegin('message', TType.STRING, 1) + oprot.writeString(self.message) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.message is None: + raise TProtocol.TProtocolException(message='Required field message is unset!') + return + + + def __str__(self): + return repr(self) + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.iteritems()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + +class ThriftUndefinedEventTypeException(TException): + """ + Attributes: + - message + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRING, 'message', None, None, ), # 1 + ) + + def __init__(self, message=None,): + self.message = message + + def read(self, iprot): + if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None: + fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRING: + self.message = iprot.readString(); + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None: + oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('ThriftUndefinedEventTypeException') + if self.message is not None: + oprot.writeFieldBegin('message', TType.STRING, 1) + oprot.writeString(self.message) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.message is None: + raise TProtocol.TProtocolException(message='Required field message is unset!') + return + + + def __str__(self): + return repr(self) + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.iteritems()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + +class ThriftSessionExpiredException(TException): + """ + Attributes: + - message + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRING, 'message', None, None, ), # 1 + ) + + def __init__(self, message=None,): + self.message = message + + def read(self, iprot): + if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None: + fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRING: + self.message = iprot.readString(); + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None: + oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('ThriftSessionExpiredException') + if self.message is not None: + oprot.writeFieldBegin('message', TType.STRING, 1) + oprot.writeString(self.message) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.message is None: + raise TProtocol.TProtocolException(message='Required field message is unset!') + return + + + def __str__(self): + return repr(self) + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.iteritems()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + +class ThriftAuthenticationException(TException): + """ + Attributes: + - message + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRING, 'message', None, None, ), # 1 + ) + + def __init__(self, message=None,): + self.message = message + + def read(self, iprot): + if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None: + fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRING: + self.message = iprot.readString(); + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None: + oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('ThriftAuthenticationException') + if self.message is not None: + oprot.writeFieldBegin('message', TType.STRING, 1) + oprot.writeString(self.message) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.message is None: + raise TProtocol.TProtocolException(message='Required field message is unset!') + return + + + def __str__(self): + return repr(self) + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.iteritems()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) http://git-wip-us.apache.org/repos/asf/stratos/blob/700a6d26/tools/python-cartridge-agent/cartridge-agent/modules/databridge/thrift/gen-py/ThriftEventTransmissionService/ThriftEventTransmissionService-remote ---------------------------------------------------------------------- diff --git a/tools/python-cartridge-agent/cartridge-agent/modules/databridge/thrift/gen-py/ThriftEventTransmissionService/ThriftEventTransmissionService-remote b/tools/python-cartridge-agent/cartridge-agent/modules/databridge/thrift/gen-py/ThriftEventTransmissionService/ThriftEventTransmissionService-remote new file mode 100755 index 0000000..0d18f58 --- /dev/null +++ b/tools/python-cartridge-agent/cartridge-agent/modules/databridge/thrift/gen-py/ThriftEventTransmissionService/ThriftEventTransmissionService-remote @@ -0,0 +1,117 @@ +#!/usr/bin/env python +# +# Autogenerated by Thrift Compiler (0.9.1) +# +# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING +# +# options string: py +# + +import sys +import pprint +from urlparse import urlparse + +from thrift.transport import TTransport +from thrift.transport import TSocket +from thrift.transport import THttpClient +from thrift.protocol import TBinaryProtocol +from ThriftEventTransmissionService import ThriftEventTransmissionService +from ThriftEventTransmissionService.ttypes import * + + +if len(sys.argv) <= 1 or sys.argv[1] == '--help': + print '' + print 'Usage: ' + sys.argv[0] + ' [-h host[:port]] [-u url] [-f[ramed]] function [arg1 [arg2...]]' + print '' + print 'Functions:' + print ' string defineStream(string sessionId, string streamDefinition)' + print ' string findStreamId(string sessionId, string streamName, string streamVersion)' + print ' void publish(ThriftEventBundle eventBundle)' + print ' bool deleteStreamById(string sessionId, string streamId)' + print ' bool deleteStreamByNameVersion(string sessionId, string streamName, string streamVersion)' + print '' + sys.exit(0) + +pp = pprint.PrettyPrinter(indent = 2) +host = 'localhost' +port = 9090 +uri = '' +framed = False +http = False +argi = 1 + +if sys.argv[argi] == '-h': + parts = sys.argv[argi+1].split(':') + host = parts[0] + if len(parts) > 1: + port = int(parts[1]) + argi += 2 + +if sys.argv[argi] == '-u': + url = urlparse(sys.argv[argi+1]) + parts = url[1].split(':') + host = parts[0] + if len(parts) > 1: + port = int(parts[1]) + else: + port = 80 + uri = url[2] + if url[4]: + uri += '?%s' % url[4] + http = True + argi += 2 + +if sys.argv[argi] == '-f' or sys.argv[argi] == '-framed': + framed = True + argi += 1 + +cmd = sys.argv[argi] +args = sys.argv[argi+1:] + +if http: + transport = THttpClient.THttpClient(host, port, uri) +else: + socket = TSocket.TSocket(host, port) + if framed: + transport = TTransport.TFramedTransport(socket) + else: + transport = TTransport.TBufferedTransport(socket) +protocol = TBinaryProtocol.TBinaryProtocol(transport) +client = ThriftEventTransmissionService.Client(protocol) +transport.open() + +if cmd == 'defineStream': + if len(args) != 2: + print 'defineStream requires 2 args' + sys.exit(1) + pp.pprint(client.defineStream(args[0],args[1],)) + +elif cmd == 'findStreamId': + if len(args) != 3: + print 'findStreamId requires 3 args' + sys.exit(1) + pp.pprint(client.findStreamId(args[0],args[1],args[2],)) + +elif cmd == 'publish': + if len(args) != 1: + print 'publish requires 1 args' + sys.exit(1) + pp.pprint(client.publish(eval(args[0]),)) + +elif cmd == 'deleteStreamById': + if len(args) != 2: + print 'deleteStreamById requires 2 args' + sys.exit(1) + pp.pprint(client.deleteStreamById(args[0],args[1],)) + +elif cmd == 'deleteStreamByNameVersion': + if len(args) != 3: + print 'deleteStreamByNameVersion requires 3 args' + sys.exit(1) + pp.pprint(client.deleteStreamByNameVersion(args[0],args[1],args[2],)) + +else: + print 'Unrecognized method %s' % cmd + sys.exit(1) + +transport.close() http://git-wip-us.apache.org/repos/asf/stratos/blob/700a6d26/tools/python-cartridge-agent/cartridge-agent/modules/databridge/thrift/gen-py/ThriftEventTransmissionService/ThriftEventTransmissionService.py ---------------------------------------------------------------------- diff --git a/tools/python-cartridge-agent/cartridge-agent/modules/databridge/thrift/gen-py/ThriftEventTransmissionService/ThriftEventTransmissionService.py b/tools/python-cartridge-agent/cartridge-agent/modules/databridge/thrift/gen-py/ThriftEventTransmissionService/ThriftEventTransmissionService.py new file mode 100644 index 0000000..cb96c29 --- /dev/null +++ b/tools/python-cartridge-agent/cartridge-agent/modules/databridge/thrift/gen-py/ThriftEventTransmissionService/ThriftEventTransmissionService.py @@ -0,0 +1,1143 @@ +# +# Autogenerated by Thrift Compiler (0.9.1) +# +# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING +# +# options string: py +# + +from ttypes import * +from thrift.Thrift import TProcessor +from thrift.transport import TTransport + +try: + from thrift.protocol import fastbinary +except: + fastbinary = None + + +class Iface: + def defineStream(self, sessionId, streamDefinition): + """ + Parameters: + - sessionId + - streamDefinition + """ + pass + + def findStreamId(self, sessionId, streamName, streamVersion): + """ + Parameters: + - sessionId + - streamName + - streamVersion + """ + pass + + def publish(self, eventBundle): + """ + Parameters: + - eventBundle + """ + pass + + def deleteStreamById(self, sessionId, streamId): + """ + Parameters: + - sessionId + - streamId + """ + pass + + def deleteStreamByNameVersion(self, sessionId, streamName, streamVersion): + """ + Parameters: + - sessionId + - streamName + - streamVersion + """ + pass + + +class Client(Iface): + def __init__(self, iprot, oprot=None): + self._iprot = self._oprot = iprot + if oprot is not None: + self._oprot = oprot + self._seqid = 0 + + def defineStream(self, sessionId, streamDefinition): + """ + Parameters: + - sessionId + - streamDefinition + """ + self.send_defineStream(sessionId, streamDefinition) + return self.recv_defineStream() + + def send_defineStream(self, sessionId, streamDefinition): + self._oprot.writeMessageBegin('defineStream', TMessageType.CALL, self._seqid) + args = defineStream_args() + args.sessionId = sessionId + args.streamDefinition = streamDefinition + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_defineStream(self): + (fname, mtype, rseqid) = self._iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(self._iprot) + self._iprot.readMessageEnd() + raise x + result = defineStream_result() + result.read(self._iprot) + self._iprot.readMessageEnd() + if result.success is not None: + return result.success + if result.ade is not None: + raise result.ade + if result.mtd is not None: + raise result.mtd + if result.tde is not None: + raise result.tde + if result.se is not None: + raise result.se + raise TApplicationException(TApplicationException.MISSING_RESULT, "defineStream failed: unknown result"); + + def findStreamId(self, sessionId, streamName, streamVersion): + """ + Parameters: + - sessionId + - streamName + - streamVersion + """ + self.send_findStreamId(sessionId, streamName, streamVersion) + return self.recv_findStreamId() + + def send_findStreamId(self, sessionId, streamName, streamVersion): + self._oprot.writeMessageBegin('findStreamId', TMessageType.CALL, self._seqid) + args = findStreamId_args() + args.sessionId = sessionId + args.streamName = streamName + args.streamVersion = streamVersion + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_findStreamId(self): + (fname, mtype, rseqid) = self._iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(self._iprot) + self._iprot.readMessageEnd() + raise x + result = findStreamId_result() + result.read(self._iprot) + self._iprot.readMessageEnd() + if result.success is not None: + return result.success + if result.tnde is not None: + raise result.tnde + if result.se is not None: + raise result.se + raise TApplicationException(TApplicationException.MISSING_RESULT, "findStreamId failed: unknown result"); + + def publish(self, eventBundle): + """ + Parameters: + - eventBundle + """ + self.send_publish(eventBundle) + self.recv_publish() + + def send_publish(self, eventBundle): + self._oprot.writeMessageBegin('publish', TMessageType.CALL, self._seqid) + args = publish_args() + args.eventBundle = eventBundle + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_publish(self): + (fname, mtype, rseqid) = self._iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(self._iprot) + self._iprot.readMessageEnd() + raise x + result = publish_result() + result.read(self._iprot) + self._iprot.readMessageEnd() + if result.ue is not None: + raise result.ue + if result.se is not None: + raise result.se + return + + def deleteStreamById(self, sessionId, streamId): + """ + Parameters: + - sessionId + - streamId + """ + self.send_deleteStreamById(sessionId, streamId) + return self.recv_deleteStreamById() + + def send_deleteStreamById(self, sessionId, streamId): + self._oprot.writeMessageBegin('deleteStreamById', TMessageType.CALL, self._seqid) + args = deleteStreamById_args() + args.sessionId = sessionId + args.streamId = streamId + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_deleteStreamById(self): + (fname, mtype, rseqid) = self._iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(self._iprot) + self._iprot.readMessageEnd() + raise x + result = deleteStreamById_result() + result.read(self._iprot) + self._iprot.readMessageEnd() + if result.success is not None: + return result.success + if result.se is not None: + raise result.se + raise TApplicationException(TApplicationException.MISSING_RESULT, "deleteStreamById failed: unknown result"); + + def deleteStreamByNameVersion(self, sessionId, streamName, streamVersion): + """ + Parameters: + - sessionId + - streamName + - streamVersion + """ + self.send_deleteStreamByNameVersion(sessionId, streamName, streamVersion) + return self.recv_deleteStreamByNameVersion() + + def send_deleteStreamByNameVersion(self, sessionId, streamName, streamVersion): + self._oprot.writeMessageBegin('deleteStreamByNameVersion', TMessageType.CALL, self._seqid) + args = deleteStreamByNameVersion_args() + args.sessionId = sessionId + args.streamName = streamName + args.streamVersion = streamVersion + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_deleteStreamByNameVersion(self): + (fname, mtype, rseqid) = self._iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(self._iprot) + self._iprot.readMessageEnd() + raise x + result = deleteStreamByNameVersion_result() + result.read(self._iprot) + self._iprot.readMessageEnd() + if result.success is not None: + return result.success + if result.se is not None: + raise result.se + raise TApplicationException(TApplicationException.MISSING_RESULT, "deleteStreamByNameVersion failed: unknown result"); + + +class Processor(Iface, TProcessor): + def __init__(self, handler): + self._handler = handler + self._processMap = {} + self._processMap["defineStream"] = Processor.process_defineStream + self._processMap["findStreamId"] = Processor.process_findStreamId + self._processMap["publish"] = Processor.process_publish + self._processMap["deleteStreamById"] = Processor.process_deleteStreamById + self._processMap["deleteStreamByNameVersion"] = Processor.process_deleteStreamByNameVersion + + def process(self, iprot, oprot): + (name, type, seqid) = iprot.readMessageBegin() + if name not in self._processMap: + iprot.skip(TType.STRUCT) + iprot.readMessageEnd() + x = TApplicationException(TApplicationException.UNKNOWN_METHOD, 'Unknown function %s' % (name)) + oprot.writeMessageBegin(name, TMessageType.EXCEPTION, seqid) + x.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + return + else: + self._processMap[name](self, seqid, iprot, oprot) + return True + + def process_defineStream(self, seqid, iprot, oprot): + args = defineStream_args() + args.read(iprot) + iprot.readMessageEnd() + result = defineStream_result() + try: + result.success = self._handler.defineStream(args.sessionId, args.streamDefinition) + except Exception.ttypes.ThriftDifferentStreamDefinitionAlreadyDefinedException, ade: + result.ade = ade + except Exception.ttypes.ThriftMalformedStreamDefinitionException, mtd: + result.mtd = mtd + except Exception.ttypes.ThriftStreamDefinitionException, tde: + result.tde = tde + except Exception.ttypes.ThriftSessionExpiredException, se: + result.se = se + oprot.writeMessageBegin("defineStream", TMessageType.REPLY, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_findStreamId(self, seqid, iprot, oprot): + args = findStreamId_args() + args.read(iprot) + iprot.readMessageEnd() + result = findStreamId_result() + try: + result.success = self._handler.findStreamId(args.sessionId, args.streamName, args.streamVersion) + except Exception.ttypes.ThriftNoStreamDefinitionExistException, tnde: + result.tnde = tnde + except Exception.ttypes.ThriftSessionExpiredException, se: + result.se = se + oprot.writeMessageBegin("findStreamId", TMessageType.REPLY, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_publish(self, seqid, iprot, oprot): + args = publish_args() + args.read(iprot) + iprot.readMessageEnd() + result = publish_result() + try: + self._handler.publish(args.eventBundle) + except Exception.ttypes.ThriftUndefinedEventTypeException, ue: + result.ue = ue + except Exception.ttypes.ThriftSessionExpiredException, se: + result.se = se + oprot.writeMessageBegin("publish", TMessageType.REPLY, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_deleteStreamById(self, seqid, iprot, oprot): + args = deleteStreamById_args() + args.read(iprot) + iprot.readMessageEnd() + result = deleteStreamById_result() + try: + result.success = self._handler.deleteStreamById(args.sessionId, args.streamId) + except Exception.ttypes.ThriftSessionExpiredException, se: + result.se = se + oprot.writeMessageBegin("deleteStreamById", TMessageType.REPLY, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_deleteStreamByNameVersion(self, seqid, iprot, oprot): + args = deleteStreamByNameVersion_args() + args.read(iprot) + iprot.readMessageEnd() + result = deleteStreamByNameVersion_result() + try: + result.success = self._handler.deleteStreamByNameVersion(args.sessionId, args.streamName, args.streamVersion) + except Exception.ttypes.ThriftSessionExpiredException, se: + result.se = se + oprot.writeMessageBegin("deleteStreamByNameVersion", TMessageType.REPLY, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + +# HELPER FUNCTIONS AND STRUCTURES + +class defineStream_args: + """ + Attributes: + - sessionId + - streamDefinition + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRING, 'sessionId', None, None, ), # 1 + (2, TType.STRING, 'streamDefinition', None, None, ), # 2 + ) + + def __init__(self, sessionId=None, streamDefinition=None,): + self.sessionId = sessionId + self.streamDefinition = streamDefinition + + def read(self, iprot): + if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None: + fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRING: + self.sessionId = iprot.readString(); + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRING: + self.streamDefinition = iprot.readString(); + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None: + oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('defineStream_args') + if self.sessionId is not None: + oprot.writeFieldBegin('sessionId', TType.STRING, 1) + oprot.writeString(self.sessionId) + oprot.writeFieldEnd() + if self.streamDefinition is not None: + oprot.writeFieldBegin('streamDefinition', TType.STRING, 2) + oprot.writeString(self.streamDefinition) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.iteritems()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + +class defineStream_result: + """ + Attributes: + - success + - ade + - mtd + - tde + - se + """ + + thrift_spec = ( + (0, TType.STRING, 'success', None, None, ), # 0 + (1, TType.STRUCT, 'ade', (Exception.ttypes.ThriftDifferentStreamDefinitionAlreadyDefinedException, Exception.ttypes.ThriftDifferentStreamDefinitionAlreadyDefinedException.thrift_spec), None, ), # 1 + (2, TType.STRUCT, 'mtd', (Exception.ttypes.ThriftMalformedStreamDefinitionException, Exception.ttypes.ThriftMalformedStreamDefinitionException.thrift_spec), None, ), # 2 + (3, TType.STRUCT, 'tde', (Exception.ttypes.ThriftStreamDefinitionException, Exception.ttypes.ThriftStreamDefinitionException.thrift_spec), None, ), # 3 + (4, TType.STRUCT, 'se', (Exception.ttypes.ThriftSessionExpiredException, Exception.ttypes.ThriftSessionExpiredException.thrift_spec), None, ), # 4 + ) + + def __init__(self, success=None, ade=None, mtd=None, tde=None, se=None,): + self.success = success + self.ade = ade + self.mtd = mtd + self.tde = tde + self.se = se + + def read(self, iprot): + if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None: + fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.STRING: + self.success = iprot.readString(); + else: + iprot.skip(ftype) + elif fid == 1: + if ftype == TType.STRUCT: + self.ade = Exception.ttypes.ThriftDifferentStreamDefinitionAlreadyDefinedException() + self.ade.read(iprot) + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRUCT: + self.mtd = Exception.ttypes.ThriftMalformedStreamDefinitionException() + self.mtd.read(iprot) + else: + iprot.skip(ftype) + elif fid == 3: + if ftype == TType.STRUCT: + self.tde = Exception.ttypes.ThriftStreamDefinitionException() + self.tde.read(iprot) + else: + iprot.skip(ftype) + elif fid == 4: + if ftype == TType.STRUCT: + self.se = Exception.ttypes.ThriftSessionExpiredException() + self.se.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None: + oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('defineStream_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.STRING, 0) + oprot.writeString(self.success) + oprot.writeFieldEnd() + if self.ade is not None: + oprot.writeFieldBegin('ade', TType.STRUCT, 1) + self.ade.write(oprot) + oprot.writeFieldEnd() + if self.mtd is not None: + oprot.writeFieldBegin('mtd', TType.STRUCT, 2) + self.mtd.write(oprot) + oprot.writeFieldEnd() + if self.tde is not None: + oprot.writeFieldBegin('tde', TType.STRUCT, 3) + self.tde.write(oprot) + oprot.writeFieldEnd() + if self.se is not None: + oprot.writeFieldBegin('se', TType.STRUCT, 4) + self.se.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.iteritems()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + +class findStreamId_args: + """ + Attributes: + - sessionId + - streamName + - streamVersion + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRING, 'sessionId', None, None, ), # 1 + (2, TType.STRING, 'streamName', None, None, ), # 2 + (3, TType.STRING, 'streamVersion', None, None, ), # 3 + ) + + def __init__(self, sessionId=None, streamName=None, streamVersion=None,): + self.sessionId = sessionId + self.streamName = streamName + self.streamVersion = streamVersion + + def read(self, iprot): + if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None: + fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRING: + self.sessionId = iprot.readString(); + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRING: + self.streamName = iprot.readString(); + else: + iprot.skip(ftype) + elif fid == 3: + if ftype == TType.STRING: + self.streamVersion = iprot.readString(); + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None: + oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('findStreamId_args') + if self.sessionId is not None: + oprot.writeFieldBegin('sessionId', TType.STRING, 1) + oprot.writeString(self.sessionId) + oprot.writeFieldEnd() + if self.streamName is not None: + oprot.writeFieldBegin('streamName', TType.STRING, 2) + oprot.writeString(self.streamName) + oprot.writeFieldEnd() + if self.streamVersion is not None: + oprot.writeFieldBegin('streamVersion', TType.STRING, 3) + oprot.writeString(self.streamVersion) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.iteritems()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + +class findStreamId_result: + """ + Attributes: + - success + - tnde + - se + """ + + thrift_spec = ( + (0, TType.STRING, 'success', None, None, ), # 0 + (1, TType.STRUCT, 'tnde', (Exception.ttypes.ThriftNoStreamDefinitionExistException, Exception.ttypes.ThriftNoStreamDefinitionExistException.thrift_spec), None, ), # 1 + (2, TType.STRUCT, 'se', (Exception.ttypes.ThriftSessionExpiredException, Exception.ttypes.ThriftSessionExpiredException.thrift_spec), None, ), # 2 + ) + + def __init__(self, success=None, tnde=None, se=None,): + self.success = success + self.tnde = tnde + self.se = se + + def read(self, iprot): + if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None: + fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.STRING: + self.success = iprot.readString(); + else: + iprot.skip(ftype) + elif fid == 1: + if ftype == TType.STRUCT: + self.tnde = Exception.ttypes.ThriftNoStreamDefinitionExistException() + self.tnde.read(iprot) + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRUCT: + self.se = Exception.ttypes.ThriftSessionExpiredException() + self.se.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None: + oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('findStreamId_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.STRING, 0) + oprot.writeString(self.success) + oprot.writeFieldEnd() + if self.tnde is not None: + oprot.writeFieldBegin('tnde', TType.STRUCT, 1) + self.tnde.write(oprot) + oprot.writeFieldEnd() + if self.se is not None: + oprot.writeFieldBegin('se', TType.STRUCT, 2) + self.se.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.iteritems()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + +class publish_args: + """ + Attributes: + - eventBundle + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'eventBundle', (Data.ttypes.ThriftEventBundle, Data.ttypes.ThriftEventBundle.thrift_spec), None, ), # 1 + ) + + def __init__(self, eventBundle=None,): + self.eventBundle = eventBundle + + def read(self, iprot): + if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None: + fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.eventBundle = Data.ttypes.ThriftEventBundle() + self.eventBundle.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None: + oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('publish_args') + if self.eventBundle is not None: + oprot.writeFieldBegin('eventBundle', TType.STRUCT, 1) + self.eventBundle.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.iteritems()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + +class publish_result: + """ + Attributes: + - ue + - se + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'ue', (Exception.ttypes.ThriftUndefinedEventTypeException, Exception.ttypes.ThriftUndefinedEventTypeException.thrift_spec), None, ), # 1 + (2, TType.STRUCT, 'se', (Exception.ttypes.ThriftSessionExpiredException, Exception.ttypes.ThriftSessionExpiredException.thrift_spec), None, ), # 2 + ) + + def __init__(self, ue=None, se=None,): + self.ue = ue + self.se = se + + def read(self, iprot): + if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None: + fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.ue = Exception.ttypes.ThriftUndefinedEventTypeException() + self.ue.read(iprot) + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRUCT: + self.se = Exception.ttypes.ThriftSessionExpiredException() + self.se.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None: + oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('publish_result') + if self.ue is not None: + oprot.writeFieldBegin('ue', TType.STRUCT, 1) + self.ue.write(oprot) + oprot.writeFieldEnd() + if self.se is not None: + oprot.writeFieldBegin('se', TType.STRUCT, 2) + self.se.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.iteritems()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + +class deleteStreamById_args: + """ + Attributes: + - sessionId + - streamId + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRING, 'sessionId', None, None, ), # 1 + (2, TType.STRING, 'streamId', None, None, ), # 2 + ) + + def __init__(self, sessionId=None, streamId=None,): + self.sessionId = sessionId + self.streamId = streamId + + def read(self, iprot): + if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None: + fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRING: + self.sessionId = iprot.readString(); + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRING: + self.streamId = iprot.readString(); + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None: + oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('deleteStreamById_args') + if self.sessionId is not None: + oprot.writeFieldBegin('sessionId', TType.STRING, 1) + oprot.writeString(self.sessionId) + oprot.writeFieldEnd() + if self.streamId is not None: + oprot.writeFieldBegin('streamId', TType.STRING, 2) + oprot.writeString(self.streamId) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.iteritems()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + +class deleteStreamById_result: + """ + Attributes: + - success + - se + """ + + thrift_spec = ( + (0, TType.BOOL, 'success', None, None, ), # 0 + (1, TType.STRUCT, 'se', (Exception.ttypes.ThriftSessionExpiredException, Exception.ttypes.ThriftSessionExpiredException.thrift_spec), None, ), # 1 + ) + + def __init__(self, success=None, se=None,): + self.success = success + self.se = se + + def read(self, iprot): + if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None: + fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.BOOL: + self.success = iprot.readBool(); + else: + iprot.skip(ftype) + elif fid == 1: + if ftype == TType.STRUCT: + self.se = Exception.ttypes.ThriftSessionExpiredException() + self.se.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None: + oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('deleteStreamById_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.BOOL, 0) + oprot.writeBool(self.success) + oprot.writeFieldEnd() + if self.se is not None: + oprot.writeFieldBegin('se', TType.STRUCT, 1) + self.se.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.iteritems()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + +class deleteStreamByNameVersion_args: + """ + Attributes: + - sessionId + - streamName + - streamVersion + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRING, 'sessionId', None, None, ), # 1 + (2, TType.STRING, 'streamName', None, None, ), # 2 + (3, TType.STRING, 'streamVersion', None, None, ), # 3 + ) + + def __init__(self, sessionId=None, streamName=None, streamVersion=None,): + self.sessionId = sessionId + self.streamName = streamName + self.streamVersion = streamVersion + + def read(self, iprot): + if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None: + fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRING: + self.sessionId = iprot.readString(); + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRING: + self.streamName = iprot.readString(); + else: + iprot.skip(ftype) + elif fid == 3: + if ftype == TType.STRING: + self.streamVersion = iprot.readString(); + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None: + oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('deleteStreamByNameVersion_args') + if self.sessionId is not None: + oprot.writeFieldBegin('sessionId', TType.STRING, 1) + oprot.writeString(self.sessionId) + oprot.writeFieldEnd() + if self.streamName is not None: + oprot.writeFieldBegin('streamName', TType.STRING, 2) + oprot.writeString(self.streamName) + oprot.writeFieldEnd() + if self.streamVersion is not None: + oprot.writeFieldBegin('streamVersion', TType.STRING, 3) + oprot.writeString(self.streamVersion) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.iteritems()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + +class deleteStreamByNameVersion_result: + """ + Attributes: + - success + - se + """ + + thrift_spec = ( + (0, TType.BOOL, 'success', None, None, ), # 0 + (1, TType.STRUCT, 'se', (Exception.ttypes.ThriftSessionExpiredException, Exception.ttypes.ThriftSessionExpiredException.thrift_spec), None, ), # 1 + ) + + def __init__(self, success=None, se=None,): + self.success = success + self.se = se + + def read(self, iprot): + if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None: + fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.BOOL: + self.success = iprot.readBool(); + else: + iprot.skip(ftype) + elif fid == 1: + if ftype == TType.STRUCT: + self.se = Exception.ttypes.ThriftSessionExpiredException() + self.se.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None: + oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('deleteStreamByNameVersion_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.BOOL, 0) + oprot.writeBool(self.success) + oprot.writeFieldEnd() + if self.se is not None: + oprot.writeFieldBegin('se', TType.STRUCT, 1) + self.se.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.iteritems()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other)
