@Override public Set<Resource<T>> listDirectory(Path path) { return getDelegate().listDirectory(path); }
private Set<Resource<T>> listDirectoryIfFound(Path path) { if(getContentStorage(path).hasDirectory(path)){ return getContentStorage(path).listDirectory(path); } return null; }
/** * Delete all resources and subdirectories of the given resource path * @param tree tree * @param path path * @return true if all resources were deleted successfully. */ public static boolean deletePathRecursive(Tree<ResourceMeta> tree, Path path){ if(tree.hasResource(path)) { //delete just this resource return tree.deleteResource(path); }else if (tree.hasDirectory(path)) { //list resources and delete Set<Resource<ResourceMeta>> resources = tree.listDirectory(path); boolean failed=false; for (Resource<ResourceMeta> resource : resources) { if(resource.isDirectory()){ if(!deletePathRecursive(tree,resource.getPath())){ failed=true; } }else { if(!tree.deleteResource(resource.getPath())){ failed=true; } } } return !failed; }else{ return true; } }