diff options
| author | Ted Ross <tross@apache.org> | 2009-08-21 21:19:22 +0000 |
|---|---|---|
| committer | Ted Ross <tross@apache.org> | 2009-08-21 21:19:22 +0000 |
| commit | 2ad1a5da3732b280d9b780313969bef4da05f113 (patch) | |
| tree | 17c318c1d32a51117556196aa2a1b3407053088f /cpp/bindings | |
| parent | 03f4fe803f86ea88f62b685622b110a9785cf8d0 (diff) | |
| download | qpid-python-2ad1a5da3732b280d9b780313969bef4da05f113.tar.gz | |
Implemented the new QMF ConnectionSettings and incorporated into the bindings.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@806725 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/bindings')
| -rw-r--r-- | cpp/bindings/qmf/qmfengine.i | 28 | ||||
| -rw-r--r-- | cpp/bindings/qmf/ruby/Makefile.am | 2 | ||||
| -rw-r--r-- | cpp/bindings/qmf/ruby/qmf.rb | 32 | ||||
| -rwxr-xr-x | cpp/bindings/qmf/tests/agent_ruby.rb | 4 |
4 files changed, 45 insertions, 21 deletions
diff --git a/cpp/bindings/qmf/qmfengine.i b/cpp/bindings/qmf/qmfengine.i index e1a4c53bec..8ae28730e5 100644 --- a/cpp/bindings/qmf/qmfengine.i +++ b/cpp/bindings/qmf/qmfengine.i @@ -19,24 +19,22 @@ %{ -#include "AgentEngine.h" -#include <ResilientConnection.h> +#include "qmf/AgentEngine.h" +#include <qmf/ResilientConnection.h> %} - -%include <Query.h> -%include <Message.h> -%include <AgentEngine.h> -%include <ResilientConnection.h> -%include <Typecode.h> -%include <Schema.h> -%include <Value.h> -%include <ObjectId.h> -%include <Object.h> - -%include <qpid/client/ClientImportExport.h> -%include <qpid/client/ConnectionSettings.h> +%include <qmf/QmfImportExport.h> +%include <qmf/Query.h> +%include <qmf/Message.h> +%include <qmf/AgentEngine.h> +%include <qmf/ConnectionSettings.h> +%include <qmf/ResilientConnection.h> +%include <qmf/Typecode.h> +%include <qmf/Schema.h> +%include <qmf/Value.h> +%include <qmf/ObjectId.h> +%include <qmf/Object.h> %inline { diff --git a/cpp/bindings/qmf/ruby/Makefile.am b/cpp/bindings/qmf/ruby/Makefile.am index 1dc08f646a..0537dd1cd8 100644 --- a/cpp/bindings/qmf/ruby/Makefile.am +++ b/cpp/bindings/qmf/ruby/Makefile.am @@ -19,7 +19,7 @@ if HAVE_RUBY_DEVEL -INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/include -I$(top_srcdir)/src/qmf -I$(top_srcdir)/src -I$(top_builddir)/src +INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/include -I$(top_srcdir)/src -I$(top_builddir)/src EXTRA_DIST = ruby.i BUILT_SOURCES = qmfengine.cpp diff --git a/cpp/bindings/qmf/ruby/qmf.rb b/cpp/bindings/qmf/ruby/qmf.rb index 35a76c490a..f3915e9c02 100644 --- a/cpp/bindings/qmf/ruby/qmf.rb +++ b/cpp/bindings/qmf/ruby/qmf.rb @@ -30,7 +30,33 @@ module Qmf end end - class ConnectionSettings < Qmfengine::ConnectionSettings + class ConnectionSettings + attr_reader :impl + + def initialize(url = nil) + if url + @impl = Qmfengine::ConnectionSettings.new(url) + else + @impl = Qmfengine::ConnectionSettings.new() + end + end + + def set_attr(key, val) + if val.class == String + v = Qmfengine::Value.new(TYPE_LSTR) + v.setString(val) + elsif val.class == TrueClass or val.class == FalseClass + v = Qmfengine::Value.new(TYPE_BOOL) + v.setBool(val) + elsif val.class == Fixnum + v = Qmfengine::Value.new(TYPE_UINT32) + v.setUint(val) + else + raise ArgumentError, "Value for attribute '#{key}' has unsupported type: #{val.class}" + end + + @impl.setAttr(key, v) + end end class ConnectionHandler @@ -66,8 +92,8 @@ module Qmf class Connection attr_reader :impl - def initialize(settings, delay_min = 1, delay_max = 128, delay_factor = 2) - @impl = Qmfengine::ResilientConnection.new(settings, delay_min, delay_max, delay_factor) + def initialize(settings) + @impl = Qmfengine::ResilientConnection.new(settings.impl) @sockEngine, @sock = Socket::socketpair(Socket::PF_UNIX, Socket::SOCK_STREAM, 0) @impl.setNotifyFd(@sockEngine.fileno) @new_conn_handlers = Array.new diff --git a/cpp/bindings/qmf/tests/agent_ruby.rb b/cpp/bindings/qmf/tests/agent_ruby.rb index d395810cb6..3f04b0ce2e 100755 --- a/cpp/bindings/qmf/tests/agent_ruby.rb +++ b/cpp/bindings/qmf/tests/agent_ruby.rb @@ -71,8 +71,8 @@ class App < Qmf::AgentHandler def main @settings = Qmf::ConnectionSettings.new - @settings.host = ARGV[0] if ARGV.size > 0 - @settings.port = ARGV[1].to_i if ARGV.size > 1 + @settings.set_attr("host", ARGV[0]) if ARGV.size > 0 + @settings.set_attr("port", ARGV[1].to_i) if ARGV.size > 1 @connection = Qmf::Connection.new(@settings) @agent = Qmf::Agent.new(self) |
