created an new assembly System.Runtime.Remoting
authorDietmar Maurer <dietmar@mono-cvs.ximian.com>
Tue, 20 Aug 2002 09:19:57 +0000 (09:19 -0000)
committerDietmar Maurer <dietmar@mono-cvs.ximian.com>
Tue, 20 Aug 2002 09:19:57 +0000 (09:19 -0000)
svn path=/trunk/mcs/; revision=6798

mcs/class/System.Runtime.Remoting/ChangeLog [new file with mode: 0644]
mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.build [new file with mode: 0644]
mcs/class/System.Runtime.Remoting/System.Runtime.Remoting/TODOAttribute.cs [new file with mode: 0644]
mcs/class/corlib/System.Runtime.Remoting.Channels.Tcp/ChangeLog [deleted file]
mcs/class/corlib/System.Runtime.Remoting.Channels.Tcp/TcpChannel.cs [deleted file]
mcs/class/corlib/System.Runtime.Remoting.Channels.Tcp/TcpClientChannel.cs [new file with mode: 0644]
mcs/class/corlib/System.Runtime.Remoting.Proxies/RemotingProxy.cs [new file with mode: 0644]
mcs/class/corlib/System.Runtime.Remoting/ChangeLog
mcs/class/corlib/System.Runtime.Remoting/RemotingServices.cs
mcs/class/library.build

diff --git a/mcs/class/System.Runtime.Remoting/ChangeLog b/mcs/class/System.Runtime.Remoting/ChangeLog
new file mode 100644 (file)
index 0000000..90c32eb
--- /dev/null
@@ -0,0 +1,3 @@
+2002-08-14  Rodrigo Moya <rodrigo@ximian.com>
+
+       * TcpChannel.cs: new classes.
\ No newline at end of file
diff --git a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.build b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.build
new file mode 100644 (file)
index 0000000..b794acf
--- /dev/null
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+<!-- NAnt build file for System.Runtime.Remoting.dll -->
+
+<project name="System" default="build">
+       <property name="debug" value="false"/>
+
+       <target name="build">
+               <csc target="library" output="../lib/System.Runtime.Remoting.dll" debug="${debug}">
+                       <arg value="/nowarn:1595"/>
+                       <arg value="/unsafe"/>
+                       <sources>
+                               <includes name="**/*.cs"/> 
+                               <excludes name="Test/**"/> 
+                       </sources>
+                       <references>
+                               <includes name="../lib/corlib.dll"/>
+                               <includes name="../lib/System.dll"/>
+                       </references>
+               </csc>
+       </target>
+       <target name="clean">
+               <delete file="../lib/System.Runtime.Remoting.dll" failonerror="false"/>
+       </target>
+</project>
diff --git a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting/TODOAttribute.cs b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting/TODOAttribute.cs
new file mode 100644 (file)
index 0000000..0920ce8
--- /dev/null
@@ -0,0 +1,37 @@
+//
+// TODOAttribute.cs
+//
+// Author:
+//   Ravi Pratap (ravi@ximian.com)
+//
+// (C) Ximian, Inc.  http://www.ximian.com
+//
+
+namespace System {
+
+       /// <summary>
+       ///   The TODO attribute is used to flag all incomplete bits in our class libraries
+       /// </summary>
+       ///
+       /// <remarks>
+       ///   Use this to decorate any element which you think is not complete
+       /// </remarks>
+       [AttributeUsage (AttributeTargets.All, AllowMultiple=true)]
+       public class MonoTODOAttribute : Attribute {
+
+               private string comment;
+               
+               public MonoTODOAttribute ()
+               {}
+
+               public MonoTODOAttribute (string comment)
+               {
+                       this.comment = comment;
+               }
+
+               public string Comment
+               {
+                       get { return comment; }
+               }
+       }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Channels.Tcp/ChangeLog b/mcs/class/corlib/System.Runtime.Remoting.Channels.Tcp/ChangeLog
deleted file mode 100644 (file)
index 90c32eb..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-2002-08-14  Rodrigo Moya <rodrigo@ximian.com>
-
-       * TcpChannel.cs: new classes.
\ No newline at end of file
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Channels.Tcp/TcpChannel.cs b/mcs/class/corlib/System.Runtime.Remoting.Channels.Tcp/TcpChannel.cs
deleted file mode 100644 (file)
index e360daf..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-//
-// System.Runtime.Remoting.Channels.Tcp.TcpChannel.cs
-//
-// Author: Rodrigo Moya (rodrigo@ximian.com)
-//
-// 2002 (C) Copyright, Ximian, Inc.
-//
-
-using System.Collections;
-using System.Runtime.Remoting.Messaging;
-
-namespace System.Runtime.Remoting.Channels.Tcp
-{
-       public class TcpChannel : IChannelReceiver, IChannel,
-               IChannelSender
-       {
-               private int tcp_port;
-               
-               public TcpChannel ()
-               {
-                       tcp_port = 0;
-               }
-
-               public TcpChannel (int port)
-               {
-                       tcp_port = port;
-               }
-
-               [MonoTODO]
-               public TcpChannel (IDictionary properties,
-                                  IClientChannelSinkProvider clientSinkProvider,
-                                  IServerChannelSinkProvider serverSinkProvider)
-               {
-                       throw new NotImplementedException ();
-               }
-
-               public object ChannelData
-               {
-                       [MonoTODO]
-                       get {
-                               throw new NotImplementedException ();
-                       }
-               }
-
-               public string ChannelName
-               {
-                       [MonoTODO]
-                       get {
-                               throw new NotImplementedException ();
-                       }
-               }
-
-               public int ChannelPriority
-               {
-                       [MonoTODO]
-                       get {
-                               throw new NotImplementedException ();
-                       }
-               }
-
-               [MonoTODO]
-               public IMessageSink CreateMessageSink (string url,
-                                                      object remoteChannelData,
-                                                      out string objectURI)
-               {
-                       throw new NotImplementedException ();
-               }
-
-               [MonoTODO]
-               public string[] GetUrlsForUri (string objectURI)
-               {
-                       throw new NotImplementedException ();
-               }
-
-               [MonoTODO]
-               public string Parse (string url, out string objectURI)
-               {
-                       throw new NotImplementedException ();
-               }
-
-               [MonoTODO]
-               public void StartListening (object data)
-               {
-                       throw new NotImplementedException ();
-               }
-
-               [MonoTODO]
-               public void StopListening (object data)
-               {
-                       throw new NotImplementedException ();
-               }
-       }
-}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Channels.Tcp/TcpClientChannel.cs b/mcs/class/corlib/System.Runtime.Remoting.Channels.Tcp/TcpClientChannel.cs
new file mode 100644 (file)
index 0000000..e1a51b8
--- /dev/null
@@ -0,0 +1,68 @@
+//
+// System.Runtime.Remoting.Channels.Tcp.TcpClientChannel.cs
+//
+// Author: Dietmar Maurer (dietmar@ximian.com)
+//
+// 2002 (C) Copyright, Ximian, Inc.
+//
+
+using System.Collections;
+using System.Runtime.Remoting.Messaging;
+using System.Runtime.Remoting.Channels;
+
+namespace System.Runtime.Remoting.Channels.Tcp
+{
+       public class TcpClientChannel : IChannelSender, IChannel
+       {
+               int priority = 1;                                       
+               string name = "tcp";
+               IClientChannelSinkProvider sink_provider;
+               
+               public TcpClientChannel ()
+               {
+                       sink_provider = null;
+               }
+
+               public TcpClientChannel (IDictionary properties, IClientChannelSinkProvider sinkProvider)
+               {
+                       priority = 1;
+                       sink_provider = sinkProvider;
+               }
+
+               public TcpClientChannel (string name, IClientChannelSinkProvider sinkProvider)
+               {
+                       priority = 1;           
+                       this.name = name;
+                       sink_provider = sinkProvider;
+               }
+               
+               public string ChannelName
+               {
+                       get {
+                               return name;
+                       }
+               }
+
+               public int ChannelPriority
+               {
+                       get {
+                               return priority;
+                       }
+               }
+
+               [MonoTODO]
+               public IMessageSink CreateMessageSink (string url,
+                                                      object remoteChannelData,
+                                                      out string objectURI)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public string Parse (string url, out string objectURI)
+               {
+                       throw new NotImplementedException ();
+               }
+
+       }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Proxies/RemotingProxy.cs b/mcs/class/corlib/System.Runtime.Remoting.Proxies/RemotingProxy.cs
new file mode 100644 (file)
index 0000000..06eeb0d
--- /dev/null
@@ -0,0 +1,35 @@
+//
+// System.Runtime.Remoting.Proxies.RemotingProxy.cs
+//
+// Authors:
+//   Dietmar Maurer (dietmar@ximian.com)
+//
+// (C) 2001 Ximian, Inc.  http://www.ximian.com
+//
+
+using System;
+using System.Runtime.Remoting.Messaging;
+using System.Runtime.Remoting.Channels;
+using System.Runtime.CompilerServices;
+
+
+namespace System.Runtime.Remoting.Proxies
+{
+
+       public class RemotingProxy : RealProxy {
+
+               IMessageSink sink;
+               
+               
+               public RemotingProxy (Type type, IMessageSink sink) : base (type)
+               {
+                       this.sink = sink;
+               }
+
+               public override IMessage Invoke (IMessage request)
+               {
+                       return sink.SyncProcessMessage (request);
+               }
+
+       }
+}
index 3af3332f2050cb09ede8cfb9e36d758a91c9ab2c..a5aa4d122da020d99fc4ec4f2d2edf46a595acc3 100755 (executable)
@@ -1,3 +1,7 @@
+2002-08-20  Dietmar Maurer  <dietmar@ximian.com>
+
+       * RemotingServices.cs: Connect impl. 
+
 2002-08-02  Duncan Mak  <duncan@ximian.com>
 
        * ActivatedClientTypeEntry.cs:
index 25b1cc874a031aad236b318f6c8f26d50d37d80f..a7f3a88795952bf9af994c69748735f299a8b409 100644 (file)
@@ -10,6 +10,8 @@
 using System;
 using System.Reflection;
 using System.Runtime.Remoting.Messaging;
+using System.Runtime.Remoting.Proxies;
+using System.Runtime.Remoting.Channels;
 using System.Runtime.CompilerServices;
 
 namespace System.Runtime.Remoting
@@ -44,7 +46,33 @@ namespace System.Runtime.Remoting
 
                        return result;
                }
-                                                                  
-               
+
+               public static object Connect (Type classToProxy, string url)
+               {
+                       IMessageSink sink = null;
+                       string uri;
+                       
+                       IChannel [] channels = ChannelServices.RegisteredChannels;
+
+                       foreach (IChannel c in channels) {
+                               IChannelSender sender = c as IChannelSender;
+                               
+                               if (sender != null) {
+                                       sink = sender.CreateMessageSink (url, null, out uri);
+
+                                       if (sink != null)
+                                               break;
+                               }
+                       }
+
+                       if (sink == null) {
+                               string msg = String.Format ("Cannot create channel sink to connect to URL {0}.", url); 
+                               throw new RemotingException (msg);
+                       }
+
+                       RemotingProxy real_proxy = new RemotingProxy (classToProxy, sink);
+
+                       return real_proxy.GetTransparentProxy ();
+               }
        }
 }
index 817c5d45f6c1acf4e310d354fca5fcd1b56037ea..241c21c8b05f52dbf5fc249955ed2e8563c2b284 100644 (file)
@@ -18,6 +18,7 @@
                <nant basedir="System.Web.Services" target="build"/>
                <nant basedir="Microsoft.VisualBasic" target="build"/>
                <nant basedir="System.Configuration.Install" target="build"/>
+               <nant basedir="System.Runtime.Remoting" target="build"/>
        </target>
 
        <target name="test">