/// <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="CmisSync.Lib.Cmis.AbstractNotifyingRepository"/> class.
        /// </summary>
        /// <param name="repoInfo">Repo info. Must not be null.</param>
        public AbstractNotifyingRepository(RepoInfo repoInfo) {
            this.Status = this.RepoStatusFlags.Status;
            if (repoInfo == null) {
                throw new ArgumentNullException("repoInfo");
            }

            // Initialize local variable
            this.RepoInfo = repoInfo;
        }
示例#3
0
 public void SetUp() {
     this.info = new RepoInfo {
         DisplayName = "name",
         Address = new Uri("http://example.com"),
         User = "******",
         ObfuscatedPassword = new Password("password").ObfuscatedPassword,
         PollInterval = 5000,
         LocalPath = this.cmissyncdir,
         RepositoryId = "repoId",
         RemotePath = "/",
         IgnoredFolders = new List<CmisSync.Lib.Config.RepoInfo.IgnoredFolder>()
     };
 }
        public void SetUp() {
            this.queue = new Mock<ISyncEventQueue>();
            this.authProvider = new Mock<IAuthenticationProvider>();
            this.repoInfo = new RepoInfo {
                User = this.username,
                ConnectionTimeout = this.connectionTimeout,
                PollInterval = this.interval,
                AuthenticationType = this.authType,
                ReadTimeout = this.readTimeout,
                ObfuscatedPassword = new Password(this.password).ObfuscatedPassword,
                Address = new Uri(this.url),
                RepositoryId = this.repoId,
                DisplayName = this.displayName
            };

            this.session = new Mock<ISession>();
            this.session.SetupCreateOperationContext();
            this.sessionFactory = new Mock<ISessionFactory>();
        }
 public static ISession CreateSession(
     this ISessionFactory factory,
     RepoInfo repoInfo,
     string appName = null)
 {
     return factory.CreateSession(repoInfo.AsSessionParameter(appName));
 }
 public static ISession CreateSession(
     this ISessionFactory factory,
     RepoInfo repoInfo,
     IObjectFactory objectFactory = null,
     IAuthenticationProvider authenticationProvider = null,
     ICache cache = null,
     string appName = null)
 {
     return factory.CreateSession(repoInfo.AsSessionParameter(appName), objectFactory, authenticationProvider, cache);
 }
示例#7
0
        /// <summary>
        /// Customization step of remote folder addition wizard is complete, start CmisSync.
        /// </summary>
        public void CustomizePageCompleted(string repoName, string localrepopath) {
            try {
                this.CheckRepoPathExists(localrepopath);
            } catch (ArgumentException) {
                if (this.LocalPathExists != null && !this.LocalPathExists(localrepopath)) {
                    return;
                }
            }

            this.SyncingReponame = repoName;
            this.saved_local_path = localrepopath;

            RepoInfo repoInfo = new RepoInfo {
                DisplayName = repoName,
                Address = this.saved_address,
                Binding = this.saved_binding,
                User = this.saved_user,
                ObfuscatedPassword = new Password(this.saved_password).ObfuscatedPassword,
                RepositoryId = this.PreviousRepository,
                RemotePath = this.PreviousPath,
                LocalPath = localrepopath
            };

            foreach (string ignore in this.ignoredPaths) {
                repoInfo.AddIgnorePath(ignore);
            }

            // Check that the folder exists.
            if (Directory.Exists(repoInfo.LocalPath)) {
                Logger.Info(string.Format("DataSpace Repository Folder {0} already exist, this could lead to sync conflicts", repoInfo.LocalPath));
            } else {
                // Create the local folder.
                Directory.CreateDirectory(repoInfo.LocalPath);
            }

            try {
                new Thread(() => {
                    Program.Controller.AddRepo(repoInfo);
                }).Start();
            } catch (Exception ex) {
                Logger.Fatal(ex.ToString());
            }

            this.ChangePageEvent(PageType.Finished);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="CmisSync.Lib.Events.RepoConfigChangedEvent"/> class.
 /// </summary>
 /// <param name='repoInfo'>
 /// Repo info.
 /// </param>
 public RepoConfigChangedEvent(RepoInfo repoInfo) {
     this.RepoInfo = repoInfo;
 }