qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ai...@apache.org
Subject svn commit: r812936 [2/6] - in /qpid/branches/java-network-refactor: ./ qpid/buildtools/buildCreator/ qpid/cpp/ qpid/cpp/bindings/qmf/ qpid/cpp/bindings/qmf/python/ qpid/cpp/bindings/qmf/python/qmf/ qpid/cpp/bindings/qmf/ruby/ qpid/cpp/bindings/qmf/tes...
Date Wed, 09 Sep 2009 13:05:52 GMT
Modified: qpid/branches/java-network-refactor/qpid/cpp/bindings/qmf/ruby/qmf.rb
URL: http://svn.apache.org/viewvc/qpid/branches/java-network-refactor/qpid/cpp/bindings/qmf/ruby/qmf.rb?rev=812936&r1=812935&r2=812936&view=diff
==============================================================================
--- qpid/branches/java-network-refactor/qpid/cpp/bindings/qmf/ruby/qmf.rb (original)
+++ qpid/branches/java-network-refactor/qpid/cpp/bindings/qmf/ruby/qmf.rb Wed Sep  9 13:05:43 2009
@@ -20,517 +20,846 @@
 require 'qmfengine'
 require 'thread'
 require 'socket'
+require 'monitor'
 
 module Qmf
 
-    # Pull all the TYPE_* constants into Qmf namespace.  Maybe there's an easier way?
-    Qmfengine.constants.each do |c|
-        if c.index('TYPE_') == 0 or c.index('ACCESS_') == 0 or c.index('DIR_') == 0
-            const_set(c, Qmfengine.const_get(c))
-        end
+  # Pull all the TYPE_* constants into Qmf namespace.  Maybe there's an easier way?
+  Qmfengine.constants.each do |c|
+    if c.index('TYPE_') == 0 or c.index('ACCESS_') == 0 or c.index('DIR_') == 0 or c.index('CLASS_') == 0
+      const_set(c, Qmfengine.const_get(c))
     end
+  end
 
-    class ConnectionSettings < Qmfengine::ConnectionSettings
-    end
+  ##==============================================================================
+  ## CONNECTION
+  ##==============================================================================
 
-    class ConnectionEvent
-        def conn_event_connected(); end
-        def conn_event_disconnected(error); end
-        def conn_event_session_closed(context, error); end
-        def conn_event_recv(context, message); end
-    end
+  class ConnectionSettings
+    attr_reader :impl
 
-    class Query
-      attr_reader :impl
-      def initialize(i)
-        @impl = i
-      end
-
-      def package_name
-        @impl.getPackage
+    def initialize(url = nil)
+      if url
+        @impl = Qmfengine::ConnectionSettings.new(url)
+      else
+        @impl = Qmfengine::ConnectionSettings.new()
       end
+    end
 
-      def class_name
-        @impl.getClass
+    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
 
-      def object_id
-        objid = @impl.getObjectId
-        if objid.class == NilClass
-          return nil
-        end
-        return ObjectId.new(objid)
-      end
+      @impl.setAttr(key, v)
     end
+  end
 
-    class AgentHandler
-      def get_query(context, query, userId); end
-      def method_call(context, name, object_id, args, userId); end
-    end
+  class ConnectionHandler
+    def conn_event_connected(); end
+    def conn_event_disconnected(error); end
+    def sess_event_session_closed(context, error); end
+    def sess_event_recv(context, message); end
+  end
 
-    class Connection
-      attr_reader :impl
+  class Connection
+    include MonitorMixin
 
-      def initialize(settings, event_handler = nil, delay_min = 1, delay_max = 128, delay_factor = 2)
-        @impl = Qmfengine::ResilientConnection.new(settings, delay_min, delay_max, delay_factor)
-        @sockEngine, @sock = Socket::socketpair(Socket::PF_UNIX, Socket::SOCK_STREAM, 0)
-        @impl.setNotifyFd(@sockEngine.fileno)
-        @new_conn_handlers = Array.new
-        @conn_handlers = Array.new
-        @sess_handlers = Array.new
+    attr_reader :impl
 
-        @thread = Thread.new do
-          run
-        end
-      end
+    def initialize(settings)
+      super()
+      @impl = Qmfengine::ResilientConnection.new(settings.impl)
+      @sockEngine, @sock = Socket::socketpair(Socket::PF_UNIX, Socket::SOCK_STREAM, 0)
+      @impl.setNotifyFd(@sockEngine.fileno)
+      @new_conn_handlers = []
+      @conn_handlers = []
 
-      def add_conn_handler(handler)
-        @new_conn_handlers.push(handler)
-        @sockEngine.write("x")
+      @thread = Thread.new do
+        run
       end
+    end
 
-      def add_sess_handler(handler)
-        @sess_handlers.push(handler)
+    def add_conn_handler(handler)
+      synchronize do
+        @new_conn_handlers << handler
       end
+      @sockEngine.write("x")
+    end
 
-      def run()
-        event = Qmfengine::ResilientConnectionEvent.new
-        connected = nil
-        while :true
-          @sock.read(1)
+    def run()
+      eventImpl = Qmfengine::ResilientConnectionEvent.new
+      connected = nil
+      new_handlers = nil
+      bt_count = 0
 
-          @new_conn_handlers.each do |nh|
-            @conn_handlers.push(nh)
-            nh.conn_event_connected() if connected
-          end
-          @new_conn_handlers = Array.new
+      while :true
+        @sock.read(1)
+
+        synchronize do
+          new_handlers = @new_conn_handlers
+          @new_conn_handlers = []
+        end
 
-          valid = @impl.getEvent(event)
-          while valid
-            begin
-              case event.kind
-              when Qmfengine::ResilientConnectionEvent::CONNECTED
-                connected = :true
-                @conn_handlers.each { |h| h.conn_event_connected() }
-              when Qmfengine::ResilientConnectionEvent::DISCONNECTED
-                connected = nil
-                @conn_handlers.each { |h| h.conn_event_disconnected(event.errorText) }
-              when Qmfengine::ResilientConnectionEvent::SESSION_CLOSED
-                event.sessionContext.handler.sess_event_session_closed(event.sessionContext, event.errorText)
-              when Qmfengine::ResilientConnectionEvent::RECV
-                event.sessionContext.handler.sess_event_recv(event.sessionContext, event.message)
-              end
-            rescue Exception => ex
-              puts "Event Exception: #{ex}"
+        new_handlers.each do |nh|
+          @conn_handlers << nh
+          nh.conn_event_connected() if connected
+        end
+        new_handlers = nil
+
+        valid = @impl.getEvent(eventImpl)
+        while valid
+          begin
+            case eventImpl.kind
+            when Qmfengine::ResilientConnectionEvent::CONNECTED
+              connected = :true
+              @conn_handlers.each { |h| h.conn_event_connected() }
+            when Qmfengine::ResilientConnectionEvent::DISCONNECTED
+              connected = nil
+              @conn_handlers.each { |h| h.conn_event_disconnected(eventImpl.errorText) }
+            when Qmfengine::ResilientConnectionEvent::SESSION_CLOSED
+              eventImpl.sessionContext.handler.sess_event_session_closed(eventImpl.sessionContext, eventImpl.errorText)
+            when Qmfengine::ResilientConnectionEvent::RECV
+              eventImpl.sessionContext.handler.sess_event_recv(eventImpl.sessionContext, eventImpl.message)
+            end
+          rescue Exception => ex
+            puts "Event Exception: #{ex}"
+            if bt_count < 2
               puts ex.backtrace
+              bt_count += 1
             end
-            @impl.popEvent
-            valid = @impl.getEvent(event)
           end
+          @impl.popEvent
+          valid = @impl.getEvent(eventImpl)
         end
       end
     end
+  end
 
-    class Session
-      attr_reader :handle, :handler
+  class Session
+    attr_reader :handle, :handler
 
-      def initialize(conn, label, handler)
-        @conn = conn
-        @label = label
-        @handler = handler
-        @handle = Qmfengine::SessionHandle.new
-        @conn.add_sess_handler(@handler)
-        result = @conn.impl.createSession(label, self, @handle)
-      end
+    def initialize(conn, label, handler)
+      @conn = conn
+      @label = label
+      @handler = handler
+      @handle = Qmfengine::SessionHandle.new
+      result = @conn.impl.createSession(label, self, @handle)
     end
 
-    class ObjectId
-      attr_reader :impl
-      def initialize(impl=nil)
-        if impl
-          @impl = impl
-        else
-          @impl = Qmfengine::ObjectId.new
-        end
-      end
-      def object_num_high
-        return @impl.getObjectNumHi
-      end
-      def object_num_low
-        return @impl.getObjectNumLo
-      end
+    def destroy()
+      @conn.impl.destroySession(@handle)
     end
+  end
 
-    class Arguments
-      attr_reader :map
-      def initialize(map)
-        @map = map
-        @by_hash = {}
-        key_count = @map.keyCount
-        a = 0
-        while a < key_count
-          @by_hash[@map.key(a)] = by_key(@map.key(a))
-          a += 1
-        end
-      end
+  ##==============================================================================
+  ## OBJECTS
+  ##==============================================================================
 
-      def [] (key)
-        return @by_hash[key]
-      end
+  class QmfObject
+    attr_reader :impl, :object_class
+    def initialize(cls)
+      @object_class = cls
+      @impl = Qmfengine::Object.new(@object_class.impl)
+    end
 
-      def []= (key, value)
-        @by_hash[key] = value
-        set(key, value)
-      end
-
-      def each
-        @by_hash.each { |k, v| yield(k, v) }
-      end
-
-      def by_key(key)
-        val = @map.byKey(key)
-        case val.getType
-        when TYPE_UINT8, TYPE_UINT16, TYPE_UINT32 then val.asUint
-        when TYPE_UINT64                          then val.asUint64
-        when TYPE_SSTR, TYPE_LSTR                 then val.asString
-        when TYPE_ABSTIME                         then val.asInt64
-        when TYPE_DELTATIME                       then val.asUint64
-        when TYPE_REF                             then val.asObjectId
-        when TYPE_BOOL                            then val.asBool
-        when TYPE_FLOAT                           then val.asFloat
-        when TYPE_DOUBLE                          then val.asDouble
-        when TYPE_UUID                            then val.asUuid
-        when TYPE_INT8, TYPE_INT16, TYPE_INT32    then val.asInt
-        when TYPE_INT64                           then val.asInt64
-        when TYPE_MAP
-        when TYPE_OBJECT
-        when TYPE_LIST
-        when TYPE_ARRAY
-        end
-      end
+    def destroy
+      @impl.destroy
+    end
 
-      def set(key, value)
-        val = @map.byKey(key)
-        case val.getType
-        when TYPE_UINT8, TYPE_UINT16, TYPE_UINT32 then val.setUint(value)
-        when TYPE_UINT64 then val.setUint64(value)
-        when TYPE_SSTR, TYPE_LSTR then value ? val.setString(value) : val.setString('')
-        when TYPE_ABSTIME then val.setInt64(value)
-        when TYPE_DELTATIME then val.setUint64(value)
-        when TYPE_REF then val.setObjectId(value.impl)
-        when TYPE_BOOL then value ? val.setBool(value) : val.setBool(0)
-        when TYPE_FLOAT then val.setFloat(value)
-        when TYPE_DOUBLE then val.setDouble(value)
-        when TYPE_UUID then val.setUuid(value)
-        when TYPE_INT8, TYPE_INT16, TYPE_INT32 then val.setInt(value)
-        when TYPE_INT64 then val.setInt64(value)
-        when TYPE_MAP
-        when TYPE_OBJECT
-        when TYPE_LIST
-        when TYPE_ARRAY
-        end
-      end
+    def object_id
+      return ObjectId.new(@impl.getObjectId)
     end
 
-    class Agent
-      def initialize(handler, label="")
-        if label == ""
-          @agentLabel = "rb-%s.%d" % [Socket.gethostname, Process::pid]
-        else
-          @agentLabel = label
-        end
-        @conn = nil
-        @handler = handler
-        @impl = Qmfengine::Agent.new(@agentLabel)
-        @event = Qmfengine::AgentEvent.new
-        @xmtMessage = Qmfengine::Message.new
-      end
+    def set_object_id(oid)
+      @impl.setObjectId(oid.impl)
+    end
 
-      def set_connection(conn)
-        @conn = conn
-        @conn.add_conn_handler(self)
+    def get_attr(name)
+      val = value(name)
+      case val.getType
+      when TYPE_UINT8, TYPE_UINT16, TYPE_UINT32 then val.asUint
+      when TYPE_UINT64 then val.asUint64
+      when TYPE_SSTR, TYPE_LSTR then val.asString
+      when TYPE_ABSTIME then val.asInt64
+      when TYPE_DELTATIME then val.asUint64
+      when TYPE_REF then val.asObjectId
+      when TYPE_BOOL then val.asBool
+      when TYPE_FLOAT then val.asFloat
+      when TYPE_DOUBLE then val.asDouble
+      when TYPE_UUID then val.asUuid
+      when TYPE_INT8, TYPE_INT16, TYPE_INT32 then val.asInt
+      when TYPE_INT64 then val.asInt64
+      when TYPE_MAP
+      when TYPE_OBJECT
+      when TYPE_LIST
+      when TYPE_ARRAY
       end
+    end
 
-      def register_class(cls)
-        @impl.registerClass(cls.impl)
+    def set_attr(name, v)
+      val = value(name)
+      case val.getType
+      when TYPE_UINT8, TYPE_UINT16, TYPE_UINT32 then val.setUint(v)
+      when TYPE_UINT64 then val.setUint64(v)
+      when TYPE_SSTR, TYPE_LSTR then v ? val.setString(v) : val.setString('')
+      when TYPE_ABSTIME then val.setInt64(v)
+      when TYPE_DELTATIME then val.setUint64(v)
+      when TYPE_REF then val.setObjectId(v.impl)
+      when TYPE_BOOL then v ? val.setBool(v) : val.setBool(0)
+      when TYPE_FLOAT then val.setFloat(v)
+      when TYPE_DOUBLE then val.setDouble(v)
+      when TYPE_UUID then val.setUuid(v)
+      when TYPE_INT8, TYPE_INT16, TYPE_INT32 then val.setInt(v)
+      when TYPE_INT64 then val.setInt64(v)
+      when TYPE_MAP
+      when TYPE_OBJECT
+      when TYPE_LIST
+      when TYPE_ARRAY
       end
+    end
 
-      def alloc_object_id(low = 0, high = 0)
-        ObjectId.new(@impl.allocObjectId(low, high))
-      end
+    def [](name)
+      get_attr(name)
+    end
 
-      def query_response(context, object)
-        @impl.queryResponse(context, object.impl)
-      end
+    def []=(name, value)
+      set_attr(name, value)
+    end
 
-      def query_complete(context)
-        @impl.queryComplete(context)
-      end
+    def inc_attr(name, by=1)
+      set_attr(name, get_attr(name) + by)
+    end
 
-      def method_response(context, status, text, arguments)
-        @impl.methodResponse(context, status, text, arguments.map)
-      end
+    def dec_attr(name, by=1)
+      set_attr(name, get_attr(name) - by)
+    end
 
-      def do_agent_events()
-        count = 0
-        valid = @impl.getEvent(@event)
-        while valid
-          count += 1
-          case @event.kind
-          when Qmfengine::AgentEvent::GET_QUERY
-            @handler.get_query(@event.sequence, Query.new(@event.query), @event.authUserId)
-          when Qmfengine::AgentEvent::START_SYNC
-          when Qmfengine::AgentEvent::END_SYNC
-          when Qmfengine::AgentEvent::METHOD_CALL
-            args = Arguments.new(@event.arguments)
-            @handler.method_call(@event.sequence, @event.name, ObjectId.new(@event.objectId),
-                                 args, @event.authUserId)
-          when Qmfengine::AgentEvent::DECLARE_QUEUE
-            @conn.impl.declareQueue(@session.handle, @event.name)
-          when Qmfengine::AgentEvent::DELETE_QUEUE
-            @conn.impl.deleteQueue(@session.handle, @event.name)
-          when Qmfengine::AgentEvent::BIND
-            @conn.impl.bind(@session.handle, @event.exchange, @event.name, @event.bindingKey)
-          when Qmfengine::AgentEvent::UNBIND
-            @conn.impl.unbind(@session.handle, @event.exchange, @event.name, @event.bindingKey)
-          when Qmfengine::AgentEvent::SETUP_COMPLETE
-            @impl.startProtocol()
-          end
-          @impl.popEvent
-          valid = @impl.getEvent(@event)
-        end
-        return count
+    private
+    def value(name)
+      val = @impl.getValue(name.to_s)
+      if val.nil?
+        raise ArgumentError, "Attribute '#{name}' not defined for class #{@object_class.impl.getName}"
       end
+      return val
+    end
+  end
 
-      def do_agent_messages()
-        count = 0
-        valid = @impl.getXmtMessage(@xmtMessage)
-        while valid
-          count += 1
-          @conn.impl.sendMessage(@session.handle, @xmtMessage)
-          @impl.popXmt
-          valid = @impl.getXmtMessage(@xmtMessage)
-        end
-        return count
-      end
+  class ConsoleObject < QmfObject
+    attr_reader :current_time, :create_time, :delete_time
 
-      def do_events()
-        begin
-          ecnt = do_agent_events
-          mcnt = do_agent_messages
-        end until ecnt == 0 and mcnt == 0
-      end
+    def initialize(cls)
+      super(cls)
+    end
 
-      def conn_event_connected()
-        puts "Agent Connection Established..."
-        @session = Session.new(@conn, "qmfa-%s.%d" % [Socket.gethostname, Process::pid], self)
-        @impl.newSession
-        do_events
-      end
+    def update()
+    end
 
-      def conn_event_disconnected(error)
-        puts "Agent Connection Lost"
-      end
+    def mergeUpdate(newObject)
+    end
 
-      def sess_event_session_closed(context, error)
-        puts "Agent Session Lost"
-      end
+    def deleted?()
+      @delete_time > 0
+    end
 
-      def sess_event_recv(context, message)
-        @impl.handleRcvMessage(message)
-        do_events
-      end
+    def index()
     end
 
-    class SchemaArgument
-      attr_reader :impl
-      def initialize(name, typecode, kwargs={})
-        @impl = Qmfengine::SchemaArgument.new(name, typecode)
-        @impl.setDirection(kwargs[:dir]) if kwargs.include?(:dir)
-        @impl.setUnit(kwargs[:unit])     if kwargs.include?(:unit)
-        @impl.setDesc(kwargs[:desc])     if kwargs.include?(:desc)
-      end
+    def method_missing(name, *args)
     end
+  end
 
-    class SchemaMethod
-      attr_reader :impl
-      def initialize(name, kwargs={})
-        @impl = Qmfengine::SchemaMethod.new(name)
-        @impl.setDesc(kwargs[:desc]) if kwargs.include?(:desc)
-        @arguments = []
+  class ObjectId
+    attr_reader :impl
+    def initialize(impl=nil)
+      if impl
+        @impl = impl
+      else
+        @impl = Qmfengine::ObjectId.new
       end
+    end
+
+    def object_num_high
+      return @impl.getObjectNumHi
+    end
 
-      def add_argument(arg)
-        @arguments << arg
-        @impl.addArgument(arg.impl)
+    def object_num_low
+      return @impl.getObjectNumLo
+    end
+
+    def ==(other)
+      return (@impl.getObjectNumHi == other.impl.getObjectNumHi) &&
+        (@impl.getObjectNumLo == other.impl.getObjectNumLo)
+    end
+  end
+
+  class Arguments
+    attr_reader :map
+    def initialize(map)
+      @map = map
+      @by_hash = {}
+      key_count = @map.keyCount
+      a = 0
+      while a < key_count
+        @by_hash[@map.key(a)] = by_key(@map.key(a))
+        a += 1
       end
     end
 
-    class SchemaProperty
-      attr_reader :impl
-      def initialize(name, typecode, kwargs={})
-        @impl = Qmfengine::SchemaProperty.new(name, typecode)
-        @impl.setAccess(kwargs[:access])     if kwargs.include?(:access)
-        @impl.setIndex(kwargs[:index])       if kwargs.include?(:index)
-        @impl.setOptional(kwargs[:optional]) if kwargs.include?(:optional)
-        @impl.setUnit(kwargs[:unit])         if kwargs.include?(:unit)
-        @impl.setDesc(kwargs[:desc])         if kwargs.include?(:desc)
+    def [] (key)
+      return @by_hash[key]
+    end
+
+    def []= (key, value)
+      @by_hash[key] = value
+      set(key, value)
+    end
+
+    def each
+      @by_hash.each { |k, v| yield(k, v) }
+    end
+
+    def by_key(key)
+      val = @map.byKey(key)
+      case val.getType
+      when TYPE_UINT8, TYPE_UINT16, TYPE_UINT32 then val.asUint
+      when TYPE_UINT64                          then val.asUint64
+      when TYPE_SSTR, TYPE_LSTR                 then val.asString
+      when TYPE_ABSTIME                         then val.asInt64
+      when TYPE_DELTATIME                       then val.asUint64
+      when TYPE_REF                             then val.asObjectId
+      when TYPE_BOOL                            then val.asBool
+      when TYPE_FLOAT                           then val.asFloat
+      when TYPE_DOUBLE                          then val.asDouble
+      when TYPE_UUID                            then val.asUuid
+      when TYPE_INT8, TYPE_INT16, TYPE_INT32    then val.asInt
+      when TYPE_INT64                           then val.asInt64
+      when TYPE_MAP
+      when TYPE_OBJECT
+      when TYPE_LIST
+      when TYPE_ARRAY
       end
+    end
 
-      def name
-        @impl.getName
+    def set(key, value)
+      val = @map.byKey(key)
+      case val.getType
+      when TYPE_UINT8, TYPE_UINT16, TYPE_UINT32 then val.setUint(value)
+      when TYPE_UINT64 then val.setUint64(value)
+      when TYPE_SSTR, TYPE_LSTR then value ? val.setString(value) : val.setString('')
+      when TYPE_ABSTIME then val.setInt64(value)
+      when TYPE_DELTATIME then val.setUint64(value)
+      when TYPE_REF then val.setObjectId(value.impl)
+      when TYPE_BOOL then value ? val.setBool(value) : val.setBool(0)
+      when TYPE_FLOAT then val.setFloat(value)
+      when TYPE_DOUBLE then val.setDouble(value)
+      when TYPE_UUID then val.setUuid(value)
+      when TYPE_INT8, TYPE_INT16, TYPE_INT32 then val.setInt(value)
+      when TYPE_INT64 then val.setInt64(value)
+      when TYPE_MAP
+      when TYPE_OBJECT
+      when TYPE_LIST
+      when TYPE_ARRAY
       end
     end
+  end
 
-    class SchemaStatistic
-      attr_reader :impl
-      def initialize(name, typecode, kwargs={})
-        @impl = Qmfengine::SchemaStatistic.new(name, typecode)
-        @impl.setUnit(kwargs[:unit]) if kwargs.include?(:unit)
-        @impl.setDesc(kwargs[:desc]) if kwargs.include?(:desc)
+  class Query
+    attr_reader :impl
+    def initialize(i)
+      @impl = i
+    end
+
+    def package_name
+      @impl.getPackage
+    end
+
+    def class_name
+      @impl.getClass
+    end
+
+    def object_id
+      objid = @impl.getObjectId
+      if objid.class == NilClass
+        return nil
       end
+      return ObjectId.new(objid)
     end
+  end
 
-    class SchemaObjectClass
-      attr_reader :impl
-      def initialize(package, name, kwargs={})
+  ##==============================================================================
+  ## SCHEMA
+  ##==============================================================================
+
+  class SchemaArgument
+    attr_reader :impl
+    def initialize(name, typecode, kwargs={})
+      @impl = Qmfengine::SchemaArgument.new(name, typecode)
+      @impl.setDirection(kwargs[:dir]) if kwargs.include?(:dir)
+      @impl.setUnit(kwargs[:unit])     if kwargs.include?(:unit)
+      @impl.setDesc(kwargs[:desc])     if kwargs.include?(:desc)
+    end
+  end
+
+  class SchemaMethod
+    attr_reader :impl
+    def initialize(name, kwargs={})
+      @impl = Qmfengine::SchemaMethod.new(name)
+      @impl.setDesc(kwargs[:desc]) if kwargs.include?(:desc)
+      @arguments = []
+    end
+
+    def add_argument(arg)
+      @arguments << arg
+      @impl.addArgument(arg.impl)
+    end
+  end
+
+  class SchemaProperty
+    attr_reader :impl
+    def initialize(name, typecode, kwargs={})
+      @impl = Qmfengine::SchemaProperty.new(name, typecode)
+      @impl.setAccess(kwargs[:access])     if kwargs.include?(:access)
+      @impl.setIndex(kwargs[:index])       if kwargs.include?(:index)
+      @impl.setOptional(kwargs[:optional]) if kwargs.include?(:optional)
+      @impl.setUnit(kwargs[:unit])         if kwargs.include?(:unit)
+      @impl.setDesc(kwargs[:desc])         if kwargs.include?(:desc)
+    end
+
+    def name
+      @impl.getName
+    end
+  end
+
+  class SchemaStatistic
+    attr_reader :impl
+    def initialize(name, typecode, kwargs={})
+      @impl = Qmfengine::SchemaStatistic.new(name, typecode)
+      @impl.setUnit(kwargs[:unit]) if kwargs.include?(:unit)
+      @impl.setDesc(kwargs[:desc]) if kwargs.include?(:desc)
+    end
+  end
+
+  class SchemaClassKey
+    attr_reader :impl
+    def initialize(i)
+      @impl = i
+    end
+
+    def get_package()
+      @impl.getPackageName()
+    end
+
+    def get_class()
+      @impl.getClassName()
+    end
+  end
+
+  class SchemaObjectClass
+    attr_reader :impl
+    def initialize(package='', name='', kwargs={})
+      @properties = []
+      @statistics = []
+      @methods = []
+      if kwargs.include?(:impl)
+        @impl = kwargs[:impl]
+      else
         @impl = Qmfengine::SchemaObjectClass.new(package, name)
-        @properties = []
-        @statistics = []
-        @methods = []
       end
+    end
 
-      def add_property(prop)
-        @properties << prop
-        @impl.addProperty(prop.impl)
-      end
+    def add_property(prop)
+      @properties << prop
+      @impl.addProperty(prop.impl)
+    end
 
-      def add_statistic(stat)
-        @statistics << stat
-        @impl.addStatistic(stat.impl)
-      end
+    def add_statistic(stat)
+      @statistics << stat
+      @impl.addStatistic(stat.impl)
+    end
 
-      def add_method(meth)
-        @methods << meth
-        @impl.addMethod(meth.impl)
-      end
+    def add_method(meth)
+      @methods << meth
+      @impl.addMethod(meth.impl)
+    end
 
-      def name
-        @impl.getName
-      end
+    def name
+      @impl.getClassKey.getClassName
+    end
 
-      def properties
-        unless @properties
-          @properties = []
-          @impl.getPropertyCount.times do |i|
-            @properties << @impl.getProperty(i)
-          end
+    def properties
+      unless @properties
+        @properties = []
+        @impl.getPropertyCount.times do |i|
+          @properties << @impl.getProperty(i)
         end
-        return @properties
       end
+      return @properties
     end
+  end
 
-    class SchemaEventClass
-      attr_reader :impl
-      def initialize(package, name, kwargs={})
+  class SchemaEventClass
+    attr_reader :impl
+    def initialize(package='', name='', kwargs={})
+      @arguments = []
+      if kwargs.include?(:impl)
+        @impl = kwargs[:impl]
+      else
         @impl = Qmfengine::SchemaEventClass.new(package, name)
         @impl.setDesc(kwargs[:desc]) if kwargs.include?(:desc)
-        @arguments = []
       end
+    end
 
-      def add_argument(arg)
-        @arguments << arg
-        @impl.addArgument(arg.impl)
+    def add_argument(arg)
+      @arguments << arg
+      @impl.addArgument(arg.impl)
+    end
+
+    def name
+      @impl.getClassKey.getClassName
+    end
+  end
+
+  ##==============================================================================
+  ## CONSOLE
+  ##==============================================================================
+
+  class ConsoleHandler
+    def agent_added(agent); end
+    def agent_deleted(agent); end
+    def new_package(package); end
+    def new_class(class_key); end
+    def object_update(object, hasProps, hasStats); end
+    def event_received(event); end
+    def agent_heartbeat(agent, timestamp); end
+    def method_response(resp); end
+    def broker_info(broker); end
+  end
+
+  class Console
+    attr_reader :impl
+
+    def initialize(handler = nil, kwargs={})
+      @handler = handler
+      @impl = Qmfengine::ConsoleEngine.new
+      @event = Qmfengine::ConsoleEvent.new
+      @broker_list = []
+    end
+
+    def add_connection(conn)
+      broker = Broker.new(self, conn)
+      @broker_list << broker
+      return broker
+    end
+
+    def del_connection(broker)
+    end
+
+    def get_packages()
+      plist = []
+      count = @impl.packageCount
+      for i in 0...count
+        plist << @impl.getPackageName(i)
+      end
+      return plist
+    end
+
+    def get_classes(package, kind=CLASS_OBJECT)
+      clist = []
+      count = @impl.classCount(package)
+      for i in 0...count
+        key = @impl.getClass(package, i)
+        class_kind = @impl.getClassKind(key)
+        if class_kind == kind
+          if kind == CLASS_OBJECT
+            clist << SchemaObjectClass.new('', '', :impl => @impl.getObjectClass(key))
+          elsif kind == CLASS_EVENT
+            clist << SchemaEventClass.new('', '', :impl => @impl.getEventClass(key))
+          end
+        end
       end
+
+      return clist
     end
 
-    class QmfObject
-      attr_reader :impl, :object_class
-      def initialize(cls)
-        @object_class = cls
-        @impl = Qmfengine::Object.new(@object_class.impl)
-      end
+    def get_schema(class_key)
+    end
 
-      def destroy
-        @impl.destroy
-      end
+    def bind_package(package)
+    end
 
-      def object_id
-        return ObjectId.new(@impl.getObjectId)
-      end
+    def bind_class(kwargs = {})
+    end
 
-      def set_object_id(oid)
-        @impl.setObjectId(oid.impl)
-      end
+    def get_agents(broker = nil)
+    end
 
-      def get_attr(name)
-        val = value(name)
-        case val.getType
-        when TYPE_UINT8, TYPE_UINT16, TYPE_UINT32 then val.asUint
-        when TYPE_UINT64 then val.asUint64
-        when TYPE_SSTR, TYPE_LSTR then val.asString
-        when TYPE_ABSTIME then val.asInt64
-        when TYPE_DELTATIME then val.asUint64
-        when TYPE_REF then val.asObjectId
-        when TYPE_BOOL then val.asBool
-        when TYPE_FLOAT then val.asFloat
-        when TYPE_DOUBLE then val.asDouble
-        when TYPE_UUID then val.asUuid
-        when TYPE_INT8, TYPE_INT16, TYPE_INT32 then val.asInt
-        when TYPE_INT64 then val.asInt64
-        when TYPE_MAP
-        when TYPE_OBJECT
-        when TYPE_LIST
-        when TYPE_ARRAY
+    def get_objects(query, kwargs = {})
+    end
+
+    def start_sync(query)
+    end
+
+    def touch_sync(sync)
+    end
+
+    def end_sync(sync)
+    end
+
+    def do_console_events()
+      count = 0
+      valid = @impl.getEvent(@event)
+      while valid
+        count += 1
+        puts "Console Event: #{@event.kind}"
+        case @event.kind
+        when Qmfengine::ConsoleEvent::AGENT_ADDED
+        when Qmfengine::ConsoleEvent::AGENT_DELETED
+        when Qmfengine::ConsoleEvent::NEW_PACKAGE
+        when Qmfengine::ConsoleEvent::NEW_CLASS
+        when Qmfengine::ConsoleEvent::OBJECT_UPDATE
+        when Qmfengine::ConsoleEvent::EVENT_RECEIVED
+        when Qmfengine::ConsoleEvent::AGENT_HEARTBEAT
+        when Qmfengine::ConsoleEvent::METHOD_RESPONSE
         end
+        @impl.popEvent
+        valid = @impl.getEvent(@event)
       end
+      return count
+    end
+  end
 
-      def set_attr(name, v)
-        val = value(name)
-        case val.getType
-        when TYPE_UINT8, TYPE_UINT16, TYPE_UINT32 then val.setUint(v)
-        when TYPE_UINT64 then val.setUint64(v)
-        when TYPE_SSTR, TYPE_LSTR then v ? val.setString(v) : val.setString('')
-        when TYPE_ABSTIME then val.setInt64(v)
-        when TYPE_DELTATIME then val.setUint64(v)
-        when TYPE_REF then val.setObjectId(v.impl)
-        when TYPE_BOOL then v ? val.setBool(v) : val.setBool(0)
-        when TYPE_FLOAT then val.setFloat(v)
-        when TYPE_DOUBLE then val.setDouble(v)
-        when TYPE_UUID then val.setUuid(v)
-        when TYPE_INT8, TYPE_INT16, TYPE_INT32 then val.setInt(v)
-        when TYPE_INT64 then val.setInt64(v)
-        when TYPE_MAP
-        when TYPE_OBJECT
-        when TYPE_LIST
-        when TYPE_ARRAY
+  class Broker < ConnectionHandler
+    include MonitorMixin
+    attr_reader :impl
+
+    def initialize(console, conn)
+      super()
+      @console = console
+      @conn = conn
+      @session = nil
+      @cv = new_cond
+      @stable = nil
+      @event = Qmfengine::BrokerEvent.new
+      @xmtMessage = Qmfengine::Message.new
+      @impl = Qmfengine::BrokerProxy.new(@console.impl)
+      @console.impl.addConnection(@impl, self)
+      @conn.add_conn_handler(self)
+    end
+
+    def waitForStable(timeout = nil)
+      synchronize do
+        return if @stable
+        if timeout
+          unless @cv.wait(timeout) { @stable }
+            raise "Timed out waiting for broker connection to become stable"
+          end
+        else
+          while not @stable
+            @cv.wait
+          end
         end
       end
+    end
 
-      def [](name)
-          get_attr(name)
+    def do_broker_events()
+      count = 0
+      valid = @impl.getEvent(@event)
+      while valid
+        count += 1
+        puts "Broker Event: #{@event.kind}"
+        case @event.kind
+        when Qmfengine::BrokerEvent::BROKER_INFO
+        when Qmfengine::BrokerEvent::DECLARE_QUEUE
+          @conn.impl.declareQueue(@session.handle, @event.name)
+        when Qmfengine::BrokerEvent::DELETE_QUEUE
+          @conn.impl.deleteQueue(@session.handle, @event.name)
+        when Qmfengine::BrokerEvent::BIND
+          @conn.impl.bind(@session.handle, @event.exchange, @event.name, @event.bindingKey)
+        when Qmfengine::BrokerEvent::UNBIND
+          @conn.impl.unbind(@session.handle, @event.exchange, @event.name, @event.bindingKey)
+        when Qmfengine::BrokerEvent::SETUP_COMPLETE
+          @impl.startProtocol
+        when Qmfengine::BrokerEvent::STABLE
+          synchronize do
+            @stable = :true
+            @cv.signal
+          end
+        end
+        @impl.popEvent
+        valid = @impl.getEvent(@event)
       end
+      return count
+    end
 
-      def []=(name, value)
-          set_attr(name, value)
+    def do_broker_messages()
+      count = 0
+      valid = @impl.getXmtMessage(@xmtMessage)
+      while valid
+        count += 1
+        @conn.impl.sendMessage(@session.handle, @xmtMessage)
+        @impl.popXmt
+        valid = @impl.getXmtMessage(@xmtMessage)
       end
+      return count
+    end
+
+    def do_events()
+      begin
+        ccnt = @console.do_console_events
+        bcnt = do_broker_events
+        mcnt = do_broker_messages
+      end until ccnt == 0 and bcnt == 0 and mcnt == 0
+    end
+
+    def conn_event_connected()
+      puts "Console Connection Established..."
+      @session = Session.new(@conn, "qmfc-%s.%d" % [Socket.gethostname, Process::pid], self)
+      @impl.sessionOpened(@session.handle)
+      do_events
+    end
 
-      def inc_attr(name, by=1)
-        set_attr(name, get_attr(name) + by)
+    def conn_event_disconnected(error)
+      puts "Console Connection Lost"
+    end
+
+    def sess_event_session_closed(context, error)
+      puts "Console Session Lost"
+      @impl.sessionClosed()
+    end
+
+    def sess_event_recv(context, message)
+      @impl.handleRcvMessage(message)
+      do_events
+    end
+  end
+
+  ##==============================================================================
+  ## AGENT
+  ##==============================================================================
+
+  class AgentHandler
+    def get_query(context, query, userId); end
+    def method_call(context, name, object_id, args, userId); end
+  end
+
+  class Agent < ConnectionHandler
+    def initialize(handler, label="")
+      if label == ""
+        @agentLabel = "rb-%s.%d" % [Socket.gethostname, Process::pid]
+      else
+        @agentLabel = label
       end
+      @conn = nil
+      @handler = handler
+      @impl = Qmfengine::AgentEngine.new(@agentLabel)
+      @event = Qmfengine::AgentEvent.new
+      @xmtMessage = Qmfengine::Message.new
+    end
+
+    def set_connection(conn)
+      @conn = conn
+      @conn.add_conn_handler(self)
+    end
+
+    def register_class(cls)
+      @impl.registerClass(cls.impl)
+    end
+
+    def alloc_object_id(low = 0, high = 0)
+      ObjectId.new(@impl.allocObjectId(low, high))
+    end
+
+    def query_response(context, object)
+      @impl.queryResponse(context, object.impl)
+    end
+
+    def query_complete(context)
+      @impl.queryComplete(context)
+    end
+
+    def method_response(context, status, text, arguments)
+      @impl.methodResponse(context, status, text, arguments.map)
+    end
 
-      def dec_attr(name, by=1)
-        set_attr(name, get_attr(name) - by)
+    def do_agent_events()
+      count = 0
+      valid = @impl.getEvent(@event)
+      while valid
+        count += 1
+        case @event.kind
+        when Qmfengine::AgentEvent::GET_QUERY
+          @handler.get_query(@event.sequence, Query.new(@event.query), @event.authUserId)
+        when Qmfengine::AgentEvent::START_SYNC
+        when Qmfengine::AgentEvent::END_SYNC
+        when Qmfengine::AgentEvent::METHOD_CALL
+          args = Arguments.new(@event.arguments)
+          @handler.method_call(@event.sequence, @event.name, ObjectId.new(@event.objectId),
+                               args, @event.authUserId)
+        when Qmfengine::AgentEvent::DECLARE_QUEUE
+          @conn.impl.declareQueue(@session.handle, @event.name)
+        when Qmfengine::AgentEvent::DELETE_QUEUE
+          @conn.impl.deleteQueue(@session.handle, @event.name)
+        when Qmfengine::AgentEvent::BIND
+          @conn.impl.bind(@session.handle, @event.exchange, @event.name, @event.bindingKey)
+        when Qmfengine::AgentEvent::UNBIND
+          @conn.impl.unbind(@session.handle, @event.exchange, @event.name, @event.bindingKey)
+        when Qmfengine::AgentEvent::SETUP_COMPLETE
+          @impl.startProtocol()
+        end
+        @impl.popEvent
+        valid = @impl.getEvent(@event)
       end
+      return count
+    end
 
-      private
-      def value(name)
-          val = @impl.getValue(name.to_s)
-          if val.nil?
-              raise ArgumentError, "Attribute '#{name}' not defined for class #{@object_class.impl.getName}"
-          end
-          return val
+    def do_agent_messages()
+      count = 0
+      valid = @impl.getXmtMessage(@xmtMessage)
+      while valid
+        count += 1
+        @conn.impl.sendMessage(@session.handle, @xmtMessage)
+        @impl.popXmt
+        valid = @impl.getXmtMessage(@xmtMessage)
       end
+      return count
+    end
+
+    def do_events()
+      begin
+        ecnt = do_agent_events
+        mcnt = do_agent_messages
+      end until ecnt == 0 and mcnt == 0
+    end
+
+    def conn_event_connected()
+      puts "Agent Connection Established..."
+      @session = Session.new(@conn, "qmfa-%s.%d" % [Socket.gethostname, Process::pid], self)
+      @impl.newSession
+      do_events
+    end
+
+    def conn_event_disconnected(error)
+      puts "Agent Connection Lost"
+    end
+
+    def sess_event_session_closed(context, error)
+      puts "Agent Session Lost"
+    end
+
+    def sess_event_recv(context, message)
+      @impl.handleRcvMessage(message)
+      do_events
     end
+  end
 
 end

Modified: qpid/branches/java-network-refactor/qpid/cpp/bindings/qmf/ruby/ruby.i
URL: http://svn.apache.org/viewvc/qpid/branches/java-network-refactor/qpid/cpp/bindings/qmf/ruby/ruby.i?rev=812936&r1=812935&r2=812936&view=diff
==============================================================================
--- qpid/branches/java-network-refactor/qpid/cpp/bindings/qmf/ruby/ruby.i (original)
+++ qpid/branches/java-network-refactor/qpid/cpp/bindings/qmf/ruby/ruby.i Wed Sep  9 13:05:43 2009
@@ -38,17 +38,33 @@
 
 %typemap (out) uint16_t
 {
-    $result = UINT2NUM((unsigned short) $1);
+    $result = UINT2NUM((uint16_t) $1);
 }
 
 %typemap (in) uint32_t
 {
-    $1 = NUM2UINT ($input);
+    if (TYPE($input) == T_BIGNUM)
+        $1 = NUM2UINT($input);
+    else
+        $1 = FIX2UINT($input);
 }
 
 %typemap (out) uint32_t
 {
-    $result = UINT2NUM((unsigned int) $1);
+    $result = UINT2NUM((uint32_t) $1);
+}
+
+%typemap (in) int32_t
+{
+    if (TYPE($input) == T_BIGNUM)
+        $1 = NUM2INT($input);
+    else
+        $1 = FIX2INT($input);
+}
+
+%typemap (out) int32_t
+{
+    $result = INT2NUM((int32_t) $1);
 }
 
 %typemap (typecheck, precedence=SWIG_TYPECHECK_INTEGER) uint32_t {
@@ -57,12 +73,28 @@
 
 %typemap (in) uint64_t
 {
-    $1 = NUM2ULONG ($input);
+    if (TYPE($input) == T_BIGNUM)
+        $1 = NUM2ULL($input);
+    else
+        $1 = (uint64_t) FIX2LONG($input);
 }
 
 %typemap (out) uint64_t
 {
-    $result = ULONG2NUM((unsigned long) $1);
+    $result = ULL2NUM((uint64_t) $1);
+}
+
+%typemap (in) int64_t
+{
+    if (TYPE($input) == T_BIGNUM)
+        $1 = NUM2LL($input);
+    else
+        $1 = (int64_t) FIX2LONG($input);
+}
+
+%typemap (out) int64_t
+{
+    $result = LL2NUM((int64_t) $1);
 }
 
 %typemap (typecheck, precedence=SWIG_TYPECHECK_INTEGER) uint64_t {

Modified: qpid/branches/java-network-refactor/qpid/cpp/bindings/qmf/tests/Makefile.am
URL: http://svn.apache.org/viewvc/qpid/branches/java-network-refactor/qpid/cpp/bindings/qmf/tests/Makefile.am?rev=812936&r1=812935&r2=812936&view=diff
==============================================================================
--- qpid/branches/java-network-refactor/qpid/cpp/bindings/qmf/tests/Makefile.am (original)
+++ qpid/branches/java-network-refactor/qpid/cpp/bindings/qmf/tests/Makefile.am Wed Sep  9 13:05:43 2009
@@ -18,4 +18,10 @@
 #
 
 TESTS = run_interop_tests
-EXTRA_DIST = run_interop_tests
+
+EXTRA_DIST =          \
+  agent_ruby.rb       \
+  python_agent.py     \
+  python_console.py   \
+  ruby_console.rb     \
+  run_interop_tests

Modified: qpid/branches/java-network-refactor/qpid/cpp/bindings/qmf/tests/agent_ruby.rb
URL: http://svn.apache.org/viewvc/qpid/branches/java-network-refactor/qpid/cpp/bindings/qmf/tests/agent_ruby.rb?rev=812936&r1=812935&r2=812936&view=diff
==============================================================================
--- qpid/branches/java-network-refactor/qpid/cpp/bindings/qmf/tests/agent_ruby.rb (original)
+++ qpid/branches/java-network-refactor/qpid/cpp/bindings/qmf/tests/agent_ruby.rb Wed Sep  9 13:05:43 2009
@@ -29,13 +29,34 @@
     @parent_class = Qmf::SchemaObjectClass.new("org.apache.qpid.qmf", "parent")
     @parent_class.add_property(Qmf::SchemaProperty.new("name", Qmf::TYPE_SSTR, :index => true))
     @parent_class.add_property(Qmf::SchemaProperty.new("state", Qmf::TYPE_SSTR))
+
+    @parent_class.add_property(Qmf::SchemaProperty.new("uint64val", Qmf::TYPE_UINT64))
     @parent_class.add_property(Qmf::SchemaProperty.new("uint32val", Qmf::TYPE_UINT32))
+    @parent_class.add_property(Qmf::SchemaProperty.new("uint16val", Qmf::TYPE_UINT16))
+    @parent_class.add_property(Qmf::SchemaProperty.new("uint8val", Qmf::TYPE_UINT8))
+
+    @parent_class.add_property(Qmf::SchemaProperty.new("int64val", Qmf::TYPE_INT64))
+    @parent_class.add_property(Qmf::SchemaProperty.new("int32val", Qmf::TYPE_INT32))
+    @parent_class.add_property(Qmf::SchemaProperty.new("int16val", Qmf::TYPE_INT16))
+    @parent_class.add_property(Qmf::SchemaProperty.new("int8val", Qmf::TYPE_INT8))
+
     @parent_class.add_statistic(Qmf::SchemaStatistic.new("queryCount", Qmf::TYPE_UINT32, :unit => "query", :desc => "Query count"))
 
+    method = Qmf::SchemaMethod.new("echo", :desc => "Check responsiveness of the agent object")
+    method.add_argument(Qmf::SchemaArgument.new("sequence", Qmf::TYPE_UINT32, :dir => Qmf::DIR_IN_OUT))
+    @parent_class.add_method(method)
+
+    method = Qmf::SchemaMethod.new("set_numerics", :desc => "Set the numeric values in the object")
+    method.add_argument(Qmf::SchemaArgument.new("test", Qmf::TYPE_SSTR, :dir => Qmf::DIR_IN))
+    @parent_class.add_method(method)
+
     method = Qmf::SchemaMethod.new("create_child", :desc => "Create a new child object")
     method.add_argument(Qmf::SchemaArgument.new("child_name", Qmf::TYPE_LSTR, :dir => Qmf::DIR_IN))
     method.add_argument(Qmf::SchemaArgument.new("child_ref", Qmf::TYPE_REF, :dir => Qmf::DIR_OUT))
+    @parent_class.add_method(method)
 
+    method = Qmf::SchemaMethod.new("probe_userid", :desc => "Return the user-id for this method call")
+    method.add_argument(Qmf::SchemaArgument.new("userid", Qmf::TYPE_SSTR, :dir => Qmf::DIR_OUT))
     @parent_class.add_method(method)
 
     @child_class = Qmf::SchemaObjectClass.new("org.apache.qpid.qmf", "child")
@@ -55,24 +76,83 @@
     #@parent.inc_attr("queryCount")
     if query.class_name == 'parent'
         @agent.query_response(context, @parent)
+    elsif query.object_id == @parent_oid
+        @agent.query_response(context, @parent)
     end
     @agent.query_complete(context)
   end
 
   def method_call(context, name, object_id, args, userId)
 #    puts "Method: user=#{userId} context=#{context} method=#{name} object_num=#{object_id.object_num_low if object_id} args=#{args}"
-    oid = @agent.alloc_object_id(2)
-    args['child_ref'] = oid
-    @child = Qmf::QmfObject.new(@model.child_class)
-    @child.set_attr("name", args.by_key("child_name"))
-    @child.set_object_id(oid)
-    @agent.method_response(context, 0, "OK", args)
+    
+    if name == "echo"
+      @agent.method_response(context, 0, "OK", args)
+
+    elsif name == "set_numerics"
+      retCode = 0
+      retText = "OK"
+
+      if args['test'] == "big"
+        @parent.set_attr("uint64val", 0x9494949449494949)
+        @parent.set_attr("uint32val", 0xa5a55a5a)
+        @parent.set_attr("uint16val", 0xb66b)
+        @parent.set_attr("uint8val",  0xc7)
+
+        @parent.set_attr("int64val", 1000000000000000000)
+        @parent.set_attr("int32val", 1000000000)
+        @parent.set_attr("int16val", 10000)
+        @parent.set_attr("int8val",  100)
+
+      elsif args['test'] == "small"
+        @parent.set_attr("uint64val", 4)
+        @parent.set_attr("uint32val", 5)
+        @parent.set_attr("uint16val", 6)
+        @parent.set_attr("uint8val",  7)
+
+        @parent.set_attr("int64val", 8)
+        @parent.set_attr("int32val", 9)
+        @parent.set_attr("int16val", 10)
+        @parent.set_attr("int8val",  11)
+
+      elsif args['test'] == "negative"
+        @parent.set_attr("uint64val", 0)
+        @parent.set_attr("uint32val", 0)
+        @parent.set_attr("uint16val", 0)
+        @parent.set_attr("uint8val",  0)
+
+        @parent.set_attr("int64val", -10000000000)
+        @parent.set_attr("int32val", -100000)
+        @parent.set_attr("int16val", -1000)
+        @parent.set_attr("int8val",  -100)
+
+      else
+        retCode = 1
+        retText = "Invalid argument value for test"
+      end
+
+      @agent.method_response(context, retCode, retText, args)
+
+    elsif name == "create_child"
+      oid = @agent.alloc_object_id(2)
+      args['child_ref'] = oid
+      @child = Qmf::QmfObject.new(@model.child_class)
+      @child.set_attr("name", args.by_key("child_name"))
+      @child.set_object_id(oid)
+      @agent.method_response(context, 0, "OK", args)
+
+    elsif name == "probe_userid"
+      args['userid'] = userId
+      @agent.method_response(context, 0, "OK", args)
+
+    else
+      @agent.method_response(context, 1, "Unimplemented Method: #{name}", args)
+    end
   end
 
   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)
 
@@ -84,10 +164,19 @@
     @parent = Qmf::QmfObject.new(@model.parent_class)
     @parent.set_attr("name", "Parent One")
     @parent.set_attr("state", "OPERATIONAL")
-    @parent.set_attr("uint32val", 0xa5a5a5a5)
 
-    oid = @agent.alloc_object_id(1)
-    @parent.set_object_id(oid)
+    @parent.set_attr("uint64val", 0)
+    @parent.set_attr("uint32val", 0)
+    @parent.set_attr("uint16val", 0)
+    @parent.set_attr("uint8val",  0)
+
+    @parent.set_attr("int64val", 0)
+    @parent.set_attr("int32val", 0)
+    @parent.set_attr("int16val", 0)
+    @parent.set_attr("int8val",  0)
+
+    @parent_oid = @agent.alloc_object_id(1)
+    @parent.set_object_id(@parent_oid)
 
     sleep
   end

Modified: qpid/branches/java-network-refactor/qpid/cpp/bindings/qmf/tests/python_console.py
URL: http://svn.apache.org/viewvc/qpid/branches/java-network-refactor/qpid/cpp/bindings/qmf/tests/python_console.py?rev=812936&r1=812935&r2=812936&view=diff
==============================================================================
--- qpid/branches/java-network-refactor/qpid/cpp/bindings/qmf/tests/python_console.py (original)
+++ qpid/branches/java-network-refactor/qpid/cpp/bindings/qmf/tests/python_console.py Wed Sep  9 13:05:43 2009
@@ -36,16 +36,109 @@
             agents = qmf.getObjects(_class="agent")
             sleep(1)
             count += 1
-            if count > 5:
+            if count > 10:
                 self.fail("Timed out waiting for remote agent")
 
-    def test_B_basic_types(self):
+    def test_B_basic_method_invocation(self):
         self.startQmf();
         qmf = self.qmf
 
         parents = qmf.getObjects(_class="parent")
         self.assertEqual(len(parents), 1)
-        self.assertEqual(parents[0].uint32val, 0xA5A5A5A5)
+        parent = parents[0]
+        for seq in range(10):
+            result = parent.echo(seq)
+            self.assertEqual(result.status, 0)
+            self.assertEqual(result.text, "OK")
+            self.assertEqual(result.sequence, seq)
+
+        result = parent.set_numerics("bogus")
+        self.assertEqual(result.status, 1)
+        self.assertEqual(result.text, "Invalid argument value for test")
+
+    def test_C_basic_types_numeric_big(self):
+        self.startQmf();
+        qmf = self.qmf
+
+        parents = qmf.getObjects(_class="parent")
+        self.assertEqual(len(parents), 1)
+        parent = parents[0]
+
+        result = parent.set_numerics("big")
+        self.assertEqual(result.status, 0)
+        self.assertEqual(result.text, "OK")
+
+        parent.update()
+
+        self.assertEqual(parent.uint64val, 0x9494949449494949)
+        self.assertEqual(parent.uint32val, 0xA5A55A5A)
+        self.assertEqual(parent.uint16val, 0xB66B)
+        self.assertEqual(parent.uint8val,  0xC7)
+
+        self.assertEqual(parent.int64val, 1000000000000000000)
+        self.assertEqual(parent.int32val, 1000000000)
+        self.assertEqual(parent.int16val, 10000)
+        self.assertEqual(parent.int8val,  100)
+
+    def test_C_basic_types_numeric_small(self):
+        self.startQmf();
+        qmf = self.qmf
+
+        parents = qmf.getObjects(_class="parent")
+        self.assertEqual(len(parents), 1)
+        parent = parents[0]
+
+        result = parent.set_numerics("small")
+        self.assertEqual(result.status, 0)
+        self.assertEqual(result.text, "OK")
+
+        parent.update()
+
+        self.assertEqual(parent.uint64val, 4)
+        self.assertEqual(parent.uint32val, 5)
+        self.assertEqual(parent.uint16val, 6)
+        self.assertEqual(parent.uint8val,  7)
+
+        self.assertEqual(parent.int64val, 8)
+        self.assertEqual(parent.int32val, 9)
+        self.assertEqual(parent.int16val, 10)
+        self.assertEqual(parent.int8val,  11)
+
+    def test_C_basic_types_numeric_negative(self):
+        self.startQmf();
+        qmf = self.qmf
+
+        parents = qmf.getObjects(_class="parent")
+        self.assertEqual(len(parents), 1)
+        parent = parents[0]
+
+        result = parent.set_numerics("negative")
+        self.assertEqual(result.status, 0)
+        self.assertEqual(result.text, "OK")
+
+        parent.update()
+
+        self.assertEqual(parent.uint64val, 0)
+        self.assertEqual(parent.uint32val, 0)
+        self.assertEqual(parent.uint16val, 0)
+        self.assertEqual(parent.uint8val,  0)
+
+        self.assertEqual(parent.int64val, -10000000000)
+        self.assertEqual(parent.int32val, -100000)
+        self.assertEqual(parent.int16val, -1000)
+        self.assertEqual(parent.int8val,  -100)
+
+    def test_D_userid_for_method(self):
+        self.startQmf();
+        qmf = self.qmf
+
+        parents = qmf.getObjects(_class="parent")
+        self.assertEqual(len(parents), 1)
+        parent = parents[0]
+
+        result = parent.probe_userid()
+        self.assertEqual(result.status, 0)
+        self.assertEqual(result.userid, "guest")
 
     def getProperty(self, msg, name):
         for h in msg.headers:

Modified: qpid/branches/java-network-refactor/qpid/cpp/bindings/qmf/tests/run_interop_tests
URL: http://svn.apache.org/viewvc/qpid/branches/java-network-refactor/qpid/cpp/bindings/qmf/tests/run_interop_tests?rev=812936&r1=812935&r2=812936&view=diff
==============================================================================
--- qpid/branches/java-network-refactor/qpid/cpp/bindings/qmf/tests/run_interop_tests (original)
+++ qpid/branches/java-network-refactor/qpid/cpp/bindings/qmf/tests/run_interop_tests Wed Sep  9 13:05:43 2009
@@ -28,6 +28,9 @@
 API_DIR=${BUILD_DIR}/bindings/qmf
 SPEC_DIR=${QPID_DIR}/specs
 
+RUBY_LIB_DIR=${API_DIR}/ruby/.libs
+PYTHON_LIB_DIR=${API_DIR}/python/.libs
+
 trap stop_broker INT TERM QUIT
 
 start_broker() {
@@ -41,7 +44,7 @@
 }
 
 start_ruby_agent() {
-    ruby -I${MY_DIR}/../ruby -I${API_DIR}/ruby/.libs ${MY_DIR}/agent_ruby.rb localhost $BROKER_PORT &
+    ruby -I${MY_DIR}/../ruby -I${RUBY_LIB_DIR} ${MY_DIR}/agent_ruby.rb localhost $BROKER_PORT &
     AGENT_PID=$!
 }
 
@@ -49,19 +52,62 @@
     kill $AGENT_PID
 }
 
+start_python_agent() {
+    PYTHONPATH="${MY_DIR}/../python:${API_DIR}/python:${PYTHON_LIB_DIR}" python ${MY_DIR}/python_agent.py localhost $BROKER_PORT &
+    PY_AGENT_PID=$!
+}
+
+stop_python_agent() {
+    kill $PY_AGENT_PID
+}
+
+TESTS_FAILED=0
+
 if test -d ${PYTHON_DIR} ;  then
     start_broker
     echo "Running qmf interop tests using broker on port $BROKER_PORT"
     PYTHONPATH=${PYTHON_DIR}:${MY_DIR}
     export PYTHONPATH
-    echo "    Ruby Agent vs. Pure-Python Console"
-    start_ruby_agent
-    echo "    Ruby agent started at pid $AGENT_PID"
-    ${PYTHON_DIR}/qpid-python-test -m python_console -b localhost:$BROKER_PORT $@
-    RETCODE=$?
-    stop_ruby_agent
+
+    if test -d ${PYTHON_LIB_DIR} ; then
+        echo "    Python Agent (external storage) vs. Pure-Python Console"
+        start_python_agent
+        echo "    Python agent started at pid $PY_AGENT_PID"
+        ${PYTHON_DIR}/qpid-python-test -m python_console -b localhost:$BROKER_PORT $@
+        RETCODE=$?
+        stop_python_agent
+        if test x$RETCODE != x0; then
+            echo "FAIL qmf interop tests (Python Agent)";
+            TESTS_FAILED=1
+        fi
+    fi
+
+    if test -d ${RUBY_LIB_DIR} ; then
+        echo "    Ruby Agent (external storage) vs. Pure-Python Console"
+        start_ruby_agent
+        echo "    Ruby agent started at pid $AGENT_PID"
+        ${PYTHON_DIR}/qpid-python-test -m python_console -b localhost:$BROKER_PORT $@
+        RETCODE=$?
+        stop_ruby_agent
+        if test x$RETCODE != x0; then
+            echo "FAIL qmf interop tests (Ruby Agent)";
+            TESTS_FAILED=1
+        fi
+    fi
+
+    # Also against the Pure-Python console:
+    #   Ruby agent (internal storage)
+    #   Python agent (external and internal)
+    #   C++ agent (external and internal)
+    #
+    # Other consoles against the same set of agents:
+    #   Wrapped Python console
+    #   Ruby console
+    #   C++ console
+
     stop_broker
-    if test x$RETCODE != x0; then 
-        echo "FAIL qmf interop tests"; exit 1;
+    if test x$TESTS_FAILED != x0; then
+        echo "TEST FAILED!"
+        exit 1
     fi
 fi

Modified: qpid/branches/java-network-refactor/qpid/cpp/configure.ac
URL: http://svn.apache.org/viewvc/qpid/branches/java-network-refactor/qpid/cpp/configure.ac?rev=812936&r1=812935&r2=812936&view=diff
==============================================================================
--- qpid/branches/java-network-refactor/qpid/cpp/configure.ac (original)
+++ qpid/branches/java-network-refactor/qpid/cpp/configure.ac Wed Sep  9 13:05:43 2009
@@ -512,8 +512,10 @@
   examples/xml-exchange/Makefile
   examples/qmf-console/Makefile
   examples/tradedemo/Makefile
+  examples/messaging/Makefile
   bindings/qmf/Makefile
   bindings/qmf/ruby/Makefile
+  bindings/qmf/python/Makefile
   bindings/qmf/tests/Makefile
   managementgen/Makefile
   etc/Makefile

Modified: qpid/branches/java-network-refactor/qpid/cpp/docs/api/doxygen_mainpage.h
URL: http://svn.apache.org/viewvc/qpid/branches/java-network-refactor/qpid/cpp/docs/api/doxygen_mainpage.h?rev=812936&r1=812935&r2=812936&view=diff
==============================================================================
--- qpid/branches/java-network-refactor/qpid/cpp/docs/api/doxygen_mainpage.h (original)
+++ qpid/branches/java-network-refactor/qpid/cpp/docs/api/doxygen_mainpage.h Wed Sep  9 13:05:43 2009
@@ -26,6 +26,7 @@
  * <h2>Messaging Client API classes</h2>
  * <ul>
  * <li><p>\ref clientapi</p></li>
+ * <li><p>\ref qmfapi</p></li>
  * </ul>
  * 
  * <h2>Code for common tasks</h2>
@@ -127,5 +128,6 @@
 
 /**
  * \defgroup clientapi Qpid C++ Client API
+ * \defgroup qmfapi Qpid Management Framework C++ API
  *
  */

Modified: qpid/branches/java-network-refactor/qpid/cpp/docs/api/user.doxygen.in
URL: http://svn.apache.org/viewvc/qpid/branches/java-network-refactor/qpid/cpp/docs/api/user.doxygen.in?rev=812936&r1=812935&r2=812936&view=diff
==============================================================================
--- qpid/branches/java-network-refactor/qpid/cpp/docs/api/user.doxygen.in (original)
+++ qpid/branches/java-network-refactor/qpid/cpp/docs/api/user.doxygen.in Wed Sep  9 13:05:43 2009
@@ -456,7 +456,7 @@
 # directories like "/usr/src/myproject". Separate the files or directories 
 # with spaces.
 
-INPUT = @top_srcdir@/include @top_builddir@/include
+INPUT = @top_srcdir@/docs/api @top_srcdir@/include @top_builddir@/include
 
 
 # If the value of the INPUT tag contains directories, you can use the 
@@ -471,7 +471,7 @@
 # should be searched for input files as well. Possible values are YES and NO. 
 # If left blank NO is used.
 
-RECURSIVE              = NO
+RECURSIVE              = YES
 
 # The EXCLUDE tag can be used to specify files and/or directories that should 
 # excluded from the INPUT source files. This way you can easily exclude a 

Modified: qpid/branches/java-network-refactor/qpid/cpp/examples/CMakeLists.txt
URL: http://svn.apache.org/viewvc/qpid/branches/java-network-refactor/qpid/cpp/examples/CMakeLists.txt?rev=812936&r1=812935&r2=812936&view=diff
==============================================================================
--- qpid/branches/java-network-refactor/qpid/cpp/examples/CMakeLists.txt (original)
+++ qpid/branches/java-network-refactor/qpid/cpp/examples/CMakeLists.txt Wed Sep  9 13:05:43 2009
@@ -62,3 +62,4 @@
 add_subdirectory(request-response)
 add_subdirectory(tradedemo)
 add_subdirectory(xml-exchange)
+add_subdirectory(messaging)

Modified: qpid/branches/java-network-refactor/qpid/cpp/examples/Makefile.am
URL: http://svn.apache.org/viewvc/qpid/branches/java-network-refactor/qpid/cpp/examples/Makefile.am?rev=812936&r1=812935&r2=812936&view=diff
==============================================================================
--- qpid/branches/java-network-refactor/qpid/cpp/examples/Makefile.am (original)
+++ qpid/branches/java-network-refactor/qpid/cpp/examples/Makefile.am Wed Sep  9 13:05:43 2009
@@ -16,7 +16,7 @@
 # specific language governing permissions and limitations
 # under the License.
 #
-SUBDIRS = direct fanout pub-sub request-response failover qmf-console tradedemo 
+SUBDIRS = direct fanout pub-sub request-response failover qmf-console tradedemo messaging
 if HAVE_XML
   SUBDIRS += xml-exchange
   broker_args = "--no-module-dir --data-dir \"\" --auth no --load-module $(top_builddir)/src/.libs/xml.so"	

Modified: qpid/branches/java-network-refactor/qpid/cpp/include/qpid/client/Connection.h
URL: http://svn.apache.org/viewvc/qpid/branches/java-network-refactor/qpid/cpp/include/qpid/client/Connection.h?rev=812936&r1=812935&r2=812936&view=diff
==============================================================================
--- qpid/branches/java-network-refactor/qpid/cpp/include/qpid/client/Connection.h (original)
+++ qpid/branches/java-network-refactor/qpid/cpp/include/qpid/client/Connection.h Wed Sep  9 13:05:43 2009
@@ -43,7 +43,21 @@
  *
  * \ingroup clientapi
  *
+ * Some methods use an AMQP 0-10 URL to specify connection parameters.
+ * This is defined in the AMQP 0-10 specification (http://jira.amqp.org/confluence/display/AMQP/AMQP+Specification).
+ *
+ *   amqp_url          = "amqp:" prot_addr_list
+ *   prot_addr_list    = [prot_addr ","]* prot_addr
+ *   prot_addr         = tcp_prot_addr | tls_prot_addr
+ *
+ *   tcp_prot_addr     = tcp_id tcp_addr
+ *   tcp_id            = "tcp:" | ""
+ *   tcp_addr          = [host [":" port] ]
+ *   host              = <as per http://www.ietf.org/rfc/rfc3986.txt>
+ *   port              = number]]>
+ *  
  */
+
 class Connection
 {
     framing::ProtocolVersion version;

Modified: qpid/branches/java-network-refactor/qpid/cpp/include/qpid/framing/FieldTable.h
URL: http://svn.apache.org/viewvc/qpid/branches/java-network-refactor/qpid/cpp/include/qpid/framing/FieldTable.h?rev=812936&r1=812935&r2=812936&view=diff
==============================================================================
--- qpid/branches/java-network-refactor/qpid/cpp/include/qpid/framing/FieldTable.h (original)
+++ qpid/branches/java-network-refactor/qpid/cpp/include/qpid/framing/FieldTable.h Wed Sep  9 13:05:43 2009
@@ -51,6 +51,9 @@
     typedef boost::shared_ptr<FieldValue> ValuePtr;
     typedef std::map<std::string, ValuePtr> ValueMap;
     typedef ValueMap::iterator iterator;
+    typedef ValueMap::const_reference const_reference;
+    typedef ValueMap::reference reference;
+    typedef ValueMap::value_type value_type;
 
     QPID_COMMON_EXTERN FieldTable() {};
     QPID_COMMON_EXTERN FieldTable(const FieldTable& ft);
@@ -97,12 +100,16 @@
     QPID_COMMON_EXTERN bool operator==(const FieldTable& other) const;
 
     // Map-like interface.
-    // TODO: may need to duplicate into versions that return mutable iterator
     ValueMap::const_iterator begin() const { return values.begin(); }
     ValueMap::const_iterator end() const { return values.end(); }
     ValueMap::const_iterator find(const std::string& s) const { return values.find(s); }
 
+    ValueMap::iterator begin() { return values.begin(); }
+    ValueMap::iterator end() { return values.end(); }
+    ValueMap::iterator find(const std::string& s) { return values.find(s); }
+
     std::pair <ValueMap::iterator, bool> insert(const ValueMap::value_type&);
+    QPID_COMMON_EXTERN ValueMap::iterator insert(ValueMap::iterator, const ValueMap::value_type&);
     void clear() { values.clear(); }
 
     // ### Hack Alert

Modified: qpid/branches/java-network-refactor/qpid/cpp/include/qpid/framing/FieldValue.h
URL: http://svn.apache.org/viewvc/qpid/branches/java-network-refactor/qpid/cpp/include/qpid/framing/FieldValue.h?rev=812936&r1=812935&r2=812936&view=diff
==============================================================================
--- qpid/branches/java-network-refactor/qpid/cpp/include/qpid/framing/FieldValue.h (original)
+++ qpid/branches/java-network-refactor/qpid/cpp/include/qpid/framing/FieldValue.h Wed Sep  9 13:05:43 2009
@@ -36,7 +36,6 @@
 namespace qpid {
 namespace framing {
 
-//class Array;
 /**
  * Exception that is the base exception for all field table errors.
  *
@@ -53,6 +52,8 @@
     InvalidConversionException() {}
 };
 
+class List;
+
 /**
  * Value that can appear in an AMQP field table
  *
@@ -82,7 +83,7 @@
     FieldValue(): data(0) {};
     // Default assignment operator is fine
     void setType(uint8_t type);
-    uint8_t getType();
+    QPID_COMMON_EXTERN uint8_t getType();
     Data& getData() { return *data; }
     uint32_t encodedSize() const { return 1 + data->encodedSize(); };
     bool empty() const { return data.get() == 0; }
@@ -96,12 +97,19 @@
     template <typename T> bool convertsTo() const { return false; }
     template <typename T> T get() const { throw InvalidConversionException(); }
 
+    template <class T, int W> T getIntegerValue() const;
+    template <class T, int W> T getFloatingPointValue() const;
+    template <class T> bool get(T&) const;
+
   protected:
     FieldValue(uint8_t t, Data* d): typeOctet(t), data(d) {}
 
+    QPID_COMMON_EXTERN static uint8_t* convertIfRequired(uint8_t* const octets, int width);
+
   private:
     uint8_t typeOctet;
     std::auto_ptr<Data> data;
+
 };
 
 template <>
@@ -165,10 +173,52 @@
         return v;
     }
     uint8_t* rawOctets() { return octets; }
+    uint8_t* rawOctets() const { return octets; }
 
     void print(std::ostream& o) const { o << "F" << width << ":"; };
 };
 
+template <class T, int W>
+inline T FieldValue::getIntegerValue() const
+{
+    FixedWidthValue<W>* const fwv = dynamic_cast< FixedWidthValue<W>* const>(data.get());
+    if (fwv) {
+        uint8_t* octets = fwv->rawOctets();
+        T v = 0;
+        for (int i = 0; i < W-1; ++i) {
+            v |= octets[i]; v <<= 8;
+        }
+        v |= octets[W-1];
+        return v;
+    } else {
+        throw InvalidConversionException();
+    }
+}
+
+template <class T, int W>
+inline T FieldValue::getFloatingPointValue() const {
+    FixedWidthValue<W>* const fwv = dynamic_cast< FixedWidthValue<W>* const>(data.get());
+    if (fwv) {
+        T value;
+        uint8_t* const octets = convertIfRequired(fwv->rawOctets(), W);
+        uint8_t* const target = reinterpret_cast<uint8_t*>(&value);
+        for (uint i = 0; i < W; ++i) target[i] = octets[i];
+        return value;
+    } else {
+        throw InvalidConversionException();
+    }
+}
+
+template <>
+inline float FieldValue::get<float>() const {
+    return getFloatingPointValue<float, 4>();
+}
+
+template <>
+inline double FieldValue::get<double>() const {
+    return getFloatingPointValue<double, 8>();
+}
+
 template <>
 class FixedWidthValue<0> : public FieldValue::Data {
   public:
@@ -243,6 +293,27 @@
     void print(std::ostream& o) const { o << "[" << value << "]"; };
 };
 
+/**
+ * Accessor that can be used to get values of type FieldTable, Array
+ * and List.
+ */
+template <class T>
+inline bool FieldValue::get(T& t) const
+{
+    const EncodedValue<T>* v = dynamic_cast< EncodedValue<T>* >(data.get());    
+    if (v != 0) {
+        t = v->getValue();
+        return true;
+    } else {
+        try {
+            t = get<T>();
+            return true;
+        } catch (const InvalidConversionException&) {
+            return false;
+        }
+    }
+}
+
 class Str8Value : public FieldValue {
   public:
     QPID_COMMON_EXTERN Str8Value(const std::string& v);
@@ -294,6 +365,7 @@
 
 class FieldTableValue : public FieldValue {
   public:
+    typedef FieldTable ValueType;
     QPID_COMMON_EXTERN FieldTableValue(const FieldTable&);
 };
 
@@ -302,6 +374,49 @@
     QPID_COMMON_EXTERN ArrayValue(const Array&);
 };
 
+class VoidValue : public FieldValue {
+  public:
+    QPID_COMMON_EXTERN VoidValue();
+};
+
+class BoolValue : public FieldValue {
+  public:
+    QPID_COMMON_EXTERN BoolValue(bool);
+};
+
+class Unsigned8Value : public FieldValue {
+  public:
+    QPID_COMMON_EXTERN Unsigned8Value(uint8_t);
+};
+
+class Unsigned16Value : public FieldValue {
+  public:
+    QPID_COMMON_EXTERN Unsigned16Value(uint16_t);
+};
+
+class Unsigned32Value : public FieldValue {
+  public:
+    QPID_COMMON_EXTERN Unsigned32Value(uint32_t);
+};
+
+class Integer8Value : public FieldValue {
+  public:
+    QPID_COMMON_EXTERN Integer8Value(int8_t);
+};
+
+class Integer16Value : public FieldValue {
+  public:
+    QPID_COMMON_EXTERN Integer16Value(int16_t);
+};
+
+typedef IntegerValue Integer32Value;
+
+class ListValue : public FieldValue {
+  public:
+    typedef List ValueType;
+    QPID_COMMON_EXTERN ListValue(const List&);
+};
+
 template <class T>
 bool getEncodedValue(FieldTable::ValuePtr vptr, T& value)
 {
@@ -315,7 +430,6 @@
     return false;
 }
 
-
 }} // qpid::framing
 
 #endif

Modified: qpid/branches/java-network-refactor/qpid/cpp/include/qpid/framing/Uuid.h
URL: http://svn.apache.org/viewvc/qpid/branches/java-network-refactor/qpid/cpp/include/qpid/framing/Uuid.h?rev=812936&r1=812935&r2=812936&view=diff
==============================================================================
--- qpid/branches/java-network-refactor/qpid/cpp/include/qpid/framing/Uuid.h (original)
+++ qpid/branches/java-network-refactor/qpid/cpp/include/qpid/framing/Uuid.h Wed Sep  9 13:05:43 2009
@@ -20,7 +20,6 @@
  */
 
 #include "qpid/CommonImportExport.h"
-#include "qpid/sys/uuid.h"
 #include "qpid/sys/IntegerTypes.h"
 
 #include <boost/array.hpp>
@@ -38,33 +37,31 @@
  *
  * Full value semantics, operators ==, < etc.  are provided by
  * boost::array so Uuid can be the key type in a map etc.
+ *
+ * TODO: change this implementation as it leaks boost into the
+ * client API
  */
 struct Uuid : public boost::array<uint8_t, 16> {
     /** If unique is true, generate a unique ID else a null ID. */
-    Uuid(bool unique=false) { if (unique) generate(); else clear(); }
+    QPID_COMMON_EXTERN Uuid(bool unique=false);
 
     /** Copy from 16 bytes of data. */
-    Uuid(const uint8_t* data) { assign(data); }
+    QPID_COMMON_EXTERN Uuid(const uint8_t* data);
+
+    // Default op= and copy ctor are fine.
+    // boost::array gives us ==, < etc.
 
     /** Copy from 16 bytes of data. */
-    void assign(const uint8_t* data) {
-        uuid_copy(c_array(), data);
-    }
+    void assign(const uint8_t* data);
 
     /** Set to a new unique identifier. */
-    void generate() { uuid_generate(c_array()); }
+    QPID_COMMON_EXTERN void generate();
 
     /** Set to all zeros. */
-    void clear() { uuid_clear(c_array()); }
+    void clear();
 
     /** Test for null (all zeros). */
-    // Force int 0/!0 to false/true; avoids compile warnings.
-    bool isNull() {
-        return !!uuid_is_null(data());
-    }
-
-    // Default op= and copy ctor are fine.
-    // boost::array gives us ==, < etc.
+    bool isNull();
 
     QPID_COMMON_EXTERN void encode(framing::Buffer& buf) const;
     QPID_COMMON_EXTERN void decode(framing::Buffer& buf);

Modified: qpid/branches/java-network-refactor/qpid/cpp/include/qpid/management/Manageable.h
URL: http://svn.apache.org/viewvc/qpid/branches/java-network-refactor/qpid/cpp/include/qpid/management/Manageable.h?rev=812936&r1=812935&r2=812936&view=diff
==============================================================================
--- qpid/branches/java-network-refactor/qpid/cpp/include/qpid/management/Manageable.h (original)
+++ qpid/branches/java-network-refactor/qpid/cpp/include/qpid/management/Manageable.h Wed Sep  9 13:05:43 2009
@@ -43,7 +43,7 @@
     static const status_t STATUS_UNKNOWN_OBJECT          = 1;
     static const status_t STATUS_UNKNOWN_METHOD          = 2;
     static const status_t STATUS_NOT_IMPLEMENTED         = 3;
-    static const status_t STATUS_INVALID_PARAMETER       = 4;
+    static const status_t STATUS_PARAMETER_INVALID       = 4;
     static const status_t STATUS_FEATURE_NOT_IMPLEMENTED = 5;
     static const status_t STATUS_FORBIDDEN               = 6;
     static const status_t STATUS_EXCEPTION               = 7;

Modified: qpid/branches/java-network-refactor/qpid/cpp/include/qpid/sys/windows/Condition.h
URL: http://svn.apache.org/viewvc/qpid/branches/java-network-refactor/qpid/cpp/include/qpid/sys/windows/Condition.h?rev=812936&r1=812935&r2=812936&view=diff
==============================================================================
--- qpid/branches/java-network-refactor/qpid/cpp/include/qpid/sys/windows/Condition.h (original)
+++ qpid/branches/java-network-refactor/qpid/cpp/include/qpid/sys/windows/Condition.h Wed Sep  9 13:05:43 2009
@@ -30,7 +30,6 @@
 #include <boost/thread/condition.hpp>
 #include <boost/thread/thread_time.hpp>
 #include <windows.h>
-#undef STATUS_INVALID_PARAMETER // Hack for windows.h namespace pollution
 
 namespace qpid {
 namespace sys {

Modified: qpid/branches/java-network-refactor/qpid/cpp/include/qpid/sys/windows/Mutex.h
URL: http://svn.apache.org/viewvc/qpid/branches/java-network-refactor/qpid/cpp/include/qpid/sys/windows/Mutex.h?rev=812936&r1=812935&r2=812936&view=diff
==============================================================================
--- qpid/branches/java-network-refactor/qpid/cpp/include/qpid/sys/windows/Mutex.h (original)
+++ qpid/branches/java-network-refactor/qpid/cpp/include/qpid/sys/windows/Mutex.h Wed Sep  9 13:05:43 2009
@@ -31,7 +31,6 @@
 #include <boost/thread/shared_mutex.hpp>
 #include <boost/thread/thread_time.hpp>
 #include <boost/thread/tss.hpp>
-#undef STATUS_INVALID_PARAMETER // Hack for windows.h namespace pollution
 
 namespace qpid {
 namespace sys {

Modified: qpid/branches/java-network-refactor/qpid/cpp/src/CMakeLists.txt
URL: http://svn.apache.org/viewvc/qpid/branches/java-network-refactor/qpid/cpp/src/CMakeLists.txt?rev=812936&r1=812935&r2=812936&view=diff
==============================================================================
--- qpid/branches/java-network-refactor/qpid/cpp/src/CMakeLists.txt (original)
+++ qpid/branches/java-network-refactor/qpid/cpp/src/CMakeLists.txt Wed Sep  9 13:05:43 2009
@@ -451,6 +451,7 @@
      qpid/framing/FieldValue.cpp
      qpid/framing/FrameSet.cpp
      qpid/framing/FrameDecoder.cpp
+     qpid/framing/List.cpp
      qpid/framing/ProtocolInitiation.cpp
      qpid/framing/ProtocolVersion.cpp
      qpid/framing/SendContent.cpp
@@ -522,6 +523,40 @@
      qpid/client/SubscriptionImpl.cpp
      qpid/client/SubscriptionManager.cpp
      qpid/client/SubscriptionManagerImpl.cpp
+     qpid/messaging/Address.cpp
+     qpid/messaging/Connection.cpp
+     qpid/messaging/ConnectionImpl.h
+     qpid/messaging/Filter.cpp
+     qpid/messaging/Message.cpp
+     qpid/messaging/MessageImpl.h
+     qpid/messaging/MessageImpl.cpp
+     qpid/messaging/Receiver.cpp
+     qpid/messaging/ReceiverImpl.h
+     qpid/messaging/Session.cpp
+     qpid/messaging/SessionImpl.h
+     qpid/messaging/Sender.cpp
+     qpid/messaging/SenderImpl.h
+     qpid/messaging/Variant.cpp
+     qpid/client/amqp0_10/AddressResolution.h
+     qpid/client/amqp0_10/AddressResolution.cpp
+     qpid/client/amqp0_10/Codecs.cpp
+     qpid/client/amqp0_10/CodecsInternal.h
+     qpid/client/amqp0_10/CompletionTracker.h
+     qpid/client/amqp0_10/CompletionTracker.cpp
+     qpid/client/amqp0_10/ConnectionImpl.h
+     qpid/client/amqp0_10/ConnectionImpl.cpp
+     qpid/client/amqp0_10/IncomingMessages.h
+     qpid/client/amqp0_10/IncomingMessages.cpp
+     qpid/client/amqp0_10/MessageSink.h
+     qpid/client/amqp0_10/MessageSource.h
+     qpid/client/amqp0_10/OutgoingMessage.h
+     qpid/client/amqp0_10/OutgoingMessage.cpp
+     qpid/client/amqp0_10/ReceiverImpl.h
+     qpid/client/amqp0_10/ReceiverImpl.cpp
+     qpid/client/amqp0_10/SessionImpl.h
+     qpid/client/amqp0_10/SessionImpl.cpp
+     qpid/client/amqp0_10/SenderImpl.h
+     qpid/client/amqp0_10/SenderImpl.cpp
 )
 add_library (qpidclient SHARED ${libqpidclient_SOURCES})
 target_link_libraries (qpidclient qpidcommon)
@@ -615,10 +650,10 @@
 #  qpid/agent/ManagementAgent.h \
 #  qpid/agent/ManagementAgentImpl.h
 set (qmfagent_SOURCES
-     ../include/qpid/agent/ManagementAgent.h
-     qpid/agent/ManagementAgentImpl.cpp
-     qpid/agent/ManagementAgentImpl.h
-     qmf/Agent.cpp
+    qmf/AgentEngine.cpp
+    qmf/AgentEngine.h
+    qpid/agent/ManagementAgentImpl.cpp
+    qpid/agent/ManagementAgentImpl.h
     )
 add_library (qmfagent SHARED ${qmfagent_SOURCES})
 target_link_libraries (qmfagent qmfcommon)
@@ -626,14 +661,31 @@
                        VERSION ${qpidc_version})
 
 set (qmfcommon_SOURCES
-    qmf/Agent.cpp
-    qmf/ResilientConnection.cpp
+    qmf/ConnectionSettingsImpl.cpp
+    qmf/ConnectionSettingsImpl.h
+    qmf/ConsoleEngine.h
+    qmf/Event.h
+    qmf/Message.h
     qmf/MessageImpl.cpp
-    qmf/SchemaImpl.cpp
-    qmf/ValueImpl.cpp
+    qmf/MessageImpl.h
+    qmf/Object.h
+    qmf/ObjectId.h
     qmf/ObjectIdImpl.cpp
+    qmf/ObjectIdImpl.h
     qmf/ObjectImpl.cpp
+    qmf/ObjectImpl.h
+    qmf/Query.h
     qmf/QueryImpl.cpp
+    qmf/QueryImpl.h
+    qmf/ResilientConnection.cpp
+    qmf/ResilientConnection.h
+    qmf/Schema.h
+    qmf/SchemaImpl.cpp
+    qmf/SchemaImpl.h
+    qmf/Typecode.h
+    qmf/Value.h
+    qmf/ValueImpl.cpp
+    qmf/ValueImpl.h
     )
 add_library (qmfcommon SHARED ${qmfcommon_SOURCES})
 target_link_libraries (qmfcommon qpidclient)

Modified: qpid/branches/java-network-refactor/qpid/cpp/src/Makefile.am
URL: http://svn.apache.org/viewvc/qpid/branches/java-network-refactor/qpid/cpp/src/Makefile.am?rev=812936&r1=812935&r2=812936&view=diff
==============================================================================
--- qpid/branches/java-network-refactor/qpid/cpp/src/Makefile.am (original)
+++ qpid/branches/java-network-refactor/qpid/cpp/src/Makefile.am Wed Sep  9 13:05:43 2009
@@ -54,7 +54,7 @@
   qpid/sys/windows/Time.cpp \
   ../include/qpid/sys/windows/Time.h \
   qpid/sys/windows/uuid.cpp \
-  ../include/qpid/sys/windows/uuid.h \
+  qpid/sys/windows/uuid.h \
   windows/QpiddBroker.cpp \
   qpid/broker/windows/BrokerDefaults.cpp \
   qpid/broker/windows/SaslAuthenticator.cpp
@@ -378,6 +378,7 @@
   qpid/framing/InputHandler.h			\
   qpid/framing/Invoker.h			\
   qpid/framing/IsInSequenceSet.h		\
+  qpid/framing/List.cpp				\
   qpid/framing/MethodBodyFactory.h		\
   qpid/framing/MethodContent.h			\
   qpid/framing/ModelMethod.h			\
@@ -460,7 +461,8 @@
   qpid/sys/Timer.cpp				\
   qpid/sys/Timer.h				\
   qpid/sys/Waitable.h				\
-  qpid/sys/alloca.h
+  qpid/sys/alloca.h				\
+  qpid/sys/uuid.h
 
 if HAVE_SASL
 libqpidcommon_la_SOURCES += qpid/sys/cyrus/CyrusSecurityLayer.h
@@ -680,7 +682,41 @@
   qpid/client/SubscriptionImpl.h		\
   qpid/client/SubscriptionManager.cpp		\
   qpid/client/SubscriptionManagerImpl.cpp	\
-  qpid/client/SubscriptionManagerImpl.h
+  qpid/client/SubscriptionManagerImpl.h		\
+  qpid/messaging/Address.cpp			\
+  qpid/messaging/Connection.cpp			\
+  qpid/messaging/Filter.cpp			\
+  qpid/messaging/Message.cpp			\
+  qpid/messaging/MessageImpl.h			\
+  qpid/messaging/MessageImpl.cpp		\
+  qpid/messaging/Sender.cpp			\
+  qpid/messaging/Receiver.cpp			\
+  qpid/messaging/Session.cpp			\
+  qpid/messaging/Variant.cpp			\
+  qpid/messaging/ConnectionImpl.h 		\
+  qpid/messaging/SenderImpl.h			\
+  qpid/messaging/ReceiverImpl.h			\
+  qpid/messaging/SessionImpl.h			\
+  qpid/client/amqp0_10/AddressResolution.h	\
+  qpid/client/amqp0_10/AddressResolution.cpp	\
+  qpid/client/amqp0_10/Codecs.cpp		\
+  qpid/client/amqp0_10/CodecsInternal.h		\
+  qpid/client/amqp0_10/ConnectionImpl.h	        \
+  qpid/client/amqp0_10/ConnectionImpl.cpp	\
+  qpid/client/amqp0_10/CompletionTracker.h	\
+  qpid/client/amqp0_10/CompletionTracker.cpp	\
+  qpid/client/amqp0_10/IncomingMessages.h	\
+  qpid/client/amqp0_10/IncomingMessages.cpp	\
+  qpid/client/amqp0_10/MessageSink.h		\
+  qpid/client/amqp0_10/MessageSource.h		\
+  qpid/client/amqp0_10/OutgoingMessage.h	\
+  qpid/client/amqp0_10/OutgoingMessage.cpp	\
+  qpid/client/amqp0_10/ReceiverImpl.h		\
+  qpid/client/amqp0_10/ReceiverImpl.cpp		\
+  qpid/client/amqp0_10/SessionImpl.h		\
+  qpid/client/amqp0_10/SessionImpl.cpp		\
+  qpid/client/amqp0_10/SenderImpl.h		\
+  qpid/client/amqp0_10/SenderImpl.cpp
 
 # NOTE: only public header files (which should be in ../include)
 # should go in this list. Private headers should go in the SOURCES
@@ -723,6 +759,7 @@
   ../include/qpid/framing/Buffer.h		\
   ../include/qpid/framing/FieldTable.h		\
   ../include/qpid/framing/FieldValue.h		\
+  ../include/qpid/framing/List.h		\
   ../include/qpid/framing/ProtocolVersion.h	\
   ../include/qpid/framing/SequenceNumber.h	\
   ../include/qpid/framing/SequenceSet.h		\
@@ -749,7 +786,18 @@
   ../include/qpid/sys/SystemInfo.h		\
   ../include/qpid/sys/Thread.h			\
   ../include/qpid/sys/Time.h			\
-  ../include/qpid/sys/uuid.h
+  ../include/qpid/messaging/Address.h 		\
+  ../include/qpid/messaging/Connection.h 	\
+  ../include/qpid/messaging/Codec.h 	        \
+  ../include/qpid/messaging/Filter.h 		\
+  ../include/qpid/messaging/Message.h 		\
+  ../include/qpid/messaging/MessageContent.h 	\
+  ../include/qpid/messaging/MessageListener.h 	\
+  ../include/qpid/messaging/Sender.h 		\
+  ../include/qpid/messaging/Receiver.h 	        \
+  ../include/qpid/messaging/Session.h 		\
+  ../include/qpid/messaging/Variant.h 		\
+  ../include/qpid/client/amqp0_10/Codecs.h
 
 # Force build of qpidd during dist phase so help2man will work.
 dist-hook: $(BUILT_SOURCES)

Modified: qpid/branches/java-network-refactor/qpid/cpp/src/qmf.mk
URL: http://svn.apache.org/viewvc/qpid/branches/java-network-refactor/qpid/cpp/src/qmf.mk?rev=812936&r1=812935&r2=812936&view=diff
==============================================================================
--- qpid/branches/java-network-refactor/qpid/cpp/src/qmf.mk (original)
+++ qpid/branches/java-network-refactor/qpid/cpp/src/qmf.mk Wed Sep  9 13:05:43 2009
@@ -18,7 +18,7 @@
 #
 
 #
-# qmf agent library makefile fragment, to be included in Makefile.am
+# qmf library makefile fragment, to be included in Makefile.am
 # 
 lib_LTLIBRARIES +=				\
   libqmfcommon.la				\
@@ -27,13 +27,18 @@
 # Public header files
 nobase_include_HEADERS +=			\
   ../include/qpid/agent/ManagementAgent.h	\
-  ../include/qpid/agent/QmfAgentImportExport.h
-
+  ../include/qpid/agent/QmfAgentImportExport.h	\
+  ../include/qmf/Agent.h			\
+  ../include/qmf/Connection.h			\
+  ../include/qmf/QmfImportExport.h		\
+  ../include/qmf/ConnectionSettings.h		\
+  ../include/qmf/AgentObject.h
 
 libqmfcommon_la_SOURCES =			\
-  qmf/Agent.cpp					\
-  qmf/Agent.h					\
-  qmf/Console.h					\
+  qmf/ConnectionSettingsImpl.cpp		\
+  qmf/ConnectionSettingsImpl.h			\
+  qmf/ConsoleEngine.cpp				\
+  qmf/ConsoleEngine.h				\
   qmf/Event.h					\
   qmf/Message.h					\
   qmf/MessageImpl.cpp				\
@@ -44,11 +49,15 @@
   qmf/ObjectIdImpl.h				\
   qmf/ObjectImpl.cpp				\
   qmf/ObjectImpl.h				\
+  qmf/Protocol.cpp				\
+  qmf/Protocol.h				\
   qmf/Query.h					\
   qmf/QueryImpl.cpp				\
   qmf/QueryImpl.h				\
   qmf/ResilientConnection.cpp			\
   qmf/ResilientConnection.h			\
+  qmf/SequenceManager.cpp			\
+  qmf/SequenceManager.h				\
   qmf/Schema.h					\
   qmf/SchemaImpl.cpp				\
   qmf/SchemaImpl.h				\
@@ -58,9 +67,9 @@
   qmf/ValueImpl.h
 
 libqmfagent_la_SOURCES =			\
-  ../include/qpid/agent/ManagementAgent.h	\
+  qmf/AgentEngine.cpp				\
+  qmf/AgentEngine.h				\
   qpid/agent/ManagementAgentImpl.cpp		\
-  qpid/agent/ManagementAgentImpl.h		\
-  qmf/Agent.cpp
+  qpid/agent/ManagementAgentImpl.h
 
-libqmfagent_la_LIBADD = libqpidclient.la
+libqmfagent_la_LIBADD = libqpidclient.la libqmfcommon.la

Modified: qpid/branches/java-network-refactor/qpid/cpp/src/qmf/Object.h
URL: http://svn.apache.org/viewvc/qpid/branches/java-network-refactor/qpid/cpp/src/qmf/Object.h?rev=812936&r1=812935&r2=812936&view=diff
==============================================================================
--- qpid/branches/java-network-refactor/qpid/cpp/src/qmf/Object.h (original)
+++ qpid/branches/java-network-refactor/qpid/cpp/src/qmf/Object.h Wed Sep  9 13:05:43 2009
@@ -31,7 +31,7 @@
     public:
         Object(const SchemaObjectClass* type);
         Object(ObjectImpl* impl);
-        ~Object();
+        virtual ~Object();
 
         void destroy();
         const ObjectId* getObjectId() const;

Modified: qpid/branches/java-network-refactor/qpid/cpp/src/qmf/ObjectId.h
URL: http://svn.apache.org/viewvc/qpid/branches/java-network-refactor/qpid/cpp/src/qmf/ObjectId.h?rev=812936&r1=812935&r2=812936&view=diff
==============================================================================
--- qpid/branches/java-network-refactor/qpid/cpp/src/qmf/ObjectId.h (original)
+++ qpid/branches/java-network-refactor/qpid/cpp/src/qmf/ObjectId.h Wed Sep  9 13:05:43 2009
@@ -39,7 +39,6 @@
         bool isDurable() const;
 
         bool operator==(const ObjectId& other) const;
-        bool operator!=(const ObjectId& other) const;
         bool operator<(const ObjectId& other) const;
         bool operator>(const ObjectId& other) const;
         bool operator<=(const ObjectId& other) const;

Modified: qpid/branches/java-network-refactor/qpid/cpp/src/qmf/ObjectIdImpl.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/java-network-refactor/qpid/cpp/src/qmf/ObjectIdImpl.cpp?rev=812936&r1=812935&r2=812936&view=diff
==============================================================================
--- qpid/branches/java-network-refactor/qpid/cpp/src/qmf/ObjectIdImpl.cpp (original)
+++ qpid/branches/java-network-refactor/qpid/cpp/src/qmf/ObjectIdImpl.cpp Wed Sep  9 13:05:43 2009
@@ -166,11 +166,6 @@
     return *impl == *other.impl;
 }
 
-bool ObjectId::operator!=(const ObjectId& other) const
-{
-    return !(*impl == *other.impl);
-}
-
 bool ObjectId::operator<(const ObjectId& other) const
 {
     return *impl < *other.impl;

Modified: qpid/branches/java-network-refactor/qpid/cpp/src/qmf/ObjectImpl.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/java-network-refactor/qpid/cpp/src/qmf/ObjectImpl.cpp?rev=812936&r1=812935&r2=812936&view=diff
==============================================================================
--- qpid/branches/java-network-refactor/qpid/cpp/src/qmf/ObjectImpl.cpp (original)
+++ qpid/branches/java-network-refactor/qpid/cpp/src/qmf/ObjectImpl.cpp Wed Sep  9 13:05:43 2009
@@ -123,9 +123,9 @@
 
 void ObjectImpl::encodeSchemaKey(qpid::framing::Buffer& buffer) const
 {
-    buffer.putShortString(objectClass->getPackage());
-    buffer.putShortString(objectClass->getName());
-    buffer.putBin128(const_cast<uint8_t*>(objectClass->getHash()));
+    buffer.putShortString(objectClass->getClassKey()->getPackageName());
+    buffer.putShortString(objectClass->getClassKey()->getClassName());
+    buffer.putBin128(const_cast<uint8_t*>(objectClass->getClassKey()->getHash()));
 }
 
 void ObjectImpl::encodeManagedObjectData(qpid::framing::Buffer& buffer) const



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


Mime
View raw message