/// <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; } }
/// <inheritdoc /> public IDataSourceAnalyser CreateAnalyser(ILogFile logFile, AnalyserTemplate template) { if (TryGetPlugin(template.AnalyserPluginId, out var plugin)) { // As usual, we don't trust plugins to behave nice and therefore we wrap them in a proxy // which handles all exceptions thrown by the plugin. var analyser = new DataSourceAnalyserProxy(plugin, template.Id, _scheduler, logFile, template.Configuration); Add(analyser); return(analyser); } else { var analyser = new DataSourceAnalyser(template, logFile, _logAnalyserEngine); Add(analyser); return(analyser); } }