* ObjRef.cs: gather the channel date at creation time.
authorDietmar Maurer <dietmar@mono-cvs.ximian.com>
Sat, 31 Aug 2002 12:43:34 +0000 (12:43 -0000)
committerDietmar Maurer <dietmar@mono-cvs.ximian.com>
Sat, 31 Aug 2002 12:43:34 +0000 (12:43 -0000)
* ChannelDataStore.cs: use a hash to store other keys

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

mcs/class/corlib/System.Runtime.Remoting.Channels/ChangeLog
mcs/class/corlib/System.Runtime.Remoting.Channels/ChannelDataStore.cs
mcs/class/corlib/System.Runtime.Remoting.Channels/ChannelServices.cs
mcs/class/corlib/System.Runtime.Remoting/ChangeLog
mcs/class/corlib/System.Runtime.Remoting/ObjRef.cs

index a0ead317d7822046592de7de664af2e47e395c98..b58aa5c852eadcbf59fcbef55721b34d4e441a76 100644 (file)
@@ -1,3 +1,7 @@
+2002-08-31  Dietmar Maurer  <dietmar@ximian.com>
+
+       * ChannelDataStore.cs: use a hash to store other keys
+
 2002-08-24  Gonzalo Paniagua Javier <gonzalo@ximian.com>
 
        * ChannelServices.cs: added private .ctor
index 6c5c7c13fe1a12a7d7f17c531581e2331c6d0561..4911fedefaf22d786cf93de94765e6c7a5a132e3 100644 (file)
@@ -2,15 +2,19 @@
 // System.Runtime.Remoting.Channels.ChannelDataStore.cs
 //
 // Author: Rodrigo Moya (rodrigo@ximian.com)
+//         Dietmar Maurer (dietmar@ximian.com)
 //
 // 2002 (C) Copyright, Ximian, Inc.
 //
 
+using System.Collections;
+
 namespace System.Runtime.Remoting.Channels
 {
        public class ChannelDataStore : IChannelDataStore
        {
-               private string[] channelUris;
+               string[] channelUris;
+               Hashtable hash;
                
                public ChannelDataStore (string[] uris)
                {
@@ -29,14 +33,18 @@ namespace System.Runtime.Remoting.Channels
 
                public object this[object key]
                {
-                       [MonoTODO]
                        get {
-                               throw new NotImplementedException ();
+                               if (hash == null)
+                                       hash = new Hashtable ();
+                               
+                               return hash [key];
                        }
 
-                       [MonoTODO]
                        set {
-                               throw new NotImplementedException ();
+                               if (hash == null)
+                                       hash = new Hashtable ();
+                               
+                               hash [key] = value;
                        }
                }
        }
index bcadd38727a49c68b61d88a6242f40d5a3fd0141..21ec6fe8ea00441bfe00574a57342a8816f14c28 100644 (file)
@@ -2,6 +2,7 @@
 // System.Runtime.Remoting.Channels.ChannelServices.cs
 //
 // Author: Rodrigo Moya (rodrigo@ximian.com)
+//         Dietmar Maurer (dietmar@ximian.com)
 //
 // 2002 (C) Copyright, Ximian, Inc.
 //
@@ -11,6 +12,27 @@ using System.Runtime.Remoting.Messaging;
 
 namespace System.Runtime.Remoting.Channels
 {
+       internal class ChannelInfoStore : IChannelInfo
+       {
+               object [] data = null;
+
+               public ChannelInfoStore ()
+               {
+                       this.data = ChannelServices.GetCurrentChannelInfo ();
+               }
+               
+               public object[] ChannelData {
+
+                       get {
+                               return data;
+                       }
+                       
+                       set {
+                               data = value;
+                       }
+               }
+       }
+       
        public sealed class ChannelServices
        {
                private static ArrayList registeredChannels = new ArrayList ();
@@ -78,6 +100,7 @@ namespace System.Runtime.Remoting.Channels
 
                public static void RegisterChannel (IChannel chnl)
                {
+                       // fixme: sort it by priority
                        registeredChannels.Add ((object) chnl);
                }
 
@@ -96,5 +119,21 @@ namespace System.Runtime.Remoting.Channels
 
                        registeredChannels.Remove ((object) chnl);
                }
+
+               internal static object [] GetCurrentChannelInfo ()
+               {
+                       ArrayList list = new ArrayList ();
+                       
+                       foreach (object chnl_obj in registeredChannels) {
+                               IChannelReceiver chnl = chnl_obj as IChannelReceiver;
+                               if (chnl != null) {
+                                       object chnl_data = chnl.ChannelData;
+                                       if (chnl_data != null)
+                                               list.Add (chnl_data);
+                               }
+                       }
+
+                       return  list.ToArray ();
+               }
        }
 }
index a5aa4d122da020d99fc4ec4f2d2edf46a595acc3..b1d1a6dff568930da17771368a3f50437047b80a 100755 (executable)
@@ -1,3 +1,7 @@
+2002-08-31  Dietmar Maurer  <dietmar@ximian.com>
+
+       * ObjRef.cs: gather the channel date at creation time.
+
 2002-08-20  Dietmar Maurer  <dietmar@ximian.com>
 
        * RemotingServices.cs: Connect impl. 
index 210f34e8dfcab3ce8d8937056db88777afffc6cd..c67cab69d3e177833fb2648b843d42d78db49e7f 100644 (file)
 
 using System;
 using System.Runtime.Serialization;
+using System.Runtime.Remoting.Channels;
 
 namespace System.Runtime.Remoting {
 
        [Serializable]
        public class ObjRef : IObjectReference, ISerializable {
                MarshalByRefObject mbr;
-               SerializationInfo si;
+               IChannelInfo chnl_info;
                string uri;
                Type type;
+
                
                public ObjRef ()
                {
+                       // no idea why this needs to be public
                }
                
                public ObjRef (MarshalByRefObject mbr, Type type)
                {
                        this.mbr = mbr;
                        this.type = type;
+
+                       chnl_info = new ChannelInfoStore ();
                }
 
                [MonoTODO]
@@ -41,13 +46,14 @@ namespace System.Runtime.Remoting {
                        // This encarnates the object from serialized data.
                }
 
-               [MonoTODO]
                public virtual IChannelInfo ChannelInfo {
+
                        get {
-                               throw new NotImplementedException ();
+                               return chnl_info;
                        }
+                       
                        set {
-                               throw new NotImplementedException ();
+                               chnl_info = value;
                        }
                }
                
@@ -86,20 +92,18 @@ namespace System.Runtime.Remoting {
                        // FIXME:
                }
 
-               [MonoTODO]
                public virtual object GetRealObject (StreamingContext sc)
                {
-                       // FIXME:
+                       if (IsFromThisAppDomain ())
+                               return mbr;
                        
+                       // FIXME:
                        return null;
                }
 
-               [MonoTODO]
                public bool IsFromThisAppDomain ()
                {
-                       // FIXME:
-                       
-                       return true;
+                       return (mbr != null);
                }
 
                [MonoTODO]