Example usage for org.apache.commons.vfs.provider.ftp FtpFileSystemConfigBuilder setEntryParser

List of usage examples for org.apache.commons.vfs.provider.ftp FtpFileSystemConfigBuilder setEntryParser

Introduction

In this page you can find the example usage for org.apache.commons.vfs.provider.ftp FtpFileSystemConfigBuilder setEntryParser.

Prototype

public void setEntryParser(FileSystemOptions opts, String key) 

Source Link

Document

set the FQCN of your FileEntryParser used to parse the directory listing from your server.

If you do not use the default commons-net FTPFileEntryParserFactory e.g.

Usage

From source file:com.adito.networkplaces.store.ftp.FTPMount.java

public FileSystemOptions getOptions(URI uri) {
    FileSystemOptions options = new FileSystemOptions();
    FtpFileSystemConfigBuilder c = FtpFileSystemConfigBuilder.getInstance();
    String mode = Property.getProperty(new ResourceKey("ftp.mode", this.getNetworkPlace().getResourceType(),
            this.getNetworkPlace().getResourceId()));
    c.setPassiveMode(options, mode.equals("passive"));
    int idleTimeout = Property.getPropertyInt(new ResourceKey("ftp.idleTimeout",
            getNetworkPlace().getResourceType(), getNetworkPlace().getResourceId()));
    //NOTE New Apache-commons-vfs does not support setIdleTimeout(options, idleTimeout)
    //c.setIdleTimeout(options, idleTimeout);
    c.setDataTimeout(options, idleTimeout);
    // TODO: Add resource attribute for all these settings.
    c.setUserDirIsRoot(options, true);// w  w  w. j a v  a 2 s  .  c o m
    String hostType = Property.getProperty(new ResourceKey("ftp.hostType",
            this.getNetworkPlace().getResourceType(), this.getNetworkPlace().getResourceId()));
    if (!"automatic".equals(hostType)) {
        c.setEntryParser(options, hostType);
    }
    return options;
}