Skip to content

Commit 3ecf250

Browse files
author
Emile Joubert
committed
Merged bug22772 into amqp_0_9_1
2 parents e7e7057 + 33d3184 commit 3ecf250

24 files changed

+3923
-293
lines changed

dist.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,11 @@ function dist-zips {
131131
"/suppress:RabbitMQ.Client.Framing.v0_8 \
132132
/suppress:RabbitMQ.Client.Framing.v0_8qpid \
133133
/suppress:RabbitMQ.Client.Framing.v0_9 \
134+
/suppress:RabbitMQ.Client.Framing.v0_9_1 \
134135
/suppress:RabbitMQ.Client.Framing.Impl.v0_8 \
135136
/suppress:RabbitMQ.Client.Framing.Impl.v0_8qpid \
136137
/suppress:RabbitMQ.Client.Framing.Impl.v0_9 \
138+
/suppress:RabbitMQ.Client.Framing.Impl.v0_9_1 \
137139
/suppress:RabbitMQ.Client.Impl \
138140
/suppress:RabbitMQ.Client.Apigen.Attributes" \
139141
$NAME_VSN-tmp-xmldoc.zip \

docs/specs/amqp0-9-1.stripped.xml

Lines changed: 459 additions & 0 deletions
Large diffs are not rendered by default.

docs/specs/amqp0-9-1.xml

Lines changed: 2843 additions & 0 deletions
Large diffs are not rendered by default.

projects/client/Apigen/src/apigen/AmqpField.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,5 +70,13 @@ public string Domain {
7070
return result;
7171
}
7272
}
73+
74+
public bool Reserved
75+
{
76+
get
77+
{
78+
return GetString("@reserved", "") == "1";
79+
}
80+
}
7381
}
7482
}

projects/client/Apigen/src/apigen/Apigen.cs

Lines changed: 54 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,10 @@ public static string MangleMethodClass(AmqpClass c, AmqpMethod m) {
165165
public bool m_versionOverridden = false;
166166
public int m_majorVersion;
167167
public int m_minorVersion;
168+
public int? m_revision;
168169
public string m_apiName;
169170
public bool m_emitComments = false;
171+
public bool m_supportsRedirect;
170172

171173
public Type m_modelType = typeof(RabbitMQ.Client.Impl.IFullModel);
172174
public ArrayList m_modelTypes = new ArrayList();
@@ -281,6 +283,11 @@ public void ParseSpec() {
281283
if (!m_versionOverridden) {
282284
m_majorVersion = GetInt(m_spec, "/amqp/@major");
283285
m_minorVersion = GetInt(m_spec, "/amqp/@minor");
286+
if (m_spec.SelectSingleNode("/amqp/@revision") != null)
287+
{
288+
m_revision = GetInt(m_spec, "/amqp/@revision");
289+
}
290+
284291
}
285292
foreach (XmlNode n in m_spec.SelectNodes("/amqp/constant")) {
286293
m_constants.Add(new DictionaryEntry(GetString(n, "@name"), GetInt(n, "@value")));
@@ -290,7 +297,10 @@ public void ParseSpec() {
290297
}
291298
foreach (XmlNode n in m_spec.SelectNodes("/amqp/domain")) {
292299
m_domains[GetString(n, "@name")] = GetString(n, "@type");
293-
}
300+
}
301+
m_supportsRedirect =
302+
m_spec.SelectSingleNode(
303+
"/amqp/class[@name='connection']/method[@name='redirect']") != null;
294304
}
295305

296306
public void ReflectModel() {
@@ -416,11 +426,18 @@ public void EmitPublic() {
416426
EmitLine(" public override int MajorVersion { get { return " + m_majorVersion + "; } }");
417427
EmitLine(" ///<summary>Protocol minor version (= "+m_minorVersion+")</summary>");
418428
EmitLine(" public override int MinorVersion { get { return " + m_minorVersion + "; } }");
429+
EmitLine(" ///<summary>Protocol revision (= " +
430+
(m_revision.HasValue ? m_revision.ToString() : "not specified") + ")</summary>");
431+
EmitLine(" public override int? Revision { get { return " +
432+
(m_revision.HasValue ? m_revision.ToString() : "null") + "; } }");
419433
EmitLine(" ///<summary>Protocol API name (= "+m_apiName+")</summary>");
420434
EmitLine(" public override string ApiName { get { return \"" + m_apiName + "\"; } }");
421435
int port = GetInt(m_spec, "/amqp/@port");
422436
EmitLine(" ///<summary>Default TCP port (= "+port+")</summary>");
423437
EmitLine(" public override int DefaultPort { get { return " + port + "; } }");
438+
EmitLine(" ///<summary>Whether redirect is supported</summary>");
439+
EmitLine(" public override bool SupportsRedirect { get { return "
440+
+ m_supportsRedirect.ToString().ToLower() + "; } }");
424441
EmitLine("");
425442
EmitMethodArgumentReader();
426443
EmitLine("");
@@ -811,7 +828,10 @@ public void EmitModelImplementation() {
811828
if (method.Name.StartsWith("Handle") ||
812829
(Attribute(method, typeof(AmqpAsynchronousHandlerAttribute)) != null))
813830
{
814-
asynchronousHandlers.Add(method);
831+
if ((Attribute(method, typeof(AmqpMethodDoNotImplementAttribute)) == null))
832+
{
833+
asynchronousHandlers.Add(method);
834+
}
815835
} else {
816836
MaybeEmitModelMethod(method);
817837
}
@@ -828,7 +848,14 @@ public void EmitContentHeaderFactory(MethodInfo method) {
828848
string contentClass = factoryAnnotation.m_contentClass;
829849
EmitModelMethodPreamble(method);
830850
EmitLine(" {");
831-
EmitLine(" return new "+MangleClass(contentClass)+"Properties();");
851+
if (Attribute(method, typeof(AmqpUnsupportedAttribute)) != null)
852+
{
853+
EmitLine(String.Format(" return default({0});", method.ReturnType));
854+
}
855+
else
856+
{
857+
EmitLine(" return new " + MangleClass(contentClass) + "Properties();");
858+
}
832859
EmitLine(" }");
833860
}
834861

@@ -1100,26 +1127,35 @@ public void EmitAsynchronousHandlers(ArrayList asynchronousHandlers) {
11001127
string implClass = MangleMethodClass(amqpClass, amqpMethod);
11011128

11021129
EmitLine(" case "+((amqpClass.Index << 16) | amqpMethod.Index)+": {");
1103-
ParameterInfo[] parameters = method.GetParameters();
1130+
ParameterInfo[] parameters = method.GetParameters();
11041131
if (parameters.Length > 0) {
1105-
EmitLine(" "+implClass+" __impl = ("+implClass+") __method;");
1132+
EmitLine(" "+implClass+" __impl = ("+implClass+") __method;");
11061133
EmitLine(" "+method.Name+"(");
11071134
int remaining = parameters.Length;
11081135
foreach (ParameterInfo pi in parameters) {
1109-
if (Attribute(pi, typeof(AmqpContentHeaderMappingAttribute)) != null) {
1110-
Emit(" ("+pi.ParameterType+") cmd.Header");
1111-
} else if (Attribute(pi, typeof(AmqpContentBodyMappingAttribute)) != null) {
1112-
Emit(" cmd.Body");
1113-
} else {
1114-
AmqpFieldMappingAttribute fieldMapping =
1115-
Attribute(pi, typeof(AmqpFieldMappingAttribute)) as AmqpFieldMappingAttribute;
1116-
Emit(" __impl.m_"+(fieldMapping == null
1117-
? pi.Name
1118-
: fieldMapping.m_fieldName));
1119-
}
11201136
remaining--;
1121-
if (remaining > 0) {
1122-
EmitLine(",");
1137+
if (Attribute(pi, typeof(AmqpUnsupportedAttribute)) == null)
1138+
{
1139+
if (Attribute(pi, typeof(AmqpContentHeaderMappingAttribute)) != null)
1140+
{
1141+
Emit(" (" + pi.ParameterType + ") cmd.Header");
1142+
}
1143+
else if (Attribute(pi, typeof(AmqpContentBodyMappingAttribute)) != null)
1144+
{
1145+
Emit(" cmd.Body");
1146+
}
1147+
else
1148+
{
1149+
AmqpFieldMappingAttribute fieldMapping =
1150+
Attribute(pi, typeof(AmqpFieldMappingAttribute)) as AmqpFieldMappingAttribute;
1151+
Emit(" __impl.m_" + (fieldMapping == null
1152+
? pi.Name
1153+
: fieldMapping.m_fieldName));
1154+
}
1155+
if (remaining > 0)
1156+
{
1157+
EmitLine(",");
1158+
}
11231159
}
11241160
}
11251161
EmitLine(");");

0 commit comments

Comments
 (0)