Skip to content

Commit 8da11f9

Browse files
author
Simon MacMullen
committed
stable to default
2 parents a221aaa + 5053258 commit 8da11f9

File tree

125 files changed

+1367
-535
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

125 files changed

+1367
-535
lines changed

Local.props.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project ToolsVersion="3.5" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<PropertyGroup>
4-
<PropTargetFramework>v3.5</PropTargetFramework>
4+
<PropTargetFramework>v3.0</PropTargetFramework>
55
<PropAssemblyVersion>0.0.0.0</PropAssemblyVersion>
66
<PropUsingMono>false</PropUsingMono>
77

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ rabbit-vsn:
1010
@echo "RABBIT_VSN is not set"
1111
@false
1212
else
13-
rabbit-vsn:
13+
rabbit-vsn:
1414
endif
1515

1616
dist: rabbit-vsn ensure-deliverables ensure-universally-readable
@@ -34,7 +34,7 @@ ensure-deliverables: rabbit-vsn
3434
file ${RELEASE_DIR}/${NAME_VSN}.msm
3535

3636
ensure-prerequisites: rabbit-vsn
37-
[ -f "/etc/debian_version" ] && dpkg -L htmldoc plotutils transfig graphviz docbook-utils || true > /dev/null
37+
[ -f "/etc/debian_version" ] && dpkg -L htmldoc plotutils transfig graphviz docbook-utils xmlstarlet || true > /dev/null
3838

3939
ensure-release-dir: rabbit-vsn
4040
touch ${RELEASE_DIR}/

docs/api-guide.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ NAMESPACES=$(cd $HTMLPATH; ls namespace-*.html | sed -e 's/namespace-\(.*\)\.htm
88
FILES="./api-title-page.html $HTMLPATH/index.html"
99
for n in $NAMESPACES
1010
do
11-
FILES="$FILES $HTMLPATH/namespace-$n.html $(cd $XMLPATH; cat namespace-$n.xml | grep '<type name' | sed -e 's:.*name="\([^"]*\)".*:'$HTMLPATH'/type-\1.html:')"
11+
FILES="$FILES $HTMLPATH/namespace-$n.html $(cd $XMLPATH; xmlstarlet sel -t -v "/namespace/typedoc/type/@name" namespace-$n.xml | sed -e 's:^\(.*\)$:'$HTMLPATH'/type-\1.html:')"
1212
done
1313

1414
htmldoc -t pdf --bodyfont serif --book --fontsize 9.0 --color $FILES > api-guide.pdf

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,15 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
167167
<chassis name="client" implement="MUST"/>
168168
<chassis name="server" implement="MUST"/>
169169
</method>
170+
<method name="blocked" index="60">
171+
<chassis name="server" implement="MUST"/>
172+
<chassis name="client" implement="MUST"/>
173+
<field name="reason" domain="shortstr" />
174+
</method>
175+
<method name="unblocked" index="61">
176+
<chassis name="server" implement="MUST"/>
177+
<chassis name="client" implement="MUST"/>
178+
</method>
170179
</class>
171180
<class name="channel" handler="channel" index="20">
172181
<chassis name="server" implement="MUST"/>

docs/specs/amqp0-9-1.xml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
exchange.bind and exchange.bind-ok,
88
exchange.unbind and exchange.unbind-ok,
99
basic.nack,
10+
connection.blocked and connection.unblocked,
1011
the ability for the Server to send basic.ack, basic.nack and
1112
basic.cancel to the client, and
1213
the un-deprecation of exchange.declare{auto-delete} and exchange.declare{internal}
@@ -893,6 +894,31 @@
893894
<chassis name = "client" implement = "MUST" />
894895
<chassis name = "server" implement = "MUST" />
895896
</method>
897+
898+
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
899+
900+
<method name = "blocked" index = "60" label = "indicates a connection is blocked">
901+
<doc>Notifies client that the connection is blocked</doc>
902+
903+
<field name = "reason" domain = "shortstr">
904+
<doc>
905+
Provides an explanation why the connection was blocked.
906+
</doc>
907+
</field>
908+
909+
<chassis name = "client" implement = "MUST" />
910+
<chassis name = "server" implement = "MUST" />
911+
</method>
912+
</class>
913+
914+
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
915+
916+
<method name = "unblocked" index = "61" label = "indicates a connection is unblocked">
917+
<doc>Notifies client that the connection is unblocked</doc>
918+
919+
<chassis name = "client" implement = "MUST" />
920+
<chassis name = "server" implement = "MUST" />
921+
</method>
896922
</class>
897923

898924
<!-- == CHANNEL ========================================================== -->

projects/client/Apigen/properties/AssemblyInfo.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
using System.Runtime.CompilerServices;
4343
using System.Runtime.InteropServices;
4444

45-
// General Information about an assembly is controlled through the following
45+
// General Information about an assembly is controlled through the following
4646
// set of attributes. Change these attribute values to modify the information
4747
// associated with an assembly.
4848
[assembly: AssemblyTitle("ApiGen")]
@@ -54,8 +54,8 @@
5454
[assembly: AssemblyTrademark("")]
5555
[assembly: AssemblyCulture("")]
5656

57-
// Setting ComVisible to false makes the types in this assembly not visible
58-
// to COM components. If you need to access a type in this assembly from
57+
// Setting ComVisible to false makes the types in this assembly not visible
58+
// to COM components. If you need to access a type in this assembly from
5959
// COM, set the ComVisible attribute to true on that type.
6060
[assembly: ComVisible(false)]
6161

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,22 +39,22 @@
3939
//---------------------------------------------------------------------------
4040

4141
using System;
42-
using System.Collections;
42+
using System.Collections.Generic;
4343
using System.Xml;
4444

4545
namespace RabbitMQ.Client.Apigen {
4646
public class AmqpClass: AmqpEntity {
47-
public ArrayList m_Methods;
48-
public ArrayList m_Fields;
47+
public IList<AmqpMethod> m_Methods;
48+
public IList<AmqpField> m_Fields;
4949

5050
public AmqpClass(XmlNode n)
5151
: base(n)
5252
{
53-
m_Methods = new ArrayList();
53+
m_Methods = new List<AmqpMethod>();
5454
foreach (XmlNode m in n.SelectNodes("method")) {
5555
m_Methods.Add(new AmqpMethod(m));
5656
}
57-
m_Fields = new ArrayList();
57+
m_Fields = new List<AmqpField>();
5858
foreach (XmlNode f in n.SelectNodes("field")) {
5959
m_Fields.Add(new AmqpField(f));
6060
}

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,22 +39,22 @@
3939
//---------------------------------------------------------------------------
4040

4141
using System;
42-
using System.Collections;
42+
using System.Collections.Generic;
4343
using System.Xml;
4444

4545
namespace RabbitMQ.Client.Apigen {
4646
public class AmqpMethod: AmqpEntity {
47-
public ArrayList m_Fields;
48-
public ArrayList m_ResponseMethods;
47+
public IList<AmqpField> m_Fields;
48+
public IList<string> m_ResponseMethods;
4949

5050
public AmqpMethod(XmlNode n)
5151
: base(n)
5252
{
53-
m_Fields = new ArrayList();
53+
m_Fields = new List<AmqpField>();
5454
foreach (XmlNode f in n.SelectNodes("field")) {
5555
m_Fields.Add(new AmqpField(f));
5656
}
57-
m_ResponseMethods = new ArrayList();
57+
m_ResponseMethods = new List<string>();
5858
foreach (XmlNode r in n.SelectNodes("response")) {
5959
m_ResponseMethods.Add(Apigen.GetString(r, "@name"));
6060
}

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

Lines changed: 33 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@
3939
//---------------------------------------------------------------------------
4040

4141
using System;
42-
using System.Collections;
42+
using System.CodeDom;
43+
using System.CodeDom.Compiler;
44+
using System.Collections.Generic;
4345
using System.IO;
4446
using System.Reflection;
4547
using System.Text;
@@ -53,7 +55,7 @@ public class Apigen {
5355
// Entry point
5456

5557
public static void Main(string[] args) {
56-
Apigen instance = new Apigen(new ArrayList(args));
58+
Apigen instance = new Apigen(new List<string>(args));
5759
instance.Generate();
5860
}
5961

@@ -118,8 +120,8 @@ public static string MangleConstant(string name) {
118120
return MangleClass(name);
119121
}
120122

121-
public static ArrayList IdentifierParts(string name) {
122-
ArrayList result = new ArrayList();
123+
public static IList<string> IdentifierParts(string name) {
124+
IList<string> result = new List<string>();
123125
foreach (String s1 in name.Split(new Char[] { '-' })) {
124126
foreach (String s2 in s1.Split(new Char[] { ' ' })) {
125127
result.Add(s2);
@@ -171,24 +173,27 @@ public static string MangleMethodClass(AmqpClass c, AmqpMethod m) {
171173
public bool m_emitComments = false;
172174

173175
public Type m_modelType = typeof(RabbitMQ.Client.Impl.IFullModel);
174-
public ArrayList m_modelTypes = new ArrayList();
175-
public ArrayList m_constants = new ArrayList();
176-
public ArrayList m_classes = new ArrayList();
177-
public Hashtable m_domains = new Hashtable();
176+
public IList<Type> m_modelTypes = new List<Type>();
177+
public IList<KeyValuePair<string, int>> m_constants = new List<KeyValuePair<string, int>>();
178+
public IList<AmqpClass> m_classes = new List<AmqpClass>();
179+
public IDictionary<string, string> m_domains = new Dictionary<string, string>();
180+
181+
public static IDictionary<string, string> m_primitiveTypeMap;
182+
public static IDictionary<string, bool> m_primitiveTypeFlagMap;
183+
184+
private CodeDomProvider m_csharpProvider;
178185

179-
public static Hashtable m_primitiveTypeMap;
180-
public static Hashtable m_primitiveTypeFlagMap;
181186
static Apigen() {
182-
m_primitiveTypeMap = new Hashtable();
183-
m_primitiveTypeFlagMap = new Hashtable();
187+
m_primitiveTypeMap = new Dictionary<string, string>();
188+
m_primitiveTypeFlagMap = new Dictionary<string, bool>();
184189
InitPrimitiveType("octet", "byte", false);
185190
InitPrimitiveType("shortstr", "string", true);
186191
InitPrimitiveType("longstr", "byte[]", true);
187192
InitPrimitiveType("short", "ushort", false);
188193
InitPrimitiveType("long", "uint", false);
189194
InitPrimitiveType("longlong", "ulong", false);
190195
InitPrimitiveType("bit", "bool", false);
191-
InitPrimitiveType("table", "System.Collections.IDictionary", true);
196+
InitPrimitiveType("table", "System.Collections.Generic.IDictionary<string, object>", true);
192197
InitPrimitiveType("timestamp", "AmqpTimestamp", false);
193198
InitPrimitiveType("content", "byte[]", true);
194199
}
@@ -227,7 +232,7 @@ public void Usage() {
227232
Environment.Exit(1);
228233
}
229234

230-
public Apigen(ArrayList args) {
235+
public Apigen(IList<string> args) {
231236
while (args.Count > 0 && ((string) args[0]).StartsWith("/")) {
232237
HandleOption((string) args[0]);
233238
args.RemoveAt(0);
@@ -239,6 +244,7 @@ public Apigen(ArrayList args) {
239244
}
240245
m_inputXmlFilename = (string) args[0];
241246
m_outputFilename = (string) args[1];
247+
this.m_csharpProvider = CodeDomProvider.CreateProvider("C#");
242248
}
243249

244250
///////////////////////////////////////////////////////////////////////////
@@ -289,7 +295,7 @@ public void ParseSpec() {
289295
}
290296
}
291297
foreach (XmlNode n in m_spec.SelectNodes("/amqp/constant")) {
292-
m_constants.Add(new DictionaryEntry(GetString(n, "@name"), GetInt(n, "@value")));
298+
m_constants.Add(new KeyValuePair<string, int>(GetString(n, "@name"), GetInt(n, "@value")));
293299
}
294300
foreach (XmlNode n in m_spec.SelectNodes("/amqp/class")) {
295301
m_classes.Add(new AmqpClass(n));
@@ -311,7 +317,7 @@ public void ReflectModel() {
311317
}
312318

313319
public string ResolveDomain(string d) {
314-
while (m_domains[d] != null) {
320+
while (m_domains.ContainsKey(d)) {
315321
string newD = (string) m_domains[d];
316322
if (d.Equals(newD))
317323
break;
@@ -418,7 +424,7 @@ public void EmitPublic() {
418424
EmitContentHeaderReader();
419425
EmitLine(" }");
420426
EmitLine(" public class Constants {");
421-
foreach (DictionaryEntry de in m_constants) {
427+
foreach (KeyValuePair<string, int> de in m_constants) {
422428
EmitLine(" ///<summary>(= "+de.Value+")</summary>");
423429
EmitLine(" public const int "+MangleConstant((string) de.Key)+" = "+de.Value+";");
424430
}
@@ -771,7 +777,7 @@ public Attribute Attribute(ICustomAttributeProvider p, Type t) {
771777
return Attribute(p.GetCustomAttributes(t, false), t);
772778
}
773779

774-
public Attribute Attribute(IEnumerable attributes, Type t) {
780+
public Attribute Attribute(IEnumerable<object> attributes, Type t) {
775781
if (t.IsSubclassOf(typeof(AmqpApigenAttribute))) {
776782
AmqpApigenAttribute result = null;
777783
foreach (AmqpApigenAttribute candidate in attributes) {
@@ -794,7 +800,7 @@ public Attribute Attribute(IEnumerable attributes, Type t) {
794800
public void EmitModelImplementation() {
795801
EmitLine(" public class Model: RabbitMQ.Client.Impl.ModelBase {");
796802
EmitLine(" public Model(RabbitMQ.Client.Impl.ISession session): base(session) {}");
797-
ArrayList asynchronousHandlers = new ArrayList();
803+
IList<MethodInfo> asynchronousHandlers = new List<MethodInfo>();
798804
foreach (Type t in m_modelTypes) {
799805
foreach (MethodInfo method in t.GetMethods()) {
800806
if (method.DeclaringType.Namespace != null &&
@@ -852,11 +858,14 @@ public void MaybeEmitModelMethod(MethodInfo method) {
852858
}
853859

854860
public string SanitisedFullName(Type t) {
855-
if (t == typeof(void)) {
856-
return "void";
857-
} else {
858-
return t.FullName;
861+
CodeTypeReferenceExpression tre = new CodeTypeReferenceExpression(t.FullName);
862+
StringBuilder sb = new StringBuilder();
863+
using (StringWriter writer = new StringWriter(sb))
864+
{
865+
this.m_csharpProvider.GenerateCodeFromExpression(tre, writer, new CodeGeneratorOptions());
859866
}
867+
868+
return sb.ToString().Trim(' ', '\t', '\r', '\n');
860869
}
861870

862871
public void EmitModelMethodPreamble(MethodInfo method) {
@@ -1086,7 +1095,7 @@ public void EmitModelMethod(MethodInfo method) {
10861095
EmitLine(" }");
10871096
}
10881097

1089-
public void EmitAsynchronousHandlers(ArrayList asynchronousHandlers) {
1098+
public void EmitAsynchronousHandlers(IList<MethodInfo> asynchronousHandlers) {
10901099
EmitLine(" public override bool DispatchAsynchronous(RabbitMQ.Client.Impl.Command cmd) {");
10911100
EmitLine(" RabbitMQ.Client.Impl.MethodBase __method = (RabbitMQ.Client.Impl.MethodBase) cmd.Method;");
10921101
EmitLine(" switch ((__method.ProtocolClassId << 16) | __method.ProtocolMethodId) {");

projects/client/ApigenBootstrap/properties/AssemblyInfo.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
using System.Runtime.CompilerServices;
4343
using System.Runtime.InteropServices;
4444

45-
// General Information about an assembly is controlled through the following
45+
// General Information about an assembly is controlled through the following
4646
// set of attributes. Change these attribute values to modify the information
4747
// associated with an assembly.
4848
[assembly: AssemblyTitle("ApiGenBootstrap")]
@@ -54,8 +54,8 @@
5454
[assembly: AssemblyTrademark("")]
5555
[assembly: AssemblyCulture("")]
5656

57-
// Setting ComVisible to false makes the types in this assembly not visible
58-
// to COM components. If you need to access a type in this assembly from
57+
// Setting ComVisible to false makes the types in this assembly not visible
58+
// to COM components. If you need to access a type in this assembly from
5959
// COM, set the ComVisible attribute to true on that type.
6060
[assembly: ComVisible(false)]
6161

0 commit comments

Comments
 (0)