public SynchronizationProfileRunner(
            ISynchronizerFactory synchronizerFactory,
            ISynchronizationReportSink reportSink,
            IFolderChangeWatcherFactory folderChangeWatcherFactory,
            Action ensureSynchronizationContext)
        {
            if (synchronizerFactory == null)
            {
                throw new ArgumentNullException(nameof(synchronizerFactory));
            }
            if (reportSink == null)
            {
                throw new ArgumentNullException(nameof(reportSink));
            }
            if (folderChangeWatcherFactory == null)
            {
                throw new ArgumentNullException(nameof(folderChangeWatcherFactory));
            }
            if (ensureSynchronizationContext == null)
            {
                throw new ArgumentNullException(nameof(ensureSynchronizationContext));
            }

            _synchronizerFactory          = synchronizerFactory;
            _reportSink                   = reportSink;
            _folderChangeWatcherFactory   = folderChangeWatcherFactory;
            _ensureSynchronizationContext = ensureSynchronizationContext;
            // Set to min, to ensure that it runs on the first run after startup
            _lastRun = DateTime.MinValue;
        }
    public SynchronizationProfileRunner (
        ISynchronizerFactory synchronizerFactory,
        ISynchronizationReportSink reportSink,
        IFolderChangeWatcherFactory folderChangeWatcherFactory,
        Action ensureSynchronizationContext, 
        ISynchronizationRunLogger runLogger)
    {
      if (synchronizerFactory == null)
        throw new ArgumentNullException (nameof (synchronizerFactory));
      if (reportSink == null)
        throw new ArgumentNullException (nameof (reportSink));
      if (folderChangeWatcherFactory == null)
        throw new ArgumentNullException (nameof (folderChangeWatcherFactory));
      if (ensureSynchronizationContext == null)
        throw new ArgumentNullException (nameof (ensureSynchronizationContext));
      if (runLogger == null)
        throw new ArgumentNullException (nameof (runLogger));

      _synchronizerFactory = synchronizerFactory;
      _reportSink = reportSink;
      _folderChangeWatcherFactory = folderChangeWatcherFactory;
      _ensureSynchronizationContext = ensureSynchronizationContext;
      _runLogger = runLogger;
      // Set to min, to ensure that it runs on the first run after startup
      _lastRun = DateTime.MinValue;
    }
Пример #3
0
        public Scheduler(
            ISynchronizerFactory synchronizerFactory,
            ISynchronizationReportSink reportSink,
            Action ensureSynchronizationContext,
            IFolderChangeWatcherFactory folderChangeWatcherFactory)
        {
            if (synchronizerFactory == null)
            {
                throw new ArgumentNullException(nameof(synchronizerFactory));
            }
            if (ensureSynchronizationContext == null)
            {
                throw new ArgumentNullException(nameof(ensureSynchronizationContext));
            }
            if (folderChangeWatcherFactory == null)
            {
                throw new ArgumentNullException(nameof(folderChangeWatcherFactory));
            }
            if (reportSink == null)
            {
                throw new ArgumentNullException(nameof(reportSink));
            }

            _reportSink                    = reportSink;
            _synchronizerFactory           = synchronizerFactory;
            _ensureSynchronizationContext  = ensureSynchronizationContext;
            _folderChangeWatcherFactory    = folderChangeWatcherFactory;
            _synchronizationTimer.Tick    += SynchronizationTimer_Tick;
            _synchronizationTimer.Interval = (int)_timerInterval.TotalMilliseconds;
            _synchronizationTimer.Start();
        }
    public Scheduler (
      ISynchronizerFactory synchronizerFactory,
      ISynchronizationReportSink reportSink,
      Action ensureSynchronizationContext, 
      IFolderChangeWatcherFactory folderChangeWatcherFactory,
      ISynchronizationRunLogger runLogger)
    {
      if (synchronizerFactory == null)
        throw new ArgumentNullException (nameof (synchronizerFactory));
      if (ensureSynchronizationContext == null)
        throw new ArgumentNullException (nameof (ensureSynchronizationContext));
      if (folderChangeWatcherFactory == null)
        throw new ArgumentNullException (nameof (folderChangeWatcherFactory));
      if (runLogger == null)
        throw new ArgumentNullException (nameof (runLogger));
      if (reportSink == null)
        throw new ArgumentNullException (nameof (reportSink));

      _reportSink = reportSink;
      _synchronizerFactory = synchronizerFactory;
      _ensureSynchronizationContext = ensureSynchronizationContext;
      _folderChangeWatcherFactory = folderChangeWatcherFactory;
      _runLogger = runLogger;
      _synchronizationTimer.Tick += SynchronizationTimer_Tick;
      _synchronizationTimer.Interval = (int) _timerInterval.TotalMilliseconds;
    }
Пример #5
0
 public SynchronizationLogger(Guid profileId, string profileName, ISynchronizationReportSink reportSink)
 {
     _startTime         = DateTime.UtcNow;
     _profileName       = profileName;
     _reportSink        = reportSink;
     _profileId         = profileId;
     _aLoadEntityLogger = new LoadEntityLogger(_loadErrors, _loadErrorsLock, true);
     _bLoadEntityLogger = new LoadEntityLogger(_loadErrors, _loadErrorsLock, false);
 }
Пример #6
0
 public SynchronizationLogger(Guid profileId, string profileName, ISynchronizationReportSink reportSink, bool includeEntityReportsWithoutErrorsOrWarnings)
 {
     _startTime   = DateTime.UtcNow;
     _profileName = profileName;
     _reportSink  = reportSink;
     _includeEntityReportsWithoutErrorsOrWarnings = includeEntityReportsWithoutErrorsOrWarnings;
     _profileId         = profileId;
     _aLoadEntityLogger = new LoadEntityLogger(_loadErrors, _loadErrorsLock, true);
     _bLoadEntityLogger = new LoadEntityLogger(_loadErrors, _loadErrorsLock, false);
 }
        public SynchronizationProfileRunner(
            ISynchronizerFactory synchronizerFactory,
            ISynchronizationReportSink reportSink,
            IFolderChangeWatcherFactory folderChangeWatcherFactory,
            Action ensureSynchronizationContext,
            ISynchronizationRunLogger runLogger,
            IDateTimeProvider dateTimeProvider,
            Guid profileId)
        {
            if (synchronizerFactory == null)
            {
                throw new ArgumentNullException(nameof(synchronizerFactory));
            }
            if (reportSink == null)
            {
                throw new ArgumentNullException(nameof(reportSink));
            }
            if (folderChangeWatcherFactory == null)
            {
                throw new ArgumentNullException(nameof(folderChangeWatcherFactory));
            }
            if (ensureSynchronizationContext == null)
            {
                throw new ArgumentNullException(nameof(ensureSynchronizationContext));
            }
            if (runLogger == null)
            {
                throw new ArgumentNullException(nameof(runLogger));
            }
            if (dateTimeProvider == null)
            {
                throw new ArgumentNullException(nameof(dateTimeProvider));
            }

            _profileId                    = profileId;
            _synchronizerFactory          = synchronizerFactory;
            _reportSink                   = reportSink;
            _folderChangeWatcherFactory   = folderChangeWatcherFactory;
            _ensureSynchronizationContext = ensureSynchronizationContext;
            _runLogger                    = runLogger;
            _dateTimeProvider             = dateTimeProvider;
            // Set to min, to ensure that it runs on the first run after startup
            _lastRun = DateTime.MinValue;
            _errorHandlingStrategy = new ErrorHandlingStrategy(_profile, _dateTimeProvider, 0);
        }
Пример #8
0
 public void Dispose()
 {
     _reportSink?.PostReport(GetReport());
     _reportSink = null;
 }