IConnectionParams IManager.AppendStep(
            IConnectionParams connectParams, string stepName, string stepArgument)
        {
            var steps = LoadStepsFromConnectionParams(connectParams).ToList();

            if (steps.Count == 0)
            {
                var path = connectParams[ConnectionParamsKeys.PathConnectionParam];
                if (path == null)
                {
                    return(null);
                }
                steps.Add(new PreprocessingHistoryItem(GetPreprocessingStep.name, path));
            }
            steps.Add(new PreprocessingHistoryItem(stepName, stepArgument));
            var retVal  = connectParams.Clone(makeWritebleCopyIfReadonly: true);
            int stepIdx = 0;

            foreach (var step in steps)
            {
                retVal[string.Format("{0}{1}", ConnectionParamsKeys.PreprocessingStepParamPrefix, stepIdx)] =
                    string.Format(string.IsNullOrEmpty(step.Argument) ? "{0}" : "{0} {1}", step.StepName, step.Argument);
                ++stepIdx;
            }
            return(retVal);
        }
Exemple #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();
        }
Exemple #3
0
        IConnectionParams ILogProviderFactory.GetConnectionParamsToBeStoredInMRUList(IConnectionParams originalConnectionParams)
        {
            var cp = originalConnectionParams.Clone(true);

            cp[ConnectionParamsKeys.PathConnectionParam] = null;
            ConnectionParamsUtils.RemoveInitialTimeOffset(cp);
            return(cp);
        }
Exemple #4
0
        public IConnectionParams Clone(bool makeWritebleCopyIfReadonly)
        {
            var tmp = underlyingParams.Clone();

            if (makeWritebleCopyIfReadonly)
            {
                return(tmp);
            }
            else
            {
                return(new ConnectionParamsReadOnlyView(tmp));
            }
        }
            IConnectionParams SanitizePreprocessingSteps(IConnectionParams providerConnectionParams)
            {
                var steps = LoadStepsFromConnectionParams(providerConnectionParams).ToArray();

                // Remove the only "get" preprocessing step
                if (steps.Length == 1 && steps[0].StepName == GetPreprocessingStep.name)
                {
                    providerConnectionParams = providerConnectionParams.Clone();
                    providerConnectionParams[ConnectionParamsKeys.PreprocessingStepParamPrefix + "0"] = null;
                    return(providerConnectionParams);
                }

                return(providerConnectionParams);
            }
Exemple #6
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();
        }
Exemple #7
0
 public override IConnectionParams GetConnectionParamsToBeStoredInMRUList(IConnectionParams originalConnectionParams)
 {
     return(ConnectionParamsUtils.RemoveNonPersistentParams(originalConnectionParams.Clone(true), tempFilesManager));
 }
Exemple #8
0
 IConnectionParams ILogProviderFactory.GetConnectionParamsToBeStoredInMRUList(IConnectionParams originalConnectionParams)
 {
     return(ConnectionParamsUtils.RemoveNonPersistentParams(originalConnectionParams.Clone(true), tempFiles));
 }
Exemple #9
0
 public IConnectionParams GetConnectionParamsToBeStoredInMRUList(IConnectionParams originalConnectionParams)
 {
     return(ConnectionParamsUtils.RemoveNonPersistentParams(originalConnectionParams.Clone(true), TempFilesManager.GetInstance()));
 }