Java Code Examples for org.apache.commons.net.ftp.FTP#DEFAULT_PORT
The following examples show how to use
org.apache.commons.net.ftp.FTP#DEFAULT_PORT .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FTPFileSystem.java From hadoop with Apache License 2.0 | 5 votes |
@Override public void initialize(URI uri, Configuration conf) throws IOException { // get super.initialize(uri, conf); // get host information from uri (overrides info in conf) String host = uri.getHost(); host = (host == null) ? conf.get(FS_FTP_HOST, null) : host; if (host == null) { throw new IOException("Invalid host specified"); } conf.set(FS_FTP_HOST, host); // get port information from uri, (overrides info in conf) int port = uri.getPort(); port = (port == -1) ? FTP.DEFAULT_PORT : port; conf.setInt("fs.ftp.host.port", port); // get user/password information from URI (overrides info in conf) String userAndPassword = uri.getUserInfo(); if (userAndPassword == null) { userAndPassword = (conf.get("fs.ftp.user." + host, null) + ":" + conf .get("fs.ftp.password." + host, null)); } String[] userPasswdInfo = userAndPassword.split(":"); Preconditions.checkState(userPasswdInfo.length > 1, "Invalid username / password"); conf.set(FS_FTP_USER_PREFIX + host, userPasswdInfo[0]); conf.set(FS_FTP_PASSWORD_PREFIX + host, userPasswdInfo[1]); setConf(conf); this.uri = uri; }
Example 2
Source File: FTPFileSystem.java From big-c with Apache License 2.0 | 5 votes |
@Override public void initialize(URI uri, Configuration conf) throws IOException { // get super.initialize(uri, conf); // get host information from uri (overrides info in conf) String host = uri.getHost(); host = (host == null) ? conf.get(FS_FTP_HOST, null) : host; if (host == null) { throw new IOException("Invalid host specified"); } conf.set(FS_FTP_HOST, host); // get port information from uri, (overrides info in conf) int port = uri.getPort(); port = (port == -1) ? FTP.DEFAULT_PORT : port; conf.setInt("fs.ftp.host.port", port); // get user/password information from URI (overrides info in conf) String userAndPassword = uri.getUserInfo(); if (userAndPassword == null) { userAndPassword = (conf.get("fs.ftp.user." + host, null) + ":" + conf .get("fs.ftp.password." + host, null)); } String[] userPasswdInfo = userAndPassword.split(":"); Preconditions.checkState(userPasswdInfo.length > 1, "Invalid username / password"); conf.set(FS_FTP_USER_PREFIX + host, userPasswdInfo[0]); conf.set(FS_FTP_PASSWORD_PREFIX + host, userPasswdInfo[1]); setConf(conf); this.uri = uri; }
Example 3
Source File: AbstractFTPInputOperator.java From attic-apex-malhar with Apache License 2.0 | 5 votes |
public AbstractFTPInputOperator() { super(); port = FTP.DEFAULT_PORT; userName = "anonymous"; password = "guest"; }
Example 4
Source File: FTPFileSystem.java From RDFS with Apache License 2.0 | 5 votes |
@Override public void initialize(URI uri, Configuration conf) throws IOException { // get super.initialize(uri, conf); // get host information from uri (overrides info in conf) String host = uri.getHost(); host = (host == null) ? conf.get("fs.ftp.host", null) : host; if (host == null) { throw new IOException("Invalid host specified"); } conf.set("fs.ftp.host", host); // get port information from uri, (overrides info in conf) int port = uri.getPort(); port = (port == -1) ? FTP.DEFAULT_PORT : port; conf.setInt("fs.ftp.host.port", port); // get user/password information from URI (overrides info in conf) String userAndPassword = uri.getUserInfo(); if (userAndPassword == null) { userAndPassword = (conf.get("fs.ftp.user." + host, null) + ":" + conf .get("fs.ftp.password." + host, null)); if (userAndPassword == null) { throw new IOException("Invalid user/passsword specified"); } } String[] userPasswdInfo = userAndPassword.split(":"); conf.set("fs.ftp.user." + host, userPasswdInfo[0]); if (userPasswdInfo.length > 1) { conf.set("fs.ftp.password." + host, userPasswdInfo[1]); } else { conf.set("fs.ftp.password." + host, null); } setConf(conf); this.uri = uri; }
Example 5
Source File: FTPFileSystem.java From hadoop-gpu with Apache License 2.0 | 5 votes |
@Override public void initialize(URI uri, Configuration conf) throws IOException { // get super.initialize(uri, conf); // get host information from uri (overrides info in conf) String host = uri.getHost(); host = (host == null) ? conf.get("fs.ftp.host", null) : host; if (host == null) { throw new IOException("Invalid host specified"); } conf.set("fs.ftp.host", host); // get port information from uri, (overrides info in conf) int port = uri.getPort(); port = (port == -1) ? FTP.DEFAULT_PORT : port; conf.setInt("fs.ftp.host.port", port); // get user/password information from URI (overrides info in conf) String userAndPassword = uri.getUserInfo(); if (userAndPassword == null) { userAndPassword = (conf.get("fs.ftp.user." + host, null) + ":" + conf .get("fs.ftp.password." + host, null)); if (userAndPassword == null) { throw new IOException("Invalid user/passsword specified"); } } String[] userPasswdInfo = userAndPassword.split(":"); conf.set("fs.ftp.user." + host, userPasswdInfo[0]); if (userPasswdInfo.length > 1) { conf.set("fs.ftp.password." + host, userPasswdInfo[1]); } else { conf.set("fs.ftp.password." + host, null); } setConf(conf); this.uri = uri; }
Example 6
Source File: FtpFs.java From hadoop with Apache License 2.0 | 4 votes |
@Override public int getUriDefaultPort() { return FTP.DEFAULT_PORT; }
Example 7
Source File: FtpFs.java From big-c with Apache License 2.0 | 4 votes |
@Override public int getUriDefaultPort() { return FTP.DEFAULT_PORT; }
Example 8
Source File: FTPFileSystem.java From hadoop with Apache License 2.0 | 2 votes |
/** * Get the default port for this FTPFileSystem. * * @return the default port */ @Override protected int getDefaultPort() { return FTP.DEFAULT_PORT; }
Example 9
Source File: FTPFileSystem.java From big-c with Apache License 2.0 | 2 votes |
/** * Get the default port for this FTPFileSystem. * * @return the default port */ @Override protected int getDefaultPort() { return FTP.DEFAULT_PORT; }