1 16 package org.apache.commons.vfs.impl; 17 18 import org.apache.commons.vfs.FileName; 19 import org.apache.commons.vfs.FileObject; 20 import org.apache.commons.vfs.FileSystemException; 21 import org.apache.commons.vfs.FileType; 22 import org.apache.commons.vfs.provider.AbstractVfsContainer; 23 24 25 30 public class VirtualFileProvider 31 extends AbstractVfsContainer 32 { 33 36 public FileObject createFileSystem(final FileObject rootFile) 37 throws FileSystemException 38 { 39 final FileName rootName = 40 getContext().getFileSystemManager().resolveName(rootFile.getName(), FileName.ROOT_PATH); 41 final VirtualFileSystem fs = new VirtualFileSystem(rootName, null); 44 addComponent(fs); 45 fs.addJunction(FileName.ROOT_PATH, rootFile); 46 return fs.getRoot(); 47 } 48 49 52 public FileObject createFileSystem(final String rootUri) throws FileSystemException 53 { 54 final FileName rootName = 55 new VirtualFileName(rootUri, FileName.ROOT_PATH, FileType.FOLDER); 56 final VirtualFileSystem fs = new VirtualFileSystem(rootName, null); 59 addComponent(fs); 60 return fs.getRoot(); 61 } 62 } 63 | Popular Tags |