Exemple #1
0
        /// <summary>
        /// Initializes a new instance of the RoutingServiceUrlProvider class.
        /// </summary>
        /// <param name="serviceUrl">A url to the load-balancing web service.</param>
        /// <param name="serverTitle">A title of the server to use load-balancing for.</param>
        /// <param name="certificateValidationSettings">The reference to the certificate
        /// validation settings object.</param>
        public RoutingServiceUrlProvider(
            string serviceUrl,
            string serverTitle,
            ICertificateValidationSettings certificateValidationSettings)
        {
            Debug.Assert(serviceUrl != null, "Expects non-null serviceUrl");
            Debug.Assert(serverTitle != null, "Expects non-null serverTitle");
            Debug.Assert(
                certificateValidationSettings != null,
                "Expects non-null certificateValidationSettings");

            _serviceUrl  = serviceUrl;
            _serverTitle = serverTitle;

            var uri = new Uri(serviceUrl);

            _serviceScheme = uri.Scheme;

            _certificateValidationSettings = certificateValidationSettings;

            _serviceWrapper = new RetriableInvocationWrapper(
                MAX_RETRY_COUNT,
                _PrepareForRetry,
                _TranslateExceptions);
        }
        /// <summary>
        /// Initializes a new instance of the RoutingServiceUrlProvider class.
        /// </summary>
        /// <param name="serviceUrl">A url to the load-balancing web service.</param>
        /// <param name="serverTitle">A title of the server to use load-balancing for.</param>
        /// <param name="certificateValidationSettings">The reference to the certificate
        /// validation settings object.</param>
        public RoutingServiceUrlProvider(
            string serviceUrl,
            string serverTitle,
            ICertificateValidationSettings certificateValidationSettings)
        {
            Debug.Assert(serviceUrl != null, "Expects non-null serviceUrl");
            Debug.Assert(serverTitle != null, "Expects non-null serverTitle");
            Debug.Assert(
                certificateValidationSettings != null,
                "Expects non-null certificateValidationSettings");

            _serviceUrl = serviceUrl;
            _serverTitle = serverTitle;

            var uri = new Uri(serviceUrl);
            _serviceScheme = uri.Scheme;

            _certificateValidationSettings = certificateValidationSettings;

            _serviceWrapper = new RetriableInvocationWrapper(
                MAX_RETRY_COUNT,
                _PrepareForRetry,
                _TranslateExceptions);
        }
        ///////////////////////////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Initializes a new instance of the ServiceCatalog class.
        /// </summary>
        /// <param name="progressReporter">The reference to the progress reporter
        /// object.</param>
        /// <param name="configPath"></param>
        /// <param name="userConfigPath"></param>
        /// <param name="certificateValidationSettings">The reference to the certificate
        /// validation settings object.</param>
        /// <param name="exceptionsHandler">Exceptions handler.</param>
        /// <exception cref="T:System.ArgumentNullException">Any of <paramref name="configPath"/>,
        /// <paramref name="userConfigPath"/>, <paramref name="progressReporter"/> or
        /// <paramref name="certificateValidationSettings"/> parameters is a null reference.</exception>
        /// <exception cref="T:ESRI.ArcLogistics.SettingsException"> Config file is invalid.
        /// In property "Source" there is path to invalid config file.</exception>
        public ServiceCatalog(
            IProgressReporter progressReporter,
            string configPath,
            string userConfigPath,
            ICertificateValidationSettings certificateValidationSettings,
            IServiceExceptionHandler exceptionsHandler)
        {
            Debug.Assert(exceptionsHandler != null);

            if (progressReporter == null)
            {
                throw new ArgumentNullException("progressReporter");
            }

            if (configPath == null)
            {
                throw new ArgumentNullException("configPath");
            }

            if (userConfigPath == null)
            {
                throw new ArgumentNullException("userConfigPath");
            }

            if (certificateValidationSettings == null)
            {
                throw new ArgumentNullException("certificateValidationSettings");
            }

            _exceptionHandler = exceptionsHandler;

            _certificateValidationSettings = certificateValidationSettings;

            // load configuration
            _servicesInfo     = _LoadServices(configPath);
            _userServicesInfo = _LoadUserConfig(userConfigPath);

            // If we have loaded services info - init servers.
            if (_servicesInfo != null)
            {
                // validate configuration
                _Validate();

                _solveInfo = _CreateSolveInfo();

                // init servers
                _InitServers();
            }


            progressReporter.Step();

            // If we have loaded services info - init services.
            if (_servicesInfo != null)
            {
                // init services
                _InitServices();
            }

            Licenser.LicenseActivated += new EventHandler(Licenser_LicenseActivated);
            _userConfigPath            = userConfigPath;
        }