Imported Upstream version 3.6.0

Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
This commit is contained in:
Jo Shields
2014-08-13 10:39:27 +01:00
commit a575963da9
50588 changed files with 8155799 additions and 0 deletions

View File

@ -0,0 +1,47 @@
//
// Author: Atsushi Enomoto <atsushi@ximian.com>
//
// Copyright (C) 2010 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_4_0
using System;
using System.ComponentModel;
using System.Configuration;
using System.ServiceModel.Configuration;
namespace System.ServiceModel.Discovery.Configuration
{
[ConfigurationCollection (typeof (ChannelEndpointElement), AddItemName = "endpoint")]
public sealed class AnnouncementChannelEndpointElementCollection : ServiceModelConfigurationElementCollection<ChannelEndpointElement>
{
public AnnouncementChannelEndpointElementCollection ()
{
}
protected override object GetElementKey (ConfigurationElement element)
{
return ((ChannelEndpointElement) element).Name;
}
}
}
#endif

View File

@ -0,0 +1,41 @@
//
// Author: Atsushi Enomoto <atsushi@ximian.com>
//
// Copyright (C) 2010 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_4_0
using System;
using System.ComponentModel;
using System.Configuration;
using System.ServiceModel.Configuration;
namespace System.ServiceModel.Discovery.Configuration
{
public class AnnouncementEndpointCollectionElement : StandardEndpointCollectionElement<AnnouncementEndpoint, AnnouncementEndpointElement>
{
public AnnouncementEndpointCollectionElement ()
{
}
}
}
#endif

View File

@ -0,0 +1,129 @@
//
// Author: Atsushi Enomoto <atsushi@ximian.com>
//
// Copyright (C) 2010 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_4_0
using System;
using System.ComponentModel;
using System.Configuration;
using System.ServiceModel.Configuration;
using System.ServiceModel.Description;
namespace System.ServiceModel.Discovery.Configuration
{
public class AnnouncementEndpointElement : StandardEndpointElement
{
static ConfigurationPropertyCollection properties;
static ConfigurationProperty discovery_version, max_announcement_delay;
static AnnouncementEndpointElement ()
{
discovery_version = new ConfigurationProperty ("discoveryVersion", typeof (DiscoveryVersion), "WSDiscovery11", new DiscoveryVersionConverter (), null, ConfigurationPropertyOptions.None);
max_announcement_delay = new ConfigurationProperty ("maxAnnouncementDelay", typeof (TimeSpan), "00:00:00", new TimeSpanConverter (), null, ConfigurationPropertyOptions.None);
properties = new ConfigurationPropertyCollection ();
properties.Add (discovery_version);
properties.Add (max_announcement_delay);
}
public AnnouncementEndpointElement ()
{
}
[TypeConverter (typeof (DiscoveryVersionConverter))]
[ConfigurationProperty ("discoveryVersion", DefaultValue = "WSDiscovery11")]
public DiscoveryVersion DiscoveryVersion {
get { return (DiscoveryVersion) base [discovery_version]; }
set { base [discovery_version] = value; }
}
protected internal override Type EndpointType {
get { return typeof (AnnouncementEndpoint); }
}
[TypeConverter (typeof (TimeSpanConverter))]
[ConfigurationProperty ("maxAnnouncementDelay", DefaultValue = "00:00:00")]
public TimeSpan MaxAnnouncementDelay {
get { return (TimeSpan) base [max_announcement_delay]; }
set { base [max_announcement_delay] = value; }
}
protected override ConfigurationPropertyCollection Properties {
get { return properties; }
}
protected internal override ServiceEndpoint CreateServiceEndpoint (ContractDescription contractDescription)
{
if (contractDescription == null)
throw new ArgumentNullException ("contractDescription");
var ret = new AnnouncementEndpoint (DiscoveryVersion) { MaxAnnouncementDelay = this.MaxAnnouncementDelay };
if (ret.Contract.ContractType != contractDescription.ContractType)
throw new ArgumentException ("The argument contractDescription does not represent the expected Announcement contract");
return ret;
}
protected internal override void InitializeFrom (ServiceEndpoint endpoint)
{
if (endpoint == null)
throw new ArgumentNullException ("endpoint");
AnnouncementEndpoint ae = (AnnouncementEndpoint) endpoint;
DiscoveryVersion = ae.DiscoveryVersion;
MaxAnnouncementDelay = ae.MaxAnnouncementDelay;
}
protected override void OnApplyConfiguration (ServiceEndpoint endpoint, ChannelEndpointElement serviceEndpointElement)
{
if (endpoint == null)
throw new ArgumentNullException ("endpoint");
AnnouncementEndpoint ae = (AnnouncementEndpoint) endpoint;
if (!ae.DiscoveryVersion.Equals (DiscoveryVersion))
throw new ArgumentException ("Argument AnnouncementEndpoint is initialized with different DiscoveryVersion");
ae.MaxAnnouncementDelay = MaxAnnouncementDelay;
ae.Address = serviceEndpointElement.CreateEndpointAddress (); // it depends on InternalVisibleTo(System.ServiceModel)
ae.Binding = ConfigUtil.CreateBinding (serviceEndpointElement.Binding, serviceEndpointElement.BindingConfiguration); // it depends on InternalVisibleTo(System.ServiceModel)
}
protected override void OnApplyConfiguration (ServiceEndpoint endpoint, ServiceEndpointElement serviceEndpointElement)
{
if (endpoint == null)
throw new ArgumentNullException ("endpoint");
AnnouncementEndpoint ae = (AnnouncementEndpoint) endpoint;
if (!ae.DiscoveryVersion.Equals (DiscoveryVersion))
throw new ArgumentException ("Argument AnnouncementEndpoint is initialized with different DiscoveryVersion");
ae.MaxAnnouncementDelay = MaxAnnouncementDelay;
ae.Address = serviceEndpointElement.CreateEndpointAddress (); // it depends on InternalVisibleTo(System.ServiceModel)
ae.Binding = ConfigUtil.CreateBinding (serviceEndpointElement.Binding, serviceEndpointElement.BindingConfiguration); // it depends on InternalVisibleTo(System.ServiceModel)
}
protected override void OnInitializeAndValidate (ChannelEndpointElement channelEndpointElement)
{
// It seems to do nothing.
}
protected override void OnInitializeAndValidate (ServiceEndpointElement serviceEndpointElement)
{
// It seems to do nothing.
}
}
}
#endif

View File

@ -0,0 +1,3 @@
2010-07-30 Atsushi Enomoto <atsushi@ximian.com>
*.cs : initial checkin.

View File

@ -0,0 +1,76 @@
//
// Author: Atsushi Enomoto <atsushi@ximian.com>
//
// Copyright (C) 2010 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_4_0
using System;
using System.ComponentModel;
using System.Configuration;
using System.ServiceModel.Configuration;
namespace System.ServiceModel.Discovery.Configuration
{
public sealed class ContractTypeNameElement : ConfigurationElement
{
static ConfigurationPropertyCollection properties;
static ConfigurationProperty name, @namespace;
static ContractTypeNameElement ()
{
name = new ConfigurationProperty ("name", typeof (string), null, null, new StringValidator (0), ConfigurationPropertyOptions.IsRequired | ConfigurationPropertyOptions.IsKey);
@namespace = new ConfigurationProperty ("namespace", typeof (string), "http://tempuri.org/", null, null, ConfigurationPropertyOptions.IsKey);
properties = new ConfigurationPropertyCollection ();
properties.Add (name);
properties.Add (@namespace);
}
public ContractTypeNameElement ()
{
}
public ContractTypeNameElement (string name, string ns)
{
Name = name;
Namespace = ns;
}
[ConfigurationProperty ("name", Options = ConfigurationPropertyOptions.IsRequired | ConfigurationPropertyOptions.IsKey)]
[StringValidator (MinLength = 0)]
public string Name {
get { return (string) base [name]; }
set { base [name] = value; }
}
[ConfigurationProperty ("namespace", DefaultValue = "http://tempuri.org/", Options = ConfigurationPropertyOptions.IsKey)]
public string Namespace {
get { return (string) base [@namespace]; }
set { base [@namespace] = value; }
}
protected override ConfigurationPropertyCollection Properties {
get { return properties; }
}
}
}
#endif

View File

@ -0,0 +1,47 @@
//
// Author: Atsushi Enomoto <atsushi@ximian.com>
//
// Copyright (C) 2010 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_4_0
using System;
using System.ComponentModel;
using System.Configuration;
using System.ServiceModel.Configuration;
namespace System.ServiceModel.Discovery.Configuration
{
[ConfigurationCollection (typeof(ContractTypeNameElement))]
public sealed class ContractTypeNameElementCollection : ServiceModelConfigurationElementCollection<ContractTypeNameElement>
{
public ContractTypeNameElementCollection ()
{
}
protected override object GetElementKey (ConfigurationElement element)
{
return ((ContractTypeNameElement) element).Name;
}
}
}
#endif

View File

@ -0,0 +1,121 @@
//
// Author: Atsushi Enomoto <atsushi@ximian.com>
//
// Copyright (C) 2010 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_4_0
using System;
using System.ComponentModel;
using System.Configuration;
using System.ServiceModel.Channels;
using System.ServiceModel.Configuration;
namespace System.ServiceModel.Discovery.Configuration
{
public sealed class DiscoveryClientElement : BindingElementExtensionElement
{
static ConfigurationPropertyCollection properties;
static ConfigurationProperty endpoint, find_criteria;
static DiscoveryClientElement ()
{
endpoint = new ConfigurationProperty ("endpoint", typeof (ChannelEndpointElement), null, null, null, ConfigurationPropertyOptions.None);
find_criteria = new ConfigurationProperty ("findCriteria", typeof (FindCriteriaElement), null, null, null, ConfigurationPropertyOptions.None);
properties = new ConfigurationPropertyCollection ();
properties.Add (endpoint);
properties.Add (find_criteria);
}
public DiscoveryClientElement ()
{
}
public override Type BindingElementType {
get { return typeof (DiscoveryClientBindingElement); }
}
[ConfigurationProperty ("endpoint")]
public ChannelEndpointElement DiscoveryEndpoint {
get { return (ChannelEndpointElement) base [endpoint]; }
}
[ConfigurationProperty ("findCriteria")]
public FindCriteriaElement FindCriteria {
get { return (FindCriteriaElement) base [find_criteria]; }
}
protected override ConfigurationPropertyCollection Properties {
get { return properties; }
}
public override void ApplyConfiguration (BindingElement bindingElement)
{
if (bindingElement == null)
throw new ArgumentNullException ("bindingElement");
if (DiscoveryEndpoint == null)
throw new ArgumentNullException ("'endpoint' configuration element is missing.");
var be = (DiscoveryClientBindingElement) bindingElement;
base.ApplyConfiguration (bindingElement);
if (FindCriteria != null)
be.FindCriteria = FindCriteria.CreateInstance ();
// FIXME: apply DiscoveryEndpoint
throw new NotImplementedException ();
}
public override void CopyFrom (ServiceModelExtensionElement from)
{
if (from == null)
throw new ArgumentNullException ("from");
var ce = (DiscoveryClientElement) from;
FindCriteria.CopyFrom (ce.FindCriteria);
}
protected internal override BindingElement CreateBindingElement ()
{
var be = new DiscoveryClientBindingElement ();
ApplyConfiguration (be);
return be;
}
protected internal override void InitializeFrom (BindingElement bindingElement)
{
if (bindingElement == null)
throw new ArgumentNullException ("bindingElement");
if (DiscoveryEndpoint == null)
throw new ArgumentNullException ("'endpoint' configuration element is missing.");
var be = (DiscoveryClientBindingElement) bindingElement;
base.InitializeFrom (be);
if (be.FindCriteria != null)
FindCriteria.InitializeFrom (be.FindCriteria);
// FIXME: initialize DiscoveryEndpoint
throw new NotImplementedException ();
}
}
}
#endif

View File

@ -0,0 +1,67 @@
//
// Author: Atsushi Enomoto <atsushi@ximian.com>
//
// Copyright (C) 2010 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_4_0
using System;
using System.ComponentModel;
using System.Configuration;
using System.ServiceModel.Configuration;
namespace System.ServiceModel.Discovery.Configuration
{
public sealed class DiscoveryClientSettingsElement : ConfigurationElement
{
static ConfigurationPropertyCollection properties;
static ConfigurationProperty endpoint, find_criteria;
static DiscoveryClientSettingsElement ()
{
endpoint = new ConfigurationProperty ("endpoint", typeof (ChannelEndpointElement), null, null, null, ConfigurationPropertyOptions.None);
find_criteria = new ConfigurationProperty ("findCriteria", typeof (FindCriteriaElement), null, null, null, ConfigurationPropertyOptions.None);
properties = new ConfigurationPropertyCollection ();
properties.Add (endpoint);
properties.Add (find_criteria);
}
public DiscoveryClientSettingsElement ()
{
}
[ConfigurationProperty ("endpoint")]
public ChannelEndpointElement DiscoveryEndpoint {
get { return (ChannelEndpointElement) base [endpoint]; }
}
[ConfigurationProperty ("findCriteria")]
public FindCriteriaElement FindCriteria {
get { return (FindCriteriaElement) base [find_criteria]; }
}
protected override ConfigurationPropertyCollection Properties {
get { return properties; }
}
}
}
#endif

View File

@ -0,0 +1,41 @@
//
// Author: Atsushi Enomoto <atsushi@ximian.com>
//
// Copyright (C) 2010 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_4_0
using System;
using System.ComponentModel;
using System.Configuration;
using System.ServiceModel.Configuration;
namespace System.ServiceModel.Discovery.Configuration
{
public class DiscoveryEndpointCollectionElement : StandardEndpointCollectionElement<DiscoveryEndpoint, DiscoveryEndpointElement>
{
public DiscoveryEndpointCollectionElement ()
{
}
}
}
#endif

View File

@ -0,0 +1,137 @@
//
// Author: Atsushi Enomoto <atsushi@ximian.com>
//
// Copyright (C) 2010 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_4_0
using System;
using System.ComponentModel;
using System.Configuration;
using System.ServiceModel.Configuration;
using System.ServiceModel.Description;
namespace System.ServiceModel.Discovery.Configuration
{
public class DiscoveryEndpointElement : StandardEndpointElement
{
static ConfigurationPropertyCollection properties;
static ConfigurationProperty discovery_mode, discovery_version, max_response_delay;
static DiscoveryEndpointElement ()
{
discovery_mode = new ConfigurationProperty ("discoveryMode", typeof (ServiceDiscoveryMode), ServiceDiscoveryMode.Managed, null, null, ConfigurationPropertyOptions.None);
discovery_version = new ConfigurationProperty ("discoveryVersion", typeof (DiscoveryVersion), "WSDiscovery11", new DiscoveryVersionConverter (), null, ConfigurationPropertyOptions.None);
max_response_delay = new ConfigurationProperty ("maxResponseDelay", typeof (TimeSpan), "00:00:00", new TimeSpanConverter (), null, ConfigurationPropertyOptions.None);
properties = new ConfigurationPropertyCollection ();
properties.Add (discovery_mode);
properties.Add (discovery_version);
properties.Add (max_response_delay);
}
public DiscoveryEndpointElement ()
{
}
[ConfigurationProperty ("discoveryMode", DefaultValue = ServiceDiscoveryMode.Managed)]
public ServiceDiscoveryMode DiscoveryMode {
get { return (ServiceDiscoveryMode) base [discovery_mode]; }
set { base [discovery_mode] = value; }
}
[TypeConverter (typeof (DiscoveryVersionConverter))]
[ConfigurationProperty ("discoveryVersion", DefaultValue = "WSDiscovery11")]
public DiscoveryVersion DiscoveryVersion {
get { return (DiscoveryVersion) base [discovery_version]; }
set { base [discovery_version] = value; }
}
[ConfigurationProperty ("maxResponseDelay", DefaultValue = "00:00:00")]
[TypeConverter (typeof (TimeSpanConverter))]
public TimeSpan MaxResponseDelay {
get { return (TimeSpan) base [max_response_delay]; }
set { base [max_response_delay] = value; }
}
protected internal override Type EndpointType {
get { return typeof (DiscoveryEndpoint); }
}
protected override ConfigurationPropertyCollection Properties {
get { return properties; }
}
protected internal override ServiceEndpoint CreateServiceEndpoint (ContractDescription contractDescription)
{
if (contractDescription == null)
throw new ArgumentNullException ("contractDescription");
var ret = new DiscoveryEndpoint (DiscoveryVersion, DiscoveryMode) { MaxResponseDelay = this.MaxResponseDelay };
if (ret.Contract.ContractType != contractDescription.ContractType)
throw new ArgumentException ("The argument contractDescription does not represent the expected Discovery contract");
return ret;
}
protected internal override void InitializeFrom (ServiceEndpoint endpoint)
{
if (endpoint == null)
throw new ArgumentNullException ("endpoint");
var de = (DiscoveryEndpoint) endpoint;
DiscoveryVersion = de.DiscoveryVersion;
MaxResponseDelay = de.MaxResponseDelay;
}
protected override void OnApplyConfiguration (ServiceEndpoint endpoint, ChannelEndpointElement serviceEndpointElement)
{
if (endpoint == null)
throw new ArgumentNullException ("endpoint");
var de = (DiscoveryEndpoint) endpoint;
if (!de.DiscoveryVersion.Equals (DiscoveryVersion))
throw new ArgumentException ("Argument DiscoveryEndpoint is initialized with different DiscoveryVersion");
de.MaxResponseDelay = MaxResponseDelay;
de.Address = serviceEndpointElement.CreateEndpointAddress (); // it depends on InternalVisibleTo(System.ServiceModel)
de.Binding = ConfigUtil.CreateBinding (serviceEndpointElement.Binding, serviceEndpointElement.BindingConfiguration); // it depends on InternalVisibleTo(System.ServiceModel)
}
protected override void OnApplyConfiguration (ServiceEndpoint endpoint, ServiceEndpointElement serviceEndpointElement)
{
if (endpoint == null)
throw new ArgumentNullException ("endpoint");
var de = (DiscoveryEndpoint) endpoint;
if (!de.DiscoveryVersion.Equals (DiscoveryVersion))
throw new ArgumentException ("Argument AnnouncementEndpoint is initialized with different DiscoveryVersion");
de.MaxResponseDelay = MaxResponseDelay;
de.Address = serviceEndpointElement.CreateEndpointAddress (); // it depends on InternalVisibleTo(System.ServiceModel)
de.Binding = ConfigUtil.CreateBinding (serviceEndpointElement.Binding, serviceEndpointElement.BindingConfiguration); // it depends on InternalVisibleTo(System.ServiceModel)
}
protected override void OnInitializeAndValidate (ChannelEndpointElement channelEndpointElement)
{
// It seems to do nothing.
}
protected override void OnInitializeAndValidate (ServiceEndpointElement channelEndpointElement)
{
// It seems to do nothing.
}
}
}
#endif

View File

@ -0,0 +1,116 @@
//
// Author: Atsushi Enomoto <atsushi@ximian.com>
//
// Copyright (C) 2010 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_4_0
using System;
using System.ComponentModel;
using System.Configuration;
using System.Globalization;
namespace System.ServiceModel.Discovery.Configuration
{
public class DiscoveryVersionConverter : TypeConverter
{
public DiscoveryVersionConverter ()
{
}
private bool CanConvert (Type type)
{
if (type == typeof (string))
return true;
if (type == typeof (DiscoveryVersion))
return true;
return false;
}
public override bool CanConvertFrom (ITypeDescriptorContext context, Type sourceType)
{
if (sourceType == null)
throw new ArgumentNullException ("sourceType");
return CanConvert (sourceType);
}
public override bool CanConvertTo (ITypeDescriptorContext context, Type destinationType)
{
if (destinationType == null)
return false;
return CanConvert (destinationType);
}
public override object ConvertFrom (ITypeDescriptorContext context, CultureInfo culture, object value)
{
if (value == null)
throw new ArgumentNullException ("value");
if (!CanConvertFrom (context, value.GetType ()))
throw new NotSupportedException ("Cannot convert from value.");
if (value is DiscoveryVersion)
return value;
string s = (value as string);
if (s != null) {
switch (s) {
case "WSDiscovery11":
return DiscoveryVersion.WSDiscovery11;
case "WSDiscoveryApril2005":
return DiscoveryVersion.WSDiscoveryApril2005;
case "WSDiscoveryCD1":
return DiscoveryVersion.WSDiscoveryCD1;
}
throw new NotSupportedException ("Cannot convert from value.");
}
return base.ConvertFrom (context, culture, value);
}
public override object ConvertTo (ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
{
if (!CanConvertTo (context, destinationType))
throw new NotSupportedException (Locale.GetText ("Cannot convert to destination type."));
var ver = (value as DiscoveryVersion);
if (ver != null) {
if (destinationType == typeof (DiscoveryVersion))
return ver;
if (destinationType == typeof (string)) {
if (ver.Equals (DiscoveryVersion.WSDiscovery11))
return "WSDiscovery11";
if (ver.Equals (DiscoveryVersion.WSDiscoveryApril2005))
return "WSDiscoveryApril2005";
if (ver.Equals (DiscoveryVersion.WSDiscoveryCD1))
return "WSDiscoveryCD1";
}
throw new NotSupportedException ("Cannot convert to destination type.");
}
return base.ConvertTo (context, culture, value, destinationType);
}
}
}
#endif

View File

@ -0,0 +1,41 @@
//
// Author: Atsushi Enomoto <atsushi@ximian.com>
//
// Copyright (C) 2010 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_4_0
using System;
using System.ComponentModel;
using System.Configuration;
using System.ServiceModel.Configuration;
namespace System.ServiceModel.Discovery.Configuration
{
public class DynamicEndpointCollectionElement : StandardEndpointCollectionElement<DynamicEndpoint, DynamicEndpointElement>
{
public DynamicEndpointCollectionElement ()
{
}
}
}
#endif

View File

@ -0,0 +1,90 @@
//
// Author: Atsushi Enomoto <atsushi@ximian.com>
//
// Copyright (C) 2010 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_4_0
using System;
using System.ComponentModel;
using System.Configuration;
using System.ServiceModel.Configuration;
using System.ServiceModel.Description;
namespace System.ServiceModel.Discovery.Configuration
{
public sealed class DynamicEndpointElement : StandardEndpointElement
{
static ConfigurationPropertyCollection properties;
static ConfigurationProperty discovery_client_settings;
static DynamicEndpointElement ()
{
discovery_client_settings = new ConfigurationProperty ("discoveryClientSettings", typeof (DiscoveryClientSettingsElement), null, null, null, ConfigurationPropertyOptions.None);
properties = new ConfigurationPropertyCollection ();
properties.Add (discovery_client_settings);
}
public DynamicEndpointElement ()
{
}
[ConfigurationProperty ("discoveryClientSettings")]
public DiscoveryClientSettingsElement DiscoveryClientSettings {
get { return (DiscoveryClientSettingsElement) base [discovery_client_settings]; }
}
protected internal override Type EndpointType {
get { return typeof (DynamicEndpoint); }
}
protected override ConfigurationPropertyCollection Properties {
get { return properties; }
}
protected internal override ServiceEndpoint CreateServiceEndpoint (ContractDescription contractDescription)
{
throw new NotImplementedException ();
}
protected override void OnApplyConfiguration (ServiceEndpoint endpoint, ChannelEndpointElement serviceEndpointElement)
{
throw new NotImplementedException ();
}
protected override void OnApplyConfiguration (ServiceEndpoint endpoint, ServiceEndpointElement serviceEndpointElement)
{
throw new NotImplementedException ();
}
protected override void OnInitializeAndValidate (ChannelEndpointElement channelEndpointElement)
{
// There seems nothing to do here.
}
protected override void OnInitializeAndValidate (ServiceEndpointElement serviceEndpointElement)
{
// There seems nothing to do here.
}
}
}
#endif

View File

@ -0,0 +1,100 @@
//
// Author: Atsushi Enomoto <atsushi@ximian.com>
//
// Copyright (C) 2010 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_4_0
using System;
using System.ComponentModel;
using System.Configuration;
using System.ServiceModel.Configuration;
using System.Xml;
using System.Xml.Linq;
namespace System.ServiceModel.Discovery.Configuration
{
public sealed class EndpointDiscoveryElement : BehaviorExtensionElement
{
static ConfigurationPropertyCollection properties;
static ConfigurationProperty types, enabled, extensions, scopes;
static EndpointDiscoveryElement ()
{
types = new ConfigurationProperty ("types", typeof (ContractTypeNameElementCollection), null, null, null, ConfigurationPropertyOptions.None);
enabled = new ConfigurationProperty ("enabled", typeof (bool), null, null, null, ConfigurationPropertyOptions.None);
extensions = new ConfigurationProperty ("extensions", typeof (XmlElementElementCollection), null, null, null, ConfigurationPropertyOptions.None);
scopes = new ConfigurationProperty ("scopes", typeof (ScopeElementCollection), null, null, null, ConfigurationPropertyOptions.None);
properties = new ConfigurationPropertyCollection ();
properties.Add (types);
properties.Add (enabled);
properties.Add (extensions);
properties.Add (scopes);
}
public EndpointDiscoveryElement ()
{
}
public override Type BehaviorType {
get { return typeof (EndpointDiscoveryBehavior); }
}
[ConfigurationProperty ("types")]
public ContractTypeNameElementCollection ContractTypeNames {
get { return (ContractTypeNameElementCollection) base [types]; }
}
[ConfigurationPropertyAttribute("enabled", DefaultValue = true)]
public bool Enabled {
get { return (bool) base [enabled]; }
set { base [enabled] = value; }
}
[ConfigurationPropertyAttribute("extensions")]
public XmlElementElementCollection Extensions {
get { return (XmlElementElementCollection) base [extensions]; }
}
[ConfigurationPropertyAttribute("scopes")]
public ScopeElementCollection Scopes {
get { return (ScopeElementCollection) base [scopes]; }
}
protected override ConfigurationPropertyCollection Properties {
get { return properties; }
}
protected internal override object CreateBehavior ()
{
var ret = new EndpointDiscoveryBehavior () { Enabled = this.Enabled };
foreach (ContractTypeNameElement ctn in ContractTypeNames)
ret.ContractTypeNames.Add (new XmlQualifiedName (ctn.Name, ctn.Namespace));
foreach (XmlElementElement xee in Extensions)
ret.Extensions.Add (XElement.Load (new XmlNodeReader (xee.XmlElement)));
foreach (ScopeElement se in Scopes)
ret.Scopes.Add (se.Scope);
return ret;
}
}
}
#endif

View File

@ -0,0 +1,147 @@
//
// Author: Atsushi Enomoto <atsushi@ximian.com>
//
// Copyright (C) 2010 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_4_0
using System;
using System.ComponentModel;
using System.Configuration;
using System.ServiceModel.Configuration;
using System.Xml;
using System.Xml.Linq;
namespace System.ServiceModel.Discovery.Configuration
{
public sealed class FindCriteriaElement : ConfigurationElement
{
static ConfigurationPropertyCollection properties;
static ConfigurationProperty types, duration, extensions, max_results, scope_match_by, scopes;
static FindCriteriaElement ()
{
types = new ConfigurationProperty ("types", typeof (ContractTypeNameElementCollection), null, null, null, ConfigurationPropertyOptions.None);
duration = new ConfigurationProperty ("duration", typeof (TimeSpan), "00:00:20", new TimeSpanConverter (), null, ConfigurationPropertyOptions.None);
extensions = new ConfigurationProperty ("extensions", typeof (XmlElementElementCollection), null, null, null, ConfigurationPropertyOptions.None);
max_results = new ConfigurationProperty ("maxResults", typeof (TimeSpan), "00:00:20", new TimeSpanConverter (), null, ConfigurationPropertyOptions.None);
scope_match_by = new ConfigurationProperty ("scopeMatchBy", typeof (Uri), null, null, null, ConfigurationPropertyOptions.None);
scopes = new ConfigurationProperty ("scopes", typeof (ScopeElementCollection), null, null, null, ConfigurationPropertyOptions.None);
properties = new ConfigurationPropertyCollection ();
properties.Add (types);
properties.Add (duration);
properties.Add (extensions);
properties.Add (max_results);
properties.Add (scope_match_by);
properties.Add (scopes);
}
public FindCriteriaElement ()
{
}
[ConfigurationProperty ("types")]
public ContractTypeNameElementCollection ContractTypeNames {
get { return (ContractTypeNameElementCollection) base [types]; }
}
[ConfigurationProperty ("duration", DefaultValue = "00:00:20")]
[TypeConverter (typeof (TimeSpanConverter))]
public TimeSpan Duration {
get { return (TimeSpan) base [duration]; }
set { base [duration] = value; }
}
[ConfigurationProperty ("extensions")]
public XmlElementElementCollection Extensions {
get { return (XmlElementElementCollection) base [extensions]; }
}
[ConfigurationProperty ("maxResults", DefaultValue = 0)]
[IntegerValidator (MinValue = 0, MaxValue = int.MaxValue)]
public int MaxResults {
get { return (int) base [max_results]; }
set { base [max_results] = value; }
}
[ConfigurationProperty ("scopeMatchBy")]
public Uri ScopeMatchBy {
get { return (Uri) base [scope_match_by]; }
set { base [scope_match_by] = value; }
}
[ConfigurationProperty ("scopes")]
public ScopeElementCollection Scopes {
get { return (ScopeElementCollection) base [scopes]; }
}
protected override ConfigurationPropertyCollection Properties {
get { return properties; }
}
internal FindCriteria CreateInstance ()
{
var fc = new FindCriteria ();
foreach (ContractTypeNameElement ctn in ContractTypeNames)
fc.ContractTypeNames.Add (new XmlQualifiedName (ctn.Name, ctn.Namespace));
fc.Duration = Duration;
foreach (XmlElementElement ext in Extensions)
fc.Extensions.Add (XElement.Load (new XmlNodeReader (ext.XmlElement)));
fc.MaxResults = MaxResults;
fc.ScopeMatchBy = ScopeMatchBy;
foreach (ScopeElement scope in Scopes)
fc.Scopes.Add (scope.Scope);
return fc;
}
internal void CopyFrom (FindCriteriaElement other)
{
foreach (ContractTypeNameElement ctn in other.ContractTypeNames)
ContractTypeNames.Add (new ContractTypeNameElement () { Name = ctn.Name, Namespace = ctn.Namespace });
Duration = other.Duration;
foreach (XmlElementElement ext in other.Extensions)
Extensions.Add (new XmlElementElement () { XmlElement = (XmlElement) ext.XmlElement.CloneNode (true) });
MaxResults = other.MaxResults;
ScopeMatchBy = other.ScopeMatchBy;
foreach (ScopeElement scope in other.Scopes)
Scopes.Add (new ScopeElement () { Scope = scope.Scope });
}
internal void InitializeFrom (FindCriteria fc)
{
foreach (var ctn in fc.ContractTypeNames)
ContractTypeNames.Add (new ContractTypeNameElement () { Name = ctn.Name, Namespace = ctn.Namespace});
Duration = fc.Duration;
var doc = new XmlDocument ();
foreach (var ext in fc.Extensions) {
var xr = ext.CreateReader ();
xr.MoveToContent ();
Extensions.Add (new XmlElementElement () { XmlElement = (XmlElement) doc.ReadNode (xr) });
}
MaxResults = fc.MaxResults;
ScopeMatchBy = fc.ScopeMatchBy;
foreach (var scope in fc.Scopes)
Scopes.Add (new ScopeElement () { Scope = scope});
}
}
}
#endif

View File

@ -0,0 +1,64 @@
//
// Author: Atsushi Enomoto <atsushi@ximian.com>
//
// Copyright (C) 2010 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_4_0
using System;
using System.ComponentModel;
using System.Configuration;
using System.ServiceModel.Configuration;
namespace System.ServiceModel.Discovery.Configuration
{
public sealed class ScopeElement : ConfigurationElement
{
static ConfigurationPropertyCollection properties;
static ConfigurationProperty scope;
static ScopeElement ()
{
scope = new ConfigurationProperty ("scopes", typeof (Uri), null, null, new CallbackValidator (typeof (ScopeElement), null/*FIXME: fill it*/), ConfigurationPropertyOptions.IsRequired | ConfigurationPropertyOptions.IsKey);
properties = new ConfigurationPropertyCollection ();
properties.Add (scope);
}
public ScopeElement ()
{
}
[MonoTODO]
[ConfigurationProperty ("scope", Options = ConfigurationPropertyOptions.IsRequired | ConfigurationPropertyOptions.IsKey)]
[CallbackValidator (CallbackMethodName = "ScopeValidatorCallback", Type = typeof (ScopeElement))]
public Uri Scope {
get { return (Uri) base [scope]; }
set { base [scope] = value; }
}
protected override ConfigurationPropertyCollection Properties {
get { return properties; }
}
}
}
#endif

View File

@ -0,0 +1,47 @@
//
// Author: Atsushi Enomoto <atsushi@ximian.com>
//
// Copyright (C) 2010 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_4_0
using System;
using System.ComponentModel;
using System.Configuration;
using System.ServiceModel.Configuration;
namespace System.ServiceModel.Discovery.Configuration
{
[ConfigurationCollection (typeof (ScopeElement))]
public sealed class ScopeElementCollection : ServiceModelConfigurationElementCollection<ScopeElement>
{
public ScopeElementCollection ()
{
}
protected override object GetElementKey (ConfigurationElement element)
{
return ((ScopeElement) element).Scope;
}
}
}
#endif

View File

@ -0,0 +1,69 @@
//
// Author: Atsushi Enomoto <atsushi@ximian.com>
//
// Copyright (C) 2010 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_4_0
using System;
using System.ComponentModel;
using System.Configuration;
using System.ServiceModel.Configuration;
using System.ServiceModel.Description;
namespace System.ServiceModel.Discovery.Configuration
{
public sealed class ServiceDiscoveryElement : BehaviorExtensionElement
{
static ConfigurationPropertyCollection properties;
static ConfigurationProperty announcement_endpoints;
static ServiceDiscoveryElement ()
{
announcement_endpoints = new ConfigurationProperty ("announcementEndpoints", typeof (AnnouncementChannelEndpointElementCollection), null, null, null, ConfigurationPropertyOptions.None);
properties = new ConfigurationPropertyCollection ();
properties.Add (announcement_endpoints);
}
public ServiceDiscoveryElement ()
{
}
[ConfigurationProperty ("announcementEndpoints")]
public AnnouncementChannelEndpointElementCollection AnnouncementEndpoints {
get { return (AnnouncementChannelEndpointElementCollection) base [announcement_endpoints]; }
}
public override Type BehaviorType {
get { return typeof (ServiceDiscoveryBehavior); }
}
protected override ConfigurationPropertyCollection Properties {
get { return properties; }
}
protected internal override object CreateBehavior ()
{
throw new NotImplementedException ();
}
}
}
#endif

View File

@ -0,0 +1,41 @@
//
// Author: Atsushi Enomoto <atsushi@ximian.com>
//
// Copyright (C) 2010 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_4_0
using System;
using System.ComponentModel;
using System.Configuration;
using System.ServiceModel.Configuration;
namespace System.ServiceModel.Discovery.Configuration
{
public class UdpAnnouncementEndpointCollectionElement : StandardEndpointCollectionElement<UdpAnnouncementEndpoint, UdpAnnouncementEndpointElement>
{
public UdpAnnouncementEndpointCollectionElement ()
{
}
}
}
#endif

View File

@ -0,0 +1,154 @@
//
// Author: Atsushi Enomoto <atsushi@ximian.com>
//
// Copyright (C) 2010 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_4_0
using System;
using System.ComponentModel;
using System.Configuration;
using System.Linq;
using System.ServiceModel.Configuration;
using System.ServiceModel.Description;
using System.ServiceModel.Discovery.Udp;
namespace System.ServiceModel.Discovery.Configuration
{
public class UdpAnnouncementEndpointElement : AnnouncementEndpointElement
{
static ConfigurationPropertyCollection properties;
static ConfigurationProperty max_announcement_delay, multicast_address, transport_settings;
static UdpAnnouncementEndpointElement ()
{
max_announcement_delay = new ConfigurationProperty ("maxAnnouncementDelay", typeof (TimeSpan), "00:00:00.500", new TimeSpanConverter (), null, ConfigurationPropertyOptions.None);
multicast_address = new ConfigurationProperty ("multicastAddress", typeof (Uri), "soap.udp://239.255.255.250:3702", new UriTypeConverter (), null, ConfigurationPropertyOptions.None);
transport_settings = new ConfigurationProperty ("transportSettings", typeof (UdpTransportSettingsElement), null, null, null, ConfigurationPropertyOptions.None);
properties = new ConfigurationPropertyCollection ();
properties.Add (max_announcement_delay);
properties.Add (multicast_address);
properties.Add (transport_settings);
}
public UdpAnnouncementEndpointElement ()
{
}
protected internal override Type EndpointType {
get { return typeof (UdpAnnouncementEndpoint); }
}
[TypeConverter (typeof (TimeSpanConverter))]
[ConfigurationPropertyAttribute("maxAnnouncementDelay", DefaultValue = "00:00:00.500")]
public new TimeSpan MaxAnnouncementDelay {
get { return (TimeSpan) base [max_announcement_delay]; }
set { base [max_announcement_delay] = value; }
}
[ConfigurationPropertyAttribute("multicastAddress", DefaultValue = "soap.udp://239.255.255.250:3702")]
public Uri MulticastAddress {
get { return (Uri) base [multicast_address]; }
set { base [multicast_address] = value; }
}
[ConfigurationPropertyAttribute("transportSettings")]
public UdpTransportSettingsElement TransportSettings {
get { return (UdpTransportSettingsElement) base [transport_settings]; }
}
protected override ConfigurationPropertyCollection Properties {
get { return properties; }
}
protected internal override ServiceEndpoint CreateServiceEndpoint (ContractDescription contractDescription)
{
if (contractDescription == null)
throw new ArgumentNullException ("contractDescription");
DiscoveryVersion ver = null;
switch (contractDescription.ContractType.Namespace) {
case DiscoveryVersion.Namespace11:
ver = DiscoveryVersion.WSDiscovery11;
break;
case DiscoveryVersion.NamespaceApril2005:
ver = DiscoveryVersion.WSDiscoveryApril2005;
break;
case DiscoveryVersion.NamespaceCD1:
ver = DiscoveryVersion.WSDiscoveryCD1;
break;
}
var ret = new UdpAnnouncementEndpoint (ver, MulticastAddress);
ret.MaxAnnouncementDelay = MaxAnnouncementDelay;
TransportSettings.ApplyConfiguration (ret.TransportSettings);
return ret;
}
protected internal override void InitializeFrom (ServiceEndpoint endpoint)
{
if (endpoint == null)
throw new ArgumentNullException ("endpoint");
var e = (UdpAnnouncementEndpoint) endpoint;
MaxAnnouncementDelay = e.MaxAnnouncementDelay;
MulticastAddress = e.MulticastAddress;
TransportSettings.InitializeFrom (e.TransportSettings);
}
protected override void OnApplyConfiguration (ServiceEndpoint endpoint, ChannelEndpointElement serviceEndpointElement)
{
if (endpoint == null)
throw new ArgumentNullException ("endpoint");
var de = (AnnouncementEndpoint) endpoint;
if (!de.DiscoveryVersion.Equals (DiscoveryVersion))
throw new ArgumentException ("Argument AnnouncementEndpoint is initialized with different DiscoveryVersion");
de.MaxAnnouncementDelay = MaxAnnouncementDelay;
de.Address = serviceEndpointElement.CreateEndpointAddress (); // it depends on InternalVisibleTo(System.ServiceModel)
var be = (UdpTransportBindingElement) de.Binding.CreateBindingElements ().First (b => b is UdpTransportBindingElement);
TransportSettings.ApplyConfiguration (be.TransportSettings);
}
protected override void OnApplyConfiguration (ServiceEndpoint endpoint, ServiceEndpointElement serviceEndpointElement)
{
if (endpoint == null)
throw new ArgumentNullException ("endpoint");
var de = (AnnouncementEndpoint) endpoint;
if (!de.DiscoveryVersion.Equals (DiscoveryVersion))
throw new ArgumentException ("Argument AnnouncementEndpoint is initialized with different DiscoveryVersion");
de.MaxAnnouncementDelay = MaxAnnouncementDelay;
de.Address = serviceEndpointElement.CreateEndpointAddress (); // it depends on InternalVisibleTo(System.ServiceModel)
var be = (UdpTransportBindingElement) de.Binding.CreateBindingElements ().First (b => b is UdpTransportBindingElement);
TransportSettings.ApplyConfiguration (be.TransportSettings);
}
protected override void OnInitializeAndValidate (ChannelEndpointElement channelEndpointElement)
{
// It seems to do nothing.
base.OnInitializeAndValidate (channelEndpointElement);
}
protected override void OnInitializeAndValidate (ServiceEndpointElement channelEndpointElement)
{
// It seems to do nothing.
base.OnInitializeAndValidate (channelEndpointElement);
}
}
}
#endif

Some files were not shown because too many files have changed in this diff Show More