summaryrefslogtreecommitdiff
path: root/cpp/bindings/qmf/ruby
diff options
context:
space:
mode:
authorTed Ross <tross@apache.org>2009-08-21 21:19:22 +0000
committerTed Ross <tross@apache.org>2009-08-21 21:19:22 +0000
commit2ad1a5da3732b280d9b780313969bef4da05f113 (patch)
tree17c318c1d32a51117556196aa2a1b3407053088f /cpp/bindings/qmf/ruby
parent03f4fe803f86ea88f62b685622b110a9785cf8d0 (diff)
downloadqpid-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/qmf/ruby')
-rw-r--r--cpp/bindings/qmf/ruby/Makefile.am2
-rw-r--r--cpp/bindings/qmf/ruby/qmf.rb32
2 files changed, 30 insertions, 4 deletions
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