/// <summary>
/// Sets up a fetcher that can get remote CMIS folders.
/// </summary>
public Fetcher(RepoInfo repoInfo, IActivityListener activityListener)
{
string remote_path = repoInfo.RemotePath.Trim("/".ToCharArray());
string address = repoInfo.Address.ToString();
TargetFolder = repoInfo.TargetDirectory;
RemoteUrl = new Uri(address + remote_path);
Logger.Info("Fetcher | Cmis Fetcher constructor");
TargetFolder = repoInfo.TargetDirectory;
RemoteUrl = repoInfo.Address;
// Check that the CmisSync root folder exists.
if (!Directory.Exists(ConfigManager.CurrentConfig.FoldersPath))
{
Logger.Fatal(String.Format("Fetcher | ERROR - Cmis Default Folder {0} does not exist", ConfigManager.CurrentConfig.FoldersPath));
throw new DirectoryNotFoundException("Root folder don't exist !");
}
// Check that the folder is writable.
if (!Utils.HasWritePermissionOnDir(ConfigManager.CurrentConfig.FoldersPath))
{
Logger.Fatal(String.Format("Fetcher | ERROR - Cmis Default Folder {0} is not writable", ConfigManager.CurrentConfig.FoldersPath));
throw new UnauthorizedAccessException("Root folder is not writable!");
}
// Check that the folder exists.
if (Directory.Exists(repoInfo.TargetDirectory))
{
Logger.Fatal(String.Format("Fetcher | ERROR - Cmis Repository Folder {0} already exist", repoInfo.TargetDirectory));
throw new UnauthorizedAccessException("Repository folder already exists!");
}
// Create the local folder.
Directory.CreateDirectory(repoInfo.TargetDirectory);
// Use this folder configuration.
this.cmisRepo = new CmisRepo(repoInfo, activityListener);
}