/// <summary> /// Adds support for the specified function and data object to the capServer instance. /// </summary> /// <param name="capServer">The capServer instance.</param> /// <param name="function">The WITSML Store API function.</param> /// <param name="dataObject">The data object.</param> /// <param name="maxDataNodes">The maximum data nodes.</param> public static void Add(this Witsml141.CapServer capServer, Functions function, string dataObject, int maxDataNodes) { Add(capServer, function, new Witsml141Schemas.ObjectWithConstraint(dataObject) { MaxDataNodes = maxDataNodes, }); }
/// <summary> /// Creates the capServers instance for a specific data schema version. /// </summary> /// <returns>The capServers instance.</returns> protected override Witsml141.CapServers CreateCapServer() { if (!Providers.Any()) { Logger.WarnFormat("No WITSML configuration providers loaded for data schema version {0}", DataSchemaVersion); return(null); } var capServer = new Witsml141.CapServer(); foreach (var config in Providers) { config.GetCapabilities(capServer); } // Sort each function by data object name capServer.Function.ForEach(f => f.DataObject = f.DataObject?.OrderBy(x => x.Value).ToList()); capServer.ApiVers = "1.4.1"; capServer.SchemaVersion = DataSchemaVersion; capServer.SupportUomConversion = false; // TODO: update after UoM conversion implemented capServer.CompressionMethod = OptionsIn.CompressionMethod.None.Value; // TODO: update when compression is supported capServer.MaxRequestLatestValues = WitsmlSettings.MaxRequestLatestValues; capServer.ChangeDetectionPeriod = WitsmlSettings.ChangeDetectionPeriod; capServer.CascadedDelete = WitsmlSettings.IsCascadeDeleteEnabled; capServer.Name = WitsmlSettings.DefaultServerName; capServer.Version = WitsmlSettings.OverrideServerVersion; capServer.Description = Settings.Default.DefaultServerDescription; capServer.Vendor = Settings.Default.DefaultVendorName; capServer.Contact = new Contact() { Name = Settings.Default.DefaultContactName, Email = Settings.Default.DefaultContactEmail, Phone = Settings.Default.DefaultContactPhone }; return(new Witsml141.CapServers() { CapServer = capServer, Version = capServer.ApiVers }); }
/// <summary> /// Set growing timeout period for growing object type in the capServer instance. /// </summary> /// <param name="capServer">The capServer instance.</param> /// <param name="objectType">The object type.</param> /// <param name="seconds">The growing timeout period in seconds.</param> public static void SetGrowingTimeoutPeriod(this Witsml141.CapServer capServer, string objectType, int seconds) { var growingTimeoutPeriod = new Witsml141Schemas.GrowingTimeoutPeriod(seconds) { DataObject = objectType }; if (capServer.GrowingTimeoutPeriod == null) { capServer.GrowingTimeoutPeriod = new List <Witsml141Schemas.GrowingTimeoutPeriod> { growingTimeoutPeriod } } ; else { capServer.GrowingTimeoutPeriod.Add(growingTimeoutPeriod); } }
/// <summary> /// Adds support for the specified function and data object to the capServer instance. /// </summary> /// <param name="capServer">The capServer instance.</param> /// <param name="function">The WITSML Store API function.</param> /// <param name="dataObject">The data object.</param> public static void Add(this Witsml141.CapServer capServer, Functions function, Witsml141Schemas.ObjectWithConstraint dataObject) { if (capServer.Function == null) { capServer.Function = new List <Witsml141Schemas.Function>(); } var name = "WMLS_" + function.ToString(); var func = capServer.Function.FirstOrDefault(x => x.Name == name); if (func == null) { capServer.Function.Add(func = new Witsml141Schemas.Function() { Name = name, DataObject = new List <Witsml141Schemas.ObjectWithConstraint>() }); } func.DataObject.Add(dataObject); }