Example #1
0
        /// <summary>
        /// </summary>
        /// <param name="factoryId"></param>
        /// <param name="configuration"></param>
        /// <returns></returns>
        public IDataSourceAnalyser Add(LogAnalyserFactoryId factoryId, ILogAnalyserConfiguration configuration)
        {
            var template = new AnalyserTemplate
            {
                Id            = AnalyserId.CreateNew(),
                FactoryId     = factoryId,
                Configuration = configuration
            };

            var analyser = new DataSourceAnalyser(template, _logFile, _logAnalyserEngine);

            try
            {
                analyser.Configuration = configuration;
                lock (_syncRoot)
                {
                    _analysers.Add(analyser, template);
                    _template.Add(template);
                }

                return(analyser);
            }
            catch (Exception)
            {
                analyser.Dispose();
                throw;
            }
        }
Example #2
0
        private IDataSourceAnalysisHandle CreatAnalysisFor(LogAnalyserFactoryId id,
                                                           ILogFile logFile,
                                                           ILogAnalyserConfiguration configuration,
                                                           IDataSourceAnalysisListener listener)
        {
            IDataSourceAnalysisHandle analysis;
            ILogAnalyserPlugin        plugin;

            if (_factoriesById.TryGetValue(id, out plugin))
            {
                analysis = new LogAnalyserProxy(_scheduler, logFile, plugin, configuration, listener);
            }
            else
            {
                Log.ErrorFormat("Unable to find plugin '{0}', analysis will be skipped", id);
                analysis = new DummyAnalysis();
            }

            return(analysis);
        }
Example #3
0
        public DataSourceAnalyserSnapshot(AnalyserId id,
                                          LogAnalyserFactoryId factoryId,
                                          ILogAnalyserConfiguration configuration,
                                          ILogAnalysisResult result,
                                          Percentage progress)
        {
            if (id == AnalyserId.Empty)
            {
                throw new ArgumentException(nameof(id));
            }
            if (factoryId == LogAnalyserFactoryId.Empty)
            {
                throw new ArgumentException(nameof(factoryId));
            }

            Id             = id;
            FactoryId      = factoryId;
            _configuration = configuration;
            _result        = result;
            _progress      = progress;
        }
Example #4
0
 public IDataSourceAnalyser Add(LogAnalyserFactoryId factoryId, ILogAnalyserConfiguration configuration)
 {
     throw new InvalidOperationException("Adding new analysers to a snapshot is not allowed");
 }