diff --git a/src/Spring/Spring.Services/ServiceModel/Activation/ServiceHostFactory.cs b/src/Spring/Spring.Services/ServiceModel/Activation/ServiceHostFactory.cs index cfd63fba..784daeaa 100644 --- a/src/Spring/Spring.Services/ServiceModel/Activation/ServiceHostFactory.cs +++ b/src/Spring/Spring.Services/ServiceModel/Activation/ServiceHostFactory.cs @@ -71,19 +71,6 @@ namespace Spring.ServiceModel.Activation return base.CreateServiceHost(reference, baseAddresses); } - - /// - /// Creates a SpringService for a specified type of service with a specific base address. - /// - /// Specifies the type of service to host. - /// The of type that contains the base addresses for the service hosted. - /// - /// A for the type of service specified with a specific base address. - /// - protected override ServiceHost CreateServiceHost(Type serviceType, Uri[] baseAddresses) - { - return new SpringServiceHost(serviceType, baseAddresses); - } } } #endif \ No newline at end of file diff --git a/src/Spring/Spring.Services/ServiceModel/SpringServiceHost.cs b/src/Spring/Spring.Services/ServiceModel/SpringServiceHost.cs index 78d193f6..0d2bd40a 100644 --- a/src/Spring/Spring.Services/ServiceModel/SpringServiceHost.cs +++ b/src/Spring/Spring.Services/ServiceModel/SpringServiceHost.cs @@ -38,21 +38,6 @@ namespace Spring.ServiceModel /// Bruno Baia public class SpringServiceHost : System.ServiceModel.ServiceHost { - private bool useSpringServiceBehavior = false; - - private IApplicationContext applicationContext; - - - /// - /// Gets or sets the application context. - /// - /// The application context. - public IApplicationContext ApplicationContext - { - get { return applicationContext; } - set { applicationContext = value; } - } - #region Constructor(s) / Destructor /// @@ -85,31 +70,6 @@ namespace Spring.ServiceModel public SpringServiceHost(string serviceName, IApplicationContext applicationContext, params Uri[] baseAddresses) : base(CreateServiceType(serviceName, applicationContext), baseAddresses) { - ApplicationContext = applicationContext; - } - - /// - /// Initializes a new instance of the class. - /// - /// Calls the contructor with an IApplicationContext argument. - /// Type of the service. - /// The base addresses. - public SpringServiceHost(Type serviceType, params Uri[] baseAddresses) - : this(serviceType, GetApplicationContext(null), baseAddresses) - { - } - - /// - /// Initializes a new instance of the class. - /// - /// Type of the service. - /// The application context. - /// The base addresses. - public SpringServiceHost(Type serviceType, IApplicationContext applicationContext, params Uri[] baseAddresses) - : base(serviceType, baseAddresses) - { - useSpringServiceBehavior = true; - ApplicationContext = applicationContext; } private static IApplicationContext GetApplicationContext(string contextName) @@ -137,20 +97,6 @@ namespace Spring.ServiceModel } #endregion - - /// - /// Invoked during the transition of a communication object into the opening state. - /// Adds the SpringServiceBehavior. - /// - protected override void OnOpening() - { - if (this.useSpringServiceBehavior && - this.Description.Behaviors.Find() == null) - { - this.Description.Behaviors.Add(new SpringServiceBehavior(ApplicationContext)); - } - base.OnOpening(); - } } } #endif \ No newline at end of file diff --git a/src/Spring/Spring.Services/ServiceModel/Support/SpringInstanceProvider.cs b/src/Spring/Spring.Services/ServiceModel/Support/SpringInstanceProvider.cs deleted file mode 100644 index 34121be9..00000000 --- a/src/Spring/Spring.Services/ServiceModel/Support/SpringInstanceProvider.cs +++ /dev/null @@ -1,138 +0,0 @@ -#if NET_3_0 -#region License - -/* - * Copyright © 2002-2008 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#endregion - -#region Imports - -using System; -using System.ServiceModel; -using System.ServiceModel.Dispatcher; -using System.ServiceModel.Channels; - -using Spring.Context; -using System.Globalization; - -#endregion - -namespace Spring.ServiceModel.Support -{ - /// - /// An IInstanceProvider implementation that delegates to the Spring container to instantiate a given - /// service type. This allows for the service intstance to be configured via dependency injection and - /// have AOP advice applied - /// - /// Bruno Baia - public class SpringInstanceProvider : IInstanceProvider - { - private IApplicationContext applicationContext; - - private Type serviceType; - - - /// - /// Gets or sets the application context. - /// - /// The application context. - public IApplicationContext ApplicationContext - { - get { return applicationContext; } - set { applicationContext = value; } - - } - - - /// - /// Gets or sets the type of the service. - /// - /// The type of the service. - public Type ServiceType - { - get { return serviceType; } - set { serviceType = value; } - } - - /// - /// Initializes a new instance of the class. - /// - /// The application context. - public SpringInstanceProvider(IApplicationContext applicationContext) - { - ApplicationContext = applicationContext; - } - - /// - /// Initializes a new instance of the class. - /// - /// The application context. - /// The type. - public SpringInstanceProvider(IApplicationContext applicationContext, Type serviceType) - { - ApplicationContext = applicationContext; - ServiceType = serviceType; - } - - #region IInstanceProvider Members - - /// - /// Returns a service object given the specified object. - /// - /// The current object. - /// A user-defined service object. - public object GetInstance(InstanceContext instanceContext) - { - return GetInstance(instanceContext, null); - } - - /// - /// Returns a service object given the specified object. - /// Delegates to the Spring container to instantiate the given object type. - /// - /// The current object. - /// The message that triggered the creation of a service object. - /// The service object. - public object GetInstance(InstanceContext instanceContext, Message message) - { - string[] objectNames = ApplicationContext.GetObjectNamesForType(ServiceType); - if (objectNames.Length != 1) - { - throw new InvalidOperationException( - string.Format( - CultureInfo.InvariantCulture, - "There must exist exactly one object definition of type '{0}' in the Spring container.", - ServiceType.FullName) - ); - } - return ApplicationContext.GetObject(objectNames[0]); - } - - /// - /// Called when an object recycles a service object. - /// A no-op implementation - /// - /// The service's instance context. - /// The service object to be recycled. - public void ReleaseInstance(InstanceContext instanceContext, object instance) - { - } - - #endregion - } -} -#endif \ No newline at end of file diff --git a/src/Spring/Spring.Services/ServiceModel/Support/SpringServiceBehavior.cs b/src/Spring/Spring.Services/ServiceModel/Support/SpringServiceBehavior.cs deleted file mode 100644 index 77b8202c..00000000 --- a/src/Spring/Spring.Services/ServiceModel/Support/SpringServiceBehavior.cs +++ /dev/null @@ -1,157 +0,0 @@ -#if NET_3_0 -#region License - -/* - * Copyright © 2002-2008 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#endregion - -#region Imports - -using System; -using System.Collections.ObjectModel; -using System.ServiceModel; -using System.ServiceModel.Channels; -using System.ServiceModel.Description; -using System.ServiceModel.Dispatcher; - -using Spring.Context; -using Spring.Context.Support; -using Spring.Util; - -#endregion - -namespace Spring.ServiceModel.Support -{ - /// - /// An implementation of IServiceBehavior that applies the to all endpoints. - /// - /// Bruno Baia - public class SpringServiceBehavior : IServiceBehavior - { - private SpringInstanceProvider springInstanceProvider; - - private string contextName; - - /// - /// Gets or sets the spring instance provider. - /// - /// The spring instance provider. - public SpringInstanceProvider InstanceProvider - { - get { return springInstanceProvider; } - } - - - /// - /// Gets the name of the spring context used when creating this behavior. - /// - /// The name of the context. - public string ContextName - { - get { return contextName; } - } - - /// - /// Initializes a new instance of the class and initializes the - /// SpringInstanceProvider - /// - public SpringServiceBehavior() : this((string)null) - { - springInstanceProvider = new SpringInstanceProvider(ContextRegistry.GetContext()); - } - - /// - /// Initializes a new instance of the class with a given Spring - /// context name. - /// - /// Name of the context. - public SpringServiceBehavior(string contextName) - { - IApplicationContext applicationContext; - if (StringUtils.IsNullOrEmpty(contextName)) - { - applicationContext = ContextRegistry.GetContext(); - } - else - { - applicationContext = ContextRegistry.GetContext(contextName); - } - this.contextName = contextName; - springInstanceProvider = new SpringInstanceProvider(applicationContext); - } - - /// - /// Initializes a new instance of the class. - /// - /// The application context. - public SpringServiceBehavior(IApplicationContext applicationContext) - { - springInstanceProvider = new SpringInstanceProvider(applicationContext); - } - - #region IServiceBehavior Members - - /// - /// Provides the ability to pass custom data to binding elements to support the contract implementation. - /// No-op implementation - /// - /// The service description of the service. - /// The host of the service. - /// The service endpoints. - /// Custom objects to which binding elements have access. - public void AddBindingParameters(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase, - Collection endpoints, BindingParameterCollection bindingParameters) - { - } - - /// - /// Add the SpringInstanceProvider to all endpoint dispatcher. - /// - /// The service description. - /// The host that is currently being built. - public void ApplyDispatchBehavior(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase) - { - foreach (ChannelDispatcherBase cdb in serviceHostBase.ChannelDispatchers) - { - ChannelDispatcher cd = cdb as ChannelDispatcher; - if (cd != null) - { - foreach (EndpointDispatcher ed in cd.Endpoints) - { - InstanceProvider.ServiceType = serviceDescription.ServiceType; - ed.DispatchRuntime.InstanceProvider = InstanceProvider; - } - } - } - } - - /// - /// Provides the ability to inspect the service host and the service description to confirm that the service can run successfully. - /// - /// - /// No-op implementation - /// - /// The service description. - /// The service host that is currently being constructed. - public void Validate(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase) - { - } - - #endregion - } -} -#endif \ No newline at end of file diff --git a/src/Spring/Spring.Services/Spring.Services.2005.csproj b/src/Spring/Spring.Services/Spring.Services.2005.csproj index 053e44c5..28076b0c 100644 --- a/src/Spring/Spring.Services/Spring.Services.2005.csproj +++ b/src/Spring/Spring.Services/Spring.Services.2005.csproj @@ -125,13 +125,6 @@ Code - - - - - - - Code diff --git a/src/Spring/Spring.Services/Spring.Services.2008.csproj b/src/Spring/Spring.Services/Spring.Services.2008.csproj index bd45bfd2..2dac5743 100644 --- a/src/Spring/Spring.Services/Spring.Services.2008.csproj +++ b/src/Spring/Spring.Services/Spring.Services.2008.csproj @@ -128,8 +128,6 @@ - - diff --git a/test/Spring/Spring.Services.Tests/Spring.Services.Tests.2005.csproj b/test/Spring/Spring.Services.Tests/Spring.Services.Tests.2005.csproj index bf1f9dc9..0302950d 100644 --- a/test/Spring/Spring.Services.Tests/Spring.Services.Tests.2005.csproj +++ b/test/Spring/Spring.Services.Tests/Spring.Services.Tests.2005.csproj @@ -121,7 +121,6 @@ Code -