This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-vfs.git
The following commit(s) were added to refs/heads/master by this push: new 748130e Javadoc and comments. 748130e is described below commit 748130e295f4dfbb93c9a88b77745eb24a1455dd Author: Gary Gregory <gardgreg...@gmail.com> AuthorDate: Sat Apr 27 13:18:19 2019 -0400 Javadoc and comments. --- .../provider/sftp/IdentityRepositoryFactory.java | 1 + .../vfs2/provider/sftp/SftpClientFactory.java | 22 +++++++++++++--------- .../commons/vfs2/provider/sftp/SftpFileObject.java | 4 ++-- .../provider/sftp/SftpFileSystemConfigBuilder.java | 21 +++++++++++++++------ .../vfs2/provider/sftp/SftpStreamProxy.java | 5 +++++ 5 files changed, 36 insertions(+), 17 deletions(-) diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/sftp/IdentityRepositoryFactory.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/sftp/IdentityRepositoryFactory.java index 747de9d..484e8ee 100644 --- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/sftp/IdentityRepositoryFactory.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/sftp/IdentityRepositoryFactory.java @@ -25,6 +25,7 @@ import com.jcraft.jsch.JSch; * @version $Id$ */ public interface IdentityRepositoryFactory { + /** * Creates an Identity repository for a given JSch instance. * diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpClientFactory.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpClientFactory.java index 3a6ef19..0148147 100644 --- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpClientFactory.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpClientFactory.java @@ -41,9 +41,9 @@ import com.jcraft.jsch.UserInfo; * Create a JSch Session instance. */ public final class SftpClientFactory { + private static final String SSH_DIR_NAME = ".ssh"; private static final String OPENSSH_CONFIG_NAME = "config"; - private static final Log LOG = LogFactory.getLog(SftpClientFactory.class); static { @@ -250,20 +250,24 @@ public final class SftpClientFactory { } /** - * Finds the .ssh directory. + * Finds the {@code .ssh} directory. * <p> * The lookup order is: + * </p> * <ol> * <li>The system property {@code vfs.sftp.sshdir} (the override mechanism)</li> - * <li>{user.home}/.ssh</li> - * <li>On Windows only: C:\cygwin\home\{user.name}\.ssh</li> + * <li>{@code user.home}/.ssh</li> + * <li>On Windows only: {@code C:\cygwin\home[user.name]\.ssh}</li> * <li>The current directory, as a last resort.</li> - * <ol> - * Windows Notes:<br> + * </ol> + * + * <h2>Windows Notes</h2> + * <p> * The default installation directory for Cygwin is {@code C:\cygwin}. On my set up (Gary here), I have Cygwin in - * C:\bin\cygwin, not the default. Also, my .ssh directory was created in the {user.home} directory. - * - * @return The .ssh directory + * {@code C:\bin\cygwin}, not the default. Also, my .ssh directory was created in the {@code user.home} directory. + * </p> + * + * @return The {@code .ssh} directory */ private static File findSshDir() { String sshDirPath; diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileObject.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileObject.java index f41a428..2d78e71 100644 --- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileObject.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileObject.java @@ -155,7 +155,7 @@ public class SftpFileObject extends AbstractFileObject<SftpFileSystem> { } /** - * Set attrs from listChildrenResolved + * Sets attrs from listChildrenResolved */ private void setStat(final SftpATTRS attrs) { this.attrs = attrs; @@ -224,7 +224,7 @@ public class SftpFileObject extends AbstractFileObject<SftpFileSystem> { } /** - * Rename the file. + * Renames the file. */ @Override protected void doRename(final FileObject newFile) throws Exception { diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileSystemConfigBuilder.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileSystemConfigBuilder.java index eeefb74..28be938 100644 --- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileSystemConfigBuilder.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileSystemConfigBuilder.java @@ -86,9 +86,7 @@ public final class SftpFileSystemConfigBuilder extends FileSystemConfigBuilder { } private static final String _PREFIX = SftpFileSystemConfigBuilder.class.getName(); - private static final SftpFileSystemConfigBuilder BUILDER = new SftpFileSystemConfigBuilder(); - private static final String COMPRESSION = _PREFIX + "COMPRESSION"; private static final String CONNECT_TIMEOUT_MILLIS = _PREFIX + ".CONNECT_TIMEOUT_MILLIS"; private static final String ENCODING = _PREFIX + ".ENCODING"; @@ -120,10 +118,12 @@ public final class SftpFileSystemConfigBuilder extends FileSystemConfigBuilder { * On this proxy host, a command (e.g. {@linkplain SftpStreamProxy#NETCAT_COMMAND} or * {@linkplain SftpStreamProxy#NETCAT_COMMAND}) is run to forward input/output streams between the target host and * the VFS host. + * </p> * <p> * When used, the proxy username ({@linkplain #setProxyUser}) and hostname ({@linkplain #setProxyHost}) <b>must</b> * be set. Optionnaly, the command ({@linkplain #setProxyCommand}), password ({@linkplain #setProxyPassword}) and * connection options ({@linkplain #setProxyOptions}) can be set. + * </p> */ public static final ProxyType PROXY_STREAM = new ProxyType("stream"); @@ -184,6 +184,7 @@ public final class SftpFileSystemConfigBuilder extends FileSystemConfigBuilder { * Gets the identity files (your private key files). * <p> * We use java.io.File because JSch cannot deal with VFS FileObjects. + * </p> * * @param opts The FileSystem options. * @return the array of identity Files. @@ -247,7 +248,7 @@ public final class SftpFileSystemConfigBuilder extends FileSystemConfigBuilder { } /** - * Get the config repository. + * Gets the config repository. * * @param opts The FileSystem options. * @return the ConfigRepository @@ -439,8 +440,10 @@ public final class SftpFileSystemConfigBuilder extends FileSystemConfigBuilder { * Configures the compression algorithms to use. * <p> * For example, use {@code "zlib,none"} to enable compression. + * </p> * <p> * See the Jsch documentation (in particular the README file) for details. + * </p> * * @param opts The FileSystem options. * @param compression The names of the compression algorithms, comma-separated. @@ -475,6 +478,7 @@ public final class SftpFileSystemConfigBuilder extends FileSystemConfigBuilder { * Sets the identity files (your private key files). * <p> * We use {@link java.io.File} because JSch cannot deal with VFS FileObjects. + * </p> * * @param opts The FileSystem options. * @param identityFiles An array of identity Files. @@ -522,9 +526,10 @@ public final class SftpFileSystemConfigBuilder extends FileSystemConfigBuilder { } /** - * Set the identity repository. + * Sets the identity repository. * <p> * This is useful when you want to use e.g. an SSH agent as provided. + * </p> * * @param opts The FileSystem options. * @param factory An identity repository. @@ -537,9 +542,10 @@ public final class SftpFileSystemConfigBuilder extends FileSystemConfigBuilder { } /** - * Set the config repository. e.g. {@code /home/user/.ssh/config}. + * Sets the config repository. e.g. {@code /home/user/.ssh/config}. * <p> * This is useful when you want to use OpenSSHConfig. + * </p> * * @param opts The FileSystem options. * @param configRepository An config repository. @@ -555,6 +561,7 @@ public final class SftpFileSystemConfigBuilder extends FileSystemConfigBuilder { * Sets the known_hosts file. e.g. {@code /home/user/.ssh/known_hosts2}. * <p> * We use {@link java.io.File} because JSch cannot deal with VFS FileObjects. + * </p> * * @param opts The FileSystem options. * @param knownHosts The known hosts file. @@ -628,6 +635,7 @@ public final class SftpFileSystemConfigBuilder extends FileSystemConfigBuilder { * Sets the proxy port to use for the SFTP connection. * <p> * You MUST also set the proxy host to use the proxy. + * </p> * * @param opts The FileSystem options. * @param proxyPort the port @@ -639,8 +647,9 @@ public final class SftpFileSystemConfigBuilder extends FileSystemConfigBuilder { /** * Sets the proxy type to use for the SFTP connection. - * + * <p> * The possibles values are: + * </p> * <ul> * <li>{@linkplain #PROXY_HTTP} connects using an HTTP proxy</li> * <li>{@linkplain #PROXY_SOCKS5} connects using an Socket5 proxy</li> diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpStreamProxy.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpStreamProxy.java index 1e089c3..8106653 100644 --- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpStreamProxy.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpStreamProxy.java @@ -56,11 +56,15 @@ public class SftpStreamProxy implements Proxy { * <p> * When run, the command output should be forwarded to the target host and port, and its input should be forwarded * from the target host and port. + * </p> * <p> * The command will be created for each host/port pair by using {@linkplain String#format(String, Object...)} with * two objects: the target host name ({@linkplain String}) and the target port ({@linkplain Integer}). + * </p> + * <p> * <p> * Here are two examples (that can be easily used by using the static members of this class): + * </p> * <ul> * <li><code>nc -q 0 %s %d</code> to use the netcat command ({@linkplain #NETCAT_COMMAND})</li> * <li><code>/bin/bash -c 'exec 3<>/dev/tcp/%s/%d; cat <&3 & cat >&3; kill $!</code> will use bash built-in TCP @@ -102,6 +106,7 @@ public class SftpStreamProxy implements Proxy { * @param commandFormat A format string that will be used to create the command to execute on the proxy host using * {@linkplain String#format(String, Object...)}. Two parameters are given to the format command, the * target host name (String) and port (Integer). + * * @param proxyUser The proxy user * @param proxyPassword The proxy password * @param proxyHost The proxy host