1 16 package org.apache.commons.vfs.provider.ftp; 17 18 import org.apache.commons.vfs.Capability; 19 import org.apache.commons.vfs.FileName; 20 import org.apache.commons.vfs.FileSystem; 21 import org.apache.commons.vfs.FileSystemConfigBuilder; 22 import org.apache.commons.vfs.FileSystemException; 23 import org.apache.commons.vfs.FileSystemOptions; 24 import org.apache.commons.vfs.provider.AbstractOriginatingFileProvider; 25 import org.apache.commons.vfs.provider.GenericFileName; 26 27 import java.util.Arrays ; 28 import java.util.Collection ; 29 import java.util.Collections ; 30 31 36 public class FtpFileProvider 37 extends AbstractOriginatingFileProvider 38 { 39 public final static String ATTR_FILE_ENTRY_PARSER = "FEP"; 40 41 final static Collection capabilities = Collections.unmodifiableCollection(Arrays.asList(new Capability[] 42 { 43 Capability.CREATE, 44 Capability.DELETE, 45 Capability.RENAME, 46 Capability.GET_TYPE, 47 Capability.LIST_CHILDREN, 48 Capability.READ_CONTENT, 49 Capability.GET_LAST_MODIFIED, 50 Capability.URI, 51 Capability.WRITE_CONTENT, 52 Capability.APPEND_CONTENT, 53 Capability.RANDOM_ACCESS_READ, 54 })); 55 56 public FtpFileProvider() 57 { 58 super(); 59 setFileNameParser(FtpFileNameParser.getInstance()); 60 } 61 62 65 protected FileSystem doCreateFileSystem(final FileName name, final FileSystemOptions fileSystemOptions) 66 throws FileSystemException 67 { 68 final GenericFileName rootName = (GenericFileName) name; 70 71 FTPClientWrapper ftpClient = new FTPClientWrapper(rootName, fileSystemOptions); 72 80 81 return new FtpFileSystem(rootName, ftpClient, fileSystemOptions); 82 } 83 84 public FileSystemConfigBuilder getConfigBuilder() 85 { 86 return FtpFileSystemConfigBuilder.getInstance(); 87 } 88 89 public Collection getCapabilities() 90 { 91 return capabilities; 92 } 93 } 94 | Popular Tags |