def toArgumentsList(self):
        list = TLVList(None,None)
        wrapper = AMQPWrapper()
        if self.containerId is None:
            raise ValueError("Detach header's container id can't be null")
        list.addElement(0, wrapper.wrap(self.containerId))
        if self.hostname is not None:
            list.addElement(1, wrapper.wrap(self.hostname))
        if self.maxFrameSize is not None:
            list.addElement(2, wrapper.wrap(self.maxFrameSize))
        if self.channelMax is not None:
            list.addElement(3, wrapper.wrap(self.channelMax))
        if self.idleTimeout is not None:
            list.addElement(4, wrapper.wrap(self.idleTimeout))
        if self.outgoingLocales is not None and len(self.outgoingLocales) > 0:
            list.addElement(5, wrapper.wrapArray(self.outgoingLocales))
        if self.incomingLocales is not None and len(self.incomingLocales) > 0:
            list.addElement(6, wrapper.wrapArray(self.incomingLocales))
        if self.offeredCapabilities is not None and len(self.offeredCapabilities) > 0:
            list.addElement(7, wrapper.wrapArray(self.offeredCapabilities))
        if self.desiredCapabilities is not None and len(self.desiredCapabilities) > 0:
            list.addElement(8, wrapper.wrapArray(self.desiredCapabilities))
        if self.properties is not None and len(self.properties) > 0:
            list.addElement(9, wrapper.wrapMap(self.properties))

        constructor = DescribedConstructor(list.getCode(),TLVFixed(AMQPType.SMALL_ULONG, self.code.value))
        list.setConstructor(constructor)
        #print('AMQPOpen list.values= ' + str(list.values))
        return list
Exemple #2
0
    def toArgumentsList(self):
        list = TLVList(None, None)
        wrapper = AMQPWrapper()
        if self.handle == None:
            raise ValueError("Transfer header's handle can't be null")
        list.addElement(0, wrapper.wrap(self.handle))
        if self.deliveryId is not None:
            list.addElement(1, wrapper.wrap(self.deliveryId))
        if self.deliveryTag is not None:
            list.addElement(2, wrapper.wrap(self.deliveryTag))
        if self.messageFormat is not None and isinstance(
                self.messageFormat, AMQPMessageFormat):
            list.addElement(3, wrapper.wrap(self.messageFormat.encode()))
        if self.settled is not None:
            list.addElement(4, wrapper.wrap(self.settled))
        if self.more is not None:
            list.addElement(5, wrapper.wrap(self.more))
        if self.rcvSettleMode is not None and isinstance(
                self.rcvSettleMode, ReceiveCode):
            list.addElement(6, wrapper.wrap(self.rcvSettleMode.value))
        if self.state is not None and isinstance(self.state, AMQPState):
            list.addElement(7, wrapper.wrap(self.state.toArgumentsList()))
        if self.resume is not None:
            list.addElement(8, wrapper.wrap(self.resume))
        if self.aborted is not None:
            list.addElement(9, wrapper.wrap(self.aborted))
        if self.batchable is not None:
            list.addElement(10, wrapper.wrap(self.batchable))

        constructor = DescribedConstructor(
            list.getCode(), TLVFixed(AMQPType.SMALL_ULONG, self.code.value))
        list.setConstructor(constructor)
        return list
Exemple #3
0
    def toArgumentsList(self):
        list = TLVList(None, None)
        wrapper = AMQPWrapper()
        if self.remoteChannel is not None:
            list.addElement(0, wrapper.wrap(self.remoteChannel))
        if self.nextOutgoingId is None:
            raise ValueError("Begin header's next-outgoing-id can't be null")
        list.addElement(1, wrapper.wrap(self.nextOutgoingId))
        if self.incomingWindow is None:
            raise ValueError("Begin header's incoming-window can't be null")
        list.addElement(2, wrapper.wrap(self.incomingWindow))
        if self.outgoingWindow is None:
            raise ValueError("Begin header's outgoing-window can't be null")
        list.addElement(3, wrapper.wrap(self.outgoingWindow))
        if self.handleMax is not None:
            list.addElement(4, wrapper.wrap(self.handleMax))
        if self.offeredCapabilities is not None and len(
                self.offeredCapabilities) > 0:
            list.addElement(5, wrapper.wrapArray(self.offeredCapabilities))
        if self.desiredCapabilities is not None and len(
                self.desiredCapabilities) > 0:
            list.addElement(6, wrapper.wrapArray(self.desiredCapabilities))
        if self.properties is not None and len(self.properties) > 0:
            list.addElement(7, wrapper.wrapMap(self.properties))

        constructor = DescribedConstructor(
            list.getCode(), TLVFixed(AMQPType.SMALL_ULONG, self.code.value))
        list.setConstructor(constructor)
        return list
Exemple #4
0
    def toArgumentsList(self):
        list = TLVList(None,None)
        if self.error is not None and isinstance(self.error, AMQPError):
            list.addElement(0, self.error.toArgumentsList())

        constructor = DescribedConstructor(list.getCode(),TLVFixed(AMQPType.SMALL_ULONG, 0x25))
        list.setConstructor(constructor)
        return list
 def getList(self):
     list = TLVList(None, None)
     if isinstance(self.code, LifetimePolicy):
         constructor = DescribedConstructor(
             list.getCode(), TLVFixed(AMQPType.SMALL_ULONG,
                                      self.code.value))
         list.setConstructor(constructor)
     return list
Exemple #6
0
    def getValue(self):
        list = TLVList(None, None)

        if self.sequence is not None and len(self.sequence) > 0:
            list = AMQPWrapper.wrapList(self.sequence)

        constructor = DescribedConstructor(
            list.getCode(), TLVFixed(AMQPType.SMALL_ULONG, 0x76))
        list.setConstructor(constructor)
        return list
    def getValue(self):
        map = TLVMap(None, None)

        if self.properties is not None and len(self.properties) > 0:
            map = AMQPWrapper.wrapMap(self.properties)

        constructor = DescribedConstructor(
            map.getCode(), TLVFixed(AMQPType.SMALL_ULONG, 0x74))
        map.setConstructor(constructor)
        return map
    def toArgumentsList(self):
        list = TLVList(None, None)

        if self.mechanisms == None:
            raise ValueError("At least one SASL Mechanism must be specified")
        wrapper = AMQPWrapper()
        list.addElement(0, wrapper.wrapArray(self.mechanisms))
        constructor = DescribedConstructor(
            list.getCode(), TLVFixed(AMQPType.SMALL_ULONG, 0x40))
        list.setConstructor(constructor)
        return list
    def toArgumentsList(self):
        list = TLVList(None, None)

        if self.challenge == None:
            raise ValueError("SASL-Challenge header's challenge can't be null")
        list.addElement(0, AMQPWrapper.wrap(self.challenge))

        constructor = DescribedConstructor(
            list.getCode(), TLVFixed(AMQPType.SMALL_ULONG, 0x42))
        list.setConstructor(constructor)
        return list
Exemple #10
0
 def getValue(self):
     wrapper = AMQPWrapper()
     bin = None
     if self.data is not None:
         bin = wrapper.wrap(self.data)
     else:
         bin = TLVNull()
     constructor = DescribedConstructor(
         bin.getCode(), TLVFixed(AMQPType.SMALL_ULONG, 0x75))
     bin.setConstructor(constructor)
     return bin
    def toArgumentsList(self):
        list = TLVList(None, None)
        if self.sectionNumber is not None:
            list.addElement(0, AMQPWrapper.wrap(self.sectionNumber))
        if self.sectionOffset is not None:
            list.addElement(1, AMQPWrapper.wrap(self.sectionOffset))

        constructor = DescribedConstructor(
            list.getCode(), TLVFixed(AMQPType.SMALL_ULONG, 0x23))
        list.setConstructor(constructor)
        return list
    def toArgumentsList(self):
        list = TLVList(None, None)
        wrapper = AMQPWrapper()
        if self.nextIncomingId is not None:
            list.addElement(0, wrapper.wrap(self.nextIncomingId))
        if self.incomingWindow is None:
            raise ValueError("Flow header's incoming-window can't be null")
        list.addElement(1, wrapper.wrap(self.incomingWindow))
        if self.nextOutgoingId is None:
            raise ValueError("Flow header's next-outgoing-id can't be null")
        list.addElement(2, wrapper.wrap(self.nextOutgoingId))
        if self.outgoingWindow is None:
            raise ValueError("Flow header's outgoing-window can't be null")
        list.addElement(3, wrapper.wrap(self.outgoingWindow))
        if self.handle is not None:
            list.addElement(4, wrapper.wrap(self.handle))
        if self.deliveryCount is not None:
            if self.handle is not None:
                list.addElement(5, wrapper.wrap(self.deliveryCount))
            else:
                raise ValueError(
                    "Flow headers delivery-count can't be assigned when handle is not specified"
                )
        if self.linkCredit is not None:
            if self.handle is not None:
                list.addElement(6, wrapper.wrap(self.linkCredit))
            else:
                raise ValueError(
                    "Flow headers link-credit can't be assigned when handle is not specified"
                )
        if self.available is not None:
            if self.handle is not None:
                list.addElement(7, wrapper.wrap(self.available))
            else:
                raise ValueError(
                    "Flow headers available can't be assigned when handle is not specified"
                )
        if self.drain is not None:
            if self.handle is not None:
                list.addElement(8, wrapper.wrap(self.drain))
            else:
                raise ValueError(
                    "Flow headers drain can't be assigned when handle is not specified"
                )
        if self.echo is not None:
            list.addElement(9, wrapper.wrap(self.echo))
        if self.properties is not None and len(self.properties) > 0:
            list.addElement(10, wrapper.wrapMap(self.properties))

        constructor = DescribedConstructor(
            list.getCode(), TLVFixed(AMQPType.SMALL_ULONG, self.code.value))
        list.setConstructor(constructor)
        return list
    def getValue(self):
        val = None
        if self.value is not None:
            val = AMQPWrapper.wrap(self.value)
        else:
            val = TLVNull()

        if val is not None:
            constructor = DescribedConstructor(
                val.getCode(), TLVFixed(AMQPType.SMALL_ULONG, 0x77))
            val.setConstructor(constructor)
        return val
    def toArgumentsList(self):
        wrapper = AMQPWrapper()
        list = TLVList(None,None)
        if self.condition is not None and isinstance(self.condition, ErrorCode):
            list.addElement(0, wrapper.wrap(AMQPSymbol(self.condition)))
        if self.description is not None:
            list.addElement(1, wrapper.wrap(self.description))
        if self.info is not None:
            list.addElement(2, wrapper.wrap(self.info))

        constructor = DescribedConstructor(list.getCode(),TLVFixed(AMQPType.SMALL_ULONG, 0x1D))
        list.setConstructor(constructor)
        return list
    def toArgumentsList(self):
        list = TLVList(None,None)
        if self.deliveryFailed is not None:
            list.addElement(0, AMQPWrapper.wrap(self.deliveryFailed))
        if self.undeliverableHere is not None:
            list.addElement(1, AMQPWrapper.wrap(self.undeliverableHere))
        if self.messageAnnotations is not None and isinstance(self.messageAnnotations,dict):
            if len(self.messageAnnotations) > 0:
                list.addElement(2, AMQPWrapper.wrapMap(self.messageAnnotations))

        constructor = DescribedConstructor(list.getCode(),TLVFixed(AMQPType.SMALL_ULONG, 0x27))
        list.setConstructor(constructor)
        return list
Exemple #16
0
    def toArgumentsList(self):
        list = TLVList(None, None)
        wrapper = AMQPWrapper()

        if self.name is None:
            raise ValueError("Attach header's name can't be null")
        list.addElement(0, wrapper.wrapString(self.name))

        if self.handle is None:
            raise ValueError("Attach header's handle can't be null")
        list.addElement(1, wrapper.wrap(self.handle))

        if self.role is None:
            raise ValueError("Attach header's role can't be null")

        list.addElement(2, wrapper.wrap(self.role.value))
        if self.sndSettleMode is not None:
            list.addElement(3, wrapper.wrap(self.sndSettleMode))
        if self.rcvSettleMode is not None:
            list.addElement(4, wrapper.wrap(self.rcvSettleMode))
        if self.source is not None and isinstance(self.source, AMQPSource):
            list.addElement(5, self.source.toArgumentsList())
        if self.target is not None and isinstance(self.target, AMQPTarget):
            list.addElement(6, self.target.toArgumentsList())
        if self.unsettled is not None and len(self.unsettled) > 0:
            list.addElement(7, wrapper.wrapMap(self.unsettled))
        if self.incompleteUnsettled is not None:
            list.addElement(8, wrapper.wrap(self.incompleteUnsettled))

        if self.initialDeliveryCount is not None:
            list.addElement(9, wrapper.wrap(self.initialDeliveryCount))
        elif self.role == RoleCode.SENDER:
            raise ValueError(
                "Sender's attach header must contain a non-null initial-delivery-count value"
            )

        if self.maxMessageSize is not None:
            list.addElement(10, wrapper.wrap(self.maxMessageSize))
        if self.offeredCapabilities is not None and len(
                self.offeredCapabilities) > 0:
            list.addElement(11, wrapper.wrapArray(self.offeredCapabilities))
        if self.desiredCapabilities is not None and len(
                self.desiredCapabilities) > 0:
            list.addElement(12, wrapper.wrapArray(self.desiredCapabilities))
        if self.properties is not None and len(self.properties) > 0:
            list.addElement(13, wrapper.wrapMap(self.properties))

        constructor = DescribedConstructor(
            list.getCode(), TLVFixed(AMQPType.SMALL_ULONG, self.code.value))
        list.setConstructor(constructor)
        return list
    def toArgumentsList(self):
        list = TLVList(None,None)
        wrapper = AMQPWrapper()
        if self.mechanism == None:
            raise ValueError("SASL-Init header's mechanism can't be null")
        list.addElement(0,wrapper.wrap(self.mechanism))
        if self.initialRespone is not None:
            list.addElement(1,wrapper.wrap(self.initialRespone))
        if self.hostName is not None:
            list.addElement(2, wrapper.wrap(self.hostName))

        constructor = DescribedConstructor(list.getCode(), TLVFixed(AMQPType.SMALL_ULONG, 0x41))
        list.setConstructor(constructor)
        return list
Exemple #18
0
 def getConstructor(self, buf):
     code = None
     constructor = None
     codeByte = util.getByte(buf, self.index)
     self.index += 1
     if codeByte == 0:
         descriptor = self.getTlv(buf)
         code = AMQPType(util.getByte(buf, self.index) & 0xff)
         self.index += 1
         constructor = DescribedConstructor(code, descriptor)
     else:
         code = AMQPType(codeByte & 0xff)
         constructor = SimpleConstructor(code)
     return constructor
    def toArgumentsList(self):
        list = TLVList(None, None)
        wrapper = AMQPWrapper()
        if self.handle is None:
            raise ValueError("Detach header's handle can't be null")
        list.addElement(0, wrapper.wrap(self.handle))
        if self.closed is not None:
            list.addElement(1, wrapper.wrap(self.closed))
        if self.error is not None and isinstance(self.error, AMQPError):
            list.addElement(2, self.error.toArgumentsList())

        constructor = DescribedConstructor(
            list.getCode(), TLVFixed(AMQPType.SMALL_ULONG, self.code.value))
        list.setConstructor(constructor)
        return list
    def toArgumentsList(self):
        list = TLVList(None, None)

        if self.outcomeCode == None and isinstance(self.outcomeCode,
                                                   OutcomeCode):
            raise ValueError("SASL-Outcome header's code can't be null")
        list.addElement(0, AMQPWrapper.wrap(self.outcomeCode.value))

        if self.additionalData is not None:
            list.addElement(1, AMQPWrapper.wrap(self.additionalData))

        constructor = DescribedConstructor(
            list.getCode(), TLVFixed(AMQPType.SMALL_ULONG, 0x44))
        list.setConstructor(constructor)
        return list
    def toArgumentsList(self):
        list = TLVList(None, None)
        wrapper = AMQPWrapper()
        if self.address is not None:
            list.addElement(0, wrapper.wrap(self.address))
        if self.durable is not None:
            list.addElement(1, wrapper.wrap(self.durable))
        if self.expiryPeriod is not None:
            list.addElement(2,
                            wrapper.wrap(AMQPSymbol(self.expiryPeriod.value)))
        if self.timeout is not None:
            list.addElement(3, wrapper.wrap(self.timeout))
        if self.dynamic is not None:
            list.addElement(4, wrapper.wrap(self.dynamic))
        if self.dynamicNodeProperties is not None and isinstance(
                self.dynamicNodeProperties, dict):
            if self.dynamic is not None:
                if self.dynamic:
                    list.addElement(
                        5, wrapper.wrapMap(self.dynamicNodeProperties))
                else:
                    raise ValueError(
                        "Source's dynamic-node-properties can't be specified when dynamic flag is false"
                    )
            else:
                raise ValueError(
                    "Source's dynamic-node-properties can't be specified when dynamic flag is not set"
                )

        if self.distributionMode is not None and isinstance(
                self.distributionMode, DistributionMode):
            list.addElement(
                6, wrapper.wrap(AMQPSymbol(self.distributionMode.value)))
        if self.filter is not None and isinstance(self.filter, dict):
            list.addElement(7, wrapper.wrapMap(self.filter))
        if self.defaultOutcome is not None and isinstance(
                self.defaultOutcome, AMQPOutcome):
            list.addElement(8, self.defaultOutcome.toArgumentsList())
        if self.outcomes is not None and len(self.outcomes) > 0:
            list.addElement(9, wrapper.wrapArray(self.outcomes))
        if self.capabilities is not None and len(self.capabilities) > 0:
            list.addElement(10, wrapper.wrapArray(self.capabilities))

        constructor = DescribedConstructor(
            list.getCode(), TLVFixed(AMQPType.SMALL_ULONG, 0x28))
        list.setConstructor(constructor)
        return list
Exemple #22
0
    def getValue(self):
        list = TLVList(None, None)

        if self.messageId is not None and isinstance(self.messageId,
                                                     MessageID):
            value = None
            if self.messageId.getBinary() is not None:
                value = self.messageId.getBinary()
            elif self.messageId.getLong() is not None:
                value = self.messageId.getLong()
            elif self.messageId.getString() is not None:
                value = self.messageId.getString()
            elif self.messageId.getUuid() is not None:
                value = self.messageId.getUuid()
            list.addElement(0, AMQPWrapper.wrap(value))

        if self.userId is not None:
            list.addElement(1, AMQPWrapper.wrap(self.userId))
        if self.to is not None:
            list.addElement(2, AMQPWrapper.wrap(self.to))
        if self.subject is not None:
            list.addElement(3, AMQPWrapper.wrap(self.subject))
        if self.replyTo is not None:
            list.addElement(4, AMQPWrapper.wrap(self.replyTo))
        if self.correlationId is not None:
            list.addElement(5, AMQPWrapper.wrap(self.correlationId))
        if self.contentType is not None:
            list.addElement(6, AMQPWrapper.wrap(self.contentType))
        if self.contentEncoding is not None:
            list.addElement(7, AMQPWrapper.wrap(self.contentEncoding))
        if self.absoluteExpiryTime is not None:
            list.addElement(8, AMQPWrapper.wrap(self.absoluteExpiryTime))
        if self.creationTime is not None:
            list.addElement(9, AMQPWrapper.wrap(self.creationTime))
        if self.groupId is not None:
            list.addElement(10, AMQPWrapper.wrap(self.groupId))
        if self.groupSequence is not None:
            list.addElement(11, AMQPWrapper.wrap(self.groupSequence))
        if self.replyToGroupId is not None:
            list.addElement(12, AMQPWrapper.wrap(self.replyToGroupId))

        constructor = DescribedConstructor(
            list.getCode(), TLVFixed(AMQPType.SMALL_ULONG, 0x73))
        list.setConstructor(constructor)
        return list
    def getValue(self):
        list = TLVList(None, None)

        if self.durable is not None:
            list.addElement(0, AMQPWrapper.wrap(self.durable))
        if self.priority is not None:
            list.addElement(1, AMQPWrapper.wrap(self.priority))
        if self.milliseconds is not None:
            list.addElement(2, AMQPWrapper.wrap(self.milliseconds))
        if self.firstAquirer is not None:
            list.addElement(3, AMQPWrapper.wrap(self.firstAquirer))
        if self.deliveryCount is not None:
            list.addElement(4, AMQPWrapper.wrap(self.deliveryCount))

        constructor = DescribedConstructor(
            list.getCode(), TLVFixed(AMQPType.SMALL_ULONG, 0x70))
        list.setConstructor(constructor)
        return list
    def toArgumentsList(self):
        list = TLVList(None, None)
        wrapper = AMQPWrapper()
        if self.role is None:
            raise ValueError("Disposition header's role can't be null")
        if isinstance(self.role, RoleCode):
            list.addElement(0, wrapper.wrap(self.role.value))
        if self.first is None:
            raise ValueError("Disposition header's first can't be null")
        list.addElement(1, wrapper.wrap(self.first))
        if self.last is not None:
            list.addElement(2, wrapper.wrap(self.last))
        if self.settled is not None:
            list.addElement(3, wrapper.wrap(self.settled))
        if self.state is not None:
            if isinstance(self.state, AMQPState):
                list.addElement(4, self.state.toArgumentsList())
        if self.batchable is not None and len(self.outgoingLocales) > 0:
            list.addElement(5, wrapper.wrap(self.batchable))

        constructor = DescribedConstructor(
            list.getCode(), TLVFixed(AMQPType.SMALL_ULONG, self.code.value))
        list.setConstructor(constructor)
        return list
    def toArgumentsList(self):
        list = TLVList(None, None)
        wrapper = AMQPWrapper()
        if self.address is not None:
            list.addElement(0, wrapper.wrap(self.address))

        if self.durable is not None:
            list.addElement(1, wrapper.wrap(self.durable))
        if self.expiryPeriod is not None:
            list.addElement(2, wrapper.wrap(self.expiryPeriod))
        if self.timeout is not None:
            result = wrapper.wrap(self.timeout)
            list.addElement(3, result)
        if self.dynamic is not None:
            list.addElement(4, wrapper.wrap(self.dynamic))
        if self.dynamicNodeProperties is not None:
            if self.dynamic is not None:
                if self.dynamic:
                    list.addElement(
                        5, wrapper.wrapMap(self.dynamicNodeProperties))
                else:
                    raise ValueError(
                        "Target's dynamic-node-properties can't be specified when dynamic flag is false"
                    )
            else:
                raise ValueError(
                    "STarget's dynamic-node-properties can't be specified when dynamic flag is not set"
                )

        if self.capabilities is not None and len(self.capabilities) > 0:
            list.addElement(6, wrapper.wrapArray(self.capabilities))

        constructor = DescribedConstructor(
            list.getCode(), TLVFixed(AMQPType.SMALL_ULONG, 0x29))
        list.setConstructor(constructor)
        return list
Exemple #26
0
 def toArgumentsList(self):
     list = TLVList(None, None)
     constructor = DescribedConstructor(
         list.getCode(), TLVFixed(AMQPType.SMALL_ULONG, 0x26))
     list.setConstructor(constructor)
     return list