diff options
author | Ted Ross <tross@apache.org> | 2012-04-24 16:08:13 +0000 |
---|---|---|
committer | Ted Ross <tross@apache.org> | 2012-04-24 16:08:13 +0000 |
commit | 0223bf0add4ac49dced9c96ece8c3f32ba7db8d6 (patch) | |
tree | 76edf82e650c7a1b221f65c50327a583202a1c3e | |
parent | d3bcd07b49ae284ff70c4b31c3db28a62712a3fd (diff) | |
download | qpid-python-0223bf0add4ac49dced9c96ece8c3f32ba7db8d6.tar.gz |
QPID-3969 - Improved handling of unspecified arguments in QMFv2 method calls.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1329817 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | qpid/cpp/managementgen/qmfgen/management-types.xml | 2 | ||||
-rwxr-xr-x | qpid/cpp/managementgen/qmfgen/schema.py | 12 | ||||
-rw-r--r-- | qpid/specs/management-schema.xml | 10 |
3 files changed, 15 insertions, 9 deletions
diff --git a/qpid/cpp/managementgen/qmfgen/management-types.xml b/qpid/cpp/managementgen/qmfgen/management-types.xml index c88f0caeae..efa8322806 100644 --- a/qpid/cpp/managementgen/qmfgen/management-types.xml +++ b/qpid/cpp/managementgen/qmfgen/management-types.xml @@ -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"/> diff --git a/qpid/cpp/managementgen/qmfgen/schema.py b/qpid/cpp/managementgen/qmfgen/schema.py index c48ae572d2..dc8ffae446 100755 --- a/qpid/cpp/managementgen/qmfgen/schema.py +++ b/qpid/cpp/managementgen/qmfgen/schema.py @@ -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") diff --git a/qpid/specs/management-schema.xml b/qpid/specs/management-schema.xml index 9eafbc52fa..66e122b049 100644 --- a/qpid/specs/management-schema.xml +++ b/qpid/specs/management-schema.xml @@ -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> |