/// <summary> /// Creates a <see cref="cdabtesttools.Target.TargetSiteWrapper"/> instance. /// </summary> /// <param name="name">A name for the target site.</param> /// <param name="targetSiteConfig">The object representing the target site node from the configuration YAML file.</param> public TargetSiteWrapper(string name, TargetSiteConfiguration targetSiteConfig) { Name = name; this.targetSiteConfig = targetSiteConfig; ose = new Terradue.OpenSearch.Engine.OpenSearchEngine(); ose.LoadPlugins(); wrapper = CreateDataAccessWrapper(targetSiteConfig); target_type = InitType(); }
public static IDataHubSourceWrapper CreateDataAccessWrapper(TargetSiteConfiguration targetSiteConfig, FiltersDefinition filters = null) { var target_uri = targetSiteConfig.GetDataAccessUri(); var target_creds = targetSiteConfig.GetDataAccessNetworkCredentials(); if (target_creds == null) { log.WarnFormat("Credentials are not set, target sites' services requiring credentials for data access will fail!"); } if (target_uri.Host == "catalogue.onda-dias.eu") { return(new OndaDiasWrapper(new Uri(string.Format("https://catalogue.onda-dias.eu/dias-catalogue")), (NetworkCredential)target_creds, targetSiteConfig.Storage.ToOpenStackStorageSettings())); } if (target_uri.Host == "finder.creodias.eu") { if (targetSiteConfig.Data.Url != null) { return(new CreoDiasWrapper(target_creds, osUrl: targetSiteConfig.Data.Url, openStackStorageSettings: targetSiteConfig.Storage.ToOpenStackStorageSettings())); } return(new CreoDiasWrapper(target_creds, openStackStorageSettings: targetSiteConfig.Storage.ToOpenStackStorageSettings())); } if (target_uri.Host.Contains("mundiwebservices.com")) { var mundiDiasWrapper = new MundiDiasWrapper(target_creds, openStackStorageSettings: targetSiteConfig.Storage.ToOpenStackStorageSettings()); mundiDiasWrapper.S3KeyId = targetSiteConfig.Data.S3KeyId; mundiDiasWrapper.S3SecretKey = targetSiteConfig.Data.S3SecretKey; return(mundiDiasWrapper); } if (target_uri.Host.Contains("sobloo.eu")) { var soblooDiasWrapper = new SoblooDiasWrapper(target_creds); soblooDiasWrapper.S3StorageSettings = targetSiteConfig.Storage.ToS3StorageSettings(); return(soblooDiasWrapper); } if (target_uri.Host.EndsWith("copernicus.eu") || target_uri.AbsolutePath.EndsWith("/dhus")) { if (filters != null && filters.GetFilters().Any(f => f.Key == "archiveStatus")) { UriBuilder urib = new UriBuilder(target_uri); urib.Path += target_uri.AbsolutePath.Replace("/search", "").TrimEnd('/').EndsWith("odata/v1") ? "" : "/odata/v1"; return(new DHuSWrapper(urib.Uri, (NetworkCredential)target_creds)); } return(new DHuSWrapper(target_uri, (NetworkCredential)target_creds)); } return(null); }
private static void LoadAndCheckConfiguration() { if (string.IsNullOrEmpty(target_name)) { throw new ArgumentNullException("Target Name", "Target Name cannot be null or empty"); } Configuration.Current = Configuration.Load(configFile); if (Configuration.Current == null) { Configuration.Current = new Config.Configuration(); } else { log.DebugFormat("Configuration found in {0}", configFile.FullName); } // Create or find existing target by name TargetSiteConfiguration _targetSite = new TargetSiteConfiguration(); if (Configuration.Current.ServiceProviders.ContainsKey(target_name)) { _targetSite = Configuration.Current.ServiceProviders[target_name]; } else { Configuration.Current.ServiceProviders.Add(target_name, _targetSite); } // Overrides target endpoint url if set by arg if (!string.IsNullOrEmpty(target_endpoint)) { _targetSite.Data.Url = target_endpoint; } // Overrides target credentialsif set by arg if (!string.IsNullOrEmpty(target_auth)) { _targetSite.Data.Credentials = target_auth; } }
private static TargetSiteWrapper ConfigureTarget(TargetSiteConfiguration targetSiteConfig) { return(new TargetSiteWrapper(target_name, targetSiteConfig)); }