initial checkin for WCF 4.0 Routing.
[mono.git] / mcs / class / System.ServiceModel.Routing / System.ServiceModel.Routing.Configuration / RoutingSection.cs
1 using System;
2 using System.Collections.Generic;
3 using System.Collections.ObjectModel;
4 using System.Configuration;
5 using System.Linq;
6 using System.ServiceModel;
7 using System.ServiceModel.Channels;
8 using System.ServiceModel.Configuration;
9 using System.ServiceModel.Description;
10 using System.ServiceModel.Dispatcher;
11
12 namespace System.ServiceModel.Routing.Configuration
13 {
14         public class RoutingSection : ConfigurationSection
15         {
16                 [MonoTODO]
17                 public static MessageFilterTable<IEnumerable<ServiceEndpoint>> CreateFilterTable (string name)
18                 {
19                         throw new NotImplementedException ();
20                         /*
21                         // FIXME: I feel messed.
22                         var sec = (RoutingSection) ConfigurationManager.GetSection ("system.serviceModel/routing");
23                         var endpoints = ((ServiceModelSectionGroup) ConfigurationManager.GetSection ("system.serviceModel")).Client.Endpoints;
24                         var table = new MessageFilterTable<IEnumerable<ServiceEndpoint>> ();
25                         var ftec = (FilterTableEntryCollection) sec.FilterTables [name];
26                         foreach (FilterTableEntryElement fte in ftec) {
27                                 var filter = table.Keys.FirstOrDefault (f => ((EndpointNameMessageFilter) f).Name == fte.FilterName);
28                                 if (filter == null) {
29                                         filter = new EndpointNameMessageFilter (fte.EndpointName);
30                                         table.Add (filter, new List<ServiceEndpoint> ());
31                                 }
32                                 var list = table [filter];
33                                 var bec = (BackupEndpointCollection) sec.BackupLists [fte.BackupList];
34                                 foreach (var bee in bec)
35                                         list.Add (endpoints [bee.EndpointName]);
36                         }
37                         return table;
38                         */
39                 }
40
41                 public RoutingSection ()
42                 {
43                         BackupLists = new BackupListCollection ();
44                         Filters = new FilterElementCollection ();
45                         FilterTables = new FilterTableCollection ();
46                         NamespaceTable = new NamespaceElementCollection ();
47                 }
48
49                 [ConfigurationProperty ("backupLists", Options = ConfigurationPropertyOptions.None)]
50                 public BackupListCollection BackupLists { get; private set; }
51
52                 [ConfigurationProperty ("filters", Options = ConfigurationPropertyOptions.None)]
53                 public FilterElementCollection Filters { get; private set; }
54
55                 [ConfigurationProperty ("filterTables", Options = ConfigurationPropertyOptions.None)]
56                 public FilterTableCollection FilterTables { get; private set; }
57
58                 [ConfigurationProperty ("namespaceTable", Options = ConfigurationPropertyOptions.None)]
59                 public NamespaceElementCollection NamespaceTable { get; private set; }
60         }
61 }