コード例 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FtpFileSystem"/> class.
        /// </summary>
        /// <param name="serverAddress">The server address.</param>
        /// <param name="credentials">The credentials.</param>
        public FtpFileSystem(Uri serverAddress, NetworkCredential credentials)
        {
            serverAddress.ThrowIfNull(() => serverAddress);
            credentials.ThrowIfNull(() => credentials);

            this.client = new FtpClient(credentials);
        }
コード例 #2
0
ファイル: ConnectionSettings.cs プロジェクト: v-kovrigin/NEST
        public ConnectionSettings(Uri uri, string defaultIndex)
        {
            uri.ThrowIfNull("uri");
            defaultIndex.ThrowIfNullOrEmpty("defaultIndex");

            this.Timeout = 60 * 1000;

            this.SetDefaultIndex(defaultIndex);
            this.Uri = uri;

            if (!uri.OriginalString.EndsWith("/"))
                this.Uri = new Uri(uri.OriginalString + "/");
            this.Host = uri.Host;
            this.Port = uri.Port;
            this.UriSpecifiedBasicAuth = !uri.UserInfo.IsNullOrEmpty();

            this.MaximumAsyncConnections = 0;
            this.DefaultTypeNameInferrer = (t => t.Name.ToLower());
            this.DefaultIndices = new FluentDictionary<Type, string>();
            this.DefaultTypeNames = new FluentDictionary<Type, string>();
            this.ConnectionStatusHandler = this.ConnectionStatusDefaultHandler;

            this.ModifyJsonSerializerSettings = (j) => { };
            this.ContractConverters = Enumerable.Empty<Func<Type, JsonConverter>>().ToList().AsReadOnly();
        }
コード例 #3
0
        /// <summary>
        /// Instantiate a connectionsettings object to tell the client where and how to connect to elasticsearch
        /// using a proxy
        /// </summary>
        /// <param name="uri">A Uri to describe the elasticsearch endpoint</param>
        /// <param name="timeout">time out in milliseconds</param>
        /// <param name="proxyAddress">proxy address</param>
        /// <param name="username">proxy username</param>
        /// <param name="password">proxy password</param>
        public ConnectionSettings(Uri uri, int timeout, string proxyAddress, string username, string password)
        {
            uri.ThrowIfNull("uri");

            this._uri = uri;
            this._password = password;
            this._username = username;
            this._timeout = timeout;
            this._proxyAddress = proxyAddress;
            this.MaximumAsyncConnections = 20;
            this._defaultTypeIndices = new FluentDictionary<Type, string>();
        }
コード例 #4
0
        /// <summary>
        /// Creates a new factory parameter by splitting the specified service URI into ServerUrl and BasePath
        /// </summary>
        public FactoryParameters(Uri serviceUri)
        {
            serviceUri.ThrowIfNull("serviceUri");

            // Retrieve Scheme and Host
            ServerUrl = serviceUri.GetComponents(UriComponents.SchemeAndServer, UriFormat.UriEscaped);
            ServerUrl.ThrowIfNullOrEmpty("ServerUrl");

            // Retrieve the remaining right part
            BasePath = serviceUri.GetComponents(UriComponents.PathAndQuery, UriFormat.UriEscaped);
            ServerUrl.ThrowIfNullOrEmpty("BasePath");
        }
コード例 #5
0
ファイル: ConnectionSettings.cs プロジェクト: Rustemt/NEST
        public ConnectionSettings(Uri uri)
        {
            uri.ThrowIfNull("uri");

            this.Timeout = 60 * 1000;

            this.Uri = uri;
            if (!uri.ToString().EndsWith("/"))
                this.Uri = new Uri(uri.ToString() + "/");
            this.Host = uri.Host;
            this.Port = uri.Port;

            this.MaximumAsyncConnections = 20;
            this.DefaultTypeNameInferrer = this.LowerCaseAndPluralizeTypeNameInferrer;
            this.DefaultIndices = new FluentDictionary<Type, string>();
            this.DefaultTypeNames = new FluentDictionary<Type, string>();
            this.ConnectionStatusHandler = this.ConnectionStatusDefaultHandler;
        }
コード例 #6
0
ファイル: ConnectionSettings.cs プロジェクト: nickcanz/NEST
        public ConnectionSettings(Uri uri)
        {
            uri.ThrowIfNull("uri");

            this.Timeout = 60 * 1000;

            this.Uri = uri;
            if (!uri.OriginalString.EndsWith("/"))
                this.Uri = new Uri(uri.OriginalString + "/");
            this.Host = uri.Host;
            this.Port = uri.Port;

            this.MaximumAsyncConnections = 0;
            this.DefaultTypeNameInferrer = this.LowerCaseAndPluralizeTypeNameInferrer;
            this.DefaultIndices = new FluentDictionary<Type, string>();
            this.DefaultTypeNames = new FluentDictionary<Type, string>();
            this.ConnectionStatusHandler = this.ConnectionStatusDefaultHandler;

            this.ModifyJsonSerializerSettings = (j) => { };
            this.ContractConverters = Enumerable.Empty<Func<Type, JsonConverter>>().ToList().AsReadOnly();
        }
コード例 #7
0
        private DigestProxyAuthorizationHeader(string authScheme, string username, string realm, string nonce, Uri digestUri, string response, string algorithm, string cnonce, string opaque, string messageQop, string nonceCount)
        {
            authScheme.ThrowIfNull("authScheme");
            username.ThrowIfNull("username");
            realm.ThrowIfNull("realm");
            nonce.ThrowIfNull("nonce");
            digestUri.ThrowIfNull("digestUri");
            response.ThrowIfNull("response");

            _authScheme = authScheme;
            _username = username;
            _realm = realm;
            _nonce = nonce;
            _digestUri = digestUri;
            _response = response;
            _algorithm = algorithm;
            _cnonce = cnonce;
            _opaque = opaque;
            _messageQop = messageQop;
            _nonceCount = nonceCount;
        }
コード例 #8
0
ファイル: ConnectionSettings.cs プロジェクト: Rustemt/NEST
 /// <summary>
 /// If your connection has to go through proxy use this method to specify the proxy url
 /// </summary>
 /// <returns></returns>
 public ConnectionSettings SetProxy(Uri proxyAdress, string username, string password)
 {
     proxyAdress.ThrowIfNull("proxyAdress");
     this.ProxyAddress = proxyAdress.ToString();
     this.ProxyUsername = username;
     this.ProxyPassword = password;
     return this;
 }
コード例 #9
0
        /// <summary>
        /// Factory method to create an HttpWebServiceException for File download requests that fail because the file could not be written
        /// </summary>
        /// <param name="url">The url of the request that failed</param>
        /// <param name="ex">The exception that was thrown creating the file</param>
        /// <returns></returns>
        /// <exception cref="System.ArgumentNullException"></exception>
        public static HttpWebClientServiceException FileError(Uri url, Exception ex)
        {
            url.ThrowIfNull(nameof(url));

            return new HttpWebClientServiceException(HttpWebClientServiceExceptionStatus.FileError, ex, url,
                String.Format(CultureConstants.DefaultCulture,
                    ExceptionMessages.FileException, url.Host));
        }
コード例 #10
0
        /// <summary>
        /// Factory method to create an HttpWebServiceException of type 'RequestsDisabled'
        /// </summary>
        /// <param name="url">The url of the request that failed</param>
        /// <returns></returns>
        /// <exception cref="System.ArgumentNullException"></exception>
        public static HttpWebClientServiceException RequestsDisabledException(Uri url)
        {
            url.ThrowIfNull(nameof(url));

            return new HttpWebClientServiceException(HttpWebClientServiceExceptionStatus.RequestsDisabled, url,
                String.Format(CultureConstants.DefaultCulture, ExceptionMessages.RequestsDisabled, url.Host));
        }
コード例 #11
0
        /// <summary>
        /// Factory method to create an HttpWebServiceException of type 'Exception'
        /// </summary>
        /// <param name="url">The url of the request that failed</param>
        /// <param name="ex">The exception that was thrown</param>
        /// <returns></returns>
        /// <exception cref="System.ArgumentNullException"></exception>
        public static HttpWebClientServiceException Exception(Uri url, Exception ex)
        {
            url.ThrowIfNull(nameof(url));

            return new HttpWebClientServiceException(HttpWebClientServiceExceptionStatus.Exception, ex, url,
                "An Exception occurred.");
        }
コード例 #12
0
        private RefererHeader(Uri url)
        {
            url.ThrowIfNull("url");

            _url = url;
        }