<PackageReference Include="Relativity.Server.Transfer.SDK" Version="24000.0.1" />

ClientConfiguration

public class ClientConfiguration : Dictionary<string, object>
using Relativity.Transfer.Resources; using System; using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Net; using System.Reflection; using System.Runtime.Serialization; namespace Relativity.Transfer { [Serializable] public class ClientConfiguration : Dictionary<string, object> { public const bool DefaultPermissionErrorsRetry = false; public const bool DefaultBadPathErrorsRetry = false; public const FileTransferHint DefaultFileTransferHint = FileTransferHint.Natives; public const bool DefaultFileNotFoundErrorsDisabled = false; public const bool DefaultFileNotFoundErrorsRetry = true; public const int DefaultFileSystemChunkSize = 16384; public const int DefaultHttpChunkSize = 102400; public const double DefaultHttpTimeoutSeconds = 300; public const int DefaultMinDataRateMbps = 0; public const int DefaultMaxJobParallelism = 1; public const int DefaultMaxJobRetryAttempts = 3; public const int DefaultMaxHttpRetryAttempts = 5; public const bool DefaultOverWriteFiles = true; public const bool DefaultPreserveDates = true; public const int DefaultTargetDataRateMbps = 100; public const bool DefaultTransferEmptyDirectories = false; public const bool DefaultValidateSourcePaths = false; private const bool DefaultSavingMemoryMode = false; public const bool DefaultUseLegacyWebApi = false; [ConfigurationDoc("bad-path-errors-retry", "Enable or disable whether to retry intermittent TransferPathStatus.BadPathError I/O errors or treat as a fatal error.", false)] public bool BadPathErrorsRetry { get { return this.GetBooleanValue("bad-path-errors-retry", false); } set { base["bad-path-errors-retry"] = value; } } [ConfigurationDoc("bcp-root-folder", "The name of the folder, located at the root of the file shares, where all bulk-load files are stored.")] public string BcpRootFolder { get { return this.GetStringValue("bcp-root-folder", null); } set { base["bcp-root-folder"] = value; } } [ConfigurationDoc("client", "The well-known transfer client value. This is automatically set when the transfer client is constructed via best-fit strategy.", WellKnownTransferClient.Unassigned, typeof(WellKnownTransferClient))] public WellKnownTransferClient Client { get { return this.GetEnumValue("client", WellKnownTransferClient.Unassigned); } set { base["client"] = value.ToString(); } } [ConfigurationDoc("client-id", "The transfer client unique identifier. This is automatically set when the transfer client is constructed via best-fit strategy.", "00000000-0000-0000-0000-000000000000")] public Guid ClientId { get { return this.GetGuidValue("client-id", Guid.Empty); } set { base["client-id"] = value.ToString(); } } public CookieContainer CookieContainer { get; set; } public Credential Credential { get; set; } [ConfigurationDoc("file-not-found-errors-disabled", "Enable or disable whether to treat missing files as warnings or errors.", false)] public bool FileNotFoundErrorsDisabled { get { return this.GetBooleanValue("file-not-found-errors-disabled", false); } set { base["file-not-found-errors-disabled"] = value; } } [ConfigurationDoc("file-not-found-errors-retry", "Enable or disable whether to retry missing file errors.", true)] public bool FileNotFoundErrorsRetry { get { return this.GetBooleanValue("file-not-found-errors-retry", true); } set { base["file-not-found-errors-retry"] = value; } } [ConfigurationDoc("file-system-chunk-size", "The size of each byte chunk transferred over file-system based transfer clients.", 16384)] public int FileSystemChunkSize { get { return this.GetInt32Value("file-system-chunk-size", 16384); } set { base["file-system-chunk-size"] = value.ToString(); } } [ConfigurationDoc("file-transfer-hint", "The hint provided to the transfer client that indicates what type of transfer workflow is being requested. This is generally used by transfer clients to tune and optimize the transfer.", FileTransferHint.Natives, typeof(FileTransferHint))] public FileTransferHint FileTransferHint { get { return this.GetEnumValue("file-transfer-hint", FileTransferHint.Natives); } set { base["file-transfer-hint"] = value; } } [ConfigurationDoc("http-chunk-size", "The size of each byte chunk transferred over HTTP based transfer clients.", 102400)] public int HttpChunkSize { get { return this.GetInt32Value("http-chunk-size", 102400); } set { base["http-chunk-size"] = value.ToString(); } } [ConfigurationDoc("http-timeout-seconds", "The timeout, in seconds, for an HTTP or REST service call.", 300)] public double HttpTimeoutSeconds { get { return this.GetDoubleValue("http-timeout-seconds", 300); } set { base["http-timeout-seconds"] = value.ToString(CultureInfo.InvariantCulture); } } [ConfigurationDoc("max-http-retry-attempts", "The maximum number of retry attempts for an HTTP or REST service call.", 5)] public int MaxHttpRetryAttempts { get { return this.GetInt32Value("max-http-retry-attempts", 5); } set { base["max-http-retry-attempts"] = value.ToString(); } } [ConfigurationDoc("max-job-parallelism", "The maximum number of threads used to transfer all paths contained within the transfer job queue.", 1)] public int MaxJobParallelism { get { return this.GetInt32Value("max-job-parallelism", 1); } set { base["max-job-parallelism"] = value.ToString(); } } [ConfigurationDoc("max-job-retry-attempts", "The maximum number of transfer job retry attempts.", 3)] public int MaxJobRetryAttempts { get { return this.GetInt32Value("max-job-retry-attempts", 3); } set { base["max-job-retry-attempts"] = value.ToString(); } } [ConfigurationDoc("min-data-rate-mbps", "The minimum data rate in Mbps unit. This isn't supported by all clients but considered a hint to clients that support configurable data rates.", 0)] public int MinDataRateMbps { get { return this.GetInt32Value("min-data-rate-mbps", 0); } set { base["min-data-rate-mbps"] = value.ToString(); } } [ConfigurationDoc("overwrite-files", "Enable or disable whether to overwrite files at the target path. The transfer job will fail when this option is disabled and target paths already exist.", true)] public bool OverwriteFiles { get { return this.GetBooleanValue("overwrite-files", true); } set { base["overwrite-files"] = value.ToString(); } } [ConfigurationDoc("permission-errors-retry", "Enable or disable whether to retry transferring files that fail due to permission or file access errors.", false)] public bool PermissionErrorsRetry { get { return this.GetBooleanValue("permission-errors-retry", false); } set { base["permission-errors-retry"] = value; } } [ConfigurationDoc("preserve-dates", "Enable or disable whether to preserve file created, modified, and access times.", true)] public bool PreserveDates { get { return this.GetBooleanValue("preserve-dates", true); } set { base["preserve-dates"] = value.ToString(); } } [ConfigurationDoc("support-check-path", "The optional path used during auto-configuration to allow each potential client perform additional support checks. This is typically used when a client is supported but may not have access or proper configuration to the specified path.")] public string SupportCheckPath { get { return this.GetStringValue("support-check-path", null); } set { base["support-check-path"] = value; } } [ConfigurationDoc("target-data-rate-mbps", "The target data rate in Mbps unit. This isn't supported by all clients but considered a hint to clients that support configurable data rates.", 100)] public int TargetDataRateMbps { get { return this.GetInt32Value("target-data-rate-mbps", 100); } set { base["target-data-rate-mbps"] = value.ToString(); } } public RelativityFileShareBase TargetFileShare { get; set; } [ConfigurationDoc("transfer-empty-directories", "Enable or disable whether to transfer empty directories.", false)] public bool TransferEmptyDirectories { get { return this.GetBooleanValue("transfer-empty-directories", false); } set { base["transfer-empty-directories"] = value; } } [ConfigurationDoc("transfer-log-directory", "The directory where transfer clients can store more detailed transfer logs separate from standard logging.")] public string TransferLogDirectory { get { return this.GetStringValue("transfer-log-directory", null); } set { base["transfer-log-directory"] = value; } } [ConfigurationDoc("validate-source-paths", "Enable or disable whether to validate source paths before adding to the transfer job queue. When enabled, this can be an expensive operation if the dataset contains a large number of files.", false)] public bool ValidateSourcePaths { get { return this.GetBooleanValue("validate-source-paths", false); } set { base["validate-source-paths"] = value.ToString(CultureInfo.InvariantCulture); } } [ConfigurationDoc("saving-memory-mode", "Turn on memory saving mode which will prevent Transfer-API to store extensive number of already successfully transferred paths.", false)] public bool SavingMemoryMode { get { return this.GetBooleanValue("saving-memory-mode", false); } set { base["saving-memory-mode"] = value.ToString(CultureInfo.InvariantCulture); } } [ConfigurationDoc("use-legacy-webapi", "Enable or disable whether whether legacy WebApi (instead of Kepler) communication mode should be used or not.", false)] public bool UseLegacyWebApi { get { return this.GetBooleanValue("use-legacy-webapi", false); } set { base["use-legacy-webapi"] = value.ToString(); } } public ClientConfiguration() { Initialize(true); } public ClientConfiguration(IDictionary<string, object> dictionary) : base(dictionary) { Initialize(false); } public ClientConfiguration(ClientConfiguration configuration) : base((IDictionary<string, object>)configuration) { if (configuration == null) throw new ArgumentNullException("configuration"); CookieContainer = configuration.CookieContainer; Credential = configuration.Credential; TargetFileShare = configuration.TargetFileShare; Initialize(false); } public ClientConfiguration(Guid clientId, WellKnownTransferClient client) { if (clientId == Guid.Empty) throw new ArgumentException(CoreStrings.ClientIdArgumentExceptionMessage, "clientId"); ClientId = clientId; Client = client; Initialize(true); } public ClientConfiguration(Guid clientId, WellKnownTransferClient client, CookieContainer cookieContainer) { if (clientId == Guid.Empty) throw new ArgumentException(CoreStrings.ClientIdArgumentExceptionMessage, "clientId"); if (cookieContainer == null) throw new ArgumentException(CoreStrings.ClientIdArgumentExceptionMessage, "cookieContainer"); ClientId = clientId; Client = client; CookieContainer = cookieContainer; Initialize(true); } protected ClientConfiguration(SerializationInfo info, StreamingContext context) : base(info, context) { } public static IEnumerable<ConfigurationDocAttribute> GetReflectedDocAttributes(ClientConfiguration configuration) { if (configuration == null) throw new ArgumentNullException("configuration"); List<ConfigurationDocAttribute> list = new List<ConfigurationDocAttribute>(); PropertyInfo[] properties = configuration.GetType().GetProperties(); for (int i = 0; i < properties.Length; i++) { object[] customAttributes = properties[i].GetCustomAttributes(true); for (int j = 0; j < customAttributes.Length; j++) { ConfigurationDocAttribute configurationDocAttribute = customAttributes[j] as ConfigurationDocAttribute; if (configurationDocAttribute != null) list.Add(configurationDocAttribute); } } return list; } public static IEnumerable<ConfigurationDocItem> GetReflectedDocItems(ClientConfiguration configuration) { return from x in GetReflectedDocAttributes(configuration) select new ConfigurationDocItem(x); } public void Copy(IDictionary<string, object> properties) { Copy(properties, true); } public void Copy(IDictionary<string, object> properties, bool overwrite) { if (properties == null) throw new ArgumentNullException("properties"); foreach (KeyValuePair<string, object> item in new Dictionary<string, object>(properties)) { if (overwrite || !ContainsKey(item.Key)) base[item.Key] = item.Value; } } public void Copy(ClientConfiguration configuration, bool overwrite) { if (configuration == null) throw new ArgumentNullException("configuration"); Copy((IDictionary<string, object>)configuration, overwrite); if (configuration.CookieContainer != null) CookieContainer = configuration.CookieContainer; if (configuration.Credential != null) Credential = configuration.Credential; if (configuration.TargetFileShare != null) TargetFileShare = configuration.TargetFileShare; } public override void GetObjectData(SerializationInfo info, StreamingContext context) { base.GetObjectData(info, context); } private void Initialize(bool overwrite) { Dictionary<string, object> dictionary = new Dictionary<string, object>(); bool flag = false; dictionary.Add("bad-path-errors-retry", flag.ToString()); dictionary.Add("bcp-root-folder", string.Empty); flag = false; dictionary.Add("file-not-found-errors-disabled", flag.ToString(CultureInfo.InvariantCulture)); flag = true; dictionary.Add("file-not-found-errors-retry", flag.ToString(CultureInfo.InvariantCulture)); int num = 16384; dictionary.Add("file-system-chunk-size", num.ToString()); dictionary.Add("file-transfer-hint", 0.ToString()); num = 102400; dictionary.Add("http-chunk-size", num.ToString()); dictionary.Add("http-timeout-seconds", 300.ToString(CultureInfo.InvariantCulture)); num = 3; dictionary.Add("max-job-retry-attempts", num.ToString()); num = 1; dictionary.Add("max-job-parallelism", num.ToString()); num = 5; dictionary.Add("max-http-retry-attempts", num.ToString()); num = 0; dictionary.Add("min-data-rate-mbps", num.ToString()); flag = true; dictionary.Add("overwrite-files", flag.ToString()); flag = false; dictionary.Add("permission-errors-retry", flag.ToString()); flag = true; dictionary.Add("preserve-dates", flag.ToString()); dictionary.Add("support-check-path", string.Empty); num = 100; dictionary.Add("target-data-rate-mbps", num.ToString()); dictionary.Add("transfer-empty-directories", false); dictionary.Add("transfer-log-directory", string.Empty); flag = false; dictionary.Add("validate-source-paths", flag.ToString()); flag = false; dictionary.Add("use-legacy-webapi", flag.ToString()); Dictionary<string, object> properties = dictionary; Copy(properties, overwrite); if (CookieContainer == null) CookieContainer = new CookieContainer(); } } }