2009-07-11 Michael Barker <mike@middlesoft.co.uk>
[mono.git] / mcs / class / System.Web.Abstractions / System.Web / HttpApplicationStateWrapper.cs
1 //
2 // HttpApplicationStateWrapper.cs
3 //
4 // Author:
5 //      Atsushi Enomoto <atsushi@ximian.com>
6 //
7 // Copyright (C) 2008 Novell Inc. http://novell.com
8 //
9
10 //
11 // Permission is hereby granted, free of charge, to any person obtaining
12 // a copy of this software and associated documentation files (the
13 // "Software"), to deal in the Software without restriction, including
14 // without limitation the rights to use, copy, modify, merge, publish,
15 // distribute, sublicense, and/or sell copies of the Software, and to
16 // permit persons to whom the Software is furnished to do so, subject to
17 // the following conditions:
18 // 
19 // The above copyright notice and this permission notice shall be
20 // included in all copies or substantial portions of the Software.
21 // 
22 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
26 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
27 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 //
30 using System;
31 using System.Collections;
32 using System.Collections.Generic;
33 using System.Collections.Specialized;
34 using System.Globalization;
35 using System.Runtime.CompilerServices;
36 using System.Runtime.Serialization;
37 using System.Security.Permissions;
38 using System.Security.Principal;
39 using System.Web.Caching;
40
41 namespace System.Web
42 {
43 #if NET_4_0
44         [TypeForwardedFrom ("System.Web.Abstractions, Version=3.5.0.0, Culture=Neutral, PublicKeyToken=31bf3856ad364e35")]
45 #endif
46         [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
47         [AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
48         public class HttpApplicationStateWrapper : HttpApplicationStateBase
49         {
50                 HttpApplicationState w;
51
52                 public HttpApplicationStateWrapper (HttpApplicationState httpApplicationState)
53                 {
54                         if (httpApplicationState == null)
55                                 throw new ArgumentNullException ("httpApplicationState");
56                         w = httpApplicationState;
57                 }
58
59                 public override string [] AllKeys {
60                         get { return w.AllKeys; }
61                 }
62
63                 public override HttpApplicationStateBase Contents {
64                         get { return new HttpApplicationStateWrapper (w.Contents); }
65                 }
66
67                 public override int Count {
68                         get { return w.Count; }
69                 }
70
71                 public override bool IsSynchronized {
72                         get { return ((ICollection) this).IsSynchronized; }
73                 }
74
75                 public override object this [int index] {
76                         get { return Get (index); }
77                 }
78
79                 public override object this [string name] {
80                         get { return Get (name); }
81                         set { Set (name, value); }
82                 }
83
84                 public override NameObjectCollectionBase.KeysCollection Keys {
85                         get { return w.Keys; }
86                 }
87
88                 public override HttpStaticObjectsCollectionBase StaticObjects {
89                         get { return new HttpStaticObjectsCollectionWrapper (w.StaticObjects); }
90                 }
91
92                 public override object SyncRoot {
93                         get { return ((ICollection) this).SyncRoot; }
94                 }
95
96                 public override void Add (string name, object value)
97                 {
98                         w.Add (name, value);
99                 }
100
101                 public override void Clear ()
102                 {
103                         w.Clear ();
104                 }
105
106                 public override void CopyTo (Array array, int index)
107                 {
108                         ((ICollection) this).CopyTo (array, index);
109                 }
110
111                 public override object Get (int index)
112                 {
113                         return w.Get (index);
114                 }
115
116                 public override object Get (string name)
117                 {
118                         return w.Get (name);
119                 }
120
121                 public override IEnumerator GetEnumerator ()
122                 {
123                         return w.GetEnumerator ();
124                 }
125
126                 public override string GetKey (int index)
127                 {
128                         return w.GetKey (index);
129                 }
130
131                 [MonoTODO]
132                 public override void GetObjectData (SerializationInfo info, StreamingContext context)
133                 {
134                         w.GetObjectData (info, context);
135
136                         throw new NotImplementedException ();
137                 }
138
139                 public override void Lock ()
140                 {
141                         w.Lock ();
142                 }
143
144                 public override void OnDeserialization (object sender)
145                 {
146                         w.OnDeserialization (sender);
147                 }
148
149                 public override void Remove (string name)
150                 {
151                         w.Remove (name);
152                 }
153
154                 public override void RemoveAll ()
155                 {
156                         w.RemoveAll ();
157                 }
158
159                 public override void RemoveAt (int index)
160                 {
161                         w.RemoveAt (index);
162                 }
163
164                 public override void Set (string name, object value)
165                 {
166                         w.Set (name, value);
167                 }
168
169                 public override void UnLock ()
170                 {
171                         w.UnLock ();
172                 }
173         }
174 }