2002-09-03 Dietmar Maurer <dietmar@ximian.com>
authorDietmar Maurer <dietmar@mono-cvs.ximian.com>
Tue, 3 Sep 2002 13:56:31 +0000 (13:56 -0000)
committerDietmar Maurer <dietmar@mono-cvs.ximian.com>
Tue, 3 Sep 2002 13:56:31 +0000 (13:56 -0000)
* System.Runtime.Remoting.Channels.CORBA/CORBAChannel.cs:
impl. the channel wrapper.

* System.Runtime.Remoting.Channels.Simple/SimpleChannel.cs:
impl. the channel wrapper.

* System.Runtime.Remoting.Channels.Simple/SimpleServerChannel.cs
(GetUrlsForUri): use all available channel uris.

svn path=/trunk/mcs/; revision=7206

mcs/class/System.Runtime.Remoting/ChangeLog
mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.CORBA/CORBAChannel.cs
mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.CORBA/CORBAServerChannel.cs
mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Simple/SimpleChannel.cs
mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Simple/SimpleClientChannel.cs
mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Simple/SimpleServerChannel.cs
mcs/class/System.Runtime.Remoting/Test/corba-example.cs
mcs/class/System.Runtime.Remoting/Test/simple-example.cs

index f7eaf42ffb4e0b75fad41811a12c4b82ac5626e5..9c233b763e82272e82ed1821a8b53f6683c37038 100644 (file)
@@ -1,3 +1,14 @@
+2002-09-03  Dietmar Maurer  <dietmar@ximian.com>
+
+       * System.Runtime.Remoting.Channels.CORBA/CORBAChannel.cs:
+       impl. the channel wrapper.
+
+       * System.Runtime.Remoting.Channels.Simple/SimpleChannel.cs:
+       impl. the channel wrapper.
+
+       * System.Runtime.Remoting.Channels.Simple/SimpleServerChannel.cs
+       (GetUrlsForUri): use all available channel uris. 
+
 2002-08-30  Dietmar Maurer  <dietmar@ximian.com>
 
        * System.Runtime.Remoting.Channels.Simple/SimpleWireFormat.cs: add
index 909cb92ef27578cc7ee35e88b97fd373f08399ea..abaad39c77cfe706ad67deb565cf1f2b1c663e5b 100644 (file)
@@ -15,83 +15,77 @@ namespace System.Runtime.Remoting.Channels.CORBA
        public class CORBAChannel : IChannelReceiver, IChannel,
                IChannelSender
        {
-               private int tcp_port;
+               CORBAServerChannel svr_chnl;
+               CORBAClientChannel cnt_chnl;
                
+               string name = "corba";
+
                public CORBAChannel ()
                {
-                       tcp_port = 0;
+                       svr_chnl = new CORBAServerChannel (0);
+                       cnt_chnl = new CORBAClientChannel ();
                }
 
                public CORBAChannel (int port)
                {
-                       tcp_port = port;
+                       svr_chnl = new CORBAServerChannel (port);
+                       cnt_chnl = new CORBAClientChannel ();
                }
 
                [MonoTODO]
                public CORBAChannel (IDictionary properties,
-                                    IClientChannelSinkProvider clientSinkProvider,
-                                    IServerChannelSinkProvider serverSinkProvider)
+                                     IClientChannelSinkProvider clientSinkProvider,
+                                     IServerChannelSinkProvider serverSinkProvider)
                {
                        throw new NotImplementedException ();
                }
 
                public object ChannelData
                {
-                       [MonoTODO]
                        get {
-                               throw new NotImplementedException ();
+                               return svr_chnl.ChannelData;
                        }
                }
 
                public string ChannelName
                {
-                       [MonoTODO]
                        get {
-                               throw new NotImplementedException ();
+                               return name;
                        }
                }
 
                public int ChannelPriority
                {
-                       [MonoTODO]
                        get {
-                               throw new NotImplementedException ();
+                               return svr_chnl.ChannelPriority;
                        }
                }
 
-               [MonoTODO]
                public IMessageSink CreateMessageSink (string url,
                                                       object remoteChannelData,
                                                       out string objectURI)
                {
-                       throw new NotImplementedException ();
+                       return cnt_chnl.CreateMessageSink (url, remoteChannelData, out objectURI);
                }
 
-               [MonoTODO]
                public string[] GetUrlsForUri (string objectURI)
                {
-                       throw new NotImplementedException ();
+                       return svr_chnl.GetUrlsForUri (objectURI);
                }
 
                public string Parse (string url, out string objectURI)
                {
-                       int port;
-                       
-                       string host = ParseCORBAURL (url, out objectURI, out port);
-
-                       return "corba://" + host + ":" + port;
+                       return svr_chnl.Parse (url, out objectURI);
                }
 
-               [MonoTODO]
                public void StartListening (object data)
                {
-                       throw new NotImplementedException ();
+                       svr_chnl.StartListening (data);
                }
 
-               [MonoTODO]
                public void StopListening (object data)
                {
-                       throw new NotImplementedException ();
+                       svr_chnl.StopListening (data);
                }
 
                internal static string ParseCORBAURL (string url, out string objectURI, out int port)
index 395d49d08f940638c9f2f6d40198c82deebced78..080af738a5334fb72e2a4dedf1ca48ffffc90e5a 100644 (file)
@@ -100,20 +100,24 @@ namespace System.Runtime.Remoting.Channels.CORBA
                        }
                }
 
-               public string GetChannelUri ()
+               string GetChannelUri ()
                {
-                       return "tcp://" + host + ":" + port;
+                       return "corba://" + host + ":" + port;
                }
                
                public string[] GetUrlsForUri (string uri)
                {
-                       string [] result = new String [1];
-
+                       string [] chnl_uris = channel_data.ChannelUris;
+                       
                        if (uri.IndexOf ('/') != 0)
-                               result [0] = GetChannelUri () + "/" + uri;
-                       else
-                               result [0] = GetChannelUri () + uri;
+                               uri = "/" + uri;
+
+                       string [] result = new String [chnl_uris.Length];
 
+                       for (int i = 0; i < chnl_uris.Length; i++) {
+                               result [i] = chnl_uris [i] + uri;
+                       }
+                       
                        return result;
                }
 
@@ -123,7 +127,7 @@ namespace System.Runtime.Remoting.Channels.CORBA
                        
                        string host = CORBAChannel.ParseCORBAURL (url, out objectURI, out port);
 
-                       return "corba://" + host + ":" + port;
+                       return GetChannelUri ();
                }
 
                void WaitForConnections ()
index 3e4eed4d914f17bd3ed0a67f909ec5f5638d82e4..1151048cbe84f2e7a796cafa7aab245176aa2f39 100644 (file)
@@ -15,16 +15,21 @@ namespace System.Runtime.Remoting.Channels.Simple
        public class SimpleChannel : IChannelReceiver, IChannel,
                IChannelSender
        {
-               private int tcp_port;
+               SimpleServerChannel svr_chnl;
+               SimpleClientChannel cnt_chnl;
                
+               string name = "simple";
+
                public SimpleChannel ()
                {
-                       tcp_port = 0;
+                       svr_chnl = new SimpleServerChannel (0);
+                       cnt_chnl = new SimpleClientChannel ();
                }
 
                public SimpleChannel (int port)
                {
-                       tcp_port = port;
+                       svr_chnl = new SimpleServerChannel (port);
+                       cnt_chnl = new SimpleClientChannel ();
                }
 
                [MonoTODO]
@@ -37,61 +42,50 @@ namespace System.Runtime.Remoting.Channels.Simple
 
                public object ChannelData
                {
-                       [MonoTODO]
                        get {
-                               throw new NotImplementedException ();
+                               return svr_chnl.ChannelData;
                        }
                }
 
                public string ChannelName
                {
-                       [MonoTODO]
                        get {
-                               throw new NotImplementedException ();
+                               return name;
                        }
                }
 
                public int ChannelPriority
                {
-                       [MonoTODO]
                        get {
-                               throw new NotImplementedException ();
+                               return svr_chnl.ChannelPriority;
                        }
                }
 
-               [MonoTODO]
                public IMessageSink CreateMessageSink (string url,
                                                       object remoteChannelData,
                                                       out string objectURI)
                {
-                       throw new NotImplementedException ();
+                       return cnt_chnl.CreateMessageSink (url, remoteChannelData, out objectURI);
                }
 
-               [MonoTODO]
                public string[] GetUrlsForUri (string objectURI)
                {
-                       throw new NotImplementedException ();
+                       return svr_chnl.GetUrlsForUri (objectURI);
                }
 
                public string Parse (string url, out string objectURI)
                {
-                       int port;
-                       
-                       string host = ParseSimpleURL (url, out objectURI, out port);
-
-                       return "tcp://" + host + ":" + port;
+                       return svr_chnl.Parse (url, out objectURI);
                }
 
-               [MonoTODO]
                public void StartListening (object data)
                {
-                       throw new NotImplementedException ();
+                       svr_chnl.StartListening (data);
                }
 
-               [MonoTODO]
                public void StopListening (object data)
                {
-                       throw new NotImplementedException ();
+                       svr_chnl.StopListening (data);
                }
 
                internal static string ParseSimpleURL (string url, out string objectURI, out int port)
index 8f03d127053b91b5b49673c8ad84aec2f669816d..6bdd1ab60586eb49e71bade8b691f5145cd49e98 100644 (file)
@@ -17,7 +17,7 @@ namespace System.Runtime.Remoting.Channels.Simple
        public class SimpleClientChannel : IChannelSender, IChannel
        {
                int priority = 1;                                       
-               string name = "tcp";
+               string name = "simple";
                IClientChannelSinkProvider sink_provider;
                
                public SimpleClientChannel ()
@@ -68,7 +68,7 @@ namespace System.Runtime.Remoting.Channels.Simple
                                                       out string objectURI)
                {
                        objectURI = null;
-                       
+
                        if (url != null) {
                                if (Parse (url, out objectURI) != null)
                                        return (IMessageSink) sink_provider.CreateSink (this, url,
index fca0b885d55e0d42942e3a19c8e0d6192594b251..ec0a93413f7eecc4b3e813fa403db9e5a5d7d791 100644 (file)
@@ -58,7 +58,7 @@ namespace System.Runtime.Remoting.Channels.Simple
                }
 
                public SimpleServerChannel (IDictionary properties,
-                                        IServerChannelSinkProvider serverSinkProvider)
+                                           IServerChannelSinkProvider serverSinkProvider)
                {
                        port = (int)properties ["port"];
                        Init (serverSinkProvider);
@@ -100,20 +100,24 @@ namespace System.Runtime.Remoting.Channels.Simple
                        }
                }
 
-               public string GetChannelUri ()
+               string GetChannelUri ()
                {
-                       return "tcp://" + host + ":" + port;
+                       return "simple://" + host + ":" + port;
                }
                
                public string[] GetUrlsForUri (string uri)
                {
-                       string [] result = new String [1];
-
+                       string [] chnl_uris = channel_data.ChannelUris;
+                       
                        if (uri.IndexOf ('/') != 0)
-                               result [0] = GetChannelUri () + "/" + uri;
-                       else
-                               result [0] = GetChannelUri () + uri;
+                               uri = "/" + uri;
 
+                       string [] result = new String [chnl_uris.Length];
+
+                       for (int i = 0; i < chnl_uris.Length; i++) {
+                               result [i] = chnl_uris [i] + uri;
+                       }
+                       
                        return result;
                }
 
@@ -123,7 +127,7 @@ namespace System.Runtime.Remoting.Channels.Simple
                        
                        string host = SimpleChannel.ParseSimpleURL (url, out objectURI, out port);
 
-                       return "tcp://" + host + ":" + port;
+                       return GetChannelUri ();
                }
 
                void WaitForConnections ()
index 89bb3c2b446be527862938d139cdaf5136c8a63f..86bffdf7f6f9a5df3415800c287dde6ee6b888a3 100644 (file)
@@ -29,24 +29,21 @@ class Test : MarshalByRefObject {
                string url = "corba://localhost:8000/test";
                string uri;
                
-               IChannelReceiver svr_chnl = new CORBAServerChannel (8000);
-               
-               IChannel chnl = new CORBAClientChannel ();
+               CORBAChannel chnl = new CORBAChannel (8000);
+               ChannelServices.RegisterChannel (chnl);
 
                Console.WriteLine ("Channel name: " + chnl.ChannelName);
                Console.WriteLine ("Channel priority: " + chnl.ChannelPriority);
                Console.WriteLine ("URI: " + chnl.Parse (url, out uri));
                Console.WriteLine ("URI: " + uri);
                
-               ChannelServices.RegisterChannel (chnl);
-
                Test tp = (Test)RemotingServices.Connect (typeof (Test), url);
 
                int res = tp.test_function (4, true);
 
                Console.WriteLine ("RESULT: " + res);
                
-               svr_chnl.StopListening (null);
+               chnl.StopListening (null);
                
                return 0;
        }
index 5ea1e9772c9a3f163834040aa97418656f122beb..0923050ce86c3918d088fb533693521378dc1a6d 100644 (file)
@@ -29,16 +29,14 @@ class Test : MarshalByRefObject {
                string url = "simple://localhost:8000/test";
                string uri;
                
-               IChannelReceiver svr_chnl = new SimpleServerChannel (8000);
-               
-               IChannel chnl = new SimpleClientChannel ();
+               SimpleChannel chnl = new SimpleChannel (8000);
+               ChannelServices.RegisterChannel (chnl);
 
                Console.WriteLine ("Channel name: " + chnl.ChannelName);
                Console.WriteLine ("Channel priority: " + chnl.ChannelPriority);
                Console.WriteLine ("URI: " + chnl.Parse (url, out uri));
                Console.WriteLine ("URI: " + uri);
                
-               ChannelServices.RegisterChannel (chnl);
 
                Test tp = (Test)RemotingServices.Connect (typeof (Test), url);
 
@@ -46,7 +44,7 @@ class Test : MarshalByRefObject {
 
                Console.WriteLine ("RESULT: " + res);
                
-               svr_chnl.StopListening (null);
+               chnl.StopListening (null);
                
                return 0;
        }