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,61 @@
//
// AssemblyInfo.cs
//
// Author:
// Joel W. Reed (joelwreed@gmail.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.
//
using System;
using System.Reflection;
using System.Resources;
using System.Security;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about the System.ServiceModel.Discovery assembly
[assembly: AssemblyVersion (Consts.FxVersion)]
[assembly: SatelliteContractVersion (Consts.FxVersion)]
[assembly: AssemblyTitle ("System.ServiceModel.Discovery.dll")]
[assembly: AssemblyDescription ("System.ServiceModel.Discovery.dll")]
[assembly: AssemblyConfiguration ("Development version")]
[assembly: AssemblyCompany ("MONO development team")]
[assembly: AssemblyProduct ("MONO CLI")]
[assembly: AssemblyCopyright ("(c) 2003 Various Authors")]
[assembly: CLSCompliant (true)]
[assembly: AssemblyDefaultAlias ("System.ServiceModel.Discovery.dll")]
[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
[assembly: AssemblyInformationalVersion (Consts.FxFileVersion)]
[assembly: NeutralResourcesLanguage ("en-US")]
[assembly: ComVisible (false)]
[assembly: AssemblyDelaySign (true)]
#if NET_2_1
[assembly: AssemblyKeyFile ("../silverlight.pub")]
#else
[assembly: AssemblyKeyFile("../winfx.pub")]
#endif

View File

@@ -0,0 +1,4 @@
2010-03-19 Atsushi Enomoto <atsushi@ximian.com>
* : initial checkin (mostly stubs).

View File

@@ -0,0 +1,10 @@
2010-07-30 Atsushi Enomoto <atsushi@ximian.com>
* System.ServiceModel.Discovery.dll.soures : add config types. NOTE:
this somehow breaks compilation. To get working build, remove those
config types.
2010-03-19 Atsushi Enomoto <atsushi@ximian.com>
* : initial checkin (mostly stubs).

View File

@@ -0,0 +1,24 @@
thisdir = class/System.ServiceModel.Discovery
SUBDIRS =
include ../../build/rules.make
LIBRARY = System.ServiceModel.Discovery.dll
LIB_MCS_FLAGS = -r:System.dll -r:System.Xml.dll -r:System.Runtime.Serialization.dll -r:System.ServiceModel.dll -r:System.Core.dll -r:System.Xml.Linq.dll
ifneq (2.1, $(FRAMEWORK_VERSION))
LIB_MCS_FLAGS += -d:NET_3_5 -d:NET_3_0 \
-r:System.Configuration.dll
endif
TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
EXTRA_DISTFILES = $(RESOURCE_FILES)
VALID_PROFILE := $(filter 2 4, $(FRAMEWORK_VERSION_MAJOR))
ifndef VALID_PROFILE
LIBRARY_NAME = dummy-System.ServiceModel.Discovery.dll
NO_INSTALL = yes
NO_SIGN_ASSEMBLY = yes
endif
include ../../build/library.make

View File

@@ -0,0 +1,60 @@
//
// RequestChannelBase.cs
//
// Author:
// Atsushi Enomoto <atsushi@ximian.com>
//
// Copyright (C) 2006 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.
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel;
using System.ServiceModel.Description;
using System.ServiceModel.Discovery;
namespace System.ServiceModel.Channels
{
internal abstract class DiscoveryChannelBase : ChannelBase
{
public DiscoveryChannelBase (ChannelManagerBase owner)
: base (owner)
{
}
public TChannel CreateDiscoveryInnerChannel<TChannel> (DiscoveryChannelFactory<TChannel> factory)
{
// FIXME: use timeout
var client = new DiscoveryClient (factory.Source.DiscoveryEndpointProvider.GetDiscoveryEndpoint ());
var res = client.Find (factory.Source.FindCriteria);
foreach (var edm in res.Endpoints) {
try {
// FIXME: find scheme-matching ListenUri
return factory.InnerFactory.CreateChannel (edm.Address, edm.ListenUris.FirstOrDefault (u => true) ?? edm.Address.Uri);
} catch (Exception) {
}
}
throw new EndpointNotFoundException (String.Format ("Could not find usable endpoint in {0} endpoints returned by the discovery service.", res.Endpoints.Count));
}
}
}

View File

@@ -0,0 +1,127 @@
//
// RequestChannelBase.cs
//
// Author:
// Atsushi Enomoto <atsushi@ximian.com>
//
// Copyright (C) 2006 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.
//
using System;
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Net.Security;
using System.ServiceModel;
using System.ServiceModel.Description;
using System.ServiceModel.Security;
namespace System.ServiceModel.Channels
{
internal abstract class RequestChannelBase : DiscoveryChannelBase, IRequestChannel
{
ChannelFactoryBase channel_factory;
EndpointAddress address;
Uri via;
public RequestChannelBase (ChannelFactoryBase factory, EndpointAddress address, Uri via)
: base (factory)
{
this.channel_factory = factory;
this.address = address;
this.via = via;
}
public EndpointAddress RemoteAddress {
get { return address; }
}
public Uri Via {
get { return via ?? RemoteAddress.Uri; }
}
public override T GetProperty<T> ()
{
if (typeof (T) == typeof (MessageVersion) && channel_factory is IHasMessageEncoder)
return (T) (object) ((IHasMessageEncoder) channel_factory).MessageEncoder.MessageVersion;
if (typeof (T) == typeof (IChannelFactory))
return (T) (object) channel_factory;
return base.GetProperty<T> ();
}
// Request
public Message Request (Message message)
{
return Request (message, DefaultSendTimeout);
}
public abstract Message Request (Message message, TimeSpan timeout);
public IAsyncResult BeginRequest (Message message, AsyncCallback callback, object state)
{
return BeginRequest (message, DefaultSendTimeout, callback, state);
}
Func<Message,TimeSpan,Message> request_delegate;
public virtual IAsyncResult BeginRequest (Message message, TimeSpan timeout, AsyncCallback callback, object state)
{
if (request_delegate == null)
request_delegate = new Func<Message,TimeSpan,Message> (Request);
return request_delegate.BeginInvoke (message, timeout, callback, state);
}
public virtual Message EndRequest (IAsyncResult result)
{
return request_delegate.EndInvoke (result);
}
// Open and Close
Action<TimeSpan> open_delegate;
protected override IAsyncResult OnBeginOpen (TimeSpan timeout, AsyncCallback callback, object state)
{
if (open_delegate == null)
open_delegate = new Action<TimeSpan> (OnOpen);
return open_delegate.BeginInvoke (timeout, callback, state);
}
protected override void OnEndOpen (IAsyncResult result)
{
open_delegate.EndInvoke (result);
}
Action<TimeSpan> close_delegate;
protected override IAsyncResult OnBeginClose (TimeSpan timeout, AsyncCallback callback, object state)
{
if (close_delegate == null)
close_delegate = new Action<TimeSpan> (OnClose);
return close_delegate.BeginInvoke (timeout, callback, state);
}
protected override void OnEndClose (IAsyncResult result)
{
close_delegate.EndInvoke (result);
}
}
}

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

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