diff options
| author | Nuno Santos <nsantos@apache.org> | 2008-04-15 16:12:01 +0000 |
|---|---|---|
| committer | Nuno Santos <nsantos@apache.org> | 2008-04-15 16:12:01 +0000 |
| commit | 0cb55b441ec82124319fd3b154261a07ded82df2 (patch) | |
| tree | 23bff88d64af5486b8c4c58f28f0b9fd6358f3ac /qpid/python | |
| parent | a106490812ea883620e84f50b4ce001d375e81f7 (diff) | |
| download | qpid-python-0cb55b441ec82124319fd3b154261a07ded82df2.tar.gz | |
QPID-921: applied qpid-patch36.diff on behalf of Ted Ross
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@648308 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/python')
| -rwxr-xr-x | qpid/python/commands/qpid-config | 10 | ||||
| -rwxr-xr-x | qpid/python/commands/qpid-route | 3 | ||||
| -rw-r--r-- | qpid/python/qpid/management.py | 8 | ||||
| -rw-r--r-- | qpid/python/qpid/managementdata.py | 33 |
4 files changed, 33 insertions, 21 deletions
diff --git a/qpid/python/commands/qpid-config b/qpid/python/commands/qpid-config index 3fd8e93c63..b93e74c4d2 100755 --- a/qpid/python/commands/qpid-config +++ b/qpid/python/commands/qpid-config @@ -97,13 +97,17 @@ class BrokerManager: try: self.spec = qpid.spec.load (_specpath) self.client = Client (self.broker.host, self.broker.port, self.spec) - self.client.start ({"LOGIN":"guest","PASSWORD":"guest"}) + self.client.start (response='\x00' + "guest" + '\x00' + "guest", + mechanism="PLAIN") self.channel = self.client.channel (1) self.mclient = managementClient (self.spec) self.mchannel = self.mclient.addChannel (self.channel) except socket.error, e: - print "Connect Error:", e - exit (1) + print "Socket Error:", e + sys.exit (1) + except Closed, e: + print "Connect Failed:", e + sys.exit (1) def Overview (self): self.ConnectToBroker () diff --git a/qpid/python/commands/qpid-route b/qpid/python/commands/qpid-route index 0db28c791b..c268c638c8 100755 --- a/qpid/python/commands/qpid-route +++ b/qpid/python/commands/qpid-route @@ -79,7 +79,8 @@ class RouteManager: try: self.spec = qpid.spec.load (_specpath) self.client = Client (broker.host, broker.port, self.spec) - self.client.start ({"LOGIN":"guest","PASSWORD":"guest"}) + self.client.start (response='\x00' + "guest" + '\x00' + "guest", + mechanism="PLAIN") self.channel = self.client.channel (1) self.mclient = managementClient (self.spec) self.mch = self.mclient.addChannel (self.channel) diff --git a/qpid/python/qpid/management.py b/qpid/python/qpid/management.py index d2dcacd62a..d32d458270 100644 --- a/qpid/python/qpid/management.py +++ b/qpid/python/qpid/management.py @@ -83,11 +83,11 @@ class methodResult: class managementChannel: """ This class represents a connection to an AMQP broker. """ - def __init__ (self, ch, topicCb, replyCb, cbContext): + def __init__ (self, ch, topicCb, replyCb, cbContext, _detlife=0): """ Given a channel on an established AMQP broker connection, this method opens a session and performs all of the declarations and bindings needed to participate in the management protocol. """ - response = ch.session_open (detached_lifetime=300) + response = ch.session_open (detached_lifetime=_detlife) self.sessionId = response.session_id self.topicName = "mgmt-%08x-%04x-%04x-%04x-%04x%08x" % struct.unpack ("!LHHHHL", response.session_id) self.replyName = "repl-%08x-%04x-%04x-%04x-%04x%08x" % struct.unpack ("!LHHHHL", response.session_id) @@ -97,8 +97,8 @@ class managementChannel: self.context = cbContext self.reqsOutstanding = 0 - ch.queue_declare (queue=self.topicName, exclusive=1, auto_delete=1) - ch.queue_declare (queue=self.replyName, exclusive=1, auto_delete=1) + ch.queue_declare (queue=self.topicName, exclusive=True, auto_delete=True) + ch.queue_declare (queue=self.replyName, exclusive=True, auto_delete=True) ch.queue_bind (exchange="qpid.management", queue=self.topicName, routing_key="mgmt.#") diff --git a/qpid/python/qpid/managementdata.py b/qpid/python/qpid/managementdata.py index ff43352247..2876bf0948 100644 --- a/qpid/python/qpid/managementdata.py +++ b/qpid/python/qpid/managementdata.py @@ -21,6 +21,7 @@ import qpid import socket +import struct from qpid.management import managementChannel, managementClient from threading import Lock from disp import Display @@ -63,19 +64,24 @@ class ManagementData: # def registerObjId (self, objId): - if self.baseId == 0: - if objId & 0x8000000000000000L == 0: - self.baseId = objId - 1000 + boot = objId & 0x7FFF000000000000L + if boot == 0: + return + self.bootSequence = boot def displayObjId (self, objId): - if objId & 0x8000000000000000L == 0: - return objId - self.baseId - return (objId & 0x7fffffffffffffffL) + 5000 + bank = (objId & 0x0000FFFFFF000000L) >> 24 + id = objId & 0x0000000000FFFFFFL + return bank * 1000 + id def rawObjId (self, displayId): - if displayId < 5000: - return displayId + self.baseId - return displayId - 5000 + 0x8000000000000000L + bank = displayId / 1000 + id = displayId % 1000 + if bank < 3: + objId = (bank << 24) + id + else: + objId = self.bootSequence + (bank << 24) + id + return objId def displayClassName (self, cls): (packageName, className, hash) = cls @@ -158,7 +164,7 @@ class ManagementData: self.lock = Lock () self.tables = {} self.schema = {} - self.baseId = 0 + self.bootSequence = 0 self.disp = disp self.lastUnit = None self.methodSeq = 1 @@ -166,7 +172,8 @@ class ManagementData: self.broker = Broker (host) self.client = Client (self.broker.host, self.broker.port, self.spec) - self.client.start ({"LOGIN": username, "PASSWORD": password}) + self.client.start (response='\x00' + username + '\x00' + password, + mechanism="PLAIN") self.channel = self.client.channel (1) self.mclient = managementClient (self.spec, self.ctrlHandler, self.configHandler, @@ -189,7 +196,7 @@ class ManagementData: if item[0] == key: typecode = item[1] unit = item[2] - if (typecode >= 1 and typecode <= 5) or typecode >= 12: # numerics + if (typecode >= 1 and typecode <= 5) or typecode == 12 or typecode == 13: # numerics if unit == None or unit == self.lastUnit: return str (value) else: @@ -214,7 +221,7 @@ class ManagementData: else: return "True" elif typecode == 14: - return str (UUID (bytes=value)) + return "%08x-%04x-%04x-%04x-%04x%08x" % struct.unpack ("!LHHHHL", value) elif typecode == 15: return str (value) return "*type-error*" |
