[mcs] Replace NET_2_1 by MOBILE
[mono.git] / mcs / class / System.ServiceModel / System.ServiceModel.Dispatcher / ClientRuntime.cs
1 //
2 // ClientRuntime.cs
3 //
4 // Author:
5 //      Atsushi Enomoto <atsushi@ximian.com>
6 //
7 // Copyright (C) 2005-2006 Novell, Inc.  http://www.novell.com
8 //
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:
16 // 
17 // The above copyright notice and this permission notice shall be
18 // included in all copies or substantial portions of the Software.
19 // 
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.
27 //
28 using System;
29 using System.Collections.Generic;
30 using System.Collections.ObjectModel;
31 using System.ServiceModel.Channels;
32 using System.ServiceModel.Description;
33
34 namespace System.ServiceModel.Dispatcher
35 {
36         public sealed class ClientRuntime
37         {
38                 SynchronizedCollection<IChannelInitializer> channel_initializers
39                         = new SynchronizedCollection<IChannelInitializer> ();
40                 SynchronizedCollection<IInteractiveChannelInitializer> interactive_channel_initializers
41                         = new SynchronizedCollection<IInteractiveChannelInitializer> ();
42                 SynchronizedCollection<IClientMessageInspector> inspectors
43                         = new SynchronizedCollection<IClientMessageInspector> ();
44                 ClientOperation.ClientOperationCollection operations
45                         = new ClientOperation.ClientOperationCollection ();
46                 IClientOperationSelector selector;
47                 Uri via;
48                 bool validate, manual_addressing;
49                 string contract_name, contract_ns;
50                 int max_fault_size = 0x10000; // FIXME: not verified.
51
52                 // .ctor() for Clients
53                 internal ClientRuntime (string name, string ns, object callbackDispatchRuntime)
54                 {
55                         contract_name = name;
56                         contract_ns = ns;
57 #if !MOBILE
58                         CallbackDispatchRuntime = (DispatchRuntime) callbackDispatchRuntime ?? new DispatchRuntime (null, this);
59 #endif
60                 }
61
62                 public Type CallbackClientType { get; set; }
63
64                 public SynchronizedCollection<IChannelInitializer> ChannelInitializers {
65                         get { return channel_initializers; }
66                 }
67
68                 public SynchronizedCollection<IInteractiveChannelInitializer> InteractiveChannelInitializers {
69                         get { return interactive_channel_initializers;}
70                 }
71
72                 public string ContractName {
73                         get { return contract_name; }
74                 }
75
76                 public string ContractNamespace {
77                         get { return contract_ns; }
78                 }
79
80                 
81                 public Type ContractClientType { get; set; }
82
83 #if !MOBILE
84                 public DispatchRuntime CallbackDispatchRuntime { get; internal set; }
85 #endif
86
87                 public SynchronizedCollection<IClientMessageInspector> MessageInspectors {
88                         get { return inspectors; }
89                 }
90
91 #if MOBILE
92                 public KeyedCollection<string,ClientOperation> Operations {
93                         get { return operations; }
94                 }
95 #else
96                 public SynchronizedKeyedCollection<string,ClientOperation> Operations {
97                         get { return operations; }
98                 }
99 #endif
100
101                 [MonoTODO]
102                 public ICollection<ClientOperation> ClientOperations {
103                         get { throw new NotImplementedException (); }
104                 }
105
106                 [MonoTODO]
107                 public ICollection<IClientMessageInspector> ClientMessageInspectors {
108                         get { throw new NotImplementedException (); }
109                 }
110
111                 public bool ManualAddressing {
112                         get { return manual_addressing; }
113                         set { manual_addressing = value; }
114                 }
115
116                 public int MaxFaultSize {
117                         get { return max_fault_size; }
118                         set { max_fault_size = value; }
119                 }
120
121                 public IClientOperationSelector OperationSelector {
122                         get { return selector; }
123                         set { selector = value; }
124                 }
125
126                 public bool ValidateMustUnderstand {
127                         get { return validate; }
128                         set { validate = value; }
129                 }
130
131                 public Uri Via {
132                         get { return via; }
133                         set { via = value; }
134                 }
135
136                 [MonoTODO]
137                 public ClientOperation UnhandledClientOperation {
138                         get { throw new NotImplementedException (); }
139                 }
140                 
141                 [MonoTODO]
142                 public bool MessageVersionNoneFaultsEnabled {
143                         get { throw new NotImplementedException (); }
144                         set { throw new NotImplementedException (); }
145                 }
146         }
147 }