Example usage for org.apache.commons.vfs2.provider.ftp FtpFileSystemConfigBuilder getInstance

List of usage examples for org.apache.commons.vfs2.provider.ftp FtpFileSystemConfigBuilder getInstance

Introduction

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

Prototype

public static FtpFileSystemConfigBuilder getInstance() 

Source Link

Document

Gets the singleton instance.

Usage

From source file:watchserver.server.WatchFTPRunner.java

public WatchFTPRunner(FTPConfig config) {
    this.config = config;
    try {/*from  w  ww .  j a v a  2 s.c o m*/
        fsManager = VFS.getManager();

        UserAuthenticator auth = new StaticUserAuthenticator("", config.getConnection().getUsername(),
                config.getConnection().getPassword());
        DefaultFileSystemConfigBuilder.getInstance().setUserAuthenticator(opts, auth);
        FtpFileSystemConfigBuilder.getInstance().setUserDirIsRoot(opts, true);
        FtpFileSystemConfigBuilder.getInstance().setPassiveMode(opts, true);

        resolvedAbsPath = fsManager.resolveFile(config.getFolder() + config.getConnection().getPathtomonitor(),
                opts);

        log.info("Connection successfully established to " + resolvedAbsPath.getPublicURIString());
        log.debug("Exists: " + resolvedAbsPath.exists());
        log.debug("Type  : " + resolvedAbsPath.getType());
    } catch (FileSystemException e) {
        log.error("File system exception for " + config.getFolder(), e);
        //throw here?
    }
}