qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From g...@apache.org
Subject svn commit: r943071 - in /qpid/trunk/qpid/cpp: include/qpid/messaging/Connection.h src/qpid/client/amqp0_10/ConnectionImpl.cpp src/qpid/messaging/Connection.cpp
Date Tue, 11 May 2010 10:06:30 GMT
Author: gsim
Date: Tue May 11 10:06:30 2010
New Revision: 943071

URL: http://svn.apache.org/viewvc?rev=943071&view=rev
Log:
QPID-664: Add default constructor for Connection; add option to set url on existing connection.

Modified:
    qpid/trunk/qpid/cpp/include/qpid/messaging/Connection.h
    qpid/trunk/qpid/cpp/src/qpid/client/amqp0_10/ConnectionImpl.cpp
    qpid/trunk/qpid/cpp/src/qpid/messaging/Connection.cpp

Modified: qpid/trunk/qpid/cpp/include/qpid/messaging/Connection.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/include/qpid/messaging/Connection.h?rev=943071&r1=943070&r2=943071&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/include/qpid/messaging/Connection.h (original)
+++ qpid/trunk/qpid/cpp/include/qpid/messaging/Connection.h Tue May 11 10:06:30 2010
@@ -45,6 +45,7 @@ class Connection : public qpid::messagin
   public:
     QPID_CLIENT_EXTERN Connection(ConnectionImpl* impl);
     QPID_CLIENT_EXTERN Connection(const Connection&);
+    QPID_CLIENT_EXTERN Connection();
     /**  
      * Current implementation supports the following options:
      * 

Modified: qpid/trunk/qpid/cpp/src/qpid/client/amqp0_10/ConnectionImpl.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/client/amqp0_10/ConnectionImpl.cpp?rev=943071&r1=943070&r2=943071&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/client/amqp0_10/ConnectionImpl.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/client/amqp0_10/ConnectionImpl.cpp Tue May 11 10:06:30 2010
@@ -103,7 +103,7 @@ ConnectionImpl::ConnectionImpl(const std
 {
     QPID_LOG(debug, "Created connection with " << options);
     setOptions(options);
-    urls.push_back(url);
+    urls.insert(urls.begin(), url);
 }
 
 void ConnectionImpl::setOptions(const Variant::Map& options)
@@ -125,10 +125,15 @@ void ConnectionImpl::setOptions(const Va
 
 void ConnectionImpl::setOption(const std::string& name, const Variant& value)
 {
-    Variant::Map options;
-    options[name] = value;
-    setOptions(options);
-    QPID_LOG(debug, "Set " << name << " to " << value);
+    if (name == "url") {
+        if (urls.size()) urls[0] = value.asString();
+        else urls.insert(urls.begin(), value.asString());
+    } else {
+        Variant::Map options;
+        options[name] = value;
+        setOptions(options);
+        QPID_LOG(debug, "Set " << name << " to " << value);
+    }
 }
 
 void ConnectionImpl::close()

Modified: qpid/trunk/qpid/cpp/src/qpid/messaging/Connection.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/messaging/Connection.cpp?rev=943071&r1=943070&r2=943071&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/messaging/Connection.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/messaging/Connection.cpp Tue May 11 10:06:30 2010
@@ -54,6 +54,13 @@ Connection::Connection(const std::string
     PI::ctor(*this, new qpid::client::amqp0_10::ConnectionImpl(url, options));
 }
 
+Connection::Connection()
+{ 
+    Variant::Map options;
+    std::string url = "amqp:tcp:127.0.0.1:5672";
+    PI::ctor(*this, new qpid::client::amqp0_10::ConnectionImpl(url, options));
+}
+
 void Connection::open() { impl->open(); }
 bool Connection::isOpen() { return impl->isOpen(); }
 void Connection::close() { impl->close(); }



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


Mime
View raw message