Exemplo n.º 1
0
 public Factory(
     ITempFilesManager tempFiles,
     ITraceSourceFactory traceSourceFactory,
     MultiInstance.IInstancesCounter mutualExecutionCounter,
     IShutdown shutdown,
     ISynchronizationContext synchronizationContext,
     Persistence.IFirstStartDetector firstStartDetector,
     Telemetry.ITelemetryCollector telemetry,
     Persistence.IStorageManager storage,
     IChangeNotification changeNotification,
     string autoUpdateUrl,
     string pluginsIndexUrl
     )
 {
     this.tempFiles              = tempFiles;
     this.traceSourceFactory     = traceSourceFactory;
     this.shutdown               = shutdown;
     this.synchronizationContext = synchronizationContext;
     this.mutualExecutionCounter = mutualExecutionCounter;
     this.firstStartDetector     = firstStartDetector;
     this.telemetry              = telemetry;
     this.storage            = storage;
     this.changeNotification = changeNotification;
     this.autoUpdateUrl      = autoUpdateUrl;
     this.pluginsIndexUrl    = pluginsIndexUrl;
 }
Exemplo n.º 2
0
        public LogSource(ILogSourcesManagerInternal owner, int id,
                         ILogProviderFactory providerFactory, IConnectionParams connectionParams,
                         IModelThreads threads, ITempFilesManager tempFilesManager, Persistence.IStorageManager storageManager,
                         IInvokeSynchronization invoker, Settings.IGlobalSettingsAccessor globalSettingsAccess, IBookmarks bookmarks)
        {
            this.owner                = owner;
            this.tracer               = new LJTraceSource("LogSource", string.Format("ls{0:D2}", id));
            this.tempFilesManager     = tempFilesManager;
            this.invoker              = invoker;
            this.globalSettingsAccess = globalSettingsAccess;
            this.bookmarks            = bookmarks;

            try
            {
                this.logSourceThreads              = new LogSourceThreads(this.tracer, threads, this);
                this.timeGaps                      = new TimeGapsDetector(tracer, invoker, new LogSourceGapsSource(this));
                this.timeGaps.OnTimeGapsChanged   += timeGaps_OnTimeGapsChanged;
                this.logSourceSpecificStorageEntry = CreateLogSourceSpecificStorageEntry(providerFactory, connectionParams, storageManager);

                var extendedConnectionParams = connectionParams.Clone(true);
                this.LoadPersistedSettings(extendedConnectionParams);
                this.provider = providerFactory.CreateFromConnectionParams(this, extendedConnectionParams);
            }
            catch (Exception e)
            {
                tracer.Error(e, "Failed to initialize log source");
                ((ILogSource)this).Dispose();
                throw;
            }

            this.owner.Container.Add(this);
            this.owner.FireOnLogSourceAdded(this);

            this.LoadBookmarks();
        }
Exemplo n.º 3
0
        public PresenterPersistentState(
            Persistence.IStorageManager storageManager,
            string globalStateStorageEntryName,
            string logSourceSpecificStateSectionName,
            IChangeNotification changeNotification,
            Func <ImmutableHashSet <string> > availableTagsSelector,
            Func <IEnumerable <ILogSource> > sourcesSelector
            )
        {
            this.changeNotification        = changeNotification;
            this.stateEntry                = storageManager.GetEntry(globalStateStorageEntryName);
            this.logSourceStateSectionName = logSourceSpecificStateSectionName;
            this.availableTagsSelector     = CreateAvailableTagsSelectorAdapter(availableTagsSelector);
            this.sourcesSelector           = sourcesSelector;

            this.getDefaultPredicate = Selectors.Create(
                this.availableTagsSelector,
                availableTags => TagsPredicate.MakeMatchAnyPredicate(availableTags)
                );

            this.getTagsPredicate = Selectors.Create(
                getDefaultPredicate,
                sourcesSelector,
                () => savedTagsRevision,
                (defaultPredicate, sources, _revision) => LoadPredicate(sources, defaultPredicate, logSourceStateSectionName)
                );
        }
Exemplo n.º 4
0
 public Factory(
     Persistence.IStorageManager storageManager,
     Telemetry.ITelemetryCollector telemetryCollector
     )
 {
     this.cacheEntry         = storageManager.GetEntry("user-code-cache", 0x81012232);
     this.telemetryCollector = telemetryCollector;
 }
Exemplo n.º 5
0
 public PresentaterPersistentState(
     Persistence.IStorageManager storageManager,
     string globalStateStorageEntryName,
     string logSourceSpecificStateSectionName
     )
 {
     this.stateEntry = storageManager.GetEntry(globalStateStorageEntryName);
     this.logSourceStateSectionName = logSourceSpecificStateSectionName;
 }
Exemplo n.º 6
0
 public Model(
     IInvokeSynchronization threadSync,
     Telemetry.ITelemetryCollector telemetryCollector,
     Persistence.IWebContentCache webCache,
     Persistence.IContentCache contentCache,
     Persistence.IStorageManager storageManager,
     IBookmarks bookmarks,
     ILogSourcesManager sourcesManager,
     IModelThreads threads,
     ITempFilesManager tempFilesManager,
     Preprocessing.IPreprocessingManagerExtensionsRegistry preprocessingManagerExtentionsRegistry,
     Preprocessing.ILogSourcesPreprocessingManager logSourcesPreprocessingManager,
     Preprocessing.IPreprocessingStepsFactory preprocessingStepsFactory,
     Progress.IProgressAggregator progressAggregator,
     ILogProviderFactoryRegistry logProviderFactoryRegistry,
     IUserDefinedFormatsManager userDefinedFormatsManager,
     MRU.IRecentlyUsedEntities mru,
     Progress.IProgressAggregatorFactory progressAggregatorsFactory,
     IHeartBeatTimer heartbeat,
     ILogSourcesController logSourcesController,
     IShutdown shutdown,
     WebBrowserDownloader.IDownloader webBrowserDownloader,
     AppLaunch.ICommandLineHandler commandLineHandler,
     Postprocessing.IPostprocessorsManager postprocessorsManager,
     Postprocessing.IUserNamesProvider analyticsShortNames,
     Analytics.TimeSeries.ITimeSeriesTypesAccess timeSeriesTypes,
     Postprocessing.IAggregatingLogSourceNamesProvider logSourceNamesProvider
     )
 {
     this.ModelThreadSynchronization = threadSync;
     this.Telemetry        = telemetryCollector;
     this.WebContentCache  = webCache;
     this.ContentCache     = contentCache;
     this.StorageManager   = storageManager;
     this.Bookmarks        = bookmarks;
     this.SourcesManager   = sourcesManager;
     this.Threads          = threads;
     this.TempFilesManager = tempFilesManager;
     this.PreprocessingManagerExtensionsRegistry = preprocessingManagerExtentionsRegistry;
     this.PreprocessingStepsFactory      = preprocessingStepsFactory;
     this.LogSourcesPreprocessingManager = logSourcesPreprocessingManager;
     this.ProgressAggregator             = progressAggregator;
     this.LogProviderFactoryRegistry     = logProviderFactoryRegistry;
     this.UserDefinedFormatsManager      = userDefinedFormatsManager;
     this.ProgressAggregatorsFactory     = progressAggregatorsFactory;
     this.MRU                    = mru;
     this.Heartbeat              = heartbeat;
     this.LogSourcesController   = logSourcesController;
     this.Shutdown               = shutdown;
     this.WebBrowserDownloader   = webBrowserDownloader;
     this.CommandLineHandler     = commandLineHandler;
     this.PostprocessorsManager  = postprocessorsManager;
     this.ShortNames             = analyticsShortNames;
     this.TimeSeriesTypes        = timeSeriesTypes;
     this.LogSourceNamesProvider = logSourceNamesProvider;
 }
Exemplo n.º 7
0
 public LogSourcesManager(
     IHeartBeatTimer heartbeat,
     IInvokeSynchronization invoker,
     IModelThreads threads,
     ITempFilesManager tempFilesManager,
     Persistence.IStorageManager storageManager,
     IBookmarks bookmarks,
     Settings.IGlobalSettingsAccessor globalSettingsAccess
     ) : this(heartbeat,
              new LogSourceFactory(threads, bookmarks, invoker, storageManager, tempFilesManager, globalSettingsAccess))
 {
 }
Exemplo n.º 8
0
        public UserDefinedSearchesManager(
            Persistence.IStorageManager storage,
            IFiltersFactory filtersFactory,
            ISynchronizationContext modelThreadSynchronization
            )
        {
            this.filtersFactory       = filtersFactory;
            this.storageEntry         = new Lazy <Persistence.IStorageEntry>(() => storage.GetEntry("UserDefinedSearches"));
            this.changeHandlerInvoker = new AsyncInvokeHelper(modelThreadSynchronization, HandleChange);

            LoadItems();
        }
Exemplo n.º 9
0
 public Factory(
     Persistence.IStorageManager storageManager,
     Telemetry.ITelemetryCollector telemetryCollector,
     IMetadataReferencesProvider metadataReferencesProvider,
     IAssemblyLoader assemblyLoader
     )
 {
     this.cacheEntry                 = storageManager.GetEntry("user-code-cache", 0x81012232);
     this.telemetryCollector         = telemetryCollector;
     this.metadataReferencesProvider = metadataReferencesProvider ?? new DefaultMetadataReferencesProvider();
     this.assemblyLoader             = assemblyLoader ?? new DefaultAssemblyLoader();
 }
Exemplo n.º 10
0
        public static void Init(
            Dialog.IPresenter optionsDialogPresenter,
            Plugins.IPageAvailability pluginsPageAvailability,
            Persistence.IStorageManager storageManager,
            MainForm.IPresenter mainFormPresenter,
            IAlertPopup popup
            )
        {
            async void handler(object s, EventArgs e)
            {
                mainFormPresenter.Loaded -= handler;
                if (pluginsPageAvailability.IsAvailable)
                {
                    bool showOffer    = false;
                    var  storageEntry = storageManager.GetEntry("PluginsInstallationOffer");
                    using (var section = storageEntry.OpenXMLSection("state", Persistence.StorageSectionOpenFlag.ReadWrite))
                    {
                        if (section.Data.Root == null)
                        {
                            showOffer = true;
                            section.Data.Add(new XElement("root"));
                        }
                    }
                    if (showOffer)
                    {
                        await Task.Delay(1000);

                        string pluginsLocation = "LogJoint options dialog";
                        if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
                        {
                            pluginsLocation = "menu LogJoint -> Preferences... -> Plug-ins";
                        }
                        else if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
                        {
                            pluginsLocation = "Options... -> Configuration... -> Plug-ins";
                        }
                        if (popup.ShowPopup(
                                "Plug-ins",
                                "LogJoint offers features via plug-ins. Do you want to choose plug-ins now?" + Environment.NewLine + Environment.NewLine +
                                "You can manage plug-ins any time in " + Environment.NewLine +
                                pluginsLocation,
                                AlertFlags.YesNoCancel
                                ) == AlertFlags.Yes)
                        {
                            optionsDialogPresenter.ShowDialog(Dialog.PageId.Plugins);
                        }
                    }
                }
            }

            mainFormPresenter.Loaded += handler;
        }
 public void Init()
 {
     view = Substitute.For <IView>();
     presentationObjectsFactory = Substitute.For <Postprocessing.Common.IPresentationObjectsFactory>();
     bookmarks               = Substitute.For <IBookmarks>();
     storageManager          = Substitute.For <Persistence.IStorageManager>();
     loadedMessagesPresenter = Substitute.For <LoadedMessages.IPresenter>();
     userNamesProvider       = Substitute.For <IUserNamesProvider>();
     view.When(v => v.SetViewModel(Arg.Any <IViewModel>())).Do(x => viewModel = x.Arg <IViewModel>());
     quickSearchTextBoxPresenter = Substitute.For <QuickSearchTextBox.IPresenter>();
     changeNotification          = Substitute.For <IChangeNotification>();
     theme = Substitute.For <IColorTheme>();
     theme.ThreadColors.Returns(ImmutableArray.Create(new Color(1), new Color(2)));
     presentationObjectsFactory.CreateQuickSearch(Arg.Any <QuickSearchTextBox.IView>()).Returns(quickSearchTextBoxPresenter);
 }
Exemplo n.º 12
0
 public LogSourcesManager(
     IHeartBeatTimer heartbeat,
     ISynchronizationContext invoker,
     IModelThreadsInternal threads,
     ITempFilesManager tempFilesManager,
     Persistence.IStorageManager storageManager,
     IBookmarks bookmarks,
     Settings.IGlobalSettingsAccessor globalSettingsAccess,
     MRU.IRecentlyUsedEntities recentlyUsedEntities,
     IShutdown shutdown,
     ITraceSourceFactory traceSourceFactory,
     IChangeNotification changeNotification
     ) : this(heartbeat, recentlyUsedEntities, shutdown, traceSourceFactory, changeNotification,
              new LogSourceFactory(threads, bookmarks, invoker, storageManager, tempFilesManager, globalSettingsAccess, traceSourceFactory))
 {
 }
Exemplo n.º 13
0
 public LogSourceFactory(
     IModelThreads threads,
     IBookmarks bookmarks,
     IInvokeSynchronization invoker,
     Persistence.IStorageManager storageManager,
     ITempFilesManager tempFilesManager,
     Settings.IGlobalSettingsAccessor globalSettingsAccess
     )
 {
     this.threads              = threads;
     this.bookmarks            = bookmarks;
     this.invoker              = invoker;
     this.storageManager       = storageManager;
     this.tempFilesManager     = tempFilesManager;
     this.globalSettingsAccess = globalSettingsAccess;
 }
Exemplo n.º 14
0
 public Model(
     ISynchronizationContext threadSync,
     IChangeNotification changeNotification,
     Persistence.IWebContentCache webCache,
     Persistence.IContentCache contentCache,
     Persistence.IStorageManager storageManager,
     IBookmarks bookmarks,
     ILogSourcesManager sourcesManager,
     IModelThreads threads,
     ITempFilesManager tempFilesManager,
     Preprocessing.IModel preprocessingModel,
     Progress.IProgressAggregator progressAggregator,
     ILogProviderFactoryRegistry logProviderFactoryRegistry,
     IUserDefinedFormatsManager userDefinedFormatsManager,
     MRU.IRecentlyUsedEntities mru,
     Progress.IProgressAggregatorFactory progressAggregatorsFactory,
     IShutdown shutdown,
     WebViewTools.IWebViewTools webViewTools,
     Postprocessing.IModel postprocessingModel,
     IPluginsManager pluginsManager,
     ITraceSourceFactory traceSourceFactory,
     LogMedia.IFileSystem fileSystem
     )
 {
     this.SynchronizationContext = threadSync;
     this.ChangeNotification     = changeNotification;
     this.WebContentCache        = webCache;
     this.ContentCache           = contentCache;
     this.StorageManager         = storageManager;
     this.Bookmarks                  = bookmarks;
     this.SourcesManager             = sourcesManager;
     this.Threads                    = threads;
     this.TempFilesManager           = tempFilesManager;
     this.Preprocessing              = preprocessingModel;
     this.ProgressAggregator         = progressAggregator;
     this.LogProviderFactoryRegistry = logProviderFactoryRegistry;
     this.UserDefinedFormatsManager  = userDefinedFormatsManager;
     this.ProgressAggregatorsFactory = progressAggregatorsFactory;
     this.MRU                = mru;
     this.Shutdown           = shutdown;
     this.WebViewTools       = webViewTools;
     this.Postprocessing     = postprocessingModel;
     this.PluginsManager     = pluginsManager;
     this.TraceSourceFactory = traceSourceFactory;
     this.FileSystem         = fileSystem;
 }
Exemplo n.º 15
0
        public TelemetryCollector(
            Persistence.IStorageManager storage,
            ITelemetryUploader telemetryUploader,
            IInvokeSynchronization synchronization,
            MultiInstance.IInstancesCounter instancesCounter,
            IShutdown shutdown,
            ILogSourcesManager logSourcesManager,
            IMemBufferTraceAccess traceAccess
            )
        {
            this.telemetryUploader = telemetryUploader;
            this.synchronization   = synchronization;
            this.traceAccess       = traceAccess;

            this.telemetryStorageEntry = storage.GetEntry("telemetry");
            this.sessionStartedMillis  = Environment.TickCount;

            this.currentSessionId = telemetryUploader.IsTelemetryConfigured ?
                                    ("session" + Guid.NewGuid().ToString("n")) : null;

            this.transactionInvoker = new AsyncInvokeHelper(synchronization,
                                                            (Action)(() => DoSessionsRegistryTransaction(TransactionFlag.Default)), new object[0]);

            shutdown.Cleanup += (s, e) => shutdown.AddCleanupTask(DisposeAsync());

            if (currentSessionId != null)
            {
                CreateCurrentSessionSection();
                InitStaticTelemetryProperties();

                logSourcesManager.OnLogSourceAdded += (s, e) =>
                {
                    ++totalNfOfLogs;
                    var nfOfSimultaneousLogs = logSourcesManager.Items.Count();
                    maxNfOfSimultaneousLogs = Math.Max(maxNfOfSimultaneousLogs, nfOfSimultaneousLogs);
                };
            }

            if (telemetryUploader.IsTelemetryConfigured && instancesCounter.IsPrimaryInstance)
            {
                this.workerCancellation     = new CancellationTokenSource();
                this.workerCancellationTask = new TaskCompletionSource <int>();
                this.worker = TaskUtils.StartInThreadPoolTaskScheduler(Worker);
            }
        }
Exemplo n.º 16
0
 public LogSourceFactory(
     IModelThreadsInternal threads,
     IBookmarks bookmarks,
     ISynchronizationContext invoker,
     Persistence.IStorageManager storageManager,
     ITempFilesManager tempFilesManager,
     Settings.IGlobalSettingsAccessor globalSettingsAccess,
     ITraceSourceFactory traceSourceFactory
     )
 {
     this.threads              = threads;
     this.bookmarks            = bookmarks;
     this.invoker              = invoker;
     this.storageManager       = storageManager;
     this.tempFilesManager     = tempFilesManager;
     this.globalSettingsAccess = globalSettingsAccess;
     this.traceSourceFactory   = traceSourceFactory;
 }
Exemplo n.º 17
0
        public void BeforeEach()
        {
            storage          = Substitute.For <Persistence.IStorageManager>();
            uploader         = Substitute.For <ITelemetryUploader>();
            instancesCounter = Substitute.For <MultiInstance.IInstancesCounter>();
            shutdown         = Substitute.For <IShutdown>();
            traceAccess      = Substitute.For <IMemBufferTraceAccess>();

            collector = new TelemetryCollector(
                storage, uploader,
                new SerialSynchronizationContext(),
                instancesCounter, shutdown,
                traceAccess,
                new TraceSourceFactory()
                );

            uploader.IsIssuesReportingConfigured.Returns(true);
        }
Exemplo n.º 18
0
 public LogSourceFactory(
     IModelThreadsInternal threads,
     IBookmarks bookmarks,
     ISynchronizationContext invoker,
     Persistence.IStorageManager storageManager,
     ITempFilesManager tempFilesManager,
     Settings.IGlobalSettingsAccessor globalSettingsAccess,
     ITraceSourceFactory traceSourceFactory,
     RegularExpressions.IRegexFactory regexFactory,
     LogMedia.IFileSystem fileSystem
     )
 {
     this.threads              = threads;
     this.bookmarks            = bookmarks;
     this.invoker              = invoker;
     this.storageManager       = storageManager;
     this.tempFilesManager     = tempFilesManager;
     this.globalSettingsAccess = globalSettingsAccess;
     this.traceSourceFactory   = traceSourceFactory;
     this.regexFactory         = regexFactory;
     this.fileSystem           = fileSystem;
 }
Exemplo n.º 19
0
        public TelemetryCollector(
            Persistence.IStorageManager storage,
            ITelemetryUploader telemetryUploader,
            ISynchronizationContext synchronization,
            MultiInstance.IInstancesCounter instancesCounter,
            IShutdown shutdown,
            IMemBufferTraceAccess traceAccess,
            ITraceSourceFactory traceSourceFactory
            )
        {
            this.trace             = traceSourceFactory.CreateTraceSource("Telemetry");
            this.telemetryUploader = telemetryUploader;
            this.synchronization   = synchronization;
            this.traceAccess       = traceAccess;

            this.telemetryStorageEntry = storage.GetEntry("telemetry");
            this.sessionStartedMillis  = Environment.TickCount;

            this.currentSessionId = telemetryUploader.IsTelemetryConfigured ?
                                    ("session" + Guid.NewGuid().ToString("n")) : null;

            this.transactionInvoker = new AsyncInvokeHelper(synchronization,
                                                            () => DoSessionsRegistryTransaction(TransactionFlag.Default));

            shutdown.Cleanup += (s, e) => shutdown.AddCleanupTask(DisposeAsync());

            if (currentSessionId != null)
            {
                CreateCurrentSessionSection();
                InitStaticTelemetryProperties();
            }

            if (telemetryUploader.IsTelemetryConfigured && instancesCounter.IsPrimaryInstance)
            {
                this.workerCancellation     = new CancellationTokenSource();
                this.workerCancellationTask = new TaskCompletionSource <int>();
                this.worker = TaskUtils.StartInThreadPoolTaskScheduler(Worker);
            }
        }
Exemplo n.º 20
0
 public Factory(
     IViewsFactory postprocessingViewsFactory,
     IManager postprocessorsManager,
     ILogSourcesManager logSourcesManager,
     ISynchronizationContext synchronizationContext,
     IChangeNotification changeNotification,
     IBookmarks bookmarks,
     IModelThreads threads,
     Persistence.IStorageManager storageManager,
     ILogSourceNamesProvider logSourceNamesProvider,
     IUserNamesProvider shortNames,
     SourcesManager.IPresenter sourcesManagerPresenter,
     LoadedMessages.IPresenter loadedMessagesPresenter,
     IClipboardAccess clipboardAccess,
     IPresentersFacade presentersFacade,
     IAlertPopup alerts,
     IColorTheme colorTheme
     )
 {
     this.postprocessingViewsFactory = postprocessingViewsFactory;
     this.postprocessorsManager      = postprocessorsManager;
     this.logSourcesManager          = logSourcesManager;
     this.synchronizationContext     = synchronizationContext;
     this.changeNotification         = changeNotification;
     this.bookmarks               = bookmarks;
     this.threads                 = threads;
     this.storageManager          = storageManager;
     this.logSourceNamesProvider  = logSourceNamesProvider;
     this.shortNames              = shortNames;
     this.sourcesManagerPresenter = sourcesManagerPresenter;
     this.loadedMessagesPresenter = loadedMessagesPresenter;
     this.clipboardAccess         = clipboardAccess;
     this.presentersFacade        = presentersFacade;
     this.alerts     = alerts;
     this.colorTheme = colorTheme;
 }
Exemplo n.º 21
0
        private static Persistence.IStorageEntry CreateLogSourceSpecificStorageEntry(
            ILogProviderFactory providerFactory,
            IConnectionParams connectionParams,
            Persistence.IStorageManager storageManager
            )
        {
            var identity = providerFactory.GetConnectionId(connectionParams);

            if (string.IsNullOrWhiteSpace(identity))
            {
                throw new ArgumentException("Invalid log source identity");
            }

            // additional hash to make sure that the same log opened as
            // different formats will have different storages
            ulong numericKey = storageManager.MakeNumericKey(
                providerFactory.CompanyName + "/" + providerFactory.FormatName);

            var storageEntry = storageManager.GetEntry(identity, numericKey);

            storageEntry.AllowCleanup();             // log source specific entries can be deleted if no space is available

            return(storageEntry);
        }
Exemplo n.º 22
0
        public LogSource(ILogSourcesManagerInternal owner, int id,
                         ILogProviderFactory providerFactory, IConnectionParams connectionParams,
                         IModelThreadsInternal threads, ITempFilesManager tempFilesManager, Persistence.IStorageManager storageManager,
                         ISynchronizationContext modelSyncContext, Settings.IGlobalSettingsAccessor globalSettingsAccess, IBookmarks bookmarks,
                         ITraceSourceFactory traceSourceFactory, RegularExpressions.IRegexFactory regexFactory, LogMedia.IFileSystem fileSystem)
        {
            this.owner                = owner;
            this.tracer               = traceSourceFactory.CreateTraceSource("LogSource", string.Format("ls{0:D2}", id));
            this.tempFilesManager     = tempFilesManager;
            this.modelSyncContext     = modelSyncContext;
            this.globalSettingsAccess = globalSettingsAccess;
            this.bookmarks            = bookmarks;
            this.traceSourceFactory   = traceSourceFactory;
            this.regexFactory         = regexFactory;
            this.fileSystem           = fileSystem;

            try
            {
                this.logSourceThreads              = new LogSourceThreads(this.tracer, threads, this);
                this.timeGaps                      = new TimeGapsDetector(tracer, modelSyncContext, new LogSourceGapsSource(this), traceSourceFactory);
                this.timeGaps.OnTimeGapsChanged   += timeGaps_OnTimeGapsChanged;
                this.logSourceSpecificStorageEntry = CreateLogSourceSpecificStorageEntry(providerFactory, connectionParams, storageManager);

                var extendedConnectionParams = connectionParams.Clone(true);
                this.LoadPersistedSettings(extendedConnectionParams);
                this.provider = providerFactory.CreateFromConnectionParams(this, extendedConnectionParams);
            }
            catch (Exception e)
            {
                tracer.Error(e, "Failed to initialize log source");
                ((ILogSource)this).Dispose();
                throw;
            }

            this.owner.Add(this);
            this.owner.FireOnLogSourceAdded(this);

            this.LoadBookmarks();
        }
Exemplo n.º 23
0
 public GlobalSettingsAccessor(Persistence.IStorageManager persistenceEntry)
 {
     this.storageManager = persistenceEntry;
 }
Exemplo n.º 24
0
        public AutoUpdater(
            MultiInstance.IInstancesCounter mutualExecutionCounter,
            IUpdateDownloader updateDownloader,
            ITempFilesManager tempFiles,
            IShutdown shutdown,
            IInvokeSynchronization eventInvoker,
            IFirstStartDetector firstStartDetector,
            Telemetry.ITelemetryCollector telemetry,
            Persistence.IStorageManager storage
            )
        {
            this.mutualExecutionCounter = mutualExecutionCounter;
            this.updateDownloader       = updateDownloader;
            this.tempFiles            = tempFiles;
            this.manualCheckRequested = new TaskCompletionSource <int>();
            this.firstStartDetector   = firstStartDetector;

            this.managedAssembliesPath = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
            this.updateInfoFilePath    = Path.Combine(managedAssembliesPath, updateInfoFileName);
            this.installationDir       = Path.GetFullPath(
                Path.Combine(managedAssembliesPath, installationPathRootRelativeToManagedAssembliesLocation));

            this.eventInvoker = eventInvoker;
            this.telemetry    = telemetry;
            this.storage      = storage;

            shutdown.Cleanup += (s, e) => ((IDisposable)this).Dispose();

            this.updatesStorageEntry = storage.GetEntry("updates");

            bool isFirstInstance        = mutualExecutionCounter.IsPrimaryInstance;
            bool isDownloaderConfigured = updateDownloader.IsDownloaderConfigured;

            if (!isDownloaderConfigured)
            {
                trace.Info("autoupdater is disabled - update downloader not configured");
                isActiveAutoUpdaterInstance = false;

                state = AutoUpdateState.Disabled;
            }
            else if (!isFirstInstance)
            {
                trace.Info("autoupdater is deactivated - not a first instance of logjoint");
                isActiveAutoUpdaterInstance = false;

                state = AutoUpdateState.Inactive;
            }
            else
            {
                trace.Info("autoupdater is enabled");
                isActiveAutoUpdaterInstance = true;

                state = AutoUpdateState.Idle;

                workerCancellation      = new CancellationTokenSource();
                workerCancellationToken = workerCancellation.Token;
                workerCancellationTask  = new TaskCompletionSource <int>();

                worker = TaskUtils.StartInThreadPoolTaskScheduler(Worker);
            }
        }
Exemplo n.º 25
0
 public RecentlyUsedEntities(Persistence.IStorageManager storageManager, ILogProviderFactoryRegistry logProviderFactoryRegistry, Telemetry.ITelemetryCollector telemetry)
 {
     this.settingsEntry = storageManager.GlobalSettingsEntry;
     this.logProviderFactoryRegistry = logProviderFactoryRegistry;
     this.telemetry = telemetry;
 }
Exemplo n.º 26
0
        public AutoUpdater(
            IFactory factory,
            MultiInstance.IInstancesCounter mutualExecutionCounter,
            IShutdown shutdown,
            ISynchronizationContext eventInvoker,
            Telemetry.ITelemetryCollector telemetry,
            Persistence.IStorageManager storage,
            ITraceSourceFactory traceSourceFactory,
            Extensibility.IPluginsManagerInternal pluginsManager,
            IChangeNotification changeNotification
            )
        {
            this.updateDownloader = factory.CreateAppUpdateDownloader();
            this.checkRequested   = new TaskCompletionSource <int>();
            this.factory          = factory;
            this.pluginsManager   = pluginsManager;
            this.trace            = traceSourceFactory.CreateTraceSource("AutoUpdater");

            var entryAssemblyLocation = Assembly.GetEntryAssembly()?.Location;

            if (entryAssemblyLocation != null)
            {
                this.managedAssembliesPath = Path.GetDirectoryName(entryAssemblyLocation);
                this.updateInfoFilePath    = Path.Combine(managedAssembliesPath, Constants.updateInfoFileName);
                this.installationDir       = Path.GetFullPath(
                    Path.Combine(managedAssembliesPath, Constants.installationPathRootRelativeToManagedAssembliesLocation));
            }

            this.eventInvoker = eventInvoker;
            this.telemetry    = telemetry;
            this.storage      = storage;

            shutdown.Cleanup += (s, e) => ((IDisposable)this).Dispose();

            this.updatesStorageEntry = storage.GetEntry("updates");

            bool isFirstInstance        = mutualExecutionCounter.IsPrimaryInstance;
            bool isDownloaderConfigured = updateDownloader.IsDownloaderConfigured;

            if (entryAssemblyLocation == null)
            {
                trace.Info("autoupdater is disabled - no entry assembly");
                isActiveAutoUpdaterInstance = false;

                state = AutoUpdateState.Disabled;
            }
            else if (!isDownloaderConfigured)
            {
                trace.Info("autoupdater is disabled - update downloader not configured");
                isActiveAutoUpdaterInstance = false;

                state = AutoUpdateState.Disabled;
            }
            else if (!isFirstInstance)
            {
                trace.Info("autoupdater is deactivated - not a first instance of logjoint");
                isActiveAutoUpdaterInstance = false;

                state = AutoUpdateState.Inactive;
            }
            else
            {
                trace.Info("autoupdater is enabled");
                isActiveAutoUpdaterInstance = true;

                state = AutoUpdateState.Idle;

                workerCancellation      = new CancellationTokenSource();
                workerCancellationToken = workerCancellation.Token;
                workerCancellationTask  = new TaskCompletionSource <int>();

                changeListenerSubscription = changeNotification.CreateSubscription(Updaters.Create(
                                                                                       () => pluginsManager.InstallationRequests,
                                                                                       (_, prev) =>
                {
                    if (prev != null)
                    {
                        checkRequested.TrySetResult(1);
                    }
                }
                                                                                       ));

                worker = TaskUtils.StartInThreadPoolTaskScheduler(Worker);
            }
        }
Exemplo n.º 27
0
        public Factory(
            IViewsFactory postprocessingViewsFactory,
            IManagerInternal postprocessorsManager,
            ILogSourcesManager logSourcesManager,
            ISynchronizationContext synchronizationContext,
            IChangeNotification changeNotification,
            IBookmarks bookmarks,
            IModelThreads threads,
            Persistence.IStorageManager storageManager,
            ILogSourceNamesProvider logSourceNamesProvider,
            IUserNamesProvider shortNames,
            SourcesManager.IPresenter sourcesManagerPresenter,
            LoadedMessages.IPresenter loadedMessagesPresenter,
            IClipboardAccess clipboardAccess,
            IPresentersFacade presentersFacade,
            IAlertPopup alerts,
            IColorTheme colorTheme,
            Drawing.IMatrixFactory matrixFactory,
            ICorrelationManager correlationManager
            )
        {
            stateInspectorVisualizer = new Lazy <StateInspectorVisualizer.IPresenterInternal>(() =>
            {
                var view  = postprocessingViewsFactory.CreateStateInspectorView();
                var model = new LogJoint.Postprocessing.StateInspector.StateInspectorVisualizerModel(
                    postprocessorsManager,
                    logSourcesManager,
                    synchronizationContext,
                    shortNames
                    );
                return(new StateInspectorVisualizer.StateInspectorPresenter(
                           view,
                           model,
                           shortNames,
                           logSourcesManager,
                           loadedMessagesPresenter,
                           bookmarks,
                           threads,
                           presentersFacade,
                           clipboardAccess,
                           sourcesManagerPresenter,
                           colorTheme
                           ));
            });

            timelineVisualizer = new Lazy <TimelineVisualizer.IPresenter>(() =>
            {
                var view  = postprocessingViewsFactory.CreateTimelineView();
                var model = new LogJoint.Postprocessing.Timeline.TimelineVisualizerModel(
                    postprocessorsManager,
                    logSourcesManager,
                    shortNames,
                    logSourceNamesProvider
                    );
                return(new TimelineVisualizer.TimelineVisualizerPresenter(
                           model,
                           view,
                           stateInspectorVisualizer.Value,
                           new Common.PresentationObjectsFactory(postprocessorsManager, logSourcesManager, changeNotification, alerts, correlationManager),
                           loadedMessagesPresenter,
                           bookmarks,
                           storageManager,
                           presentersFacade,
                           shortNames,
                           changeNotification,
                           colorTheme
                           ));
            });

            sequenceDiagramVisualizer = new Lazy <SequenceDiagramVisualizer.IPresenter>(() =>
            {
                var view  = postprocessingViewsFactory.CreateSequenceDiagramView();
                var model = new LogJoint.Postprocessing.SequenceDiagram.SequenceDiagramVisualizerModel(
                    postprocessorsManager,
                    logSourcesManager,
                    shortNames,
                    logSourceNamesProvider,
                    changeNotification
                    );
                return(new SequenceDiagramVisualizer.SequenceDiagramVisualizerPresenter(
                           model,
                           view,
                           stateInspectorVisualizer.Value,
                           new Common.PresentationObjectsFactory(postprocessorsManager, logSourcesManager, changeNotification, alerts, correlationManager),
                           loadedMessagesPresenter,
                           bookmarks,
                           storageManager,
                           presentersFacade,
                           shortNames,
                           changeNotification,
                           colorTheme,
                           matrixFactory
                           ));
            });

            timeSeriesVisualizer = new Lazy <TimeSeriesVisualizer.IPresenter>(() =>
            {
                var view  = postprocessingViewsFactory.CreateTimeSeriesView();
                var model = new LogJoint.Postprocessing.TimeSeries.TimelineVisualizerModel(
                    postprocessorsManager,
                    logSourcesManager,
                    shortNames,
                    logSourceNamesProvider
                    );
                return(new TimeSeriesVisualizer.TimeSeriesVisualizerPresenter(
                           model,
                           view,
                           new Common.PresentationObjectsFactory(postprocessorsManager, logSourcesManager, changeNotification, alerts, correlationManager),
                           loadedMessagesPresenter.LogViewerPresenter,
                           bookmarks,
                           presentersFacade,
                           changeNotification
                           ));
            });
        }