コード例 #1
0
        /// <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;
        }
コード例 #2
0
        /// <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;
        }
コード例 #3
0
        /// <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();
        }
コード例 #4
0
        /// <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;
        }
コード例 #5
0
        /// <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);
        }
コード例 #6
0
        /// <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;
        }
コード例 #7
0
        /// <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;
        }
コード例 #8
0
        /// <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;
        }
コード例 #9
0
        /// <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;
        }
コード例 #10
0
        /// <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;
        }
コード例 #11
0
        /// <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;
        }
コード例 #12
0
        /// <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);
        }
コード例 #13
0
        /// <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;
        }
コード例 #14
0
        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);
        }
コード例 #15
0
        /// <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();
        }
コード例 #16
0
        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);
        }
コード例 #17
0
        /// <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;
        }
コード例 #18
0
        /// <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;
        }
コード例 #19
0
        /// <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;
        }
コード例 #20
0
        /// <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;
        }
コード例 #21
0
        /// <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;
 }
コード例 #23
0
        /// <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;
        }
コード例 #24
0
        /// <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;
        }
コード例 #25
0
        /// <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;
        }
コード例 #26
0
        /// <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;
        }
コード例 #27
0
        /// <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();
        }
コード例 #28
0
        /// <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;
        }
コード例 #29
0
        /// <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;
        }
コード例 #30
0
        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;
        }
コード例 #31
0
        /// <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;
            }
        }
コード例 #32
0
ファイル: SyncMechanism.cs プロジェクト: sunxk/CmisSync
        /// <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;
        }
コード例 #33
0
        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;
        }
コード例 #34
0
        /// <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;
        }
コード例 #35
0
        /// <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());
            };
        }
コード例 #36
0
ファイル: NetWatcher.cs プロジェクト: sunxk/CmisSync
        /// <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);
        }
コード例 #37
0
        /// <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;
        }
コード例 #38
0
        /// <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;
            }
        }
コード例 #39
0
        /// <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());
            };
        }
コード例 #40
0
        /// <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;
        }
コード例 #41
0
        /// <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;
        }
コード例 #42
0
ファイル: NetWatcher.cs プロジェクト: OpenDataSpace/CmisSync
        /// <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);
        }
コード例 #43
0
        /// <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();
        }
コード例 #44
0
        /// <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);
        }
コード例 #45
0
        /// <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;
        }
コード例 #46
0
        /// <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();
        }
コード例 #48
0
        /// <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;
        }
 public HandlerMockWithoutTimerAction(
     ISyncEventQueue queue,
     IMetaDataStorage storage,
     IFileSystemInfoFactory fsFactory) : base(queue, storage, fsFactory, 10) {
     this.timer.Dispose();
     this.timer = new Timer();
     this.timer.AutoReset = false;
 }
コード例 #50
0
 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;
 }
コード例 #51
0
 public EventQueue(ISyncEventQueue queue) {
     Queue = queue;
 }
コード例 #52
0
 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;
 }
コード例 #53
0
 /// <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) {
 }
コード例 #54
0
        /// <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;
        }
コード例 #55
0
 /// <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) {
 }
コード例 #56
0
 protected virtual WatcherData GetWatcherData(string pathname, ISyncEventQueue queue) {
     Assert.Fail("to be implemented in sub class");
     return new WatcherData();
 }
コード例 #57
0
ファイル: MacWatcher.cs プロジェクト: OpenDataSpace/CmisSync
 /// <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)) {
 }
コード例 #58
0
ファイル: MacWatcher.cs プロジェクト: OpenDataSpace/CmisSync
        /// <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);
        }