File: ServiceDescriptions.cs

package info (click to toggle)
mono 6.8.0.105%2Bdfsg-3.3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,284,512 kB
  • sloc: cs: 11,172,132; xml: 2,850,069; ansic: 671,653; cpp: 122,091; perl: 59,366; javascript: 30,841; asm: 22,168; makefile: 20,093; sh: 15,020; python: 4,827; pascal: 925; sql: 859; sed: 16; php: 1
file content (198 lines) | stat: -rw-r--r-- 8,526 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
//------------------------------------------------------------------------------
// <copyright file="ServiceDescriptions.cs" company="Microsoft">
//     Copyright (c) Microsoft Corporation.  All rights reserved.
// </copyright>                                                                
//------------------------------------------------------------------------------

namespace System.Web.Services.Description {

    using System.Xml;
    using System.Xml.Serialization;
    using System.Xml.Schema;
    using System.Collections;
    using System;
    using System.IO;
    using System.ComponentModel;

    /// <include file='doc\ServiceDescriptions.uex' path='docs/doc[@for="ServiceDescriptionCollection"]/*' />
    /// <devdoc>
    ///    <para>[To be supplied.]</para>
    /// </devdoc>
    public sealed class ServiceDescriptionCollection : ServiceDescriptionBaseCollection {
        /// <include file='doc\ServiceDescriptions.uex' path='docs/doc[@for="ServiceDescriptionCollection.ServiceDescriptionCollection"]/*' />
        /// <devdoc>
        ///    <para>[To be supplied.]</para>
        /// </devdoc>
        public ServiceDescriptionCollection() : base(null) { }

        /// <include file='doc\ServiceDescriptions.uex' path='docs/doc[@for="ServiceDescriptionCollection.this"]/*' />
        /// <devdoc>
        ///    <para>[To be supplied.]</para>
        /// </devdoc>
        public ServiceDescription this[int index] {
            get { return (ServiceDescription)List[index]; }
            set { List[index] = value; }
        }
        
        /// <include file='doc\ServiceDescriptions.uex' path='docs/doc[@for="ServiceDescriptionCollection.this1"]/*' />
        /// <devdoc>
        ///    <para>[To be supplied.]</para>
        /// </devdoc>
        public ServiceDescription this[string ns] {
            get { return (ServiceDescription)Table[ns]; }
        }

        /// <include file='doc\ServiceDescriptions.uex' path='docs/doc[@for="ServiceDescriptionCollection.Add"]/*' />
        /// <devdoc>
        ///    <para>[To be supplied.]</para>
        /// </devdoc>
        public int Add(ServiceDescription serviceDescription) {
            return List.Add(serviceDescription);
        }
        
        /// <include file='doc\ServiceDescriptions.uex' path='docs/doc[@for="ServiceDescriptionCollection.Insert"]/*' />
        /// <devdoc>
        ///    <para>[To be supplied.]</para>
        /// </devdoc>
        public void Insert(int index, ServiceDescription serviceDescription) {
            List.Insert(index, serviceDescription);
        }
        
        /// <include file='doc\ServiceDescriptions.uex' path='docs/doc[@for="ServiceDescriptionCollection.IndexOf"]/*' />
        /// <devdoc>
        ///    <para>[To be supplied.]</para>
        /// </devdoc>
        public int IndexOf(ServiceDescription serviceDescription) {
            return List.IndexOf(serviceDescription);
        }
        
        /// <include file='doc\ServiceDescriptions.uex' path='docs/doc[@for="ServiceDescriptionCollection.Contains"]/*' />
        /// <devdoc>
        ///    <para>[To be supplied.]</para>
        /// </devdoc>
        public bool Contains(ServiceDescription serviceDescription) {
            return List.Contains(serviceDescription);
        }
        
        /// <include file='doc\ServiceDescriptions.uex' path='docs/doc[@for="ServiceDescriptionCollection.Remove"]/*' />
        /// <devdoc>
        ///    <para>[To be supplied.]</para>
        /// </devdoc>
        public void Remove(ServiceDescription serviceDescription) {
            List.Remove(serviceDescription);
        }
        
        /// <include file='doc\ServiceDescriptions.uex' path='docs/doc[@for="ServiceDescriptionCollection.CopyTo"]/*' />
        /// <devdoc>
        ///    <para>[To be supplied.]</para>
        /// </devdoc>
        public void CopyTo(ServiceDescription[] array, int index) {
            List.CopyTo(array, index);
        }

        /// <include file='doc\ServiceDescriptions.uex' path='docs/doc[@for="ServiceDescriptionCollection.GetKey"]/*' />
        /// <devdoc>
        ///    <para>[To be supplied.]</para>
        /// </devdoc>
        protected override string GetKey(object value) {
            string ns = ((ServiceDescription)value).TargetNamespace;
            if (ns == null) 
                return string.Empty;
            return ns;
        }

        Exception ItemNotFound(XmlQualifiedName name, string type) {
            return new Exception(Res.GetString(Res.WebDescriptionMissingItem, type, name.Name, name.Namespace));
        }

        /// <include file='doc\ServiceDescriptions.uex' path='docs/doc[@for="ServiceDescriptionCollection.GetMessage"]/*' />
        /// <devdoc>
        ///    <para>[To be supplied.]</para>
        /// </devdoc>
        public Message GetMessage(XmlQualifiedName name) {
            ServiceDescription sd = GetServiceDescription(name);
            Message message = null;
            while (message == null && sd != null) {
                message = sd.Messages[name.Name];
                sd = sd.Next;
            }
            if (message == null) throw ItemNotFound(name, "message");
            return message;
        }

        /// <include file='doc\ServiceDescriptions.uex' path='docs/doc[@for="ServiceDescriptionCollection.GetPortType"]/*' />
        /// <devdoc>
        ///    <para>[To be supplied.]</para>
        /// </devdoc>
        public PortType GetPortType(XmlQualifiedName name) {
            ServiceDescription sd = GetServiceDescription(name);
            PortType portType = null;
            while (portType == null && sd != null) {
                portType = sd.PortTypes[name.Name];
                sd = sd.Next;
            }
            if (portType == null) throw ItemNotFound(name, "message");
            return portType;
        }

        /// <include file='doc\ServiceDescriptions.uex' path='docs/doc[@for="ServiceDescriptionCollection.GetService"]/*' />
        /// <devdoc>
        ///    <para>[To be supplied.]</para>
        /// </devdoc>
        public Service GetService(XmlQualifiedName name) {
            ServiceDescription sd = GetServiceDescription(name);
            Service service = null;
            while (service == null && sd != null) {
                service = sd.Services[name.Name];
                sd = sd.Next;
            }
            if (service == null) throw ItemNotFound(name, "service");
            return service;
        }

        /// <include file='doc\ServiceDescriptions.uex' path='docs/doc[@for="ServiceDescriptionCollection.GetBinding"]/*' />
        /// <devdoc>
        ///    <para>[To be supplied.]</para>
        /// </devdoc>
        public Binding GetBinding(XmlQualifiedName name) {
            ServiceDescription sd = GetServiceDescription(name);
            Binding binding = null;
            while (binding == null && sd != null) {
                binding = sd.Bindings[name.Name];
                sd = sd.Next;
            }
            if (binding == null) throw ItemNotFound(name, "binding");
            return binding;
        }

        ServiceDescription GetServiceDescription(XmlQualifiedName name) {
            ServiceDescription serviceDescription = this[name.Namespace];
            if (serviceDescription == null) {
                throw new ArgumentException(Res.GetString(Res.WebDescriptionMissing, name.ToString(), name.Namespace), "name");
            }
            return serviceDescription;
        }

        /// <include file='doc\ServiceDescriptions.uex' path='docs/doc[@for="ServiceDescriptionCollection.SetParent"]/*' />
        /// <devdoc>
        ///    <para>[To be supplied.]</para>
        /// </devdoc>
        protected override void SetParent(object value, object parent) {
            ((ServiceDescription)value).SetParent((ServiceDescriptionCollection)parent);
        }

        /// <include file='doc\ServiceDescriptions.uex' path='docs/doc[@for="ServiceDescriptionBaseCollection.OnInsertComplete"]/*' />
        /// <devdoc>
        ///    <para>[To be supplied.]</para>
        /// </devdoc>
        protected override void OnInsertComplete(int index, object value) {
            string key = GetKey(value);
            if (key != null) {
                ServiceDescription item = (ServiceDescription)Table[key];
                ((ServiceDescription)value).Next = (ServiceDescription)Table[key];
                Table[key] = value;
            }
            SetParent(value, this);
        }
    }
}