You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by js...@apache.org on 2006/10/18 14:01:43 UTC

svn commit: r465226 - in /incubator/activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ: Commands/WireFormatInfo.cs ConnectionFactory.cs Transport/Tcp/TcpTransportFactory.cs Util/URISupport.cs

Author: jstrachan
Date: Wed Oct 18 05:01:42 2006
New Revision: 465226

URL: http://svn.apache.org/viewvc?view=rev&rev=465226
Log:
applied patch for AMQ-989 to allow specification of wireFormat parameters in broker URI together with supporting the customizaztion of the socket etc

Modified:
    incubator/activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Commands/WireFormatInfo.cs
    incubator/activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/ConnectionFactory.cs
    incubator/activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Transport/Tcp/TcpTransportFactory.cs
    incubator/activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Util/URISupport.cs

Modified: incubator/activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Commands/WireFormatInfo.cs
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Commands/WireFormatInfo.cs?view=diff&rev=465226&r1=465225&r2=465226
==============================================================================
--- incubator/activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Commands/WireFormatInfo.cs (original)
+++ incubator/activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Commands/WireFormatInfo.cs Wed Oct 18 05:01:42 2006
@@ -49,7 +49,7 @@
             return GetType().Name + "["
                 + " Magic=" + Magic
                 + " Version=" + Version
-                + " MarshalledProperties=" + MarshalledProperties
+                + " MarshalledProperties=" + Properties.ToString()
                 + " ]";
 
         }

Modified: incubator/activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/ConnectionFactory.cs
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/ConnectionFactory.cs?view=diff&rev=465226&r1=465225&r2=465226
==============================================================================
--- incubator/activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/ConnectionFactory.cs (original)
+++ incubator/activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/ConnectionFactory.cs Wed Oct 18 05:01:42 2006
@@ -51,18 +51,14 @@
         {
             ConnectionInfo info = CreateConnectionInfo(userName, password);
 
-            // Extract query parameters from broker Uri
-            System.Collections.Specialized.StringDictionary map = URISupport.ParseQuery(brokerUri.Query);
-
             TcpTransportFactory tcpTransportFactory = new TcpTransportFactory();
-            // Set properties on connection using parameters prefixed with "transport."
-            URISupport.SetProperties(tcpTransportFactory, map, "transport.");
-
 			ITransport transport = tcpTransportFactory.CreateTransport(brokerUri);
 
             Connection connection = new Connection(transport, info);
 			connection.ClientId = info.ClientId;
+
 			// Set properties on connection using parameters prefixed with "jms."
+			System.Collections.Specialized.StringDictionary map = URISupport.ParseQuery(brokerUri.Query);
 			URISupport.SetProperties(connection, map, "jms.");
 
 			return connection;

Modified: incubator/activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Transport/Tcp/TcpTransportFactory.cs
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Transport/Tcp/TcpTransportFactory.cs?view=diff&rev=465226&r1=465225&r2=465226
==============================================================================
--- incubator/activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Transport/Tcp/TcpTransportFactory.cs (original)
+++ incubator/activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Transport/Tcp/TcpTransportFactory.cs Wed Oct 18 05:01:42 2006
@@ -21,6 +21,7 @@
 using ActiveMQ.Commands;
 using ActiveMQ.OpenWire;
 using ActiveMQ.Transport;
+using ActiveMQ.Util;
 
 namespace ActiveMQ.Transport.Tcp {
         public class TcpTransportFactory : ITransportFactory
@@ -34,16 +35,24 @@
 
                 public ITransport CreateTransport(Uri location)
                 {
+                        // Extract query parameters from broker Uri
+                        System.Collections.Specialized.StringDictionary map = URISupport.ParseQuery(location.Query);
+
+                        // Set transport. properties on this (the factory)
+                        URISupport.SetProperties(this, map, "transport.");
+
                         // Console.WriteLine("Opening socket to: " + host + " on port: " + port);
                         Socket socket = Connect(location.Host, location.Port);
                         TcpTransport tcpTransport = new TcpTransport(socket);
                         ITransport rc = tcpTransport;
 
-                        // At present the URI is parsed for options by the ConnectionFactory
                         if (UseLogging)
                         {
                                 rc = new LoggingTransport(rc);
                         }
+
+                        // Set wireformat. properties on the wireformat owned by the tcpTransport
+                        URISupport.SetProperties(tcpTransport.Wireformat.PreferedWireFormatInfo, map, "wireFormat.");
 
                         rc = new WireFormatNegotiator(rc, tcpTransport.Wireformat);
                         rc = new ResponseCorrelator(rc);

Modified: incubator/activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Util/URISupport.cs
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Util/URISupport.cs?view=diff&rev=465226&r1=465225&r2=465226
==============================================================================
--- incubator/activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Util/URISupport.cs (original)
+++ incubator/activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Util/URISupport.cs Wed Oct 18 05:01:42 2006
@@ -73,7 +73,7 @@
 			Type type = target.GetType();
 			foreach(string key in map.Keys)
 			{
-				if(key.StartsWith(prefix))
+				if(key.ToLower().StartsWith(prefix.ToLower()))
 				{
 					string bareKey = key.Substring(prefix.Length);
 					System.Reflection.PropertyInfo prop = type.GetProperty(bareKey, System.Reflection.BindingFlags.FlattenHierarchy | System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.IgnoreCase);