/// <summary> /// Initializes a new instance of the <see cref="CmisSync.Lib.Queueing.ReportingSyncEventHandler"/> class. /// </summary> /// <param name='queue'> /// A reference to the queue. /// </param> /// <exception cref='ArgumentNullException'> /// Is thrown when an argument passed to a method is invalid because it is <see langword="null" /> . /// </exception> public ReportingSyncEventHandler(ISyncEventQueue queue) : base() { if (queue == null) { throw new ArgumentNullException("queue"); } this.Queue = queue; }
/// <summary> /// Initializes a new instance of the <see cref="CmisSync.Lib.Filter.AbstractFileFilter"/> class. /// </summary> /// <param name='queue'> /// Queue where all filtered events should be reported to. /// </param> public AbstractFileFilter(ISyncEventQueue queue) { if (queue == null) { throw new ArgumentNullException("queue", "The given queue must not be null, bacause the Filters are reporting their filtered events to this queue"); } this.Queue = queue; }
/// <summary> /// Initializes a new instance of the /// <see cref="CreatedChangedDeletedFileSystemEventHandler"/> class. /// </summary> /// <param name="queue">Sync event queue.</param> /// <param name="storage">Meta data storage.</param> /// <param name="fsFactory">File system info factory.</param> /// <param name="threshold">Delay after which a deleted event is passed to the queue.</param> public CreatedChangedDeletedFileSystemEventHandler( ISyncEventQueue queue, IMetaDataStorage storage, IFileSystemInfoFactory fsFactory = null, long threshold = 100) { if (queue == null) { throw new ArgumentNullException("Given queue is null"); } if (storage == null) { throw new ArgumentNullException("Given storage is null"); } this.queue = queue; this.storage = storage; this.threshold = threshold; this.fsFactory = fsFactory ?? new FileSystemInfoFactory(); this.events = new List <Tuple <FileSystemEventArgs, Guid, DateTime, bool> >(); this.timer = new Timer(); this.timer.AutoReset = false; this.timer.Elapsed += (sender, e) => this.PopEventsFromList(); }
/// <summary> /// Initializes a new instance of the <see cref="CmisSync.Lib.Queueing.AbstractEventProducer"/> class. /// </summary> /// <param name='queue'> /// The queue which could be used to pass events to. /// </param> public AbstractEventProducer(ISyncEventQueue queue) { if (queue == null) { throw new ArgumentNullException("queue"); } this.Queue = queue; }
/// <summary> /// Initializes a new instance of the <see cref="CmisSync.Lib.Sync.Strategy.MacWatcher"/> class. /// </summary> /// <param name="pathname">Path to be monitored.</param> /// <param name="queue">Queue to pass the new events to.</param> /// <param name="latency">Maximum latency for file system events.</param> public MacWatcher(string pathname, ISyncEventQueue queue, TimeSpan latency) { if (string.IsNullOrEmpty(pathname)) { throw new ArgumentNullException("The given fs stream must not be null"); } if (queue == null) { throw new ArgumentNullException("The given queue must not be null"); } this.Queue = queue; this.RunLoopThread = new Thread(() => { this.RunLoop = NSRunLoop.Current; while (!this.StopRunLoop) { this.RunLoop.RunUntil(NSDate.FromTimeIntervalSinceNow(1)); this.CleanLastRenameEvent(); } }); this.RunLoopThread.Start(); while (RunLoop == null) { Thread.Sleep(10); } this.FsStream = new FSEventStream(new [] { pathname }, latency, FSEventStreamCreateFlags.FileEvents); this.EnableEvents = false; this.FsStream.ScheduleWithRunLoop(this.RunLoop); }
/// <summary> /// Initializes a new instance of the <see cref="CmisSync.Lib.Queueing.ConnectionScheduler"/> class. /// </summary> /// <param name="repoInfo">Repo info.</param> /// <param name="queue">Event queue.</param> /// <param name="sessionFactory">Session factory.</param> /// <param name="authProvider">Auth provider.</param> /// <param name="interval">Retry interval in msec.</param> public ConnectionScheduler( RepoInfo repoInfo, ISyncEventQueue queue, ISessionFactory sessionFactory, IAuthenticationProvider authProvider, int interval = 5000) { if (interval <= 0) { throw new ArgumentException(string.Format("Given Interval \"{0}\" is smaller or equal to null", interval)); } if (repoInfo == null) { throw new ArgumentNullException("repoInfo"); } if (queue == null) { throw new ArgumentNullException("queue"); } if (sessionFactory == null) { throw new ArgumentNullException("sessionFactory"); } if (authProvider == null) { throw new ArgumentNullException("authProvider"); } this.Queue = queue; this.SessionFactory = sessionFactory; this.RepoInfo = repoInfo; this.AuthProvider = authProvider; this.Interval = interval; }
/// <summary> /// Initializes a new instance of the <see cref="ContentChanges"/> class. /// </summary> /// <param name="session">Cmis Session.</param> /// <param name="storage">Meta Data Storage.</param> /// <param name="queue">Event Queue.</param> /// <param name="maxNumberOfContentChanges">Max number of content changes.</param> /// <param name="isPropertyChangesSupported">If set to <c>true</c> is property changes supported.</param> public ContentChanges( ISession session, IMetaDataStorage storage, ISyncEventQueue queue, int maxNumberOfContentChanges = 100, bool isPropertyChangesSupported = false) : base(queue) { if (session == null) { throw new ArgumentNullException("session"); } if (storage == null) { throw new ArgumentNullException("storage"); } if (maxNumberOfContentChanges <= 1) { throw new ArgumentException("MaxNumberOfContentChanges must be greater then one", "maxNumberOfContentChanges"); } this.session = session; this.storage = storage; this.maxNumberOfContentChanges = maxNumberOfContentChanges; this.isPropertyChangesSupported = isPropertyChangesSupported; }
/// <summary> /// Initializes a new instance of the <see cref="ReportingFilter"/> class. /// </summary> /// <param name="queue">Sync Event Queue to put work on.</param> /// <param name="ignoredFoldersFilter">Ignored folders filter.</param> /// <param name="ignoredFileNameFilter">Ignored file name filter.</param> /// <param name="ignoredFolderNameFilter">Ignored folder name filter.</param> /// <param name="invalidFoderNameFilter">Invalid folder name filter</param> public ReportingFilter( ISyncEventQueue queue, IgnoredFoldersFilter ignoredFoldersFilter, IgnoredFileNamesFilter ignoredFileNameFilter, IgnoredFolderNameFilter ignoredFolderNameFilter, InvalidFolderNameFilter invalidFoderNameFilter, SymlinkFilter symlinkFilter) : base(queue) { if (ignoredFoldersFilter == null) { throw new ArgumentNullException("ignoredFoldersFilter"); } if (ignoredFileNameFilter == null) { throw new ArgumentNullException("ignoredFileNameFilter"); } if (ignoredFolderNameFilter == null) { throw new ArgumentNullException("ignoredFolderNameFilter"); } if (invalidFoderNameFilter == null) { throw new ArgumentNullException("invalidFoderNameFilter"); } if (symlinkFilter == null) { throw new ArgumentNullException("symlinkFilter"); } this.ignoredFoldersFilter = ignoredFoldersFilter; this.ignoredFileNameFilter = ignoredFileNameFilter; this.ignoredFolderNameFilter = ignoredFolderNameFilter; this.invalidFolderNameFilter = invalidFoderNameFilter; this.symlinkFilter = symlinkFilter; }
/// <summary> /// Initializes a new instance of the <see cref="CmisSync.Lib.Producer.Crawler.CrawlEventNotifier"/> class. /// </summary> /// <param name="queue">Sync event queue which should be notified about the crawled events.</param> public CrawlEventNotifier(ISyncEventQueue queue) { if (queue == null) { throw new ArgumentNullException("queue"); } this.queue = queue; }
/// <summary> /// Initializes a new instance of the <see cref="ReportingFilter"/> class. /// </summary> /// <param name="queue">Sync Event Queue to put work on.</param> /// <param name="ignoredFoldersFilter">Ignored folders filter.</param> /// <param name="ignoredFileNameFilter">Ignored file name filter.</param> /// <param name="ignoredFolderNameFilter">Ignored folder name filter.</param> /// <param name="invalidFoderNameFilter">Invalid folder name filter</param> public ReportingFilter( ISyncEventQueue queue, IgnoredFoldersFilter ignoredFoldersFilter, IgnoredFileNamesFilter ignoredFileNameFilter, IgnoredFolderNameFilter ignoredFolderNameFilter, InvalidFolderNameFilter invalidFoderNameFilter) : base(queue) { if (ignoredFoldersFilter == null) { throw new ArgumentNullException("Given folder filter is null"); } if (ignoredFileNameFilter == null) { throw new ArgumentNullException("Given file name filter is null"); } if (ignoredFolderNameFilter == null) { throw new ArgumentNullException("Given folder name filter is null"); } if (invalidFoderNameFilter == null) { throw new ArgumentNullException("Given invalid folder name filter is null"); } this.ignoredFoldersFilter = ignoredFoldersFilter; this.ignoredFileNameFilter = ignoredFileNameFilter; this.ignoredFolderNameFilter = ignoredFolderNameFilter; this.invalidFolderNameFilter = invalidFoderNameFilter; }
/// <summary> /// Initializes a new instance of the <see cref="CmisSync.Lib.Sync.Strategy.ContentChangeEventAccumulator"/> class. /// </summary> /// <param name='session'> /// Cmis Session. /// </param> /// <param name='queue'> /// The ISyncEventQueue. /// </param> /// <exception cref='ArgumentNullException'> /// Is thrown when an argument passed to a method is invalid because it is <see langword="null" /> . /// </exception> public ContentChangeEventAccumulator(ISession session, ISyncEventQueue queue) : base(queue) { if (session == null) { throw new ArgumentNullException("session"); } this.session = session; }
/// <summary> /// Initializes a new instance of the <see cref="DescendantsCrawler"/> class. /// </summary> /// <param name="queue">Sync Event Queue.</param> /// <param name="remoteFolder">Remote folder.</param> /// <param name="localFolder">Local folder.</param> /// <param name="storage">Meta data storage.</param> /// <param name="filter">Aggregated filter.</param> /// <param name="activityListener">Activity listner.</param> public DescendantsCrawler( ISyncEventQueue queue, IFolder remoteFolder, IDirectoryInfo localFolder, IMetaDataStorage storage, IFilterAggregator filter, IActivityListener activityListener, IIgnoredEntitiesStorage ignoredStorage) : base(queue) { if (remoteFolder == null) { throw new ArgumentNullException("remoteFolder"); } if (localFolder == null) { throw new ArgumentNullException("localFolder"); } if (storage == null) { throw new ArgumentNullException("storage"); } if (filter == null) { throw new ArgumentNullException("filter"); } if (activityListener == null) { throw new ArgumentNullException("activityListener"); } this.activityListener = activityListener; this.treebuilder = new DescendantsTreeBuilder(storage, remoteFolder, localFolder, filter, ignoredStorage); this.eventGenerator = new CrawlEventGenerator(storage); this.notifier = new CrawlEventNotifier(queue); }
/// <summary> /// Initializes a new instance of the <see cref="RemoteObjectMovedOrRenamedAccumulator"/> class. /// </summary> /// <param name="queue">Sync event queue.</param> /// <param name="storage">Meta data storage.</param> /// <param name="fsFactory">FileSystemInfo factory.</param> public RemoteObjectMovedOrRenamedAccumulator(ISyncEventQueue queue, IMetaDataStorage storage, IFileSystemInfoFactory fsFactory = null) : base(queue) { if (storage == null) { throw new ArgumentNullException("storage"); } this.storage = storage; this.fsFactory = fsFactory == null ? new FileSystemInfoFactory() : fsFactory; }
protected override WatcherData GetWatcherData(string pathname, ISyncEventQueue queue) { WatcherData watcherData = new WatcherData(); watcherData.Data = new Tuple <FileSystemWatcher, IMetaDataStorage>(new FileSystemWatcher(pathname), this.storage.Object); watcherData.Watcher = new NetWatcher((watcherData.Data as Tuple <FileSystemWatcher, IMetaDataStorage>).Item1, queue, this.storage.Object); return(watcherData); }
/// <summary> /// Initializes a new instance of the <see cref="RenamedFileSystemEventHandler"/> class. /// </summary> /// <param name="queue">Sync event queue to report the events to.</param> /// <param name="fsFactory">File system factory.</param> public RenamedFileSystemEventHandler(ISyncEventQueue queue, IFileSystemInfoFactory fsFactory = null) { if (queue == null) { throw new ArgumentNullException("queue"); } this.queue = queue; this.fsFactory = fsFactory ?? new FileSystemInfoFactory(); }
protected override WatcherData GetWatcherData(string pathname, ISyncEventQueue queue) { WatcherData watcherData = new WatcherData(); watcherData.Data = new EventQueue(queue); watcherData.Watcher = new MacWatcher(pathname, watcherData.Data as ISyncEventQueue, TimeSpan.FromMilliseconds(100)); return(watcherData); }
/// <summary> /// Initializes a new instance of the <see cref="CmisSync.Lib.Queueing.AbstractEventProducer"/> class. /// </summary> /// <param name='queue'> /// The queue which could be used to pass events to. /// </param> public AbstractEventProducer(ISyncEventQueue queue) { if (queue == null) { throw new ArgumentNullException("The given event queue must no be null"); } this.Queue = queue; }
/// <summary> /// Initializes a new instance of the <see cref="CmisSync.Lib.Sync.Strategy.ContentChangeEventAccumulator"/> class. /// </summary> /// <param name='session'> /// Cmis Session. /// </param> /// <param name='queue'> /// The ISyncEventQueue. /// </param> /// <exception cref='ArgumentNullException'> /// Is thrown when an argument passed to a method is invalid because it is <see langword="null" /> . /// </exception> public ContentChangeEventAccumulator(ISession session, ISyncEventQueue queue) : base(queue) { if (session == null) { throw new ArgumentNullException("Session instance is needed for the ContentChangeEventAccumulator, but was null"); } this.session = session; }
public HandlerMockWithoutTimerAction( ISyncEventQueue queue, IMetaDataStorage storage, IFileSystemInfoFactory fsFactory) : base(queue, storage, fsFactory, 10) { this.timer.Dispose(); this.timer = new Timer(); this.timer.AutoReset = false; }
/// <summary> /// Initializes a new instance of the <see cref="EventManagerInitializer"/> class. /// </summary> /// <param name='queue'>The SyncEventQueue.</param> /// <param name='storage'>Storage for Metadata.</param> /// <param name='fileTransmissionStorage'>Storage for file transmissions.</param> /// <param name='ignoredStorage'>Storage for ignored entities.</param> /// <param name='repoInfo'>Repo info.</param> /// <param name='filter'>Filter aggregation.</param> /// <param name='activityListner'>Listener for Sync activities.</param> /// <param name='fsFactory'>File system factory.</param> /// <exception cref='ArgumentNullException'> /// Is thrown when an argument passed to a method is invalid because it is <see langword="null" /> . /// </exception> public EventManagerInitializer( ISyncEventQueue queue, IMetaDataStorage storage, IFileTransmissionStorage fileTransmissionStorage, IIgnoredEntitiesStorage ignoredStorage, RepoInfo repoInfo, IFilterAggregator filter, ActivityListenerAggregator activityListener, IFileSystemInfoFactory fsFactory = null) : base(queue) { if (storage == null) { throw new ArgumentNullException("storage"); } if (fileTransmissionStorage == null) { throw new ArgumentNullException("fileTransmissionStorage"); } if (repoInfo == null) { throw new ArgumentNullException("repoInfo"); } if (filter == null) { throw new ArgumentNullException("filter"); } if (activityListener == null) { throw new ArgumentNullException("activityListener"); } if (ignoredStorage == null) { throw new ArgumentNullException("ignoredStorage", "Given storage for ignored entries is null"); } if (fsFactory == null) { this.fileSystemFactory = new FileSystemInfoFactory(); } else { this.fileSystemFactory = fsFactory; } this.filter = filter; this.repoInfo = repoInfo; this.storage = storage; this.ignoredStorage = ignoredStorage; this.fileTransmissionStorage = fileTransmissionStorage; this.activityListener = activityListener; }
/// <summary> /// Initializes a new instance of the <see cref="RenamedFileSystemEventHandler"/> class. /// </summary> /// <param name="queue">Sync event queue to report the events to.</param> /// <param name="fsFactory">File system factory.</param> public RenamedFileSystemEventHandler(ISyncEventQueue queue, IFileSystemInfoFactory fsFactory = null) { if (queue == null) { throw new ArgumentNullException("Given queue is null"); } this.queue = queue; this.fsFactory = fsFactory ?? new FileSystemInfoFactory(); }
/// <summary> /// Initializes a new instance of the <see cref="SyncMechanism"/> class. /// </summary> /// <param name="localSituation">Local situation.</param> /// <param name="remoteSituation">Remote situation.</param> /// <param name="queue">Sync event queue.</param> /// <param name="session">CMIS Session.</param> /// <param name="storage">Meta data storage.</param> /// <param name="transmissionStorage">File transmission storage.</param> /// <param name="activityListener">Active sync progress listener.</param> /// <param name="filters">Ignore filter.</param> /// <param name="solver">Solver for custom solver matrix.</param> public SyncMechanism( ISituationDetection <AbstractFolderEvent> localSituation, ISituationDetection <AbstractFolderEvent> remoteSituation, ISyncEventQueue queue, ISession session, IMetaDataStorage storage, IFileTransmissionStorage transmissionStorage, ActivityListenerAggregator activityListener, IFilterAggregator filters, ISolver[,] solver = null) : base(queue) { if (session == null) { throw new ArgumentNullException("session"); } if (storage == null) { throw new ArgumentNullException("storage"); } if (transmissionStorage == null) { throw new ArgumentNullException("transmissionStorage"); } if (localSituation == null) { throw new ArgumentNullException("localSituation"); } if (remoteSituation == null) { throw new ArgumentNullException("remoteSituation"); } if (activityListener == null) { throw new ArgumentNullException("activityListener"); } if (filters == null) { throw new ArgumentNullException("filters"); } this.session = session; this.storage = storage; this.transmissionStorage = transmissionStorage; this.LocalSituation = localSituation; this.RemoteSituation = remoteSituation; this.activityListener = activityListener; this.filters = filters; this.Solver = solver == null?this.CreateSolver() : solver; }
/// <summary> /// Initializes a new instance of the <see cref="CmisSync.Lib.SelectiveIgnore.IgnoreFlagChangeDetection"/> class. /// </summary> /// <param name="ignores">Storage for ignores.</param> /// <param name="matcher">Path matcher.</param> /// <param name="queue">Sync Event Queue.</param> public IgnoreFlagChangeDetection(IIgnoredEntitiesStorage ignores, IPathMatcher matcher, ISyncEventQueue queue) : base(queue) { if (ignores == null) { throw new ArgumentNullException("ignores"); } if (matcher == null) { throw new ArgumentNullException("matcher"); } this.ignores = ignores; this.matcher = matcher; }
public SelectiveIgnoreEventTransformer(IIgnoredEntitiesCollection ignores, ISyncEventQueue queue) { if (queue == null) { throw new ArgumentNullException("queue"); } if (ignores == null) { throw new ArgumentNullException("ignores"); } this.ignores = ignores; this.queue = queue; }
/// <summary> /// Initializes a new instance of the <see cref="CmisSync.Lib.Sync.Strategy.ContentChangeEventTransformer"/> class. /// </summary> /// <param name='queue'> /// The ISyncEventQueue. /// </param> /// <param name='storage'> /// The MetaDataStorage. /// </param> /// <param name='fsFactory'> /// Fs factory can be null. /// </param> /// <exception cref='ArgumentNullException'> /// Is thrown when an argument passed to a method is invalid because it is <see langword="null" /> . /// </exception> public ContentChangeEventTransformer(ISyncEventQueue queue, IMetaDataStorage storage, IFileSystemInfoFactory fsFactory = null) : base(queue) { if (storage == null) { throw new ArgumentNullException("storage"); } this.storage = storage; if (fsFactory == null) { this.fsFactory = new FileSystemInfoFactory(); } else { this.fsFactory = fsFactory; } }
/// <summary> /// Initializes a new instance of the <see cref="SyncMechanism"/> class. /// </summary> /// <param name="localSituation">Local situation.</param> /// <param name="remoteSituation">Remote situation.</param> /// <param name="queue">Sync event queue.</param> /// <param name="session">CMIS Session.</param> /// <param name="storage">Meta data storage.</param> /// <param name="activityListener">Active sync progress listener.</param> /// <param name="solver">Solver for custom solver matrix.</param> /// <param name="isServerAbleToUpdateModificationDate">Enables the modification date sync feature.</param> public SyncMechanism( ISituationDetection <AbstractFolderEvent> localSituation, ISituationDetection <AbstractFolderEvent> remoteSituation, ISyncEventQueue queue, ISession session, IMetaDataStorage storage, ActivityListenerAggregator activityListener, IFilterAggregator filters, ISolver[,] solver = null, bool isServerAbleToUpdateModificationDate = false) : base(queue) { if (session == null) { throw new ArgumentNullException("Given session is null"); } if (storage == null) { throw new ArgumentNullException("Given storage is null"); } if (localSituation == null) { throw new ArgumentNullException("Given local situation detection is null"); } if (remoteSituation == null) { throw new ArgumentNullException("Given remote situation detection is null"); } if (activityListener == null) { throw new ArgumentNullException("Given activity listener is null"); } if (filters == null) { throw new ArgumentNullException("Given filter aggregator is null"); } this.session = session; this.storage = storage; this.LocalSituation = localSituation; this.RemoteSituation = remoteSituation; this.activityListener = activityListener; this.isServerAbleToUpdateModificationDate = isServerAbleToUpdateModificationDate; this.filters = filters; this.Solver = solver == null?this.CreateSolver() : solver; }
/// <summary> /// Initializes a new instance of the <see cref="SyncMechanism"/> class. /// </summary> /// <param name="localSituation">Local situation.</param> /// <param name="remoteSituation">Remote situation.</param> /// <param name="queue">Sync event queue.</param> /// <param name="session">CMIS Session.</param> /// <param name="storage">Meta data storage.</param> /// <param name="transmissionStorage">File transmission storage.</param> /// <param name="activityListener">Active sync progress listener.</param> /// <param name="filters">Ignore filter.</param> /// <param name="solver">Solver for custom solver matrix.</param> public SyncMechanism( ISituationDetection<AbstractFolderEvent> localSituation, ISituationDetection<AbstractFolderEvent> remoteSituation, ISyncEventQueue queue, ISession session, IMetaDataStorage storage, IFileTransmissionStorage transmissionStorage, ActivityListenerAggregator activityListener, IFilterAggregator filters, ISolver[,] solver = null) : base(queue) { if (session == null) { throw new ArgumentNullException("session"); } if (storage == null) { throw new ArgumentNullException("storage"); } if (transmissionStorage == null) { throw new ArgumentNullException("transmissionStorage"); } if (localSituation == null) { throw new ArgumentNullException("localSituation"); } if (remoteSituation == null) { throw new ArgumentNullException("remoteSituation"); } if (activityListener == null) { throw new ArgumentNullException("activityListener"); } if (filters == null) { throw new ArgumentNullException("filters"); } this.session = session; this.storage = storage; this.transmissionStorage = transmissionStorage; this.LocalSituation = localSituation; this.RemoteSituation = remoteSituation; this.activityListener = activityListener; this.filters = filters; this.Solver = solver == null ? this.CreateSolver() : solver; }
/// <summary> /// Initializes a new instance of the <see cref="CmisSync.Lib.Queueing.SyncScheduler"/> class. /// Starts adding events automatically after successful creation. /// </summary> /// <param name="queue">Sync event queue.</param> /// <param name="pollInterval">Poll interval.</param> public SyncScheduler(ISyncEventQueue queue, double pollInterval = 5000) { if (queue == null) { throw new ArgumentNullException("queue"); } if (pollInterval <= 0) { throw new ArgumentException("pollinterval must be greater than zero", "pollInterval"); } this.interval = pollInterval; this.queue = queue; this.timer = new Timer(this.interval); this.timer.Elapsed += delegate(object sender, ElapsedEventArgs e) { this.queue.AddEvent(new StartNextSyncEvent()); }; }
/// <summary> /// Initializes a new instance of the <see cref="NetWatcher"/> class. /// Takes the given file system watcher and listens for events and passes them to the given queue /// </summary> /// <param name="watcher">File System Watcher.</param> /// <param name="queue">Queue for the occured events.</param> /// <param name="storage">Meta Data Storage to verify, if a deleted object is a file or folder.</param> /// <param name="fsFactory">File system info factory. If factory is null, the normal file system is used, otherwise the given factory.</param> public NetWatcher( FileSystemWatcher watcher, ISyncEventQueue queue, IMetaDataStorage storage, FileSystemInfoFactory fsFactory = null) { if (watcher == null) { throw new ArgumentNullException("The given fs watcher must not be null"); } if (string.IsNullOrEmpty(watcher.Path)) { throw new ArgumentException("The given watcher must contain a path, where it is listening"); } if (queue == null) { throw new ArgumentNullException("The given queue must not be null"); } if (storage == null) { throw new ArgumentNullException("The given storage must not be null"); } this.fsFactory = fsFactory ?? new FileSystemInfoFactory(); this.queue = queue; this.storage = storage; this.fileSystemWatcher = watcher; this.fileSystemWatcher.IncludeSubdirectories = true; this.fileSystemWatcher.Filter = "*"; this.fileSystemWatcher.InternalBufferSize = 4 * 1024 * 16; this.fileSystemWatcher.NotifyFilter = NotifyFilters.Size | NotifyFilters.FileName | NotifyFilters.DirectoryName | NotifyFilters.LastWrite | NotifyFilters.Security; this.createChangeDeleteHandler = new CreatedChangedDeletedFileSystemEventHandler(this.queue, this.storage, this.fsFactory); this.renamedHandler = new RenamedFileSystemEventHandler(this.queue, this.fsFactory); this.fileSystemWatcher.Created += new FileSystemEventHandler(this.createChangeDeleteHandler.Handle); this.fileSystemWatcher.Deleted += new FileSystemEventHandler(this.createChangeDeleteHandler.Handle); this.fileSystemWatcher.Changed += new FileSystemEventHandler(this.createChangeDeleteHandler.Handle); this.fileSystemWatcher.Renamed += new RenamedEventHandler(this.renamedHandler.Handle); }
/// <summary> /// Initializes a new instance of the <see cref="CmisSync.Lib.Producer.Crawler.DescendantsCrawler"/> class based on its internal classes. /// This is mostly usefull for Unit Testing /// </summary> /// <param name='queue'> /// The event queue. /// </param> /// <param name='builder'> /// The DescendantsTreeBuilder. /// </param> /// <param name='generator'> /// The CrawlEventGenerator. /// </param> /// <param name="notifier"> /// Event Notifier. /// </param> /// <param name='activityListener'> /// Activity listener. /// </param> /// <exception cref='ArgumentNullException'> /// <attribution license="cc4" from="Microsoft" modified="false" /><para>The exception that is thrown when a /// null reference (Nothing in Visual Basic) is passed to a method that does not accept it as a valid argument. </para> /// </exception> public DescendantsCrawler( ISyncEventQueue queue, IDescendantsTreeBuilder builder, CrawlEventGenerator generator, CrawlEventNotifier notifier, IActivityListener activityListener) : base(queue) { if (activityListener == null) { throw new ArgumentNullException("activityListener"); } this.activityListener = activityListener; this.treebuilder = builder; this.eventGenerator = generator; this.notifier = notifier; }
/// <summary> /// Initializes a new instance of the <see cref="CmisSync.Lib.Queueing.SyncScheduler"/> class. /// Starts adding events automatically after successful creation. /// </summary> /// <param name="queue">Sync event queue.</param> /// <param name="pollInterval">Poll interval.</param> public SyncScheduler(ISyncEventQueue queue, double pollInterval = 5000) { if (queue == null) { throw new ArgumentNullException("Given queue must not be null"); } if (pollInterval <= 0) { throw new ArgumentException("pollinterval must be greater than zero"); } this.interval = pollInterval; this.queue = queue; this.timer = new Timer(this.interval); this.timer.Elapsed += delegate(object sender, ElapsedEventArgs e) { this.queue.AddEvent(new StartNextSyncEvent()); }; }
/// <summary> /// Initializes a new instance of the <see cref="EventManagerInitializer"/> class. /// </summary> /// <param name='queue'>The SyncEventQueue.</param> /// <param name='storage'>Storage for Metadata.</param> /// <param name='repoInfo'>Repo info.</param> /// <param name="filter">Filter aggregation.</param> /// <param name='activityListner'>Listener for Sync activities.</param> /// <param name='fsFactory'>File system factory.</param> /// <exception cref='ArgumentNullException'> /// Is thrown when an argument passed to a method is invalid because it is <see langword="null" /> . /// </exception> public EventManagerInitializer( ISyncEventQueue queue, IMetaDataStorage storage, RepoInfo repoInfo, IFilterAggregator filter, ActivityListenerAggregator activityListener, IFileSystemInfoFactory fsFactory = null) : base(queue) { if (storage == null) { throw new ArgumentNullException("storage null"); } if (repoInfo == null) { throw new ArgumentNullException("Repoinfo null"); } if (filter == null) { throw new ArgumentNullException("Filter null"); } if (activityListener == null) { throw new ArgumentNullException("Given activityListener is null"); } if (fsFactory == null) { this.fileSystemFactory = new FileSystemInfoFactory(); } else { this.fileSystemFactory = fsFactory; } this.filter = filter; this.repoInfo = repoInfo; this.storage = storage; this.activityListener = activityListener; }
/// <summary> /// Initializes a new instance of the <see cref="CmisSync.Lib.Consumer.SituationSolver.LocalObjectChanged"/> class. /// </summary> /// <param name="session">Cmis session.</param> /// <param name="storage">Meta data storage.</param> /// <param name="queue">Event queue for publishing upload transmission.</param> /// <param name="transmissionManager">Transmission manager.</param> /// <param name="serverCanModifyCreationAndModificationDate">If set to <c>true</c> server can modify creation and modification date.</param> public LocalObjectChanged( ISession session, IMetaDataStorage storage, ISyncEventQueue queue, ActiveActivitiesManager transmissionManager, bool serverCanModifyCreationAndModificationDate = false) : base(session, storage, serverCanModifyCreationAndModificationDate) { if (queue == null) { throw new ArgumentNullException("Given queue is null"); } if (transmissionManager == null) { throw new ArgumentNullException("Given transmission manager is null"); } this.queue = queue; this.transmissionManager = transmissionManager; }
/// <summary> /// Initializes a new instance of the <see cref="NetWatcher"/> class. /// Takes the given file system watcher and listens for events and passes them to the given queue /// </summary> /// <param name="watcher">File System Watcher.</param> /// <param name="queue">Queue for the occured events.</param> /// <param name="storage">Meta Data Storage to verify, if a deleted object is a file or folder.</param> /// <param name="fsFactory">File system info factory. If factory is null, the normal file system is used, otherwise the given factory.</param> public NetWatcher( FileSystemWatcher watcher, ISyncEventQueue queue, IMetaDataStorage storage, FileSystemInfoFactory fsFactory = null) { if (watcher == null) { throw new ArgumentNullException("watcher"); } if (string.IsNullOrEmpty(watcher.Path)) { throw new ArgumentException("The given watcher must contain a path, where it is listening"); } if (queue == null) { throw new ArgumentNullException("queue"); } if (storage == null) { throw new ArgumentNullException("storage"); } this.fsFactory = fsFactory ?? new FileSystemInfoFactory(); this.queue = queue; this.storage = storage; this.fileSystemWatcher = watcher; this.fileSystemWatcher.IncludeSubdirectories = true; this.fileSystemWatcher.Filter = "*"; this.fileSystemWatcher.InternalBufferSize = 4 * 1024 * 16; this.fileSystemWatcher.NotifyFilter = NotifyFilters.Size | NotifyFilters.FileName | NotifyFilters.DirectoryName | NotifyFilters.LastWrite | NotifyFilters.Security; this.createChangeDeleteHandler = new CreatedChangedDeletedFileSystemEventHandler(this.queue, this.storage, this.fsFactory); this.renamedHandler = new RenamedFileSystemEventHandler(this.queue, this.fsFactory); this.fileSystemWatcher.Created += new FileSystemEventHandler(this.createChangeDeleteHandler.Handle); this.fileSystemWatcher.Deleted += new FileSystemEventHandler(this.createChangeDeleteHandler.Handle); this.fileSystemWatcher.Changed += new FileSystemEventHandler(this.createChangeDeleteHandler.Handle); this.fileSystemWatcher.Renamed += new RenamedEventHandler(this.renamedHandler.Handle); }
/// <summary> /// Initializes a new instance of the <see cref="CmisSync.Lib.Consumer.SituationSolver.RemoteObjectChanged"/> class. /// </summary> /// <param name="session">Cmis session.</param> /// <param name="storage">Meta data storage.</param> /// <param name="queue">Event Queue to report transmission events to.</param> /// <param name="transmissonManager">Transmisson manager.</param> /// <param name="fsFactory">File System Factory.</param> public RemoteObjectChanged( ISession session, IMetaDataStorage storage, ISyncEventQueue queue, ActiveActivitiesManager transmissonManager, IFileSystemInfoFactory fsFactory = null) : base(session, storage) { if (queue == null) { throw new ArgumentNullException("Given queue is null"); } if (transmissonManager == null) { throw new ArgumentNullException("Given transmission manager is null"); } this.queue = queue; this.transmissonManager = transmissonManager; this.fsFactory = fsFactory ?? new FileSystemInfoFactory(); }
/// <summary> /// Initializes a new instance of the <see cref="CmisSync.Lib.Queueing.ConnectionScheduler"/> class. /// </summary> /// <param name="repoInfo">Repo info.</param> /// <param name="queue">Queue.</param> /// <param name="sessionFactory">Session factory.</param> /// <param name="authProvider">Auth provider.</param> /// <param name="interval">Interval.</param> public ConnectionScheduler( RepoInfo repoInfo, ISyncEventQueue queue, ISessionFactory sessionFactory, IAuthenticationProvider authProvider, int interval = 5000) { if (interval <= 0) { throw new ArgumentException(string.Format("Given Interval \"{0}\" is smaller or equal to null", interval)); } if (repoInfo == null) { throw new ArgumentNullException("Given repo info is null"); } if (queue == null) { throw new ArgumentNullException("Given queue is null"); } if (sessionFactory == null) { throw new ArgumentNullException("Given session factory is null"); } if (authProvider == null) { throw new ArgumentNullException("Given authentication provider is null"); } this.Queue = queue; this.SessionFactory = sessionFactory; this.RepoInfo = repoInfo; this.AuthProvider = authProvider; this.Interval = interval; }
/// <summary> /// Initializes a new instance of the /// <see cref="CreatedChangedDeletedFileSystemEventHandler"/> class. /// </summary> /// <param name="queue">Sync event queue.</param> /// <param name="storage">Meta data storage.</param> /// <param name="fsFactory">File system info factory.</param> /// <param name="threshold">Delay after which a deleted event is passed to the queue.</param> public CreatedChangedDeletedFileSystemEventHandler( ISyncEventQueue queue, IMetaDataStorage storage, IFileSystemInfoFactory fsFactory = null, long threshold = 100) { if (queue == null) { throw new ArgumentNullException("queue"); } if (storage == null) { throw new ArgumentNullException("storage"); } this.queue = queue; this.storage = storage; this.threshold = threshold; this.fsFactory = fsFactory ?? new FileSystemInfoFactory(); this.events = new List<Tuple<FileSystemEventArgs, Guid, DateTime, bool>>(); this.timer = new Timer(); this.timer.AutoReset = false; this.timer.Elapsed += (sender, e) => this.PopEventsFromList(); }
protected override WatcherData GetWatcherData(string pathname, ISyncEventQueue queue) { WatcherData watcherData = new WatcherData(); watcherData.Data = new EventQueue(queue); watcherData.Watcher = new MacWatcher(pathname, watcherData.Data as ISyncEventQueue, TimeSpan.FromMilliseconds(100)); return watcherData; }
public EventQueue(ISyncEventQueue queue) { Queue = queue; }
protected override WatcherData GetWatcherData(string pathname, ISyncEventQueue queue) { WatcherData watcherData = new WatcherData(); watcherData.Data = new Tuple<FileSystemWatcher, IMetaDataStorage>(new FileSystemWatcher(pathname), this.storage.Object); watcherData.Watcher = new NetWatcher((watcherData.Data as Tuple<FileSystemWatcher, IMetaDataStorage>).Item1, queue, this.storage.Object); return watcherData; }
/// <summary> /// Initializes a new instance of the <see cref="WatcherConsumer"/> class. /// </summary> /// <param name='queue'> /// Queue where the FSEvents and also the FileEvents and FolderEvents are reported. /// </param> public WatcherConsumer(ISyncEventQueue queue) : base(queue) { }
/// <summary> /// Initializes a new instance of the <see cref="CmisSync.Lib.Queueing.DelayRetryAndNextSyncEventHandler"/> class. /// </summary> /// <param name='queue'> /// The SyncEventQueue. /// </param> public DelayRetryAndNextSyncEventHandler(ISyncEventQueue queue) : base(queue) { }
protected virtual WatcherData GetWatcherData(string pathname, ISyncEventQueue queue) { Assert.Fail("to be implemented in sub class"); return new WatcherData(); }
/// <summary> /// Initializes a new instance of the <see cref="CmisSync.Lib.Sync.Strategy.MacWatcher"/> class. /// The default latency is set to 1 second. /// </summary> /// <param name="pathname">Path to be monitored.</param> /// <param name="queue">Queue to pass the new events to.</param> public MacWatcher(string pathname, ISyncEventQueue queue) : this(pathname, queue, TimeSpan.FromSeconds(1)) { }
/// <summary> /// Initializes a new instance of the <see cref="CmisSync.Lib.Sync.Strategy.MacWatcher"/> class. /// </summary> /// <param name="pathname">Path to be monitored.</param> /// <param name="queue">Queue to pass the new events to.</param> /// <param name="latency">Maximum latency for file system events.</param> public MacWatcher(string pathname, ISyncEventQueue queue, TimeSpan latency) { if (string.IsNullOrEmpty(pathname)) { throw new ArgumentNullException("pathname", "The given fs stream must not be null"); } if (queue == null) { throw new ArgumentNullException("queue", "The given queue must not be null"); } this.Queue = queue; this.RunLoopThread = new Thread(() => { this.RunLoop = NSRunLoop.Current; while (!this.StopRunLoop) { this.RunLoop.RunUntil(NSDate.FromTimeIntervalSinceNow(1)); this.CleanLastRenameEvent(); } }); this.RunLoopThread.Start(); while (RunLoop == null) { Thread.Sleep(10); } this.FsStream = new FSEventStream(new [] { pathname }, latency, FSEventStreamCreateFlags.FileEvents); this.EnableEvents = false; this.FsStream.ScheduleWithRunLoop(this.RunLoop); }