def method(self, channel, userSequence, objId, classId, methodName, args): """ Invoke a method on an object """ codec = Codec() sequence = self.seqMgr.reserve((userSequence, classId, methodName)) self.setHeader(codec, ord('M'), sequence) objId.encode(codec) codec.write_str8(classId[0]) codec.write_str8(classId[1]) codec.write_bin128(classId[2]) codec.write_str8(methodName) bank = "%d.%d" % (objId.getBroker(), objId.getBank()) # Encode args according to schema if classId not in self.schema: self.seqMgr.release(sequence) raise ValueError("Unknown class name: %s" % classId) schemaClass = self.schema[classId] ms = schemaClass['M'] arglist = None for mname in ms: (mdesc, margs) = ms[mname] if mname == methodName: arglist = margs if arglist == None: self.seqMgr.release(sequence) raise ValueError("Unknown method name: %s" % methodName) for arg in arglist: if arg[2].find("I") != -1: value = arg[8] # default if arg[0] in args: value = args[arg[0]] if value == None: self.seqMgr.release(sequence) raise ValueError("Missing non-defaulted argument: %s" % arg[0]) self.encodeValue(codec, value, arg[1]) packageName = classId[0] className = classId[1] msg = channel.message(codec.encoded, "agent." + bank) channel.send("qpid.management", msg)
def method (self, channel, userSequence, objId, classId, methodName, args): """ Invoke a method on an object """ codec = Codec () sequence = self.seqMgr.reserve ((userSequence, classId, methodName)) self.setHeader (codec, ord ('M'), sequence) objId.encode(codec) codec.write_str8 (classId[0]) codec.write_str8 (classId[1]) codec.write_bin128 (classId[2]) codec.write_str8 (methodName) bank = "%d.%d" % (objId.getBroker(), objId.getBank()) # Encode args according to schema if classId not in self.schema: self.seqMgr.release (sequence) raise ValueError ("Unknown class name: %s" % classId) schemaClass = self.schema[classId] ms = schemaClass['M'] arglist = None for mname in ms: (mdesc, margs) = ms[mname] if mname == methodName: arglist = margs if arglist == None: self.seqMgr.release (sequence) raise ValueError ("Unknown method name: %s" % methodName) for arg in arglist: if arg[2].find("I") != -1: value = arg[8] # default if arg[0] in args: value = args[arg[0]] if value == None: self.seqMgr.release (sequence) raise ValueError ("Missing non-defaulted argument: %s" % arg[0]) self.encodeValue (codec, value, arg[1]) packageName = classId[0] className = classId[1] msg = channel.message(codec.encoded, "agent." + bank) channel.send ("qpid.management", msg)
def handleClassInd (self, ch, codec): kind = codec.read_uint8() if kind != 1: # This API doesn't handle new-style events return pname = codec.read_str8() cname = codec.read_str8() hash = codec.read_bin128() if pname not in self.packages: return if (cname, hash) not in self.packages[pname]: # Send a schema request sendCodec = Codec () seq = self.seqMgr.reserve ("outstanding") self.setHeader (sendCodec, ord ('S'), seq) self.incOutstanding (ch) sendCodec.write_str8 (pname) sendCodec.write_str8 (cname) sendCodec.write_bin128 (hash) smsg = ch.message(sendCodec.encoded) ch.send ("qpid.management", smsg)
def handleClassInd(self, ch, codec): kind = codec.read_uint8() if kind != 1: # This API doesn't handle new-style events return pname = codec.read_str8() cname = codec.read_str8() hash = codec.read_bin128() if pname not in self.packages: return if (cname, hash) not in self.packages[pname]: # Send a schema request sendCodec = Codec() seq = self.seqMgr.reserve("outstanding") self.setHeader(sendCodec, ord('S'), seq) self.incOutstanding(ch) sendCodec.write_str8(pname) sendCodec.write_str8(cname) sendCodec.write_bin128(hash) smsg = ch.message(sendCodec.encoded) ch.send("qpid.management", smsg)