2 // EndpointDispatcher.cs
5 // Atsushi Enomoto <atsushi@ximian.com>
7 // Copyright (C) 2005-2006 Novell, Inc. http://www.novell.com
9 // Permission is hereby granted, free of charge, to any person obtaining
10 // a copy of this software and associated documentation files (the
11 // "Software"), to deal in the Software without restriction, including
12 // without limitation the rights to use, copy, modify, merge, publish,
13 // distribute, sublicense, and/or sell copies of the Software, and to
14 // permit persons to whom the Software is furnished to do so, subject to
15 // the following conditions:
17 // The above copyright notice and this permission notice shall be
18 // included in all copies or substantial portions of the Software.
20 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
24 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
25 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 using System.Collections.Generic;
30 using System.Collections.ObjectModel;
31 using System.Reflection;
32 using System.ServiceModel.Description;
33 using System.ServiceModel.Channels;
34 using System.ServiceModel.Dispatcher;
35 using System.ServiceModel.Security.Tokens;
38 namespace System.ServiceModel.Dispatcher
40 public class EndpointDispatcher
42 EndpointAddress address;
43 string contract_name, contract_ns;
44 ChannelDispatcher channel_dispatcher;
45 MessageFilter address_filter;
46 MessageFilter contract_filter;
48 DispatchRuntime dispatch_runtime;
50 // Umm, this API is ugly, since it or its members will
51 // anyways require ServiceEndpoint, those arguments are
52 // likely to be replaced by ServiceEndpoint (especially
53 // considering about possible EndpointAddress inconsistency).
54 public EndpointDispatcher (EndpointAddress address,
55 string contractName, string contractNamespace)
57 if (contractName == null)
58 throw new ArgumentNullException ("contractName");
59 if (contractNamespace == null)
60 throw new ArgumentNullException ("contractNamespace");
62 throw new ArgumentNullException ("address");
64 this.address = address;
65 contract_name = contractName;
66 contract_ns = contractNamespace;
68 dispatch_runtime = new DispatchRuntime (this);
71 public DispatchRuntime DispatchRuntime {
72 get { return dispatch_runtime; }
75 public string ContractName {
76 get { return contract_name; }
79 public string ContractNamespace {
80 get { return contract_ns; }
83 public ChannelDispatcher ChannelDispatcher {
84 get { return channel_dispatcher; }
85 internal set { channel_dispatcher = value; }
88 public MessageFilter AddressFilter {
89 get { return address_filter; }
92 throw new ArgumentNullException ("value");
93 address_filter = value;
97 public MessageFilter ContractFilter {
98 get { return contract_filter ?? (contract_filter = new MatchAllMessageFilter ()); }
101 throw new ArgumentNullException ("value");
102 contract_filter = value;
106 public EndpointAddress EndpointAddress {
107 get { return address; }
110 public int FilterPriority {
111 get { return filter_priority; }
112 set { filter_priority = value; }