2006-11-15 Atsushi Enomoto <atsushi@ximian.com>
[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 #if !TARGET_J2EE
46                 CodeNamespace _proxyCode;
47 #endif
48                 ServiceDescriptionImportWarnings _warnings;
49                 string _protocolName;
50                 string _appSettingUrlKey;
51                 string _appSettingBaseUrl;
52                 StringCollection _validationWarnings;
53                 
54 #if !TARGET_J2EE
55                 public WebReference (DiscoveryClientDocumentCollection documents, CodeNamespace proxyCode)
56                 {
57                         if (documents == null) throw new ArgumentNullException ("documents");
58                         if (proxyCode == null) throw new ArgumentNullException ("proxyCode");
59                         
60                         _documents = documents;
61                         _proxyCode = proxyCode;
62                 }
63                 
64                 public WebReference (DiscoveryClientDocumentCollection documents, CodeNamespace proxyCode, string appSettingUrlKey, string appSettingBaseUrl)
65                         : this (documents, proxyCode, String.Empty, appSettingUrlKey, appSettingBaseUrl)
66                 {
67                 }
68                 
69                 public WebReference (DiscoveryClientDocumentCollection documents, CodeNamespace proxyCode, string protocolName, string appSettingUrlKey, string appSettingBaseUrl)
70                 {
71                         if (documents == null) throw new ArgumentNullException ("documents");
72                         if (proxyCode == null) throw new ArgumentNullException ("proxyCode");
73                         
74                         _documents = documents;
75                         _proxyCode = proxyCode;
76                         _protocolName = protocolName;
77                         _appSettingUrlKey = appSettingUrlKey;
78                         _appSettingBaseUrl = appSettingBaseUrl;
79                 }
80 #endif          
81                 public string AppSettingBaseUrl {
82                         get { return _appSettingBaseUrl; }
83                 }
84                 
85                 public string AppSettingUrlKey {
86                         get { return _appSettingUrlKey; }
87                 }
88                 
89                 public DiscoveryClientDocumentCollection Documents {
90                         get { return _documents; }
91                 }
92
93                 public string ProtocolName {
94                         get { return _protocolName; }
95                         set { _protocolName = value; }
96                 }
97 #if !TARGET_J2EE
98                 public CodeNamespace ProxyCode {
99                         get { return _proxyCode; }
100                 }
101 #endif
102                 public StringCollection ValidationWarnings {
103                         get { 
104                                 if (_validationWarnings == null) _validationWarnings = new StringCollection ();
105                                 return _validationWarnings; 
106                         }
107                 }
108
109                 public ServiceDescriptionImportWarnings Warnings {
110                         get { return _warnings; }
111                         set { _warnings = value; }
112                 }
113                 
114                 internal void SetValidationWarnings (StringCollection col)
115                 {
116                         _validationWarnings = col;
117                 }
118         }
119 }
120