The virtial file system allows the same operations as you are may know form java.io but names and behavior are a bit different. See techdocu for an introduction to the VFS.
VFSContainer folder = (VFSContainer) wikiContainer.resolve(WIKI_FOLDER_NAME);if you are not shure whether it is a file or a folder you get an VFSItem as result of a resolve operatin and have to check with:
if (item instanceof VFSLeaf) { VFSLeaf leaf = (VFSLeaf)item; } TODO:Add methods like isLeaf() or isContainer() to item.
VFSContainer rootContainer = FileResourceManager.getInstance().getFileResourceRootImpl(ores);TODO: Create proper factory that delivers Containers,
VFSLeaf leaf = wikiContentContainer.createChildLeaf(filename); FileUtils.save(leaf.getOutputStream(false), content, "utf-8");
VFSLeaf leaf = (VFSLeaf) folder.resolve(page.getPageId() + "." + WikiManager.WIKI_FILE_SUFFIX); page.setContent(FileUtils.load(leaf.getInputStream(), "utf-8"));
List propertyLeafs = wikiCtn.getItems(new VFSItemSuffixFilter(new String[] { WikiManager.WIKI_PROPERTIES_SUFFIX }));
rootContainer.createChildContainer(WIKI_RESOURCE_FOLDER_NAME)
VFSLeaf leaf = wikiContentContainer.createChildLeaf(page.getPageId());
The VFS can also be used to create a collection of containers that are merged virtually to offer some folders in a view which is not physically the same on the filesystem. Similar to the use of symlinks in a unix environnement. @see org.olat.modules.bc.BriefcaseWebDAVProvider
TODO:how to create an initial container out form a path??? creating an Impl, This need to be refactored to use the Abstract type VFSContainer through out olat