Beispiel #1
0
        public static CatalogueSetConfiguration ResolveBaseline(string setName, CatalogueSetConfiguration setConfiguration)
        {
            switch (setConfiguration.Type)
            {
            // ... unless it is a baseline and we need to get the reference baseline
            case TargetCatalogueSetType.baseline:
                // if configured in the catalogue set
                var referenceSetId = setConfiguration.ReferenceSetId;
                // otherwise, we use the same set name
                if (string.IsNullOrEmpty(referenceSetId))
                {
                    referenceSetId = setName;
                }
                // We check that the baseline exists
                if (!Configuration.Current.Data.Sets.ContainsKey(referenceSetId))
                {
                    log.WarnFormat("Target Site Catalogue Set named '{0}' reference an catalogue reference not found '{1}', skipping!", setName, setConfiguration.ReferenceSetId);
                    return(null);
                }
                return(Configuration.Current.Data.Sets[referenceSetId]);

            case TargetCatalogueSetType.local:
            default:
                return(setConfiguration);
            }
        }
Beispiel #2
0
        public static IEnumerable <FiltersDefinition> GenerateDataOperationalLatencyFiltersDefinition(string setName, CatalogueSetConfiguration setConfiguration)
        {
            List <FiltersDefinition> bulkDataDefs = new List <FiltersDefinition>();

            // Let's get the baseline
            var catalogueSetConfiguration = ResolveBaseline(setName, setConfiguration);

            foreach (FiltersDefinition fd in GenerateFilterDefinitionsFromCollectionsDefinition(catalogueSetConfiguration))
            {
                float max       = 240;
                var   startDate = DateTime.UtcNow.Subtract(TimeSpan.FromHours(max));
                fd.RemoveFilter("{http://a9.com/-/opensearch/extensions/time/1.0/}timeliness");
                fd.RemoveFilter("{http://a9.com/-/opensearch/extensions/time/1.0/}start");
                fd.AddFilter("sensingStart", "{http://a9.com/-/opensearch/extensions/time/1.0/}start", startDate.ToString("s"), string.Format("last {0} hours", max), null, null);
                fd.AddFilter("count", "{http://a9.com/-/spec/opensearch/1.1/}count", "50", "", null, null);
                bulkDataDefs.Add(fd);
            }
            return(bulkDataDefs);
        }
Beispiel #3
0
        public static IEnumerable <CrossCatalogueCoverageFiltersDefinition> GenerateDataAvailabilityLatencyFiltersDefinition(string setName, CatalogueSetConfiguration setConfiguration, TargetSiteWrapper target)
        {
            List <CrossCatalogueCoverageFiltersDefinition> bulkDataDefs = new List <CrossCatalogueCoverageFiltersDefinition>();

            // Let's get the baseline
            var catalogueSetConfiguration = ResolveBaseline(setName, setConfiguration);

            TargetSiteWrapper ref_target = new TargetSiteWrapper(setConfiguration.ReferenceTargetSite, Configuration.Current.GetTargetSiteConfiguration(setConfiguration.ReferenceTargetSite));

            foreach (FiltersDefinition fd in GenerateFilterDefinitionsFromCollectionsDefinition(catalogueSetConfiguration))
            {
                // if there is no sensing start defined in the catalogue set
                // add a sensing time for the last 40 days
                if (!fd.Filters.Any(f => f.FullName == "{http://a9.com/-/opensearch/extensions/time/1.0/}start"))
                {
                    float max       = 40;
                    var   startDate = DateTime.UtcNow.Subtract(TimeSpan.FromDays(max));
                    fd.RemoveFilter("{http://a9.com/-/opensearch/extensions/time/1.0/}start");
                    fd.AddFilter("sensingStart", "{http://a9.com/-/opensearch/extensions/time/1.0/}start", startDate.ToString("s"), string.Format("last {0} days", max), null, null);
                }
                fd.AddFilter("count", "{http://a9.com/-/spec/opensearch/1.1/}count", "20", "", null, null);
                bulkDataDefs.Add(new CrossCatalogueCoverageFiltersDefinition(
                                     new TargetAndFiltersDefinition(target, fd),
                                     new TargetAndFiltersDefinition(ref_target, fd)
                                     ));
            }
            return(bulkDataDefs);
        }
Beispiel #4
0
        private static IEnumerable <FiltersDefinition> GenerateFilterDefinitionsFromCollectionsDefinition(CatalogueSetConfiguration catDefinition)
        {
            List <FiltersDefinition> filtersDefinition = new List <FiltersDefinition>();

            foreach (var collection in catDefinition.Collections)
            {
                var fds = new FiltersDefinition(collection.Key);
                fds.AddFilters(collection.Value.Parameters);
                fds.AddFilters(catDefinition.Parameters);
                filtersDefinition.Add(fds);
            }

            return(filtersDefinition);
        }
Beispiel #5
0
        /// <summary>
        /// Creates a list of cross filter definitions for a target site against a reference target site.
        /// </summary>
        /// <param name="setName">The name of the catalogue set.</param>
        /// <param name="setConfiguration">The configuration set</param>
        /// <param name="target">The target</param>
        /// <returns>A list of cross filter definitions.</returns>
        internal static IEnumerable <CrossCatalogueCoverageFiltersDefinition> GenerateCrossCatalogueCoverageFiltersDefinition(string setName, CatalogueSetConfiguration setConfiguration, TargetSiteWrapper target)
        {
            List <CrossCatalogueCoverageFiltersDefinition> bulkDataDefs = new List <CrossCatalogueCoverageFiltersDefinition>();

            // Let's get the baseline
            var catalogueSetConfiguration = ResolveBaseline(setName, setConfiguration);

            // Let's get the reference target
            TargetSiteWrapper ref_target = new TargetSiteWrapper(setConfiguration.ReferenceTargetSite, Configuration.Current.GetTargetSiteConfiguration(setConfiguration.ReferenceTargetSite));

            // Let's build the filter defintions
            foreach (FiltersDefinition pt in GenerateFilterDefinitionsFromCollectionsDefinition(catalogueSetConfiguration))
            {
                FiltersDefinition _targetFiltersDefinition = new FiltersDefinition("[target]");

                _targetFiltersDefinition.AddFilters(pt.Filters);
                _targetFiltersDefinition.AddFilter("count", "{http://a9.com/-/spec/opensearch/1.1/}count", "0", "", null, null);
                try
                {
                    _targetFiltersDefinition.AddFilters(catalogueSetConfiguration.Parameters);
                }
                catch { }
                FiltersDefinition _refFiltersDefinition = new FiltersDefinition(_targetFiltersDefinition);
                _refFiltersDefinition.Name = "[reference]";
                // special filter for filtering out product that are not considered as in the reference baseline
                try
                {
                    _targetFiltersDefinition.AddFilters(setConfiguration.Parameters);
                }
                catch { }

                bulkDataDefs.Add(new CrossCatalogueCoverageFiltersDefinition(
                                     new TargetAndFiltersDefinition(target, _targetFiltersDefinition),
                                     new TargetAndFiltersDefinition(ref_target, _refFiltersDefinition)
                                     ));
            }
            return(bulkDataDefs);
        }