Author: tross
Date: Tue Apr 24 16:08:13 2012
New Revision: 1329817

URL: http://svn.apache.org/viewvc?rev=1329817&view=rev
Log:
QPID-3969 - Improved handling of unspecified arguments in QMFv2 method calls.

Modified:
    qpid/trunk/qpid/cpp/managementgen/qmfgen/management-types.xml
    qpid/trunk/qpid/cpp/managementgen/qmfgen/schema.py
    qpid/trunk/qpid/specs/management-schema.xml

Modified: qpid/trunk/qpid/cpp/managementgen/qmfgen/management-types.xml
URL: 
http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/managementgen/qmfgen/management-types.xml?rev=1329817&r1=1329816&r2=1329817&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/managementgen/qmfgen/management-types.xml (original)
+++ qpid/trunk/qpid/cpp/managementgen/qmfgen/management-types.xml Tue Apr 24 
16:08:13 2012
@@ -35,7 +35,7 @@
 <type name="int16"     base="S16"       cpp="int16_t"       
encode="@.putInt16(#)"       decode="# = @.getInt16()"     stream="#" size="2" 
accessor="direct" init="0"/>
 <type name="int32"     base="S32"       cpp="int32_t"       
encode="@.putInt32(#)"       decode="# = @.getInt32()"     stream="#" size="4" 
accessor="direct" init="0"/>
 <type name="int64"     base="S64"       cpp="int64_t"       
encode="@.putInt64(#)"       decode="# = @.getInt64()"     stream="#" size="8" 
accessor="direct" init="0"/>
-<type name="bool"      base="BOOL"      cpp="bool"       
encode="@.putOctet(#?1:0)"   decode="# = @.getOctet()==1"  stream="#" size="1" 
accessor="direct" init="0"/>
+<type name="bool"      base="BOOL"      cpp="bool"          
encode="@.putOctet(#?1:0)"   decode="# = @.getOctet()==1"  stream="#" size="1" 
accessor="direct" init="false"/>
 <type name="sstr"      base="SSTR"      cpp="std::string"   
encode="@.putShortString(#)" decode="@.getShortString(#)"  stream="#" size="(1 
+ #.length())" accessor="direct" init='""' byRef="y" unmap="(#).getString()"/>
 <type name="lstr"      base="LSTR"      cpp="std::string"   
encode="@.putMediumString(#)" decode="@.getMediumString(#)" stream="#" size="(2 
+ #.length())" accessor="direct" init='""' byRef="y" unmap="(#).getString()"/>
 <type name="absTime"   base="ABSTIME"   cpp="int64_t"       
encode="@.putLongLong(#)"    decode="# = @.getLongLong()"  stream="#" size="8" 
accessor="direct" init="0"/>

Modified: qpid/trunk/qpid/cpp/managementgen/qmfgen/schema.py
URL: 
http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/managementgen/qmfgen/schema.py?rev=1329817&r1=1329816&r2=1329817&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/managementgen/qmfgen/schema.py (original)
+++ qpid/trunk/qpid/cpp/managementgen/qmfgen/schema.py Tue Apr 24 16:08:13 2012
@@ -225,8 +225,7 @@ class SchemaType:
   def genRead (self, stream, varName, indent="    "):
     stream.write(indent + self.decode.replace("@", "buf").replace("#", 
varName) + ";\n")
 
-  def genUnmap (self, stream, varName, indent="    ", key=None, mapName="_map",
-                _optional=False):
+  def genUnmap (self, stream, varName, indent="    ", key=None, 
mapName="_map", _optional=False, _default=None):
     if key is None:
       key = varName
     stream.write(indent + "if ((_i = " + mapName + ".find(\"" + key + "\")) != 
" + mapName + ".end()) {\n")
@@ -234,6 +233,11 @@ class SchemaType:
                  self.unmap.replace("#", "_i->second") + ";\n")
     if _optional:
         stream.write(indent + "    _found = true;\n")
+    stream.write(indent + "} else {\n")
+    default = _default
+    if not default:
+        default = self.init
+    stream.write(indent + "    " + varName + " = " + default + ";\n")
     stream.write(indent + "}\n")
 
   def genWrite (self, stream, varName, indent="    "):
@@ -1405,7 +1409,9 @@ class SchemaClass:
                                  "ioArgs." + arg.dir.lower () + "_" + arg.name,
                                  "        ",
                                  arg.name,
-                                 "inMap")
+                                 "inMap",
+                                 False,
+                                 arg.default)
 
       stream.write ("        bool allow = coreObject->AuthorizeMethod(METHOD_" 
+\
                     method.getName().upper() + ", ioArgs, userId);\n")

Modified: qpid/trunk/qpid/specs/management-schema.xml
URL: 
http://svn.apache.org/viewvc/qpid/trunk/qpid/specs/management-schema.xml?rev=1329817&r1=1329816&r2=1329817&view=diff
==============================================================================
--- qpid/trunk/qpid/specs/management-schema.xml (original)
+++ qpid/trunk/qpid/specs/management-schema.xml Tue Apr 24 16:08:13 2012
@@ -125,8 +125,8 @@
     <statistic name="abandonedViaAlt"     type="count64" unit="message" 
desc="Messages routed to alternate exchange from a deleted queue"/>
 
     <method name="echo" desc="Request a response to test the path to the 
management broker">
-      <arg name="sequence" dir="IO" type="uint32" default="0"/>
-      <arg name="body"     dir="IO" type="lstr"   default=""/>
+      <arg name="sequence" dir="IO" type="uint32"/>
+      <arg name="body"     dir="IO" type="lstr"/>
     </method>
 
     <method name="connect" desc="Establish a connection to another broker">
@@ -143,7 +143,7 @@
       <arg name="srcQueue"          dir="I" type="sstr" desc="Source queue"/>
       <arg name="destQueue"         dir="I" type="sstr" desc="Destination 
queue"/>
       <arg name="qty"               dir="I" type="uint32" desc="# of messages 
to move. 0 means all messages"/>
-      <arg name="filter"  dir="I" type="map" default="{}"   desc="if 
specified, move only those messages matching this filter"/>
+      <arg name="filter"  dir="I" type="map" desc="if specified, move only 
those messages matching this filter"/>
     </method>
 
     <method name="setLogLevel" desc="Set the log level">
@@ -272,14 +272,14 @@
 
     <method name="purge" desc="Discard all or some messages on a queue">
       <arg name="request" dir="I" type="uint32" desc="0 for all messages or 
n>0 for n messages"/>
-      <arg name="filter"  dir="I" type="map" default="{}"  desc="if specified, 
purge only those messages matching this filter"/>
+      <arg name="filter"  dir="I" type="map"    desc="if specified, purge only 
those messages matching this filter"/>
     </method>
 
     <method name="reroute" desc="Remove all or some messages on this queue and 
route them to an exchange">
       <arg name="request"        dir="I" type="uint32" desc="0 for all 
messages or n>0 for n messages"/>
       <arg name="useAltExchange" dir="I" type="bool"   desc="Iff true, use the 
queue's configured alternate exchange; iff false, use exchange named in the 
'exchange' argument"/>
       <arg name="exchange"       dir="I" type="sstr"   desc="Name of the 
exchange to route the messages through"/>
-      <arg name="filter"  dir="I" type="map" default="{}" desc="if specified, 
reroute only those messages matching this filter"/>
+      <arg name="filter"  dir="I" type="map"           desc="if specified, 
reroute only those messages matching this filter"/>
     </method>
   </class>
 



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to