summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/client
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2008-06-02 21:38:25 +0000
committerAlan Conway <aconway@apache.org>2008-06-02 21:38:25 +0000
commit3ff35b94f59f92bf33c8f4d29643c4ad899b4673 (patch)
treef45d78a5d4a03408e813cc1fc82f7ba749053d44 /cpp/src/qpid/client
parent93aa60d35700a912d47719770f294135292359e6 (diff)
downloadqpid-python-3ff35b94f59f92bf33c8f4d29643c4ad899b4673.tar.gz
Separate option parsing from qpid::client::ClientSettings.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@662581 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/client')
-rw-r--r--cpp/src/qpid/client/Connection.cpp3
-rw-r--r--cpp/src/qpid/client/ConnectionSettings.cpp30
-rw-r--r--cpp/src/qpid/client/ConnectionSettings.h20
3 files changed, 8 insertions, 45 deletions
diff --git a/cpp/src/qpid/client/Connection.cpp b/cpp/src/qpid/client/Connection.cpp
index 6994c7a400..752cb9095c 100644
--- a/cpp/src/qpid/client/Connection.cpp
+++ b/cpp/src/qpid/client/Connection.cpp
@@ -53,8 +53,7 @@ void Connection::open(
const std::string& vhost,
uint16_t maxFrameSize)
{
- // FIXME aconway 2008-06-02: refactor ConnectionSettings to separate out command line parsing.
- ConnectionSettings settings("");
+ ConnectionSettings settings;
settings.host = host;
settings.port = port;
settings.username = uid;
diff --git a/cpp/src/qpid/client/ConnectionSettings.cpp b/cpp/src/qpid/client/ConnectionSettings.cpp
index 26a11c3b9d..2de2f92e45 100644
--- a/cpp/src/qpid/client/ConnectionSettings.cpp
+++ b/cpp/src/qpid/client/ConnectionSettings.cpp
@@ -29,8 +29,7 @@
namespace qpid {
namespace client {
-ConnectionSettings::ConnectionSettings(const std::string& argv0) :
- Options("Connection Settings"),
+ConnectionSettings::ConnectionSettings() :
host("localhost"),
port(TcpAddress::DEFAULT_PORT),
clientid("cpp"),
@@ -42,34 +41,11 @@ ConnectionSettings::ConnectionSettings(const std::string& argv0) :
maxChannels(32767),
maxFrameSize(65535),
bounds(2),
- tcpNoDelay(false),
- log(argv0)
-{
- addOptions()
- ("broker,b", optValue(host, "HOST"), "Broker host to connect to")
- ("port,p", optValue(port, "PORT"), "Broker port to connect to")
- ("virtualhost,v", optValue(virtualhost, "VHOST"), "virtual host")
- ("clientname,n", optValue(clientid, "ID"), "unique client identifier")
- ("username", optValue(username, "USER"), "user name for broker log in.")
- ("password", optValue(password, "PASSWORD"), "password for broker log in.")
- ("mechanism", optValue(mechanism, "MECH"), "SASL mechanism to use when authenticating.")
- ("locale", optValue(locale, "LOCALE"), "locale to use.")
- ("max-channels", optValue(maxChannels, "N"), "the maximum number of channels the client requires.")
- ("max-frame-size", optValue(maxFrameSize, "N"), "the maximum frame size to request.")
- ("bounds-multiplier", optValue(bounds, "N"),
- "restricts the total size of outgoing frames queued up for writing (as a multiple of the max frame size).");
- add(log);
-}
+ tcpNoDelay(false)
+{}
ConnectionSettings::~ConnectionSettings() {}
-void ConnectionSettings::parse(int argc, char** argv)
-{
- qpid::Options::parse(argc, argv);
- qpid::log::Logger::instance().configure(log);
-}
-
-
void ConnectionSettings::configurePosixTcpSocket(int fd) const
{
if (tcpNoDelay) {
diff --git a/cpp/src/qpid/client/ConnectionSettings.h b/cpp/src/qpid/client/ConnectionSettings.h
index d35b8bc0e7..bc3d79e1c6 100644
--- a/cpp/src/qpid/client/ConnectionSettings.h
+++ b/cpp/src/qpid/client/ConnectionSettings.h
@@ -34,12 +34,11 @@ namespace qpid {
namespace client {
/**
- * Used to hold seetings for a connection (and parse these from
- * command line options etc if desired).
+ * Settings for a Connection.
*/
-struct ConnectionSettings : qpid::Options, qpid::sys::Socket::Configuration {
- // FIXME aconway 2008-06-02: separate option parsing from settings as subclass.
- ConnectionSettings(const std::string& argv0=std::string());
+struct ConnectionSettings : public sys::Socket::Configuration {
+
+ ConnectionSettings();
virtual ~ConnectionSettings();
/**
@@ -47,12 +46,6 @@ struct ConnectionSettings : qpid::Options, qpid::sys::Socket::Configuration {
*/
virtual void configurePosixTcpSocket(int fd) const;
- /**
- * Parse options from command line arguments (will throw exception
- * if arguments cannot be parsed).
- */
- void parse(int argc, char** argv);
-
/**
* The host (or ip address) to connect to (defaults to 'localhost').
*/
@@ -110,11 +103,6 @@ struct ConnectionSettings : qpid::Options, qpid::sys::Socket::Configuration {
* If true, TCP_NODELAY will be set for the connection.
*/
bool tcpNoDelay;
-
- /**
- * Logging settings to use.
- */
- log::Options log;
};
}} // namespace qpid::client