829a72a6f173f9e4e61491e1cdd84afe59c59a66
[mono.git] / mcs / class / System.Web.Services / System.Web.Services.Description / WebReference.cs
1 // 
2 // System.Web.Services.Description.WebReference.cs
3 //
4 // Author:
5 //   Lluis Sanchez (lluis@novell.com)
6 //
7 // Copyright (C) Novell, Inc., 2004
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
31 using System.Web.Services.Discovery;
32 using System.Collections.Specialized;
33 using System.CodeDom;
34
35 namespace System.Web.Services.Description 
36 {
37 #if NET_2_0
38         public
39 #else
40         internal
41 #endif
42         sealed class WebReference
43         {
44                 DiscoveryClientDocumentCollection _documents;
45                 CodeNamespace _proxyCode;
46                 ServiceDescriptionImportWarnings _warnings;
47                 string _protocolName;
48                 string _appSettingUrlKey;
49                 string _appSettingBaseUrl;
50                 StringCollection _validationWarnings;
51                 
52                 public WebReference (DiscoveryClientDocumentCollection documents, CodeNamespace proxyCode)
53                 {
54                         if (documents == null) throw new ArgumentNullException ("documents");
55                         if (proxyCode == null) throw new ArgumentNullException ("proxyCode");
56                         
57                         _documents = documents;
58                         _proxyCode = proxyCode;
59                 }
60                 
61                 public WebReference (DiscoveryClientDocumentCollection documents, CodeNamespace proxyCode, string protocolName, string appSettingUrlKey, string appSettingBaseUrl)
62                 {
63                         if (documents == null) throw new ArgumentNullException ("documents");
64                         if (proxyCode == null) throw new ArgumentNullException ("proxyCode");
65                         
66                         _documents = documents;
67                         _proxyCode = proxyCode;
68                         _protocolName = protocolName;
69                         _appSettingUrlKey = appSettingUrlKey;
70                         _appSettingBaseUrl = appSettingBaseUrl;
71                 }
72                 
73                 public string AppSettingBaseUrl {
74                         get { return _appSettingBaseUrl; }
75                 }
76                 
77                 public string AppSettingUrlKey {
78                         get { return _appSettingUrlKey; }
79                 }
80                 
81                 public DiscoveryClientDocumentCollection Documents {
82                         get { return _documents; }
83                 }
84
85                 public string ProtocolName {
86                         get { return _protocolName; }
87                         set { _protocolName = value; }
88                 }
89
90                 public CodeNamespace ProxyCode {
91                         get { return _proxyCode; }
92                 }
93
94                 public StringCollection ValidationWarnings {
95                         get { 
96                                 if (_validationWarnings == null) _validationWarnings = new StringCollection ();
97                                 return _validationWarnings; 
98                         }
99                 }
100
101                 public ServiceDescriptionImportWarnings Warnings {
102                         get { return _warnings; }
103                         set { _warnings = value; }
104                 }
105                 
106                 internal void SetValidationWarnings (StringCollection col)
107                 {
108                         _validationWarnings = col;
109                 }
110         }
111 }
112