<commit_before>#region License

/*
 * Copyright  2002-2005 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.Globalization;
using System.Collections;
using System.Reflection;
using System.Reflection.Emit;
using System.Web.Services;

using Spring.Context;
using Spring.Context.Support;
using Spring.Core;
using Spring.Core.TypeResolution;
using Spring.Objects;
using Spring.Objects.Factory;
using Spring.Util;
using Spring.Proxy;

#endregion

namespace Spring.Web.Services
{
    /// <summary>
    /// Exports an object as a web service.
    /// </summary>
    /// <remarks>
    /// <p>
    /// The exporter will create a web service wrapper for the object that is
    /// to be exposed and additionally enable its configuration as a web
    /// service.
    /// </p>
    /// <p>
    /// The exported object can be either a standard .NET web service
    /// implementation, with methods marked using the standard
    /// <see cref="System.Web.Services.WebMethodAttribute"/>, or it can be a
    /// plain .NET object.
    /// </p>
    /// </remarks>
    /// <author><NAME></author>
    public class WebServiceExporter : IInitializingObject, IObjectFactoryAware, IFactoryObject, IObjectNameAware, IDisposable
    {
        /// <summary>
        /// Holds EXPORTER_ID to WebServiceExporter instance mappings.
        /// </summary>
        private static readonly IDictionary s_activeExporters = new Hashtable();

        ///<summary>
        /// Returns the target object instance exported by the WebServiceExporter identified by <see cref="EXPORTER_ID"/>.
        ///</summary>
        ///<param name="exporterId"></param>
        ///<returns></returns>
        public static object GetTarget( string exporterId )
        {
            WebServiceExporter exporterInstance;
            lock (s_activeExporters.SyncRoot)
            {
                exporterInstance = (WebServiceExporter)s_activeExporters[exporterId];
            }
            AssertUtils.ArgumentNotNull( exporterInstance, "exporterId", "Remoting Server object is not associated with any active SaoExporter" );
            object target = exporterInstance.GetTargetInstance();
            AssertUtils.ArgumentNotNull( target, "exporterId", string.Format( "Failed retrieving target object for SaoExporter ID {0}", exporterId ) );
            return target;
        }

        #region Fields

#if NET_2_0
        private WsiProfiles _wsiProfile = WsiProfiles.BasicProfile1_1;
#endif
        private readonly string EXPORTER_ID = Guid.NewGuid().ToString();
        private Type _webServiceBaseType = typeof(WebService);
        private string _targetName;<commit_msg>fixed error messages in WebServiceExporter<commit_after>#region License

/*
 * Copyright  2002-2005 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.Globalization;
using System.Collections;
using System.Reflection;
using System.Reflection.Emit;
using System.Web.Services;

using Spring.Context;
using Spring.Context.Support;
using Spring.Core;
using Spring.Core.TypeResolution;
using Spring.Objects;
using Spring.Objects.Factory;
using Spring.Util;
using Spring.Proxy;

#endregion

namespace Spring.Web.Services
{
    /// <summary>
    /// Exports an object as a web service.
    /// </summary>
    /// <remarks>
    /// <p>
    /// The exporter will create a web service wrapper for the object that is
    /// to be exposed and additionally enable its configuration as a web
    /// service.
    /// </p>
    /// <p>
    /// The exported object can be either a standard .NET web service
    /// implementation, with methods marked using the standard
    /// <see cref="System.Web.Services.WebMethodAttribute"/>, or it can be a
    /// plain .NET object.
    /// </p>
    /// </remarks>
    /// <author><NAME></author>
    public class WebServiceExporter : IInitializingObject, IObjectFactoryAware, IFactoryObject, IObjectNameAware, IDisposable
    {
        /// <summary>
        /// Holds EXPORTER_ID to WebServiceExporter instance mappings.
        /// </summary>
        private static readonly IDictionary s_activeExporters = new Hashtable();

        ///<summary>
        /// Returns the target object instance exported by the WebServiceExporter identified by <see cref="EXPORTER_ID"/>.
        ///</summary>
        ///<param name="exporterId"></param>
        ///<returns></returns>
        public static object GetTarget( string exporterId )
        {
            WebServiceExporter exporterInstance;
            lock (s_activeExporters.SyncRoot)
            {
                exporterInstance = (WebServiceExporter)s_activeExporters[exporterId];
            }
            if (exporterInstance == null)
            {
                throw new ArgumentNullException("exporterId", "WebService object is not associated with any active WebServiceExporter");
            }
            object target = exporterInstance.GetTargetInstance();
            if (target == null)
            {
                throw new ArgumentNullException("exporterId", string.Format( "Failed retrieving target object for WebServiceExporter ID {0}", exporterId ));
            }
            return target;
        }

        #region Fields

#if NET_2_0
        private WsiProfiles _wsiProfile = WsiProfiles.BasicProfile1_1;
#endif
        private readonly string EXPORTER_ID = Guid.NewGuid().ToString();
        private Type _webServiceBaseType = typeof(WebService);
        private string _targetName;
{'fraction_non_alphanumeric': 0.09519492293744333, 'fraction_numerical': 0.005137503777576307, 'mean_word_length': 2.7311161217587374, 'pattern_counts': {'":': 0, '<': 45, '<?xml version=': 0, '>': 45, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7586599', 'n_tokens_mistral': 1726, 'n_tokens_neox': 1696, 'n_words': 598}