Add object() and first_object() convenience APIs to qmf
-------------------------------------------------------

                 Key: QPID-1541
                 URL: https://issues.apache.org/jira/browse/QPID-1541
             Project: Qpid
          Issue Type: Improvement
          Components: Qpid Managment Framework
            Reporter: Ian Main


Here is a patch to add object() and first_object() to the ruby qmf console.  
Similar would have to be done for python but it should be very easy.

diff --git a/lib/qpid/qmf.rb b/lib/qpid/qmf.rb
index d2e2651..f341da7 100644
--- a/lib/qpid/qmf.rb
+++ b/lib/qpid/qmf.rb
@@ -390,6 +390,18 @@ module Qpid::Qmf
       @result
     end
 
+    # Return one and only one object or nil.
+    def object(kwargs)
+      objs = objects(kwargs)
+      return objs.length == 1 ? objs[0] : nil
+    end
+
+    # Return the first of potentially many objects.
+    def first_object(kwargs)
+      objs = objects(kwargs)
+      return objs.length > 0 ? objs[0] : nil
+    end
+
     def set_event_filter(kwargs); end
 
     def handle_broker_connect(broker); end


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to