2 // MessageLoggingElement.cs
5 // Atsushi Enomoto <atsushi@ximian.com>
7 // Copyright (C) 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.
30 using System.Collections;
31 using System.Collections.Generic;
32 using System.Collections.ObjectModel;
33 using System.ComponentModel;
34 using System.Configuration;
36 using System.Net.Security;
37 using System.Reflection;
38 using System.Security.Cryptography.X509Certificates;
39 using System.Security.Principal;
40 using System.IdentityModel.Claims;
41 using System.IdentityModel.Policy;
42 using System.IdentityModel.Tokens;
43 using System.ServiceModel;
44 using System.ServiceModel.Channels;
45 using System.ServiceModel.Description;
46 using System.ServiceModel.Diagnostics;
47 using System.ServiceModel.Dispatcher;
48 using System.ServiceModel.MsmqIntegration;
49 using System.ServiceModel.PeerResolvers;
50 using System.ServiceModel.Security;
51 using System.Runtime.Serialization;
55 namespace System.ServiceModel.Configuration
58 public sealed partial class MessageLoggingElement
59 : ConfigurationElement
62 static ConfigurationPropertyCollection properties;
63 static ConfigurationProperty filters;
64 static ConfigurationProperty log_entire_message;
65 static ConfigurationProperty log_malformed_messages;
66 static ConfigurationProperty log_messages_at_service_level;
67 static ConfigurationProperty log_messages_at_transport_level;
68 static ConfigurationProperty max_messages_to_log;
69 static ConfigurationProperty max_size_of_message_to_log;
71 static MessageLoggingElement ()
73 properties = new ConfigurationPropertyCollection ();
74 filters = new ConfigurationProperty ("filters",
75 typeof (XPathMessageFilterElementCollection), null, null/* FIXME: get converter for XPathMessageFilterElementCollection*/, null,
76 ConfigurationPropertyOptions.None);
78 log_entire_message = new ConfigurationProperty ("logEntireMessage",
79 typeof (bool), "false", new BooleanConverter (), null,
80 ConfigurationPropertyOptions.None);
82 log_malformed_messages = new ConfigurationProperty ("logMalformedMessages",
83 typeof (bool), "false", new BooleanConverter (), null,
84 ConfigurationPropertyOptions.None);
86 log_messages_at_service_level = new ConfigurationProperty ("logMessagesAtServiceLevel",
87 typeof (bool), "false", new BooleanConverter (), null,
88 ConfigurationPropertyOptions.None);
90 log_messages_at_transport_level = new ConfigurationProperty ("logMessagesAtTransportLevel",
91 typeof (bool), "false", new BooleanConverter (), null,
92 ConfigurationPropertyOptions.None);
94 max_messages_to_log = new ConfigurationProperty ("maxMessagesToLog",
95 typeof (int), "10000", null/* FIXME: get converter for int*/, null,
96 ConfigurationPropertyOptions.None);
98 max_size_of_message_to_log = new ConfigurationProperty ("maxSizeOfMessageToLog",
99 typeof (int), "262144", null/* FIXME: get converter for int*/, null,
100 ConfigurationPropertyOptions.None);
102 properties.Add (filters);
103 properties.Add (log_entire_message);
104 properties.Add (log_malformed_messages);
105 properties.Add (log_messages_at_service_level);
106 properties.Add (log_messages_at_transport_level);
107 properties.Add (max_messages_to_log);
108 properties.Add (max_size_of_message_to_log);
111 public MessageLoggingElement ()
118 [ConfigurationProperty ("filters",
119 Options = ConfigurationPropertyOptions.None,
120 DefaultValue = null)]
121 public XPathMessageFilterElementCollection Filters {
122 get { return (XPathMessageFilterElementCollection) base [filters]; }
125 [ConfigurationProperty ("logEntireMessage",
126 Options = ConfigurationPropertyOptions.None,
127 DefaultValue = false)]
128 public bool LogEntireMessage {
129 get { return (bool) base [log_entire_message]; }
130 set { base [log_entire_message] = value; }
133 [ConfigurationProperty ("logMalformedMessages",
134 Options = ConfigurationPropertyOptions.None,
135 DefaultValue = false)]
136 public bool LogMalformedMessages {
137 get { return (bool) base [log_malformed_messages]; }
138 set { base [log_malformed_messages] = value; }
141 [ConfigurationProperty ("logMessagesAtServiceLevel",
142 Options = ConfigurationPropertyOptions.None,
143 DefaultValue = false)]
144 public bool LogMessagesAtServiceLevel {
145 get { return (bool) base [log_messages_at_service_level]; }
146 set { base [log_messages_at_service_level] = value; }
149 [ConfigurationProperty ("logMessagesAtTransportLevel",
150 Options = ConfigurationPropertyOptions.None,
151 DefaultValue = false)]
152 public bool LogMessagesAtTransportLevel {
153 get { return (bool) base [log_messages_at_transport_level]; }
154 set { base [log_messages_at_transport_level] = value; }
157 [IntegerValidator ( MinValue = -1,
158 MaxValue = int.MaxValue,
159 ExcludeRange = false)]
160 [ConfigurationProperty ("maxMessagesToLog",
161 Options = ConfigurationPropertyOptions.None,
162 DefaultValue = "10000")]
163 public int MaxMessagesToLog {
164 get { return (int) base [max_messages_to_log]; }
165 set { base [max_messages_to_log] = value; }
168 [IntegerValidator ( MinValue = -1,
169 MaxValue = int.MaxValue,
170 ExcludeRange = false)]
171 [ConfigurationProperty ("maxSizeOfMessageToLog",
172 Options = ConfigurationPropertyOptions.None,
173 DefaultValue = "262144")]
174 public int MaxSizeOfMessageToLog {
175 get { return (int) base [max_size_of_message_to_log]; }
176 set { base [max_size_of_message_to_log] = value; }
179 protected override ConfigurationPropertyCollection Properties {
180 get { return properties; }