Author: aconway
Date: Fri Feb 17 14:12:59 2012
New Revision: 1245526

URL: http://svn.apache.org/viewvc?rev=1245526&view=rev
Log:
QPID-3603: Set connection.start client-properties argument from python.

The client-properties can be specified for old-API, new-API and
QMF connections.

Modified:
    qpid/branches/qpid-3603-7/qpid/cpp/src/tests/test_env.sh.in
    qpid/branches/qpid-3603-7/qpid/extras/qmf/src/py/qmf/console.py
    qpid/branches/qpid-3603-7/qpid/python/qpid/delegates.py
    qpid/branches/qpid-3603-7/qpid/python/qpid/messaging/driver.py
    qpid/branches/qpid-3603-7/qpid/python/qpid/messaging/endpoints.py

Modified: qpid/branches/qpid-3603-7/qpid/cpp/src/tests/test_env.sh.in
URL: 
http://svn.apache.org/viewvc/qpid/branches/qpid-3603-7/qpid/cpp/src/tests/test_env.sh.in?rev=1245526&r1=1245525&r2=1245526&view=diff
==============================================================================
--- qpid/branches/qpid-3603-7/qpid/cpp/src/tests/test_env.sh.in (original)
+++ qpid/branches/qpid-3603-7/qpid/cpp/src/tests/test_env.sh.in Fri Feb 17 
14:12:59 2012
@@ -55,7 +55,7 @@ export RECEIVER_EXEC=$QPID_TEST_EXEC_DIR
 export SENDER_EXEC=$QPID_TEST_EXEC_DIR/sender
 
 # Path
-export 
PATH=$top_builddir/src:$builddir:$srcdir:$PYTHON_COMMANDS:$QPID_TEST_EXEC_DIR:$PATH
+export 
PATH=$top_builddir/src:$builddir:$srcdir:$PYTHON_COMMANDS:$QPID_TEST_EXEC_DIR:$PYTHON_DIR/commands:$PATH
 
 # Modules
 export TEST_STORE_LIB=$testmoduledir/test_store.so

Modified: qpid/branches/qpid-3603-7/qpid/extras/qmf/src/py/qmf/console.py
URL: 
http://svn.apache.org/viewvc/qpid/branches/qpid-3603-7/qpid/extras/qmf/src/py/qmf/console.py?rev=1245526&r1=1245525&r2=1245526&view=diff
==============================================================================
--- qpid/branches/qpid-3603-7/qpid/extras/qmf/src/py/qmf/console.py (original)
+++ qpid/branches/qpid-3603-7/qpid/extras/qmf/src/py/qmf/console.py Fri Feb 17 
14:12:59 2012
@@ -640,7 +640,7 @@ class Session:
     return "QMF Console Session Manager (brokers: %d)" % len(self.brokers)
 
 
-  def addBroker(self, target="localhost", timeout=None, mechanisms=None):
+  def addBroker(self, target="localhost", timeout=None, mechanisms=None, 
**connectArgs):
     """ Connect to a Qpid broker.  Returns an object of type Broker.
     Will raise an exception if the session is not managing the connection and
     the connection setup to the broker fails.
@@ -650,7 +650,7 @@ class Session:
     else:
       url = BrokerURL(target)
     broker = Broker(self, url.host, url.port, mechanisms, url.authName, 
url.authPass,
-                    ssl = url.scheme == URL.AMQPS, connTimeout=timeout)
+                    ssl = url.scheme == URL.AMQPS, connTimeout=timeout, 
**connectArgs)
 
     self.brokers.append(broker)
     return broker
@@ -2240,7 +2240,8 @@ class Broker(Thread):
       self.typecode = typecode
       self.data = data
 
-  def __init__(self, session, host, port, authMechs, authUser, authPass, 
ssl=False, connTimeout=None):
+  def __init__(self, session, host, port, authMechs, authUser, authPass,
+               ssl=False, connTimeout=None, **connectArgs):
     """ Create a broker proxy and setup a connection to the broker.  Will raise
     an exception if the connection fails and the session is not configured to
     retry connection setup (manageConnections = False).
@@ -2274,7 +2275,7 @@ class Broker(Thread):
     self.amqpSessionId = "%s.%d.%d" % (platform.uname()[1], os.getpid(), 
Broker.nextSeq)
     Broker.nextSeq += 1
     self.last_age_check = time()
-
+    self.connectArgs = connectArgs
     # thread control
     self.setDaemon(True)
     self.setName("Thread for broker: %s:%d" % (host, port))
@@ -2426,7 +2427,8 @@ class Broker(Thread):
       else:
         connSock = sock
       self.conn = Connection(connSock, username=self.authUser, 
password=self.authPass,
-                             mechanism = self.mechanisms, host=self.host, 
service="qpidd")
+                             mechanism = self.mechanisms, host=self.host, 
service="qpidd",
+                             **self.connectArgs)
       def aborted():
         raise Timeout("Waiting for connection to be established with broker")
       oldAborted = self.conn.aborted

Modified: qpid/branches/qpid-3603-7/qpid/python/qpid/delegates.py
URL: 
http://svn.apache.org/viewvc/qpid/branches/qpid-3603-7/qpid/python/qpid/delegates.py?rev=1245526&r1=1245525&r2=1245526&view=diff
==============================================================================
--- qpid/branches/qpid-3603-7/qpid/python/qpid/delegates.py (original)
+++ qpid/branches/qpid-3603-7/qpid/python/qpid/delegates.py Fri Feb 17 14:12:59 
2012
@@ -159,7 +159,8 @@ class Client(Delegate):
   def __init__(self, connection, username=None, password=None,
                mechanism=None, heartbeat=None, **kwargs):
     Delegate.__init__(self, connection)
-
+    self.client_properties=Client.PROPERTIES.copy()
+    self.client_properties.update(kwargs.get("client_properties",{}))
     ##
     ## self.acceptableMechanisms is the list of SASL mechanisms that the 
client is willing to
     ## use.  If it's None, then any mechanism is acceptable.
@@ -215,7 +216,8 @@ class Client(Delegate):
         mech = "ANONYMOUS"
         if not mech in mech_list:
           raise Closed("No acceptable SASL authentication mechanism available")
-    ch.connection_start_ok(client_properties=Client.PROPERTIES, 
mechanism=mech, response=initial)
+    ch.connection_start_ok(client_properties=self.client_properties,
+                           mechanism=mech, response=initial)
 
   def connection_secure(self, ch, secure):
     resp = None

Modified: qpid/branches/qpid-3603-7/qpid/python/qpid/messaging/driver.py
URL: 
http://svn.apache.org/viewvc/qpid/branches/qpid-3603-7/qpid/python/qpid/messaging/driver.py?rev=1245526&r1=1245525&r2=1245526&view=diff
==============================================================================
--- qpid/branches/qpid-3603-7/qpid/python/qpid/messaging/driver.py (original)
+++ qpid/branches/qpid-3603-7/qpid/python/qpid/messaging/driver.py Fri Feb 17 
14:12:59 2012
@@ -705,7 +705,10 @@ class Engine:
       mech, initial = self._sasl.start(" ".join(mechs))
     except sasl.SASLError, e:
       raise AuthenticationFailure(text=str(e))
-    self.write_op(ConnectionStartOk(client_properties=CLIENT_PROPERTIES,
+
+    client_properties = CLIENT_PROPERTIES.copy()
+    client_properties.update(self.connection.client_properties)
+    self.write_op(ConnectionStartOk(client_properties=client_properties,
                                     mechanism=mech, response=initial))
 
   def do_connection_secure(self, secure):

Modified: qpid/branches/qpid-3603-7/qpid/python/qpid/messaging/endpoints.py
URL: 
http://svn.apache.org/viewvc/qpid/branches/qpid-3603-7/qpid/python/qpid/messaging/endpoints.py?rev=1245526&r1=1245525&r2=1245526&view=diff
==============================================================================
--- qpid/branches/qpid-3603-7/qpid/python/qpid/messaging/endpoints.py (original)
+++ qpid/branches/qpid-3603-7/qpid/python/qpid/messaging/endpoints.py Fri Feb 
17 14:12:59 2012
@@ -170,6 +170,7 @@ class Connection(Endpoint):
     self.ssl_keyfile = options.get("ssl_keyfile", None)
     self.ssl_certfile = options.get("ssl_certfile", None)
     self.ssl_trustfile = options.get("ssl_trustfile", None)
+    self.client_properties = options.get("client_properties", {})
 
     self.options = options
 



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

Reply via email to