1 16 package org.apache.commons.vfs.provider.tar; 17 18 import org.apache.commons.vfs.Capability; 19 import org.apache.commons.vfs.FileName; 20 import org.apache.commons.vfs.FileObject; 21 import org.apache.commons.vfs.FileSystem; 22 import org.apache.commons.vfs.FileSystemException; 23 import org.apache.commons.vfs.FileSystemOptions; 24 import org.apache.commons.vfs.FileType; 25 import org.apache.commons.vfs.provider.AbstractLayeredFileProvider; 26 import org.apache.commons.vfs.provider.FileProvider; 27 import org.apache.commons.vfs.provider.LayeredFileName; 28 29 import java.util.Arrays ; 30 import java.util.Collection ; 31 import java.util.Collections ; 32 33 36 public class TarFileProvider 37 extends AbstractLayeredFileProvider 38 implements FileProvider 39 { 40 protected final static Collection capabilities = Collections.unmodifiableCollection(Arrays.asList(new Capability[] 41 { 42 Capability.GET_LAST_MODIFIED, 43 Capability.GET_TYPE, 44 Capability.LIST_CHILDREN, 45 Capability.READ_CONTENT, 46 Capability.URI, 47 Capability.VIRTUAL 48 })); 49 50 public TarFileProvider() 51 { 52 super(); 53 } 54 55 63 protected FileSystem doCreateFileSystem(final String scheme, 64 final FileObject file, 65 final FileSystemOptions fileSystemOptions) 66 throws FileSystemException 67 { 68 final FileName rootName = 69 new LayeredFileName(scheme, file.getName(), FileName.ROOT_PATH, FileType.FOLDER); 70 return new TarFileSystem(rootName, file, fileSystemOptions); 71 } 72 73 public Collection getCapabilities() 74 { 75 return capabilities; 76 } 77 } 78 | Popular Tags |