2004-02-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
[mono.git] / mcs / class / System.Web / System.Web / SiteMap.cs
1 //
2 // System.Web.SiteMap
3 //
4 // Authors:
5 //      Ben Maurer (bmaurer@users.sourceforge.net)
6 //
7 // (C) 2003 Ben Maurer
8 //
9
10 #if NET_1_2
11 using System.Collections;
12 using System.Collections.Specialized;
13 using System.Text;
14 using System.Configuration.Provider;
15
16 namespace System.Web {
17         public sealed class SiteMap {
18                 [MonoTODO ("Get everything from the config")]
19                 private static void Init ()
20                 {
21                         if (provider == null) {
22                                 lock (typeof (SiteMap)) {
23                                         if (provider == null) {
24                                                 providers = new SiteMapProviderCollection ();
25                                                 provider = new XmlSiteMapProvider ();
26                                                 NameValueCollection attributes = new NameValueCollection ();
27                                                 attributes.Add ("siteMapFile", "app.sitemap");
28                                                 ((IProvider)provider).Initialize ("AspNetXmlSiteMapProvider", attributes);
29                                                 providers.Add ((IProvider)provider);
30                                         }
31                                 }
32                         }
33                 }
34                 
35                 public static SiteMapNode CurrentNode { 
36                         get { return Provider.CurrentNode; }
37                 }
38                 public static SiteMapNode RootNode { 
39                         get { return Provider.RootNode; }
40                 }
41                 
42                 public static ISiteMapProvider Provider {
43                         get {
44                                 Init ();
45                                 return provider;
46                         }
47                 }
48                 public static SiteMapProviderCollection Providers {
49                         get {
50                                 Init ();
51                                 return providers;
52                         }
53                 }
54                 
55                 static ISiteMapProvider provider;
56                 static SiteMapProviderCollection providers;
57         }
58 }
59 #endif
60