/// <summary>
        /// Initializes a new instance of the <see cref="CmisSync.Lib.FileTransmission.ChunkedDownloader"/> class.
        /// </summary>
        /// <param name="chunkSize">Chunk size.</param>
        /// <param name="storage"><c>IFileTransmissionStorage</c> to persist</param>
        public ChunkedDownloader(long chunkSize = 1024 * 1024, IFileTransmissionStorage storage = null) {
            if (chunkSize <= 0) {
                throw new ArgumentException("The chunk size must be a positive number and cannot be zero or less");
            }

            this.ChunkSize = chunkSize;
            this.Storage = storage;
        }
 public LocalObjectRenamedOrMovedRemoteObjectDeleted(
     ISession session,
     IMetaDataStorage storage,
     IFileTransmissionStorage transmissionStorage,
     TransmissionManager manager,
     ISolver secondSolver = null) : base(session, storage) {
         this.secondSolver = secondSolver ?? new LocalObjectAdded(session, storage, transmissionStorage, manager);
 }
 public LocalObjectRenamedOrMovedRemoteObjectDeleted(
     ISession session,
     IMetaDataStorage storage,
     IFileTransmissionStorage transmissionStorage,
     TransmissionManager manager,
     ISolver secondSolver = null) : base(session, storage)
 {
     this.secondSolver = secondSolver ?? new LocalObjectAdded(session, storage, transmissionStorage, manager);
 }
Esempio n. 4
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;
        }
Esempio n. 5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CmisSync.Lib.FileTransmission.ChunkedDownloader"/> class.
        /// </summary>
        /// <param name="chunkSize">Chunk size.</param>
        /// <param name="storage"><c>IFileTransmissionStorage</c> to persist</param>
        public ChunkedDownloader(long chunkSize = 1024 * 1024, IFileTransmissionStorage storage = null)
        {
            if (chunkSize <= 0)
            {
                throw new ArgumentException("The chunk size must be a positive number and cannot be zero or less");
            }

            this.ChunkSize = chunkSize;
            this.Storage   = storage;
        }
Esempio n. 6
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;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="CmisSync.Lib.Consumer.SituationSolver.PWC.AbstractEnhancedSolverWithPWC"/> class.
        /// </summary>
        /// <param name="session">Cmis Session.</param>
        /// <param name="storage">Meta Data Storage.</param>
        /// <param name="transmissionStorage">File Transmission Storage.</param>
        public AbstractEnhancedSolverWithPWC(
            ISession session,
            IMetaDataStorage storage,
            IFileTransmissionStorage transmissionStorage) : base(session, storage, transmissionStorage) {
            if (transmissionStorage == null) {
                throw new ArgumentNullException("Given transmission storage is null");
            }

            if (!session.ArePrivateWorkingCopySupported()) {
                throw new ArgumentException("Given session does not support private working copies");
            }
        }
        /// <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="transmissionManager">Transmission manager.</param>
        public LocalObjectChanged(
            ISession session,
            IMetaDataStorage storage,
            IFileTransmissionStorage transmissionStorage,
            ITransmissionManager transmissionManager) : base(session, storage, transmissionStorage)
        {
            if (transmissionManager == null) {
                throw new ArgumentNullException("transmissionManager");
            }

            this.transmissionManager = transmissionManager;
        }
        /// <summary>
        /// Initializes a new instance of the
        /// <see cref="CmisSync.Lib.Consumer.SituationSolver.LocalObjectChangedRemoteObjectChanged"/> class.
        /// </summary>
        /// <param name="session">Cmis session.</param>
        /// <param name="storage">Meta data storage.</param>
        /// <param name="transmissionStorage">Transmission storage.</param>
        /// <param name="transmissionManager">Transmission manager.</param>
        /// <param name="fsFactory">File system factory.</param>
        public LocalObjectChangedRemoteObjectChanged(
            ISession session,
            IMetaDataStorage storage,
            IFileTransmissionStorage transmissionStorage,
            ITransmissionManager transmissionManager,
            IFileSystemInfoFactory fsFactory = null) : base(session, storage, transmissionStorage) {
            if (transmissionManager == null) {
                throw new ArgumentNullException("transmissionManager");
            }

            this.transmissionManager = transmissionManager;
            this.fsFactory = fsFactory ?? new FileSystemInfoFactory();
        }
Esempio n. 10
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="transmissionManager">Transmission manager.</param>
        public LocalObjectChanged(
            ISession session,
            IMetaDataStorage storage,
            IFileTransmissionStorage transmissionStorage,
            ITransmissionManager transmissionManager) : base(session, storage, transmissionStorage)
        {
            if (transmissionManager == null)
            {
                throw new ArgumentNullException("transmissionManager");
            }

            this.transmissionManager = transmissionManager;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="CmisSync.Lib.Consumer.SituationSolver.PWC.AbstractEnhancedSolverWithPWC"/> class.
        /// </summary>
        /// <param name="session">Cmis Session.</param>
        /// <param name="storage">Meta Data Storage.</param>
        /// <param name="transmissionStorage">File Transmission Storage.</param>
        public AbstractEnhancedSolverWithPWC(
            ISession session,
            IMetaDataStorage storage,
            IFileTransmissionStorage transmissionStorage) : base(session, storage, transmissionStorage)
        {
            if (transmissionStorage == null)
            {
                throw new ArgumentNullException("Given transmission storage is null");
            }

            if (!session.ArePrivateWorkingCopySupported())
            {
                throw new ArgumentException("Given session does not support private working copies");
            }
        }
        /// <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="transmissonManager">Transmisson manager.</param>
        /// <param name="fsFactory">File System Factory.</param>
        public RemoteObjectChanged(
            ISession session,
            IMetaDataStorage storage,
            IFileTransmissionStorage transmissionStorage,
            TransmissionManager transmissonManager,
            IFileSystemInfoFactory fsFactory = null) : base(session, storage, transmissionStorage)
        {
            if (transmissonManager == null)
            {
                throw new ArgumentNullException("transmissonManager");
            }

            this.transmissonManager = transmissonManager;
            this.fsFactory          = fsFactory ?? new FileSystemInfoFactory();
        }
Esempio n. 13
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;
        }
        public LocalObjectChangedWithPWC(
            ISession session,
            IMetaDataStorage storage,
            IFileTransmissionStorage transmissionStorage,
            ITransmissionManager manager,
            ISolver folderOrFileContentUnchangedSolver) : base(session, storage, transmissionStorage) {
            if (folderOrFileContentUnchangedSolver == null) {
                throw new ArgumentNullException("folderOrFileContentUnchangedSolver", "Given solver for folder or unchanged file content situations is null");
            }

            if (!session.ArePrivateWorkingCopySupported()) {
                throw new ArgumentException("The given session does not support private working copies", "session");
            }

            this.folderOrFileContentUnchangedSolver = folderOrFileContentUnchangedSolver;
            this.transmissionManager = manager;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="CmisSync.Lib.Consumer.SituationSolver.PWC.LocalObjectAddedWithPWC"/> class.
        /// </summary>
        /// <param name="session">Cmis session.</param>
        /// <param name="storage">Meta data storage.</param>
        /// <param name="transmissionStorage">Transmission storage.</param>
        /// <param name="manager">Active activities manager.</param>
        /// <param name="localFolderOrEmptyFileAddedSolver">Local folder or empty file added solver.</param>
        public LocalObjectAddedWithPWC(
            ISession session,
            IMetaDataStorage storage,
            IFileTransmissionStorage transmissionStorage,
            ITransmissionManager manager,
            ISolver localFolderOrEmptyFileAddedSolver) : base(session, storage, transmissionStorage)
        {
            if (localFolderOrEmptyFileAddedSolver == null) {
                throw new ArgumentNullException("localFolderOrEmptyFileAddedSolver", "Given solver for locally added folders is null");
            }

            if (!session.ArePrivateWorkingCopySupported()) {
                throw new ArgumentException("Given session doesn't support private working copies", "session");
            }

            this.folderOrEmptyFileAddedSolver = localFolderOrEmptyFileAddedSolver;
            this.transmissionManager = manager;
        }
        /// <summary>
        /// Initializes a new instance of the
        /// <see cref="CmisSync.Lib.Consumer.SituationSolver.PWC.LocalObjectChangedRemoteObjectChangedWithPWC"/> class.
        /// </summary>
        /// <param name="session">Cmis session.</param>
        /// <param name="storage">Meta data storage.</param>
        /// <param name="transmissionStorage">Transmission storage.</param>
        /// <param name="manager">Transmission manager.</param>
        /// <param name="localObjectChangedRemoteObjectChangedFallbackSolver">Local object changed remote object changed fallback solver.</param>
        public LocalObjectChangedRemoteObjectChangedWithPWC(
            ISession session,
            IMetaDataStorage storage,
            IFileTransmissionStorage transmissionStorage,
            TransmissionManager manager,
            ISolver localObjectChangedRemoteObjectChangedFallbackSolver) : base(session, storage, transmissionStorage)
        {
            if (localObjectChangedRemoteObjectChangedFallbackSolver == null) {
                throw new ArgumentNullException("localObjectChangedRemoteObjectChangedFallbackSolver", "Given fallback solver is null");
            }

            if (!session.ArePrivateWorkingCopySupported()) {
                throw new ArgumentException("Given session does not support pwc updates", "session");
            }

            this.fallbackSolver = localObjectChangedRemoteObjectChangedFallbackSolver;
            this.transmissionManager = manager;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="CmisSync.Lib.Consumer.SituationSolver.AbstractEnhancedSolver"/> class.
        /// </summary>
        /// <param name="session">Cmis Session.</param>
        /// <param name="storage">Meta Data Storage.</param>
        /// <param name="transmissionStorage">File Transmission Storage.</param>
        public AbstractEnhancedSolver(
            ISession session,
            IMetaDataStorage storage,
            IFileTransmissionStorage transmissionStorage = null)
        {
            this.Storage = storage;
            if (session == null) {
                throw new ArgumentNullException("session");
            }

            if (storage == null) {
                throw new ArgumentNullException("storage");
            }

            this.Session = session;
            this.Storage = storage;
            this.TransmissionStorage = transmissionStorage;
            this.ServerCanModifyDateTimes = this.Session.IsServerAbleToUpdateModificationDate();
        }
Esempio n. 18
0
        public LocalObjectChangedWithPWC(
            ISession session,
            IMetaDataStorage storage,
            IFileTransmissionStorage transmissionStorage,
            ITransmissionManager manager,
            ISolver folderOrFileContentUnchangedSolver) : base(session, storage, transmissionStorage)
        {
            if (folderOrFileContentUnchangedSolver == null)
            {
                throw new ArgumentNullException("folderOrFileContentUnchangedSolver", "Given solver for folder or unchanged file content situations is null");
            }

            if (!session.ArePrivateWorkingCopySupported())
            {
                throw new ArgumentException("The given session does not support private working copies", "session");
            }

            this.folderOrFileContentUnchangedSolver = folderOrFileContentUnchangedSolver;
            this.transmissionManager = manager;
        }
        /// <summary>
        /// Initializes a new instance of the
        /// <see cref="CmisSync.Lib.Consumer.SituationSolver.PWC.LocalObjectChangedRemoteObjectChangedWithPWC"/> class.
        /// </summary>
        /// <param name="session">Cmis session.</param>
        /// <param name="storage">Meta data storage.</param>
        /// <param name="transmissionStorage">Transmission storage.</param>
        /// <param name="manager">Transmission manager.</param>
        /// <param name="localObjectChangedRemoteObjectChangedFallbackSolver">Local object changed remote object changed fallback solver.</param>
        public LocalObjectChangedRemoteObjectChangedWithPWC(
            ISession session,
            IMetaDataStorage storage,
            IFileTransmissionStorage transmissionStorage,
            TransmissionManager manager,
            ISolver localObjectChangedRemoteObjectChangedFallbackSolver) : base(session, storage, transmissionStorage)
        {
            if (localObjectChangedRemoteObjectChangedFallbackSolver == null)
            {
                throw new ArgumentNullException("localObjectChangedRemoteObjectChangedFallbackSolver", "Given fallback solver is null");
            }

            if (!session.ArePrivateWorkingCopySupported())
            {
                throw new ArgumentException("Given session does not support pwc updates", "session");
            }

            this.fallbackSolver      = localObjectChangedRemoteObjectChangedFallbackSolver;
            this.transmissionManager = manager;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="CmisSync.Lib.Consumer.SituationSolver.PWC.LocalObjectAddedWithPWC"/> class.
        /// </summary>
        /// <param name="session">Cmis session.</param>
        /// <param name="storage">Meta data storage.</param>
        /// <param name="transmissionStorage">Transmission storage.</param>
        /// <param name="manager">Active activities manager.</param>
        /// <param name="localFolderOrEmptyFileAddedSolver">Local folder or empty file added solver.</param>
        public LocalObjectAddedWithPWC(
            ISession session,
            IMetaDataStorage storage,
            IFileTransmissionStorage transmissionStorage,
            ITransmissionManager manager,
            ISolver localFolderOrEmptyFileAddedSolver) : base(session, storage, transmissionStorage)
        {
            if (localFolderOrEmptyFileAddedSolver == null)
            {
                throw new ArgumentNullException("localFolderOrEmptyFileAddedSolver", "Given solver for locally added folders is null");
            }

            if (!session.ArePrivateWorkingCopySupported())
            {
                throw new ArgumentException("Given session doesn't support private working copies", "session");
            }

            this.folderOrEmptyFileAddedSolver = localFolderOrEmptyFileAddedSolver;
            this.transmissionManager          = manager;
        }
Esempio n. 21
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CmisSync.Lib.Consumer.SituationSolver.AbstractEnhancedSolver"/> class.
        /// </summary>
        /// <param name="session">Cmis Session.</param>
        /// <param name="storage">Meta Data Storage.</param>
        /// <param name="transmissionStorage">File Transmission Storage.</param>
        public AbstractEnhancedSolver(
            ISession session,
            IMetaDataStorage storage,
            IFileTransmissionStorage transmissionStorage = null)
        {
            this.Storage = storage;
            if (session == null)
            {
                throw new ArgumentNullException("session");
            }

            if (storage == null)
            {
                throw new ArgumentNullException("storage");
            }

            this.Session                  = session;
            this.Storage                  = storage;
            this.TransmissionStorage      = transmissionStorage;
            this.ServerCanModifyDateTimes = this.Session.IsServerAbleToUpdateModificationDate();
        }
 public SolverClass(
     ISession session,
     IMetaDataStorage storage,
     IFileTransmissionStorage transmissionStorage = null) : base(session, storage, transmissionStorage) {
 }
Esempio n. 23
0
 /// <summary>
 /// Creates the downloader.
 /// </summary>
 /// <returns>The downloader.</returns>
 /// <param name="chunkSize">Chunk size.</param>
 public static IFileDownloader CreateDownloader(long chunkSize = 0, IFileTransmissionStorage storage = null)
 {
     return(chunkSize > 0 ? (IFileDownloader) new ChunkedDownloader(chunkSize, storage) : (IFileDownloader) new SimpleFileDownloader());
 }
 public SolverClass(
     ISession session,
     IMetaDataStorage storage,
     IFileTransmissionStorage transmissionStorage = null) : base(session, storage, transmissionStorage)
 {
 }
Esempio n. 25
0
 /// <summary>
 /// Creates the downloader.
 /// </summary>
 /// <returns>The downloader.</returns>
 /// <param name="chunkSize">Chunk size.</param>
 public static IFileDownloader CreateDownloader(long chunkSize = 0, IFileTransmissionStorage storage = null) {
     return chunkSize > 0 ? (IFileDownloader)new ChunkedDownloader(chunkSize, storage) : (IFileDownloader)new SimpleFileDownloader();
 }