2 // System.Runtime.Remoting.Channels.ChannelServices.cs
4 // Author: Rodrigo Moya (rodrigo@ximian.com)
5 // Dietmar Maurer (dietmar@ximian.com)
7 // 2002 (C) Copyright, Ximian, Inc.
10 using System.Collections;
11 using System.Runtime.Remoting.Messaging;
13 namespace System.Runtime.Remoting.Channels
15 internal class ChannelInfoStore : IChannelInfo
17 object [] data = null;
19 public ChannelInfoStore ()
21 this.data = ChannelServices.GetCurrentChannelInfo ();
24 public object[] ChannelData {
36 public sealed class ChannelServices
38 private static ArrayList registeredChannels = new ArrayList ();
40 private ChannelServices ()
44 public static IChannel[] RegisteredChannels
47 IChannel[] channels = new IChannel[registeredChannels.Count];
49 for (int i = 0; i < registeredChannels.Count; i++)
50 channels[i] = (IChannel) registeredChannels[i];
57 public static IMessageCtrl AsyncDispatchMessage (IMessage msg,
58 IMessageSink replySink)
60 throw new NotImplementedException ();
63 public static IServerChannelSink CreateServerChannelSinkChain (
64 IServerChannelSinkProvider provider,
65 IChannelReceiver channel)
67 IServerChannelSinkProvider tmp = provider;
68 while (tmp.Next != null) tmp = tmp.Next;
69 tmp.Next = new ServerDispatchSinkProvider ();
71 return provider.CreateSink (channel);
75 public static ServerProcessing DispatchMessage (
76 IServerChannelSinkStack sinkStack,
78 out IMessage replyMsg)
80 throw new NotImplementedException ();
84 public static IChannel GetChannel (string name)
86 throw new NotImplementedException ();
90 public static IDictionary GetChannelSinkProperties (object obj)
92 throw new NotImplementedException ();
96 public static string[] GetUrlsForObject (MarshalByRefObject obj)
98 throw new NotImplementedException ();
101 public static void RegisterChannel (IChannel chnl)
103 // fixme: sort it by priority
104 registeredChannels.Add ((object) chnl);
108 public static IMessage SyncDispatchMessage (IMessage msg)
110 throw new NotImplementedException ();
113 public static void UnregisterChannel (IChannel chnl)
116 throw new ArgumentNullException ();
117 if (!registeredChannels.Contains ((object) chnl))
118 throw new RemotingException ();
120 registeredChannels.Remove ((object) chnl);
123 internal static object [] GetCurrentChannelInfo ()
125 ArrayList list = new ArrayList ();
127 foreach (object chnl_obj in registeredChannels) {
128 IChannelReceiver chnl = chnl_obj as IChannelReceiver;
131 object chnl_data = chnl.ChannelData;
132 if (chnl_data != null)
133 list.Add (chnl_data);
137 return list.ToArray ();