Exemple #1
0
 public void CreateMockObjects()
 {
     this.storageEngine = new DBreezeEngine(new DBreezeConfiguration {
         Storage = DBreezeConfiguration.eStorage.MEMORY
     });
     this.localRootPath = Path.Combine(Path.GetTempPath(), Path.GetTempFileName());
     this.matcher       = new PathMatcher(this.localRootPath, this.remoteRootPath);
     this.queue         = new Mock <ISyncEventQueue>();
     this.remoteFolder  = MockOfIFolderUtil.CreateRemoteFolderMock(this.remoteRootId, this.remoteRootPath, this.remoteRootPath);
     this.remoteFolder.SetupDescendants();
     this.localFolder = new Mock <IDirectoryInfo>();
     this.localFolder.Setup(f => f.FullName).Returns(this.localRootPath);
     this.localFolder.Setup(f => f.Exists).Returns(true);
     this.localFolder.Setup(f => f.IsExtendedAttributeAvailable()).Returns(true);
     this.localFolder.SetupGuid(this.rootGuid);
     this.localFolder.Setup(f => f.LastWriteTimeUtc).Returns(this.lastLocalWriteTime);
     this.fsFactory = new Mock <IFileSystemInfoFactory>();
     this.fsFactory.AddIDirectoryInfo(this.localFolder.Object);
     this.mappedRootObject = new MappedObject(
         this.remoteRootPath,
         this.remoteRootId,
         MappedObjectType.Folder,
         null,
         "changeToken")
     {
         Guid = this.rootGuid,
         LastLocalWriteTimeUtc = this.lastLocalWriteTime
     };
     this.storage = new MetaDataStorage(this.storageEngine, this.matcher);
     this.storage.SaveMappedObject(this.mappedRootObject);
     this.filter   = MockOfIFilterAggregatorUtil.CreateFilterAggregator().Object;
     this.listener = new Mock <IActivityListener>();
 }
 public void CreateMockObjects() {
     this.storageEngine = new DBreezeEngine(new DBreezeConfiguration { Storage = DBreezeConfiguration.eStorage.MEMORY });
     this.localRootPath = Path.Combine(Path.GetTempPath(), Path.GetTempFileName());
     this.matcher = new PathMatcher(this.localRootPath, this.remoteRootPath);
     this.queue = new Mock<ISyncEventQueue>();
     this.remoteFolder = MockOfIFolderUtil.CreateRemoteFolderMock(this.remoteRootId, this.remoteRootPath, this.remoteRootPath);
     this.remoteFolder.SetupDescendants();
     this.localFolder = new Mock<IDirectoryInfo>();
     this.localFolder.Setup(f => f.FullName).Returns(this.localRootPath);
     this.localFolder.Setup(f => f.Exists).Returns(true);
     this.localFolder.Setup(f => f.IsExtendedAttributeAvailable()).Returns(true);
     this.localFolder.SetupGuid(this.rootGuid);
     this.localFolder.Setup(f => f.LastWriteTimeUtc).Returns(this.lastLocalWriteTime);
     this.fsFactory = new Mock<IFileSystemInfoFactory>();
     this.fsFactory.AddIDirectoryInfo(this.localFolder.Object);
     this.mappedRootObject = new MappedObject(
         this.remoteRootPath,
         this.remoteRootId,
         MappedObjectType.Folder,
         null,
         "changeToken") {
         Guid = this.rootGuid,
         LastLocalWriteTimeUtc = this.lastLocalWriteTime
     };
     this.storage = new MetaDataStorage(this.storageEngine, this.matcher, true);
     this.storage.SaveMappedObject(this.mappedRootObject);
     this.filter = MockOfIFilterAggregatorUtil.CreateFilterAggregator().Object;
     this.listener = new Mock<IActivityListener>();
 }
        public MetaDataStorage(DBreezeEngine engine, IPathMatcher matcher, bool fullValidation, bool disableInitialValidation = false)
        {
            if (engine == null)
            {
                throw new ArgumentNullException("engine");
            }

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

            this.engine  = engine;
            this.matcher = matcher;
            this.fullValidationOnEachManipulation = fullValidation;

            if (!disableInitialValidation)
            {
                try {
                    this.ValidateObjectStructure();
                } catch (InvalidDataException e) {
                    Logger.Fatal("Database object structure is invalid", e);
                }
            }
        }
Exemple #4
0
 /// <summary>
 /// Creates an instance of the <see cref="OpenApiHost{TRequest, TResponse}"/>.
 /// </summary>
 /// <param name="matcher">The path matcher.</param>
 /// <param name="contextBuilder">The OpenAPI context builder.</param>
 /// <param name="operationInvoker">The OpenAPI operation invoker.</param>
 /// <param name="resultBuilder">The OpenAPI result builder.</param>
 public OpenApiHost(IPathMatcher matcher, IOpenApiContextBuilder <TRequest> contextBuilder, IOpenApiOperationInvoker <TRequest, TResponse> operationInvoker, IOpenApiResultBuilder <TResponse> resultBuilder)
 {
     this.matcher          = matcher;
     this.contextBuilder   = contextBuilder;
     this.operationInvoker = operationInvoker;
     this.resultBuilder    = resultBuilder;
 }
Exemple #5
0
        public ProjectDirectoryToWebsiteDirectoryMapper([CanBeNull] IPathMatcher pathMatcher, [NotNull] string projectDirectory, [NotNull] string websiteDirectory)
        {
            IsMapped = !string.IsNullOrEmpty(websiteDirectory);

            PathMatcher      = pathMatcher;
            ProjectDirectory = '\\' + PathHelper.NormalizeFilePath(projectDirectory).Trim('\\');
            WebsiteDirectory = '\\' + PathHelper.NormalizeFilePath(websiteDirectory).Trim('\\');
        }
Exemple #6
0
        public SimpleRouteMatcher(IPathMatcher pathMatcher)
        {
            if (pathMatcher == null)
            {
                throw new ArgumentNullException(nameof(pathMatcher));
            }

            this.pathMatcher = pathMatcher;
        }
Exemple #7
0
        private bool MatchDirectoryRelativePath(IPathMatcher matcher, DirectoryName directoryName, IPathComparer comparer)
        {
            // "Chromium" root directories make it through here, skip them.
            if (directoryName.IsAbsoluteName)
            {
                return(false);
            }

            return(matcher.MatchDirectoryName(directoryName.RelativePathName.RelativeName, comparer));
        }
Exemple #8
0
        public WebsiteItemPathToProjectDirectoryMapper([CanBeNull] IPathMatcher itemNamePathMatcher, [CanBeNull] IPathMatcher templateNamePathMatcher, [NotNull] string databaseName, [NotNull] string itemPath, [NotNull] string projectDirectory, [NotNull] string format)
        {
            IsMapped = !string.IsNullOrEmpty(projectDirectory);

            ItemPath                = '/' + PathHelper.NormalizeItemPath(itemPath).Trim('/');
            ProjectDirectory        = '\\' + PathHelper.NormalizeFilePath(projectDirectory).Trim('\\');
            ItemNamePathMatcher     = itemNamePathMatcher;
            TemplateNamePathMatcher = templateNamePathMatcher;
            DatabaseName            = databaseName;
            Format = format;
        }
        public ProjectDirectoryToWebsiteItemPathMapper([CanBeNull] IPathMatcher pathMatcher, [NotNull] string projectDirectory, [NotNull] string databaseName, [NotNull] string itemPath, bool isImport, bool uploadMedia)
        {
            IsMapped = !string.IsNullOrEmpty(itemPath);

            PathMatcher      = pathMatcher;
            ProjectDirectory = '\\' + PathHelper.NormalizeFilePath(projectDirectory).Trim('\\');
            ItemPath         = '/' + PathHelper.NormalizeItemPath(itemPath).Trim('/');
            DatabaseName     = databaseName;
            IsImport         = isImport;
            UploadMedia      = uploadMedia;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="LocalObjectFetcher"/> class.
        /// </summary>
        /// <param name='matcher'>
        /// Matcher from IMetaDataStorage
        /// </param>
        /// <param name='fsFactory'>
        /// Fs factory, should be null unless in Unit Tests
        /// </param>
        /// <exception cref='ArgumentNullException'>
        /// Is thrown when an argument passed to a method is invalid because it is <see langword="null" /> .
        /// </exception>
        public LocalObjectFetcher(IPathMatcher matcher, IFileSystemInfoFactory fsFactory = null) {
            if (matcher == null) {
                throw new ArgumentNullException("matcher");
            }

            this.matcher = matcher;
            if(fsFactory == null) {
                this.fsFactory = new FileSystemInfoFactory();
            } else {
                this.fsFactory = fsFactory;
            }
        }
        /// <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;
        }
Exemple #12
0
        public MetaDataStorage(DBreezeEngine engine, IPathMatcher matcher)
        {
            if (engine == null)
            {
                throw new ArgumentNullException("Given DBreeze engine instance is null");
            }

            if (matcher == null)
            {
                throw new ArgumentNullException("Given Matcher is null");
            }

            this.engine  = engine;
            this.matcher = matcher;
        }
Exemple #13
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;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="CmisSync.Lib.SelectiveIgnore.IgnoredEntity"/> class.
        /// </summary>
        /// <param name="doc">Ignored document.</param>
        /// <param name="matcher">Path matcher to create local path.</param>
        public IgnoredEntity(IDocument doc, IPathMatcher matcher) {
            if (doc == null) {
                throw new ArgumentNullException("doc");
            }

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

            if (!matcher.CanCreateLocalPath(doc)) {
                throw new ArgumentException("Cannot create a local path for the given remote folder");
            }

            this.ObjectId = doc.Id;
            this.LocalPath = matcher.CreateLocalPath(doc);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="LocalObjectFetcher"/> class.
        /// </summary>
        /// <param name='matcher'>
        /// Matcher from IMetaDataStorage
        /// </param>
        /// <param name='fsFactory'>
        /// Fs factory, should be null unless in Unit Tests
        /// </param>
        /// <exception cref='ArgumentNullException'>
        /// Is thrown when an argument passed to a method is invalid because it is <see langword="null" /> .
        /// </exception>
        public LocalObjectFetcher(IPathMatcher matcher, IFileSystemInfoFactory fsFactory = null)
        {
            if (matcher == null)
            {
                throw new ArgumentNullException("matcher");
            }

            this.matcher = matcher;
            if (fsFactory == null)
            {
                this.fsFactory = new FileSystemInfoFactory();
            }
            else
            {
                this.fsFactory = fsFactory;
            }
        }
Exemple #16
0
        /// <summary>
        /// Creates an appropriate path matcher for the specified match type.
        /// </summary>
        /// <param name="matchType">The PathMatchType used to determine the appropriate path matcher.</param>
        /// <returns></returns>
        public static IPathMatcher Create(PathMatchType matchType)
        {
            // Check for cached matchers first.
            IDictionary <PathMatchType, IPathMatcher> cachedMatchers = CachedMatchers;

            if (cachedMatchers != null && cachedMatchers.ContainsKey(matchType))
            {
                IPathMatcher cachedPathMatcher = cachedMatchers[matchType];
                Logger.LogFormat("Cached {0} retrieved.", cachedPathMatcher.GetType().Name);
                return(cachedPathMatcher);
            }

            // Create the appropriate path matcher.
            IPathMatcher pathMatcher;

            switch (matchType)
            {
            case PathMatchType.Regex:
                pathMatcher = new RegexPathMatcher();
                break;

            case PathMatchType.StartsWith:
                pathMatcher = new StartsWithPathMatcher();
                break;

            case PathMatchType.Exact:
                pathMatcher = new ExactPathMatcher();
                break;

            default:
                throw new ArgumentOutOfRangeException("matchType");
            }

            // Cache the path matcher, if possible.
            if (cachedMatchers != null)
            {
                cachedMatchers.Add(matchType, pathMatcher);
            }

            Logger.LogFormat("Creating {0}.", pathMatcher.GetType().Name);
            return(pathMatcher);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="CmisSync.Lib.SelectiveIgnore.IgnoredEntity"/> class.
        /// </summary>
        /// <param name="doc">Ignored document.</param>
        /// <param name="matcher">Path matcher to create local path.</param>
        public IgnoredEntity(IDocument doc, IPathMatcher matcher)
        {
            if (doc == null)
            {
                throw new ArgumentNullException("doc");
            }

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

            if (!matcher.CanCreateLocalPath(doc))
            {
                throw new ArgumentException("Cannot create a local path for the given remote folder");
            }

            this.ObjectId  = doc.Id;
            this.LocalPath = matcher.CreateLocalPath(doc);
        }
        public MetaDataStorage(DBreezeEngine engine, IPathMatcher matcher, bool fullValidation, bool disableInitialValidation = false) {
            if (engine == null) {
                throw new ArgumentNullException("engine");
            }

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

            this.engine = engine;
            this.matcher = matcher;
            this.fullValidationOnEachManipulation = fullValidation;

            if (!disableInitialValidation) {
                try {
                    this.ValidateObjectStructure();
                } catch(InvalidDataException e) {
                    Logger.Fatal("Database object structure is invalid", e);
                }
            }
        }
Exemple #19
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CmisSync.Lib.Producer.Crawler.DescendantsTreeBuilder"/> class.
        /// </summary>
        /// <param name='storage'>
        /// The MetadataStorage.
        /// </param>
        /// <param name='remoteFolder'>
        /// Remote folder.
        /// </param>
        /// <param name='localFolder'>
        /// Local folder.
        /// </param>
        /// <param name='filter'>
        /// Aggregated Filters.
        /// </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 DescendantsTreeBuilder(
            IMetaDataStorage storage,
            IFolder remoteFolder,
            IDirectoryInfo localFolder,
            IFilterAggregator filter,
            IIgnoredEntitiesStorage ignoredStorage)
        {
            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 (ignoredStorage == null)
            {
                throw new ArgumentNullException("ignoredStorage");
            }

            this.storage        = storage;
            this.remoteFolder   = remoteFolder;
            this.localFolder    = localFolder;
            this.filter         = filter;
            this.matcher        = new PathMatcher(localFolder.FullName, remoteFolder.Path);
            this.ignoredStorage = ignoredStorage;
        }
        /// <summary>
        /// Evaluates the specified request for the need to switch its security.
        /// </summary>
        /// <param name="request">The request to evaluate.</param>
        /// <param name="settings">The settings to use for evaluation.</param>
        /// <return>
        /// A RequestSecurity value indicating the security the evaluated request should be under.
        /// </return>
        public RequestSecurity Evaluate(HttpRequestBase request, Settings settings)
        {
            // Test if the request matches the configured mode.
            if (!RequestMatchesMode(request, settings.Mode))
            {
                Logger.Log("Request does not match mode and should be ignored.");
                return(RequestSecurity.Ignore);
            }

            if (settings.IgnoreAjaxRequests && IsAjaxRequest(request))
            {
                Logger.Log("Request is an AJAX request that should be ignored.");
                return(RequestSecurity.Ignore);
            }

            // Find any matching path setting for the request.
            Logger.Log("Checking for a matching path for this request...");
            string requestPath = request.RawUrl;

            if (!string.IsNullOrEmpty(requestPath))
            {
                foreach (PathSetting pathSetting in settings.Paths)
                {
                    // Get an appropriate path matcher and test the request's path for a match.
                    IPathMatcher matcher = PathMatcherFactory.Create(pathSetting.MatchType);
                    if (matcher.IsMatch(requestPath, pathSetting.Path, pathSetting.IgnoreCase))
                    {
                        Logger.LogFormat("Matching path found; security is {0}.", pathSetting.Security);
                        return(pathSetting.Security);
                    }
                }
            }

            // Any non-matching request should default to Insecure.
            Logger.Log("No matching path found; security defaults to Insecure.");
            return(RequestSecurity.Insecure);
        }
Exemple #21
0
        /// <summary>
        /// Gets the remote directory tree.
        /// </summary>
        /// <returns>The remote directory tree.</returns>
        /// <param name="parent">Parent folder.</param>
        /// <param name="descendants">Descendants of remote object.</param>
        /// <param name="filter">Filter of ignored or invalid files and folder</param>
        public static IObjectTree <IFileableCmisObject> GetRemoteDirectoryTree(IFolder parent, IList <ITree <IFileableCmisObject> > descendants, IFilterAggregator filter, IIgnoredEntitiesStorage ignoredStorage, IPathMatcher matcher)
        {
            IList <IObjectTree <IFileableCmisObject> > children = new List <IObjectTree <IFileableCmisObject> >();

            if (descendants != null)
            {
                foreach (var child in descendants)
                {
                    if (child.Item is IFolder)
                    {
                        string reason;
                        var    folder = child.Item as IFolder;
                        if (!filter.FolderNamesFilter.CheckFolderName(folder.Name, out reason) && !filter.InvalidFolderNamesFilter.CheckFolderName(folder.Name, out reason))
                        {
                            if (folder.AreAllChildrenIgnored())
                            {
                                ignoredStorage.AddOrUpdateEntryAndDeleteAllChildrenFromStorage(new IgnoredEntity(folder, matcher));
                                Logger.Info(string.Format("Folder {0} with Id {1} is ignored", folder.Name, folder.Id));
                                children.Add(new ObjectTree <IFileableCmisObject> {
                                    Item     = child.Item,
                                    Children = new List <IObjectTree <IFileableCmisObject> >()
                                });
                            }
                            else
                            {
                                ignoredStorage.Remove(folder.Id);
                                children.Add(GetRemoteDirectoryTree(folder, child.Children, filter, ignoredStorage, matcher));
                            }
                        }
                        else
                        {
                            Logger.Info(reason);
                        }
                    }
                    else if (child.Item is IDocument)
                    {
                        string reason;
                        if (!filter.FileNamesFilter.CheckFile(child.Item.Name, out reason))
                        {
                            children.Add(new ObjectTree <IFileableCmisObject> {
                                Item     = child.Item,
                                Children = new List <IObjectTree <IFileableCmisObject> >()
                            });
                        }
                        else
                        {
                            Logger.Info(reason);
                        }
                    }
                }
            }

            var tree = new ObjectTree <IFileableCmisObject> {
                Item     = parent,
                Children = children
            };

            return(tree);
        }
 private static bool MatchFileOrDirectory(IPathMatcher item, IList<DirectoryEntry> entries) {
   return
     entries.Any(d => d.IsDirectory && item.MatchDirectoryName(new RelativePath(d.Name), SystemPathComparer.Instance)) ||
     entries.Any(f => f.IsFile && item.MatchFileName(new RelativePath(f.Name), SystemPathComparer.Instance));
 }
 private static bool MatchFileOrDirectory(IPathMatcher item, IList <DirectoryEntry> entries)
 {
     return
         (entries.Any(d => d.IsDirectory && item.MatchDirectoryName(new RelativePath(d.Name), SystemPathComparer.Instance)) ||
          entries.Any(f => f.IsFile && item.MatchFileName(new RelativePath(f.Name), SystemPathComparer.Instance)));
 }
 private static bool MatchFileOrDirectory(IPathMatcher item, IEnumerable <string> directories, IEnumerable <string> files)
 {
     return
         (directories.Any(d => item.MatchDirectoryName(d, SystemPathComparer.Instance)) ||
          files.Any(f => item.MatchFileName(f, SystemPathComparer.Instance)));
 }
 private static bool MatchFileOrDirectory(IPathMatcher item, IEnumerable<string> directories, IEnumerable<string> files)
 {
     return
     directories.Any(d => item.MatchDirectoryName(new RelativePath(d), SystemPathComparer.Instance)) ||
     files.Any(f => item.MatchFileName(new RelativePath(f), SystemPathComparer.Instance));
 }
Exemple #26
0
 private bool MatchFileRelativePath(IPathMatcher matcher, FileName fileName, IPathComparer comparer)
 {
     return(matcher.MatchFileName(fileName.RelativePath, comparer));
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="CmisSync.Lib.Producer.Crawler.DescendantsTreeBuilder"/> class.
        /// </summary>
        /// <param name='storage'>
        /// The MetadataStorage.
        /// </param>
        /// <param name='remoteFolder'>
        /// Remote folder.
        /// </param>
        /// <param name='localFolder'>
        /// Local folder.
        /// </param>
        /// <param name='filter'>
        /// Aggregated Filters.
        /// </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 DescendantsTreeBuilder(
            IMetaDataStorage storage,
            IFolder remoteFolder,
            IDirectoryInfo localFolder,
            IFilterAggregator filter,
            IIgnoredEntitiesStorage ignoredStorage)
        {
            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 (ignoredStorage == null) {
                throw new ArgumentNullException("ignoredStorage");
            }

            this.storage = storage;
            this.remoteFolder = remoteFolder;
            this.localFolder = localFolder;
            this.filter = filter;
            this.matcher = new PathMatcher(localFolder.FullName, remoteFolder.Path);
            this.ignoredStorage = ignoredStorage;
        }
Exemple #28
0
 public DestinationPatternsMessageCondition(string[] patterns, IPathMatcher matcher)
     : this(patterns, new SimpleRouteMatcher(matcher != null ? matcher : new AntPathMatcher()))
 {
 }
        /// <summary>
        /// Gets the remote directory tree.
        /// </summary>
        /// <returns>The remote directory tree.</returns>
        /// <param name="parent">Parent folder.</param>
        /// <param name="descendants">Descendants of remote object.</param>
        /// <param name="filter">Filter of ignored or invalid files and folder</param>
        public static IObjectTree<IFileableCmisObject> GetRemoteDirectoryTree(IFolder parent, IList<ITree<IFileableCmisObject>> descendants, IFilterAggregator filter, IIgnoredEntitiesStorage ignoredStorage, IPathMatcher matcher) {
            IList<IObjectTree<IFileableCmisObject>> children = new List<IObjectTree<IFileableCmisObject>>();
            if (descendants != null) {
                foreach (var child in descendants) {
                    if (child.Item is IFolder) {
                        string reason;
                        var folder = child.Item as IFolder;
                        if (!filter.FolderNamesFilter.CheckFolderName(folder.Name, out reason) && !filter.InvalidFolderNamesFilter.CheckFolderName(folder.Name, out reason)) {
                            if (folder.AreAllChildrenIgnored()) {
                                ignoredStorage.AddOrUpdateEntryAndDeleteAllChildrenFromStorage(new IgnoredEntity(folder, matcher));
                                Logger.Info(string.Format("Folder {0} with Id {1} is ignored", folder.Name, folder.Id));
                                children.Add(new ObjectTree<IFileableCmisObject> {
                                    Item = child.Item,
                                    Children = new List<IObjectTree<IFileableCmisObject>>()
                                });
                            } else {
                                ignoredStorage.Remove(folder.Id);
                                children.Add(GetRemoteDirectoryTree(folder, child.Children, filter, ignoredStorage, matcher));
                            }
                        } else {
                            Logger.Info(reason);
                        }
                    } else if (child.Item is IDocument) {
                        string reason;
                        if (!filter.FileNamesFilter.CheckFile(child.Item.Name, out reason)) {
                            children.Add(new ObjectTree<IFileableCmisObject> {
                                Item = child.Item,
                                Children = new List<IObjectTree<IFileableCmisObject>>()
                            });
                        } else {
                            Logger.Info(reason);
                        }
                    }
                }
            }

            var tree = new ObjectTree<IFileableCmisObject> {
                Item = parent,
                Children = children
            };

            return tree;
        }