qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From astitc...@apache.org
Subject svn commit: r1157278 - in /qpid/trunk/qpid: extras/qmf/src/py/qmf/console.py tools/src/py/qpid-route
Date Fri, 12 Aug 2011 22:32:57 GMT
Author: astitcher
Date: Fri Aug 12 22:32:57 2011
New Revision: 1157278

URL: http://svn.apache.org/viewvc?rev=1157278&view=rev
Log:
QPID-3409: Fixup federation tools to allow IPv6 literals as part of the address in broker
URLs

Modified:
    qpid/trunk/qpid/extras/qmf/src/py/qmf/console.py
    qpid/trunk/qpid/tools/src/py/qpid-route

Modified: qpid/trunk/qpid/extras/qmf/src/py/qmf/console.py
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/extras/qmf/src/py/qmf/console.py?rev=1157278&r1=1157277&r2=1157278&view=diff
==============================================================================
--- qpid/trunk/qpid/extras/qmf/src/py/qmf/console.py (original)
+++ qpid/trunk/qpid/extras/qmf/src/py/qmf/console.py Fri Aug 12 22:32:57 2011
@@ -107,8 +107,8 @@ class Console:
 # BrokerURL
 #===================================================================================================
 class BrokerURL(URL):
-  def __init__(self, text):
-    URL.__init__(self, text)
+  def __init__(self, *args, **kwargs):
+    URL.__init__(self, *args, **kwargs)
     if self.port is None:
       if self.scheme == URL.AMQPS:
         self.port = 5671
@@ -122,7 +122,7 @@ class BrokerURL(URL):
       self.authPass = str(self.password)
 
   def name(self):
-    return self.host + ":" + str(self.port)
+    return str(self)
 
   def match(self, host, port):
     return socket.getaddrinfo(self.host, self.port)[0][4] == socket.getaddrinfo(host, port)[0][4]
@@ -645,7 +645,10 @@ class Session:
     Will raise an exception if the session is not managing the connection and
     the connection setup to the broker fails.
     """
-    url = BrokerURL(target)
+    if isinstance(target, BrokerURL):
+      url = target
+    else:
+      url = BrokerURL(target)
     broker = Broker(self, url.host, url.port, mechanisms, url.authName, url.authPass,
                     ssl = url.scheme == URL.AMQPS, connTimeout=timeout)
 
@@ -2346,18 +2349,19 @@ class Broker(Thread):
 
   def getUrl(self):
     """ """
-    return "%s:%d" % (self.host, self.port)
+    return BrokerURL(host=self.host, port=self.port)
 
   def getFullUrl(self, noAuthIfGuestDefault=True):
     """ """
-    ssl = ""
     if self.ssl:
-      ssl = "s"
-    auth = "%s/%s@" % (self.authUser, self.authPass)
+      scheme = "amqps"
+    else:
+      scheme = "amqp"
     if self.authUser == "" or \
           (noAuthIfGuestDefault and self.authUser == "guest" and self.authPass == "guest"):
-      auth = ""
-    return "amqp%s://%s%s:%d" % (ssl, auth, self.host, self.port or 5672)
+      return BrokerURL(scheme=scheme, host=self.host, port=(self.port or 5672))
+    else:
+      return BrokerURL(scheme=scheme, user=self.authUser, password=self.authPass, host=self.host,
port=(self.port or 5672))
 
   def __repr__(self):
     if self.connected:

Modified: qpid/trunk/qpid/tools/src/py/qpid-route
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/tools/src/py/qpid-route?rev=1157278&r1=1157277&r2=1157278&view=diff
==============================================================================
--- qpid/trunk/qpid/tools/src/py/qpid-route (original)
+++ qpid/trunk/qpid/tools/src/py/qpid-route Fri Aug 12 22:32:57 2011
@@ -217,11 +217,11 @@ class RouteManager:
             added = False
             links = self.qmf.getObjects(_class="link")
             for link in links:
-                url = BrokerURL("%s:%d" % (link.host, link.port))
+                url = BrokerURL(host=link.host, port=link.port)
                 if url.name() not in self.brokerList:
                     print "    %s..." % url.name(),
                     try:
-                        b = self.qmf.addBroker("%s:%d" % (link.host, link.port), config._connTimeout)
+                        b = self.qmf.addBroker(url, config._connTimeout)
                         self.brokerList[url.name()] = b
                         added = True
                         print "Ok"
@@ -245,7 +245,7 @@ class RouteManager:
             for bridge in bridges:
                 if bridge.src == ex:
                     link = bridge._linkRef_
-                    fromUrl = "%s:%s" % (link.host, link.port)
+                    fromUrl = BrokerURL(host=link.host, port=link.port)
                     toUrl = bridge.getBroker().getUrl()
                     found = False
                     for pair in pairs:



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org


Mime
View raw message