Ejemplo n.º 1
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();
        }
Ejemplo n.º 2
0
 ILogSourceInternal ILogSourceFactory.CreateLogSource(
     ILogSourcesManagerInternal owner,
     int id,
     ILogProviderFactory providerFactory,
     IConnectionParams connectionParams)
 {
     return(new LogSource(
                owner,
                id,
                providerFactory,
                connectionParams,
                threads,
                tempFilesManager,
                storageManager,
                invoker,
                globalSettingsAccess,
                bookmarks
                ));
 }
Ejemplo n.º 3
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();
        }