[SSHD-815] Extract SFTP in its own module

Project: http://git-wip-us.apache.org/repos/asf/mina-sshd/repo
Commit: http://git-wip-us.apache.org/repos/asf/mina-sshd/commit/251db9b9
Tree: http://git-wip-us.apache.org/repos/asf/mina-sshd/tree/251db9b9
Diff: http://git-wip-us.apache.org/repos/asf/mina-sshd/diff/251db9b9

Branch: refs/heads/master
Commit: 251db9b9dccfc4b9091e69982928d308fd09c04a
Parents: 19be905
Author: Guillaume Nodet <gno...@apache.org>
Authored: Fri Apr 13 11:13:07 2018 +0200
Committer: Guillaume Nodet <gno...@apache.org>
Committed: Mon Apr 16 13:46:34 2018 +0200

----------------------------------------------------------------------
 README.md                                       |  149 +-
 assembly/pom.xml                                |    5 +
 pom.xml                                         |    1 +
 sshd-contrib/pom.xml                            |    5 +
 ...impleAccessControlSftpEventListenerTest.java |    5 +-
 .../sshd/client/ClientFactoryManager.java       |    2 -
 .../java/org/apache/sshd/client/SshClient.java  |   13 -
 .../client/session/AbstractClientSession.java   |   27 -
 .../sshd/client/session/ClientSession.java      |    4 +-
 .../client/simple/AbstractSimpleClient.java     |  100 -
 .../apache/sshd/client/simple/SimpleClient.java |    1 -
 .../sshd/client/simple/SimpleSftpClient.java    |  179 --
 .../client/subsystem/sftp/RawSftpClient.java    |   44 -
 .../sftp/SftpAclFileAttributeView.java          |   67 -
 .../sshd/client/subsystem/sftp/SftpClient.java  | 1038 -------
 .../subsystem/sftp/SftpClientCreator.java       |   85 -
 .../subsystem/sftp/SftpClientFactory.java       |   51 -
 .../sftp/SftpClientFactoryManager.java          |   37 -
 .../sshd/client/subsystem/sftp/SftpCommand.java |  920 -------
 .../subsystem/sftp/SftpDirEntryIterator.java    |  194 --
 .../subsystem/sftp/SftpDirectoryStream.java     |   65 -
 .../client/subsystem/sftp/SftpFileStore.java    |  105 -
 .../client/subsystem/sftp/SftpFileSystem.java   |  596 ----
 .../subsystem/sftp/SftpFileSystemChannel.java   |   37 -
 .../subsystem/sftp/SftpFileSystemProvider.java  | 1249 ---------
 .../sftp/SftpInputStreamWithChannel.java        |  179 --
 .../subsystem/sftp/SftpIterableDirEntry.java    |   72 -
 .../sftp/SftpOutputStreamWithChannel.java       |  124 -
 .../sshd/client/subsystem/sftp/SftpPath.java    |   43 -
 .../client/subsystem/sftp/SftpPathIterator.java |   82 -
 .../sftp/SftpPosixFileAttributeView.java        |   94 -
 .../subsystem/sftp/SftpPosixFileAttributes.java |  113 -
 .../subsystem/sftp/SftpRemotePathChannel.java   |  412 ---
 .../subsystem/sftp/SftpVersionSelector.java     |  127 -
 .../subsystem/sftp/StfpIterableDirHandle.java   |   59 -
 .../extensions/BuiltinSftpClientExtensions.java |  162 --
 .../extensions/CheckFileHandleExtension.java    |   45 -
 .../sftp/extensions/CheckFileNameExtension.java |   43 -
 .../sftp/extensions/CopyDataExtension.java      |   34 -
 .../sftp/extensions/CopyFileExtension.java      |   36 -
 .../sftp/extensions/MD5FileExtension.java       |   40 -
 .../sftp/extensions/MD5HandleExtension.java     |   43 -
 .../sftp/extensions/SftpClientExtension.java    |   34 -
 .../extensions/SftpClientExtensionFactory.java  |   39 -
 .../extensions/SpaceAvailableExtension.java     |   34 -
 .../helpers/AbstractCheckFileExtension.java     |   76 -
 .../helpers/AbstractMD5HashExtension.java       |   75 -
 .../helpers/AbstractSftpClientExtension.java    |  206 --
 .../helpers/CheckFileHandleExtensionImpl.java   |   49 -
 .../helpers/CheckFileNameExtensionImpl.java     |   48 -
 .../helpers/CopyDataExtensionImpl.java          |   58 -
 .../helpers/CopyFileExtensionImpl.java          |   53 -
 .../helpers/MD5FileExtensionImpl.java           |   45 -
 .../helpers/MD5HandleExtensionImpl.java         |   46 -
 .../helpers/SpaceAvailableExtensionImpl.java    |   56 -
 .../openssh/OpenSSHFsyncExtension.java          |   35 -
 .../openssh/OpenSSHStatExtensionInfo.java       |  150 -
 .../openssh/OpenSSHStatHandleExtension.java     |   34 -
 .../openssh/OpenSSHStatPathExtension.java       |   34 -
 .../AbstractOpenSSHStatCommandExtension.java    |   57 -
 .../helpers/OpenSSHFsyncExtensionImpl.java      |   49 -
 .../helpers/OpenSSHStatHandleExtensionImpl.java |   44 -
 .../helpers/OpenSSHStatPathExtensionImpl.java   |   43 -
 .../subsystem/sftp/impl/AbstractSftpClient.java | 1188 --------
 .../impl/AbstractSftpFileAttributeView.java     |   92 -
 .../sftp/impl/DefaultCloseableHandle.java       |   66 -
 .../subsystem/sftp/impl/DefaultSftpClient.java  |  464 ----
 .../sftp/impl/DefaultSftpClientFactory.java     |   81 -
 .../common/subsystem/sftp/SftpConstants.java    |  330 ---
 .../common/subsystem/sftp/SftpException.java    |   43 -
 .../sshd/common/subsystem/sftp/SftpHelper.java  | 1114 --------
 .../sftp/SftpUniversalOwnerAndGroup.java        |   67 -
 .../sftp/extensions/AbstractParser.java         |   39 -
 .../sftp/extensions/AclSupportedParser.java     |  208 --
 .../sftp/extensions/ExtensionParser.java        |   42 -
 .../sftp/extensions/NewlineParser.java          |  115 -
 .../subsystem/sftp/extensions/ParserUtils.java  |  195 --
 .../extensions/SpaceAvailableExtensionInfo.java |  125 -
 .../sftp/extensions/Supported2Parser.java       |   93 -
 .../sftp/extensions/SupportedParser.java        |   82 -
 .../sftp/extensions/VendorIdParser.java         |   71 -
 .../sftp/extensions/VersionsParser.java         |   83 -
 .../openssh/AbstractOpenSSHExtensionParser.java |  113 -
 .../openssh/FstatVfsExtensionParser.java        |   32 -
 .../openssh/FsyncExtensionParser.java           |   33 -
 .../openssh/HardLinkExtensionParser.java        |   33 -
 .../openssh/PosixRenameExtensionParser.java     |   33 -
 .../openssh/StatVfsExtensionParser.java         |   33 -
 .../java/org/apache/sshd/server/SshServer.java  |    2 -
 .../sftp/AbstractSftpEventListenerAdapter.java  |  258 --
 .../sftp/AbstractSftpEventListenerManager.java  |   60 -
 .../sftp/AbstractSftpSubsystemHelper.java       | 2580 ------------------
 .../subsystem/sftp/DefaultGroupPrincipal.java   |   32 -
 .../subsystem/sftp/DefaultUserPrincipal.java    |   32 -
 .../server/subsystem/sftp/DirectoryHandle.java  |  109 -
 .../sshd/server/subsystem/sftp/FileHandle.java  |  270 --
 .../sshd/server/subsystem/sftp/Handle.java      |   79 -
 .../subsystem/sftp/InvalidHandleException.java  |   32 -
 .../server/subsystem/sftp/PrincipalBase.java    |   65 -
 .../sftp/SftpErrorStatusDataHandler.java        |   83 -
 .../subsystem/sftp/SftpEventListener.java       |  396 ---
 .../sftp/SftpEventListenerManager.java          |   48 -
 .../subsystem/sftp/SftpFileSystemAccessor.java  |  155 --
 .../sftp/SftpFileSystemAccessorManager.java     |   29 -
 .../server/subsystem/sftp/SftpSubsystem.java    | 1069 --------
 .../sftp/SftpSubsystemEnvironment.java          |   67 -
 .../subsystem/sftp/SftpSubsystemFactory.java    |  173 --
 .../server/subsystem/sftp/UnixDateFormat.java   |  108 -
 .../sftp/UnsupportedAttributePolicy.java        |   36 -
 .../java/org/apache/sshd/KeyReExchangeTest.java |   53 +-
 .../java/org/apache/sshd/client/ClientTest.java |   50 +-
 .../client/simple/SimpleSftpClientTest.java     |  127 -
 .../sftp/AbstractSftpClientTestSupport.java     |   97 -
 .../sftp/DefaultCloseableHandleTest.java        |   87 -
 .../client/subsystem/sftp/SftpCommandMain.java  |   36 -
 .../subsystem/sftp/SftpFileSystemTest.java      |  490 ----
 .../sshd/client/subsystem/sftp/SftpTest.java    | 1500 ----------
 .../subsystem/sftp/SftpVersionSelectorTest.java |  134 -
 .../client/subsystem/sftp/SftpVersionsTest.java |  510 ----
 .../BuiltinSftpClientExtensionsTest.java        |   84 -
 .../helpers/AbstractCheckFileExtensionTest.java |  228 --
 .../helpers/AbstractMD5HashExtensionTest.java   |  177 --
 .../helpers/CopyDataExtensionImplTest.java      |  192 --
 .../helpers/CopyFileExtensionImplTest.java      |   96 -
 .../SpaceAvailableExtensionImplTest.java        |  101 -
 .../openssh/helpers/OpenSSHExtensionsTest.java  |  207 --
 .../common/channel/TestChannelListener.java     |  153 --
 .../subsystem/sftp/SftpConstantsTest.java       |   75 -
 .../sftp/SftpUniversalOwnerAndGroupTest.java    |   70 -
 .../java/org/apache/sshd/server/ServerTest.java |    2 +-
 .../sftp/SftpSubsystemFactoryTest.java          |  101 -
 .../server/subsystem/sftp/SshFsMounter.java     |  327 ---
 .../sshd/util/test/TestChannelListener.java     |  155 ++
 sshd-git/pom.xml                                |    6 +
 sshd-mina/pom.xml                               |   69 +-
 sshd-sftp/pom.xml                               |  103 +
 .../sshd/client/simple/SimpleSftpClient.java    |  179 ++
 .../client/simple/SimpleSftpClientImpl.java     |  170 ++
 .../client/subsystem/sftp/RawSftpClient.java    |   44 +
 .../sftp/SftpAclFileAttributeView.java          |   67 +
 .../sshd/client/subsystem/sftp/SftpClient.java  | 1038 +++++++
 .../subsystem/sftp/SftpClientFactory.java       |  100 +
 .../sshd/client/subsystem/sftp/SftpCommand.java |  920 +++++++
 .../subsystem/sftp/SftpDirEntryIterator.java    |  194 ++
 .../subsystem/sftp/SftpDirectoryStream.java     |   65 +
 .../client/subsystem/sftp/SftpFileStore.java    |  105 +
 .../client/subsystem/sftp/SftpFileSystem.java   |  598 ++++
 .../subsystem/sftp/SftpFileSystemChannel.java   |   37 +
 .../subsystem/sftp/SftpFileSystemProvider.java  | 1255 +++++++++
 .../sftp/SftpInputStreamWithChannel.java        |  179 ++
 .../subsystem/sftp/SftpIterableDirEntry.java    |   72 +
 .../sftp/SftpOutputStreamWithChannel.java       |  124 +
 .../sshd/client/subsystem/sftp/SftpPath.java    |   43 +
 .../client/subsystem/sftp/SftpPathIterator.java |   82 +
 .../sftp/SftpPosixFileAttributeView.java        |   94 +
 .../subsystem/sftp/SftpPosixFileAttributes.java |  113 +
 .../subsystem/sftp/SftpRemotePathChannel.java   |  412 +++
 .../subsystem/sftp/SftpVersionSelector.java     |  126 +
 .../subsystem/sftp/StfpIterableDirHandle.java   |   59 +
 .../extensions/BuiltinSftpClientExtensions.java |  162 ++
 .../extensions/CheckFileHandleExtension.java    |   45 +
 .../sftp/extensions/CheckFileNameExtension.java |   43 +
 .../sftp/extensions/CopyDataExtension.java      |   34 +
 .../sftp/extensions/CopyFileExtension.java      |   36 +
 .../sftp/extensions/MD5FileExtension.java       |   40 +
 .../sftp/extensions/MD5HandleExtension.java     |   43 +
 .../sftp/extensions/SftpClientExtension.java    |   34 +
 .../extensions/SftpClientExtensionFactory.java  |   39 +
 .../extensions/SpaceAvailableExtension.java     |   34 +
 .../helpers/AbstractCheckFileExtension.java     |   76 +
 .../helpers/AbstractMD5HashExtension.java       |   75 +
 .../helpers/AbstractSftpClientExtension.java    |  206 ++
 .../helpers/CheckFileHandleExtensionImpl.java   |   49 +
 .../helpers/CheckFileNameExtensionImpl.java     |   48 +
 .../helpers/CopyDataExtensionImpl.java          |   58 +
 .../helpers/CopyFileExtensionImpl.java          |   53 +
 .../helpers/MD5FileExtensionImpl.java           |   45 +
 .../helpers/MD5HandleExtensionImpl.java         |   46 +
 .../helpers/SpaceAvailableExtensionImpl.java    |   56 +
 .../openssh/OpenSSHFsyncExtension.java          |   35 +
 .../openssh/OpenSSHStatExtensionInfo.java       |  150 +
 .../openssh/OpenSSHStatHandleExtension.java     |   34 +
 .../openssh/OpenSSHStatPathExtension.java       |   34 +
 .../AbstractOpenSSHStatCommandExtension.java    |   57 +
 .../helpers/OpenSSHFsyncExtensionImpl.java      |   49 +
 .../helpers/OpenSSHStatHandleExtensionImpl.java |   44 +
 .../helpers/OpenSSHStatPathExtensionImpl.java   |   43 +
 .../subsystem/sftp/impl/AbstractSftpClient.java | 1188 ++++++++
 .../impl/AbstractSftpFileAttributeView.java     |   92 +
 .../sftp/impl/DefaultCloseableHandle.java       |   66 +
 .../subsystem/sftp/impl/DefaultSftpClient.java  |  464 ++++
 .../sftp/impl/DefaultSftpClientFactory.java     |   81 +
 .../common/subsystem/sftp/SftpConstants.java    |  330 +++
 .../common/subsystem/sftp/SftpException.java    |   43 +
 .../sshd/common/subsystem/sftp/SftpHelper.java  | 1114 ++++++++
 .../sftp/SftpUniversalOwnerAndGroup.java        |   67 +
 .../sftp/extensions/AbstractParser.java         |   39 +
 .../sftp/extensions/AclSupportedParser.java     |  208 ++
 .../sftp/extensions/ExtensionParser.java        |   42 +
 .../sftp/extensions/NewlineParser.java          |  115 +
 .../subsystem/sftp/extensions/ParserUtils.java  |  195 ++
 .../extensions/SpaceAvailableExtensionInfo.java |  125 +
 .../sftp/extensions/Supported2Parser.java       |   93 +
 .../sftp/extensions/SupportedParser.java        |   82 +
 .../sftp/extensions/VendorIdParser.java         |   71 +
 .../sftp/extensions/VersionsParser.java         |   83 +
 .../openssh/AbstractOpenSSHExtensionParser.java |  113 +
 .../openssh/FstatVfsExtensionParser.java        |   32 +
 .../openssh/FsyncExtensionParser.java           |   33 +
 .../openssh/HardLinkExtensionParser.java        |   33 +
 .../openssh/PosixRenameExtensionParser.java     |   33 +
 .../openssh/StatVfsExtensionParser.java         |   33 +
 .../sftp/AbstractSftpEventListenerAdapter.java  |  258 ++
 .../sftp/AbstractSftpEventListenerManager.java  |   60 +
 .../sftp/AbstractSftpSubsystemHelper.java       | 2580 ++++++++++++++++++
 .../subsystem/sftp/DefaultGroupPrincipal.java   |   32 +
 .../subsystem/sftp/DefaultUserPrincipal.java    |   32 +
 .../server/subsystem/sftp/DirectoryHandle.java  |  109 +
 .../sshd/server/subsystem/sftp/FileHandle.java  |  270 ++
 .../sshd/server/subsystem/sftp/Handle.java      |   79 +
 .../subsystem/sftp/InvalidHandleException.java  |   32 +
 .../server/subsystem/sftp/PrincipalBase.java    |   65 +
 .../sftp/SftpErrorStatusDataHandler.java        |   83 +
 .../subsystem/sftp/SftpEventListener.java       |  396 +++
 .../sftp/SftpEventListenerManager.java          |   48 +
 .../subsystem/sftp/SftpFileSystemAccessor.java  |  155 ++
 .../sftp/SftpFileSystemAccessorManager.java     |   29 +
 .../server/subsystem/sftp/SftpSubsystem.java    | 1069 ++++++++
 .../sftp/SftpSubsystemEnvironment.java          |   67 +
 .../subsystem/sftp/SftpSubsystemFactory.java    |  173 ++
 .../server/subsystem/sftp/TreeLockExecutor.java |   75 +
 .../server/subsystem/sftp/UnixDateFormat.java   |  108 +
 .../sftp/UnsupportedAttributePolicy.java        |   36 +
 .../java/org/apache/sshd/client/ClientTest.java |  426 +++
 .../simple/BaseSimpleClientTestSupport.java     |   70 +
 .../client/simple/SimpleSftpClientTest.java     |  129 +
 .../sftp/AbstractSftpClientTestSupport.java     |  106 +
 .../sftp/DefaultCloseableHandleTest.java        |   87 +
 .../client/subsystem/sftp/SftpCommandMain.java  |   36 +
 .../subsystem/sftp/SftpFileSystemTest.java      |  494 ++++
 .../sshd/client/subsystem/sftp/SftpTest.java    | 1500 ++++++++++
 .../subsystem/sftp/SftpVersionSelectorTest.java |  134 +
 .../client/subsystem/sftp/SftpVersionsTest.java |  510 ++++
 .../BuiltinSftpClientExtensionsTest.java        |   84 +
 .../helpers/AbstractCheckFileExtensionTest.java |  228 ++
 .../helpers/AbstractMD5HashExtensionTest.java   |  177 ++
 .../helpers/CopyDataExtensionImplTest.java      |  192 ++
 .../helpers/CopyFileExtensionImplTest.java      |   96 +
 .../SpaceAvailableExtensionImplTest.java        |  101 +
 .../openssh/helpers/OpenSSHExtensionsTest.java  |  207 ++
 .../subsystem/sftp/SftpConstantsTest.java       |   75 +
 .../sftp/SftpUniversalOwnerAndGroupTest.java    |   70 +
 .../sftp/SftpSubsystemFactoryTest.java          |  101 +
 .../server/subsystem/sftp/SshFsMounter.java     |  327 +++
 sshd-spring-sftp/pom.xml                        |    5 +
 .../sftp/ApacheSshdSftpSessionFactory.java      |    3 +-
 256 files changed, 23866 insertions(+), 23207 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/251db9b9/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index 8d0c018..52c5180 100644
--- a/README.md
+++ b/README.md
@@ -60,7 +60,7 @@ Optional dependency to enable choosing between NIO 
asynchronous sockets (the def
         <groupId>org.apache.mina</groupId>
         <artifactId>mina-core</artifactId>
             <!-- see SSHD POM for latest tested known version of MINA core -->
-        <version>2.0.6</version>
+        <version>2.0.17</version>
     </dependency>
 
 ```
@@ -382,7 +382,6 @@ The usage of a `FileSystemFactory` is not limited though to 
the server only - th
 it in order to retrieve the *local* path for upload/download-ing 
files/folders. This means that the client side can also
 be tailored to present different views for different clients
 
-
 ## `ExecutorService`-s
 
 The framework requires from time to time spawning some threads in order to 
function correctly - e.g., commands, SFTP subsystem,
@@ -520,6 +519,41 @@ due to SCP protocol limitations one cannot change the 
**size** of the input/outp
 
 ## SFTP
 
+Both client-side and server-side SFTP are supported.  Starting from SSHD 
1.8.0, the SFTP related code is located in the `sshd-sftp`, so you need to add 
this additional dependency to your maven project:
+
+```xml
+
+    <dependency>
+        <groupId>org.apache.sshd</groupId>
+        <artifactId>sshd-sftp</artifactId>
+        <version>...same as sshd-core...</version>
+    </dependency>
+
+```
+
+### Server-side SFTP
+
+On the server side, the following code needs to be added:
+
+```java
+
+    SftpSubsystemFactory factory = new SftpSubsystemFactory.Builder()
+        .build();
+    server.setSubsystemFactories(Collections.singletonList(factory));
+
+```
+
+### Client-side SFTP
+
+```java
+
+    SftpClient client = SftpClientFactory.instance().createSftpClient(session);
+
+```
+
+### `SftpEventListener`
+
+See above...
 In addition to the `SftpEventListener` there are a few more SFTP-related 
special interfaces and modules.
 
 
@@ -545,7 +579,7 @@ range.
         session.addPasswordIdentity(password);
         session.auth.verify(timeout);
 
-        try (SftpClient sftp = session.createSftpClient(myVersionSelector)) {
+        try (SftpClient sftp = 
SftpClientFactory.instance().createSftpClient(session, myVersionSelector)) {
             ... do SFTP related stuff...
         }
     }
@@ -558,73 +592,30 @@ configuration key. For more advanced restrictions one 
needs to sub-class `SftpSu
 `SftpSubsystemFactory` that uses the sub-classed code.
 
 
-### Registering a custom `SftpClientFactory`
+### Using a custom `SftpClientFactory`
 
 The code creates `SftpClient`-s and `SftpFileSystem`-s using a default 
built-in `SftpClientFactory` instance (see
-`DefaultSftpClientFactory`). Users may choose to register a custom factory in 
order to provide their own
+`DefaultSftpClientFactory`). Users may choose to use a custom factory in order 
to provide their own
 implementations - e.g., in order to override some default behavior. The custom 
factory may be registered either at
 the client or session level - e.g.:
 
 ```java
 
     SshClient client = ... setup client...
-    client.setSftpClientFactory(new MySuperDuperSftpClientFactory());
 
     try (ClientSession session = client.connect(user, host, 
port).verify(timeout).getSession()) {
         // override the default factory with a special one - but only for this 
session
-        session.setSftpClientFactory(new SpecialSessionSftpClientFactory());
+        session.setSftpClientFactory();
         session.addPasswordIdentity(password);
         session.auth.verify(timeout);
 
-        try (SftpClient sftp = session.createSftpClient()) {
+        try (SftpClient sftp = new 
SpecialSessionSftpClientFactory().createSftpClient()) {
             ... instance created through SpecialSessionSftpClientFactory ...
         }
     }
 
 ```
 
-If no factory provided or factory set to _null_ then code reverts to using the 
default built-in one. **Note:** setting
-the factory to _null_ on the session level, simply delegates the creation to 
whatever factory is registered at the
-client level - default or custom.
-
-```java
-
-    SshClient client = ... setup client...
-    client.setSftpClientFactory(new MySuperDuperSftpClientFactory());
-
-    try (ClientSession session = client.connect(user, host, 
port).verify(timeout).getSession()) {
-        // override the default factory with a special one - but only for this 
session
-        session.setSftpClientFactory(new SpecialSessionSftpClientFactory());
-        session.addPasswordIdentity(password);
-        session.auth.verify(timeout);
-
-        try (SftpClient sftp = session.createSftpClient()) {
-            ... instance created through SpecialSessionSftpClientFactory ...
-        }
-
-        // revert to one from client
-        session.setSftpClientFactory(null);
-
-        try (SftpClient sftp = session.createSftpClient()) {
-            ... instance created through MySuperDuperSftpClientFactory ...
-        }
-
-        // remove client-level factory
-        client.setSftpClientFactory(null);
-
-        try (SftpClient sftp = session.createSftpClient()) {
-            ... instance created through built-in DefaultSftpClientFactory ...
-        }
-
-        // re-instate session-level factory
-        session.setSftpClientFactory(new SpecialSessionSftpClientFactory());
-
-        try (SftpClient sftp = session.createSftpClient()) {
-            ... instance created through SpecialSessionSftpClientFactory ...
-        }
-    }
-
-```
 
 ### Using `SftpFileSystemProvider` to create an `SftpFileSystem`
 
@@ -783,7 +774,7 @@ UTF-8 is used. **Note:** the value can be a charset name or 
a `java.nio.charset.
          PropertyResolverUtils.updateProperty(session, 
SftpClient.NAME_DECODING_CHARSET, "ISO-8859-4");
          session.authenticate(...);
 
-         try (SftpClient sftp = session.createSftpClient()) {
+         try (SftpClient sftp = 
SftpClientFactory.instance().createSftpClient(session)) {
              for (DirEntry entry : sftp.readDir(...some path...)) {
                  ...handle entry assuming ISO-8859-4 (inherited from the 
session) encoded names...
              }
@@ -799,58 +790,6 @@ UTF-8 is used. **Note:** the value can be a charset name 
or a `java.nio.charset.
 
 ```
 
-Another option is to register a custom `SftpClientFactory` and create a 
`DefaultSftpClient` that overrides `getReferencedName` method:
-
-```java
-
-public class MyCustomSftpClient extends DefaultSftpClient {
-    public MyCustomSftpClient(ClientSession session) {
-        super(session);
-    }
-
-    @Override
-    protected String getReferencedName(int cmd, Buffer buf) {
-        byte[] bytes = buf.getBytes();
-        Charset cs = detectCharset(bytes);
-        return new String(bytes, cs);
-    }
-
-    @Override
-    protected <B extends Buffer> B putReferencedName(int cmd, B buf, String 
name) {
-        Charset cs = detectCharset(name);
-        buf.putString(name, cs);
-        return buf;
-    }
-}
-
-public class MyCustomSftpClientFactory extends DefaultSftpClientFactory {
-    public MyCustomSftpClientFactory() {
-        super();
-    }
-
-    protected DefaultSftpClient createDefaultSftpClient(ClientSession session, 
SftpVersionSelector selector) throws IOException {
-        return MyCustomSftpClient(session);
-    }
-}
-
-    // Usage - register at client level and affect ALL SFTP interactions
-    SshClient client = ... setup/obtain an instance...
-    client.setSftpClientFactory(new MyCustomSftpClientFactory());
-
-    // Usage - selective session registration
-    SshClient client = ... setup/obtain an instance...
-    try (ClientSession session = client.connect(...)) {
-        if (...something special about the host/port/etc....) {
-            // affect only SFTP interactions for this session
-            session.setSftpClientFactory(new MyCustomSftpClientFactory());
-        }
-    }
-
-
-```
-
-### Supported SFTP extensions
-
 Both client and server support several of the SFTP extensions specified in 
various drafts:
 
 * `supported` - [DRAFT 05 - section 
4.4](http://tools.ietf.org/wg/secsh/draft-ietf-secsh-filexfer/draft-ietf-secsh-filexfer-05.tx)
@@ -887,7 +826,7 @@ On the client side, all the supported extensions are 
classes that implement `Sft
         session.addPasswordIdentity(password);
         session.auth().verify(timeout);
 
-        try (SftpClient sftp = session.createSftpClient()) {
+        try (SftpClient sftp = 
SftpClientFactory.instance().createSftpClient(session)) {
             Map<String, byte[]> extensions = sftp.getServerExtensions();
             // Key=extension name, value=registered parser instance
             Map<String, ?> data = ParserUtils.parse(extensions);
@@ -919,7 +858,7 @@ One can skip all the conditional code if a specific known 
extension is required:
         session.addPasswordIdentity(password);
         session.auth().verify(timeout);
 
-        try (SftpClient sftp = session.createSftpClient()) {
+        try (SftpClient sftp = 
SftpClientFactory.instance().createSftpClient(session)) {
             // Returns null if extension is not supported by remote server
             SpaceAvailableExtension space = 
sftp.getExtension(SpaceAvailableExtension.class);
             if (space != null) {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/251db9b9/assembly/pom.xml
----------------------------------------------------------------------
diff --git a/assembly/pom.xml b/assembly/pom.xml
index 97500ba..85eab19 100644
--- a/assembly/pom.xml
+++ b/assembly/pom.xml
@@ -42,6 +42,11 @@
             <version>${project.version}</version>
         </dependency>
         <dependency>
+            <groupId>org.apache.sshd</groupId>
+            <artifactId>sshd-sftp</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
             <groupId>org.slf4j</groupId>
             <artifactId>slf4j-jdk14</artifactId>
         </dependency>

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/251db9b9/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 6dafdeb..ea73bb4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1004,6 +1004,7 @@
 
     <modules>
         <module>sshd-core</module>
+        <module>sshd-sftp</module>
         <module>sshd-mina</module>
         <module>sshd-ldap</module>
         <module>sshd-git</module>

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/251db9b9/sshd-contrib/pom.xml
----------------------------------------------------------------------
diff --git a/sshd-contrib/pom.xml b/sshd-contrib/pom.xml
index 1e6430e..3f49df8 100644
--- a/sshd-contrib/pom.xml
+++ b/sshd-contrib/pom.xml
@@ -51,6 +51,11 @@
             <artifactId>sshd-core</artifactId>
             <version>${project.version}</version>
         </dependency>
+        <dependency>
+            <groupId>org.apache.sshd</groupId>
+            <artifactId>sshd-sftp</artifactId>
+            <version>${project.version}</version>
+        </dependency>
             <!-- For ed25519 support -->
         <dependency>
             <groupId>net.i2p.crypto</groupId>

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/251db9b9/sshd-contrib/src/test/java/org/apache/sshd/server/subsystem/sftp/SimpleAccessControlSftpEventListenerTest.java
----------------------------------------------------------------------
diff --git 
a/sshd-contrib/src/test/java/org/apache/sshd/server/subsystem/sftp/SimpleAccessControlSftpEventListenerTest.java
 
b/sshd-contrib/src/test/java/org/apache/sshd/server/subsystem/sftp/SimpleAccessControlSftpEventListenerTest.java
index 6f90d3d..ddbe162 100644
--- 
a/sshd-contrib/src/test/java/org/apache/sshd/server/subsystem/sftp/SimpleAccessControlSftpEventListenerTest.java
+++ 
b/sshd-contrib/src/test/java/org/apache/sshd/server/subsystem/sftp/SimpleAccessControlSftpEventListenerTest.java
@@ -30,6 +30,7 @@ import org.apache.sshd.client.session.ClientSession;
 import org.apache.sshd.client.subsystem.sftp.SftpClient;
 import org.apache.sshd.client.subsystem.sftp.SftpClient.CloseableHandle;
 import org.apache.sshd.client.subsystem.sftp.SftpClient.OpenMode;
+import org.apache.sshd.client.subsystem.sftp.SftpClientFactory;
 import org.apache.sshd.common.file.FileSystemFactory;
 import org.apache.sshd.common.file.virtualfs.VirtualFileSystemFactory;
 import org.apache.sshd.common.subsystem.sftp.SftpConstants;
@@ -101,7 +102,7 @@ public class SimpleAccessControlSftpEventListenerTest 
extends BaseTestSupport {
                 session.addPasswordIdentity(getCurrentTestName());
                 session.auth().verify(5L, TimeUnit.SECONDS);
 
-                try (SftpClient sftp = session.createSftpClient()) {
+                try (SftpClient sftp = 
SftpClientFactory.instance().createSftpClient(session)) {
                     String file = Utils.resolveRelativeRemotePath(parentPath, 
testFile);
                     try (CloseableHandle handle = sftp.open(file, 
OpenMode.Read)) {
                         byte[] actual = new byte[data.length];
@@ -151,7 +152,7 @@ public class SimpleAccessControlSftpEventListenerTest 
extends BaseTestSupport {
                 session.addPasswordIdentity(getCurrentTestName());
                 session.auth().verify(5L, TimeUnit.SECONDS);
 
-                try (SftpClient sftp = session.createSftpClient()) {
+                try (SftpClient sftp = 
SftpClientFactory.instance().createSftpClient(session)) {
                     String folder = 
Utils.resolveRelativeRemotePath(parentPath, targetPath);
                     for (SftpClient.DirEntry entry : sftp.readDir(folder)) {
                         assertNotNull("No entry", entry);

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/251db9b9/sshd-core/src/main/java/org/apache/sshd/client/ClientFactoryManager.java
----------------------------------------------------------------------
diff --git 
a/sshd-core/src/main/java/org/apache/sshd/client/ClientFactoryManager.java 
b/sshd-core/src/main/java/org/apache/sshd/client/ClientFactoryManager.java
index 7627020..31b2a22 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/ClientFactoryManager.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/ClientFactoryManager.java
@@ -21,7 +21,6 @@ package org.apache.sshd.client;
 import org.apache.sshd.client.config.hosts.HostConfigEntryResolver;
 import org.apache.sshd.client.config.keys.ClientIdentityLoader;
 import org.apache.sshd.client.session.ClientProxyConnectorHolder;
-import org.apache.sshd.client.subsystem.sftp.SftpClientFactoryManager;
 import org.apache.sshd.common.FactoryManager;
 import org.apache.sshd.common.config.keys.FilePasswordProvider;
 import org.apache.sshd.common.scp.ScpFileOpenerHolder;
@@ -34,7 +33,6 @@ import org.apache.sshd.common.scp.ScpFileOpenerHolder;
  */
 public interface ClientFactoryManager
         extends FactoryManager,
-                SftpClientFactoryManager,
                 ScpFileOpenerHolder,
                 ClientProxyConnectorHolder,
                 ClientAuthenticationManager {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/251db9b9/sshd-core/src/main/java/org/apache/sshd/client/SshClient.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/SshClient.java 
b/sshd-core/src/main/java/org/apache/sshd/client/SshClient.java
index 7a185d1..0874b93 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/SshClient.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/SshClient.java
@@ -87,8 +87,6 @@ import 
org.apache.sshd.client.session.ClientUserAuthServiceFactory;
 import org.apache.sshd.client.session.SessionFactory;
 import org.apache.sshd.client.simple.AbstractSimpleClientSessionCreator;
 import org.apache.sshd.client.simple.SimpleClient;
-import org.apache.sshd.client.subsystem.sftp.SftpClientFactory;
-import org.apache.sshd.client.subsystem.sftp.impl.DefaultSftpClientFactory;
 import org.apache.sshd.common.Closeable;
 import org.apache.sshd.common.Factory;
 import org.apache.sshd.common.FactoryManager;
@@ -214,7 +212,6 @@ public class SshClient extends AbstractFactoryManager 
implements ClientFactoryMa
     private FilePasswordProvider filePasswordProvider;
     private PasswordIdentityProvider passwordIdentityProvider;
     private ScpFileOpener scpOpener;
-    private SftpClientFactory sftpClientFactory;
 
     private final List<Object> identities = new CopyOnWriteArrayList<>();
     private final AuthenticationIdentitiesProvider identitiesProvider;
@@ -253,16 +250,6 @@ public class SshClient extends AbstractFactoryManager 
implements ClientFactoryMa
     }
 
     @Override
-    public SftpClientFactory getSftpClientFactory() {
-        return (sftpClientFactory == null) ? DefaultSftpClientFactory.INSTANCE 
: sftpClientFactory;
-    }
-
-    @Override
-    public void setSftpClientFactory(SftpClientFactory sftpClientFactory) {
-        this.sftpClientFactory = sftpClientFactory;
-    }
-
-    @Override
     public ServerKeyVerifier getServerKeyVerifier() {
         return serverKeyVerifier;
     }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/251db9b9/sshd-core/src/main/java/org/apache/sshd/client/session/AbstractClientSession.java
----------------------------------------------------------------------
diff --git 
a/sshd-core/src/main/java/org/apache/sshd/client/session/AbstractClientSession.java
 
b/sshd-core/src/main/java/org/apache/sshd/client/session/AbstractClientSession.java
index 6a1a15d..d57a799 100644
--- 
a/sshd-core/src/main/java/org/apache/sshd/client/session/AbstractClientSession.java
+++ 
b/sshd-core/src/main/java/org/apache/sshd/client/session/AbstractClientSession.java
@@ -21,7 +21,6 @@ package org.apache.sshd.client.session;
 
 import java.io.IOException;
 import java.net.SocketAddress;
-import java.nio.file.FileSystem;
 import java.security.KeyPair;
 import java.security.PublicKey;
 import java.util.EnumMap;
@@ -43,9 +42,6 @@ import org.apache.sshd.client.channel.ClientChannel;
 import org.apache.sshd.client.keyverifier.ServerKeyVerifier;
 import org.apache.sshd.client.scp.DefaultScpClient;
 import org.apache.sshd.client.scp.ScpClient;
-import org.apache.sshd.client.subsystem.sftp.SftpClient;
-import org.apache.sshd.client.subsystem.sftp.SftpClientFactory;
-import org.apache.sshd.client.subsystem.sftp.SftpVersionSelector;
 import org.apache.sshd.common.FactoryManager;
 import org.apache.sshd.common.NamedFactory;
 import org.apache.sshd.common.NamedResource;
@@ -90,7 +86,6 @@ public abstract class AbstractClientSession extends 
AbstractSession implements C
     private ScpFileOpener scpOpener;
     private SocketAddress connectAddress;
     private ClientProxyConnector proxyConnector;
-    private SftpClientFactory sftpClientFactory;
 
     protected AbstractClientSession(ClientFactoryManager factoryManager, 
IoSession ioSession) {
         super(false, factoryManager, ioSession);
@@ -167,16 +162,6 @@ public abstract class AbstractClientSession extends 
AbstractSession implements C
     }
 
     @Override
-    public SftpClientFactory getSftpClientFactory() {
-        return resolveEffectiveProvider(SftpClientFactory.class, 
sftpClientFactory, getFactoryManager().getSftpClientFactory());
-    }
-
-    @Override
-    public void setSftpClientFactory(SftpClientFactory sftpClientFactory) {
-        this.sftpClientFactory = sftpClientFactory;
-    }
-
-    @Override
     public void addPasswordIdentity(String password) {
         // DO NOT USE checkNotNullOrNotEmpty SINCE IT TRIMS THE RESULT
         ValidateUtils.checkTrue((password != null) && (!password.isEmpty()), 
"No password provided");
@@ -341,18 +326,6 @@ public abstract class AbstractClientSession extends 
AbstractSession implements C
     }
 
     @Override
-    public SftpClient createSftpClient(SftpVersionSelector selector) throws 
IOException {
-        SftpClientFactory factory = getSftpClientFactory();
-        return factory.createSftpClient(this, selector);
-    }
-
-    @Override
-    public FileSystem createSftpFileSystem(SftpVersionSelector selector, int 
readBufferSize, int writeBufferSize) throws IOException {
-        SftpClientFactory factory = getSftpClientFactory();
-        return factory.createSftpFileSystem(this, selector, readBufferSize, 
writeBufferSize);
-    }
-
-    @Override
     public SshdSocketAddress startLocalPortForwarding(SshdSocketAddress local, 
SshdSocketAddress remote) throws IOException {
         ForwardingFilter filter = getForwardingFilter();
         return filter.startLocalPortForwarding(local, remote);

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/251db9b9/sshd-core/src/main/java/org/apache/sshd/client/session/ClientSession.java
----------------------------------------------------------------------
diff --git 
a/sshd-core/src/main/java/org/apache/sshd/client/session/ClientSession.java 
b/sshd-core/src/main/java/org/apache/sshd/client/session/ClientSession.java
index b807f17..96caf2e 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/session/ClientSession.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/session/ClientSession.java
@@ -45,8 +45,6 @@ import org.apache.sshd.client.future.AuthFuture;
 import org.apache.sshd.client.scp.ScpClientCreator;
 import org.apache.sshd.client.session.forward.DynamicPortForwardingTracker;
 import org.apache.sshd.client.session.forward.ExplicitPortForwardingTracker;
-import org.apache.sshd.client.subsystem.sftp.SftpClientCreator;
-import org.apache.sshd.client.subsystem.sftp.SftpClientFactoryManager;
 import org.apache.sshd.common.forward.PortForwardingManager;
 import org.apache.sshd.common.future.KeyExchangeFuture;
 import org.apache.sshd.common.session.Session;
@@ -83,7 +81,7 @@ import org.apache.sshd.common.util.net.SshdSocketAddress;
  * @author <a href="mailto:d...@mina.apache.org";>Apache MINA SSHD Project</a>
  */
 public interface ClientSession
-            extends Session, ScpClientCreator, SftpClientCreator, 
SftpClientFactoryManager,
+            extends Session, ScpClientCreator,
             ClientProxyConnectorHolder, ClientAuthenticationManager,
             PortForwardingManager {
     enum ClientSessionEvent {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/251db9b9/sshd-core/src/main/java/org/apache/sshd/client/simple/AbstractSimpleClient.java
----------------------------------------------------------------------
diff --git 
a/sshd-core/src/main/java/org/apache/sshd/client/simple/AbstractSimpleClient.java
 
b/sshd-core/src/main/java/org/apache/sshd/client/simple/AbstractSimpleClient.java
index a5420c7..247be60 100644
--- 
a/sshd-core/src/main/java/org/apache/sshd/client/simple/AbstractSimpleClient.java
+++ 
b/sshd-core/src/main/java/org/apache/sshd/client/simple/AbstractSimpleClient.java
@@ -30,7 +30,6 @@ import java.util.Objects;
 import org.apache.sshd.client.scp.CloseableScpClient;
 import org.apache.sshd.client.scp.ScpClient;
 import org.apache.sshd.client.session.ClientSession;
-import org.apache.sshd.client.subsystem.sftp.SftpClient;
 import org.apache.sshd.common.util.GenericUtils;
 import org.apache.sshd.common.util.ValidateUtils;
 import org.apache.sshd.common.util.logging.AbstractLoggingBean;
@@ -44,105 +43,6 @@ public abstract class AbstractSimpleClient extends 
AbstractLoggingBean implement
     }
 
     @Override
-    public SftpClient sftpLogin(SocketAddress target, String username, String 
password) throws IOException {
-        return createSftpClient(sessionLogin(target, username, password));
-    }
-
-    @Override
-    public SftpClient sftpLogin(SocketAddress target, String username, KeyPair 
identity) throws IOException {
-        return createSftpClient(sessionLogin(target, username, identity));
-    }
-
-    protected SftpClient createSftpClient(final ClientSession session) throws 
IOException {
-        Exception err = null;
-        try {
-            SftpClient client = session.createSftpClient();
-            try {
-                return createSftpClient(session, client);
-            } catch (Exception e) {
-                err = GenericUtils.accumulateException(err, e);
-                try {
-                    client.close();
-                } catch (Exception t) {
-                    if (log.isDebugEnabled()) {
-                        log.debug("createSftpClient({}) failed ({}) to close 
client: {}",
-                                  session, t.getClass().getSimpleName(), 
t.getMessage());
-                    }
-
-                    if (log.isTraceEnabled()) {
-                        log.trace("createSftpClient(" + session + ") client 
close failure details", t);
-                    }
-                    err = GenericUtils.accumulateException(err, t);
-                }
-            }
-        } catch (Exception e) {
-            err = GenericUtils.accumulateException(err, e);
-        }
-
-        // This point is reached if error occurred
-        log.warn("createSftpClient({}) failed ({}) to create session: {}",
-                 session, err.getClass().getSimpleName(), err.getMessage());
-
-        try {
-            session.close();
-        } catch (Exception e) {
-            if (log.isDebugEnabled()) {
-                log.debug("createSftpClient({}) failed ({}) to close session: 
{}",
-                          session, e.getClass().getSimpleName(), 
e.getMessage());
-            }
-
-            if (log.isTraceEnabled()) {
-                log.trace("createSftpClient(" + session + ") session close 
failure details", e);
-            }
-            err = GenericUtils.accumulateException(err, e);
-        }
-
-        if (err instanceof IOException) {
-            throw (IOException) err;
-        } else {
-            throw new IOException(err);
-        }
-    }
-
-    protected SftpClient createSftpClient(final ClientSession session, final 
SftpClient client) throws IOException {
-        ClassLoader loader = getClass().getClassLoader();
-        Class<?>[] interfaces = {SftpClient.class};
-        return (SftpClient) Proxy.newProxyInstance(loader, interfaces, (proxy, 
method, args) -> {
-            Throwable err = null;
-            Object result = null;
-            String name = method.getName();
-            try {
-                result = method.invoke(client, args);
-            } catch (Throwable t) {
-                if (log.isTraceEnabled()) {
-                    log.trace("invoke(SftpClient#{}) failed ({}) to execute: 
{}",
-                              name, t.getClass().getSimpleName(), 
t.getMessage());
-                }
-                err = GenericUtils.accumulateException(err, t);
-            }
-
-            // propagate the "close" call to the session as well
-            if ("close".equals(name) && GenericUtils.isEmpty(args)) {
-                try {
-                    session.close();
-                } catch (Throwable t) {
-                    if (log.isDebugEnabled()) {
-                        log.debug("invoke(ClientSession#{}) failed ({}) to 
execute: {}",
-                                  name, t.getClass().getSimpleName(), 
t.getMessage());
-                    }
-                    err = GenericUtils.accumulateException(err, t);
-                }
-            }
-
-            if (err != null) {
-                throw err;
-            }
-
-            return result;
-        });
-    }
-
-    @Override
     public CloseableScpClient scpLogin(String host, String username, String 
password) throws IOException {
         return scpLogin(host, DEFAULT_PORT, username, password);
     }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/251db9b9/sshd-core/src/main/java/org/apache/sshd/client/simple/SimpleClient.java
----------------------------------------------------------------------
diff --git 
a/sshd-core/src/main/java/org/apache/sshd/client/simple/SimpleClient.java 
b/sshd-core/src/main/java/org/apache/sshd/client/simple/SimpleClient.java
index fa5510d..6fff133 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/simple/SimpleClient.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/simple/SimpleClient.java
@@ -32,7 +32,6 @@ public interface SimpleClient
         extends SimpleClientConfigurator,
                 SimpleSessionClient,
                 SimpleScpClient,
-                SimpleSftpClient,
                 Channel {
     // marker interface
 }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/251db9b9/sshd-core/src/main/java/org/apache/sshd/client/simple/SimpleSftpClient.java
----------------------------------------------------------------------
diff --git 
a/sshd-core/src/main/java/org/apache/sshd/client/simple/SimpleSftpClient.java 
b/sshd-core/src/main/java/org/apache/sshd/client/simple/SimpleSftpClient.java
deleted file mode 100644
index 119b9e2..0000000
--- 
a/sshd-core/src/main/java/org/apache/sshd/client/simple/SimpleSftpClient.java
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.sshd.client.simple;
-
-import java.io.IOException;
-import java.net.InetAddress;
-import java.net.InetSocketAddress;
-import java.net.SocketAddress;
-import java.nio.channels.Channel;
-import java.security.KeyPair;
-import java.util.Objects;
-
-import org.apache.sshd.client.subsystem.sftp.SftpClient;
-import org.apache.sshd.common.util.ValidateUtils;
-
-/**
- * A simplified <U>synchronous</U> API for obtaining SFTP sessions.
- *
- * @author <a href="mailto:d...@mina.apache.org";>Apache MINA SSHD Project</a>
- */
-public interface SimpleSftpClient extends SimpleClientConfigurator, Channel {
-    /**
-     * Creates an SFTP session on the default port and logs in using the 
provided credentials
-     *
-     * @param host The target host name or address
-     * @param username Username
-     * @param password Password
-     * @return Created {@link SftpClient} - <B>Note:</B> closing the client 
also closes its
-     * underlying session
-     * @throws IOException If failed to login or authenticate
-     */
-    default SftpClient sftpLogin(String host, String username, String 
password) throws IOException {
-        return sftpLogin(host, DEFAULT_PORT, username, password);
-    }
-
-    /**
-     * Creates an SFTP session using the provided credentials
-     *
-     * @param host The target host name or address
-     * @param port The target port
-     * @param username Username
-     * @param password Password
-     * @return Created {@link SftpClient} - <B>Note:</B> closing the client 
also closes its
-     * underlying session
-     * @throws IOException If failed to login or authenticate
-     */
-    default SftpClient sftpLogin(String host, int port, String username, 
String password) throws IOException {
-        return 
sftpLogin(InetAddress.getByName(ValidateUtils.checkNotNullAndNotEmpty(host, "No 
host")), port, username, password);
-    }
-
-    /**
-     * Creates an SFTP session on the default port and logs in using the 
provided credentials
-     *
-     * @param host The target host name or address
-     * @param username Username
-     * @param identity The {@link KeyPair} identity
-     * @return Created {@link SftpClient} - <B>Note:</B> closing the client 
also closes its
-     * underlying session
-     * @throws IOException If failed to login or authenticate
-     */
-    default SftpClient sftpLogin(String host, String username, KeyPair 
identity) throws IOException {
-        return sftpLogin(host, DEFAULT_PORT, username, identity);
-    }
-
-    /**
-     * Creates an SFTP session using the provided credentials
-     *
-     * @param host The target host name or address
-     * @param port The target port
-     * @param username Username
-     * @param identity The {@link KeyPair} identity
-     * @return Created {@link SftpClient} - <B>Note:</B> closing the client 
also closes its
-     * underlying session
-     * @throws IOException If failed to login or authenticate
-     */
-    default SftpClient sftpLogin(String host, int port, String username, 
KeyPair identity) throws IOException {
-        return 
sftpLogin(InetAddress.getByName(ValidateUtils.checkNotNullAndNotEmpty(host, "No 
host")), port, username, identity);
-    }
-
-    /**
-     * Creates an SFTP session on the default port and logs in using the 
provided credentials
-     *
-     * @param host The target host {@link InetAddress}
-     * @param username Username
-     * @param password Password
-     * @return Created {@link SftpClient} - <B>Note:</B> closing the client 
also closes its
-     * underlying session
-     * @throws IOException If failed to login or authenticate
-     */
-    default SftpClient sftpLogin(InetAddress host, String username, String 
password) throws IOException {
-        return sftpLogin(host, DEFAULT_PORT, username, password);
-    }
-
-    /**
-     * Creates an SFTP session using the provided credentials
-     *
-     * @param host The target host {@link InetAddress}
-     * @param port The target port
-     * @param username Username
-     * @param password Password
-     * @return Created {@link SftpClient} - <B>Note:</B> closing the client 
also closes its
-     * underlying session
-     * @throws IOException If failed to login or authenticate
-     */
-    default SftpClient sftpLogin(InetAddress host, int port, String username, 
String password) throws IOException {
-        return sftpLogin(new InetSocketAddress(Objects.requireNonNull(host, 
"No host address"), port), username, password);
-    }
-
-    /**
-     * Creates an SFTP session on the default port and logs in using the 
provided credentials
-     *
-     * @param host The target host {@link InetAddress}
-     * @param username Username
-     * @param identity The {@link KeyPair} identity
-     * @return Created {@link SftpClient} - <B>Note:</B> closing the client 
also closes its
-     * underlying session
-     * @throws IOException If failed to login or authenticate
-     */
-    default SftpClient sftpLogin(InetAddress host, String username, KeyPair 
identity) throws IOException {
-        return sftpLogin(host, DEFAULT_PORT, username, identity);
-    }
-
-    /**
-     * Creates an SFTP session using the provided credentials
-     *
-     * @param host The target host {@link InetAddress}
-     * @param port The target port
-     * @param username Username
-     * @param identity The {@link KeyPair} identity
-     * @return Created {@link SftpClient} - <B>Note:</B> closing the client 
also closes its
-     * underlying session
-     * @throws IOException If failed to login or authenticate
-     */
-    default SftpClient sftpLogin(InetAddress host, int port, String username, 
KeyPair identity) throws IOException {
-        return sftpLogin(new InetSocketAddress(Objects.requireNonNull(host, 
"No host address"), port), username, identity);
-    }
-
-    /**
-     * Creates an SFTP session using the provided credentials
-     *
-     * @param target The target {@link SocketAddress}
-     * @param username Username
-     * @param password Password
-     * @return Created {@link SftpClient} - <B>Note:</B> closing the client 
also closes its
-     * underlying session
-     * @throws IOException If failed to login or authenticate
-     */
-    SftpClient sftpLogin(SocketAddress target, String username, String 
password) throws IOException;
-
-    /**
-     * Creates an SFTP session using the provided credentials
-     *
-     * @param target The target {@link SocketAddress}
-     * @param username Username
-     * @param identity The {@link KeyPair} identity
-     * @return Created {@link SftpClient} - <B>Note:</B> closing the client 
also closes its
-     * underlying session
-     * @throws IOException If failed to login or authenticate
-     */
-    SftpClient sftpLogin(SocketAddress target, String username, KeyPair 
identity) throws IOException;
-
-}

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/251db9b9/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/RawSftpClient.java
----------------------------------------------------------------------
diff --git 
a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/RawSftpClient.java
 
b/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/RawSftpClient.java
deleted file mode 100644
index 676a03e..0000000
--- 
a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/RawSftpClient.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.sshd.client.subsystem.sftp;
-
-import java.io.IOException;
-
-import org.apache.sshd.common.util.buffer.Buffer;
-
-/**
- * @author <a href="mailto:d...@mina.apache.org";>Apache MINA SSHD Project</a>
- */
-public interface RawSftpClient {
-    /**
-     * @param cmd    Command to send - <B>Note:</B> only lower 8-bits are used
-     * @param buffer The {@link Buffer} containing the command data
-     * @return The assigned request id
-     * @throws IOException if failed to send command
-     */
-    int send(int cmd, Buffer buffer) throws IOException;
-
-    /**
-     * @param id The expected request id
-     * @return The received response {@link Buffer} containing the request id
-     * @throws IOException If connection closed or interrupted
-     */
-    Buffer receive(int id) throws IOException;
-}

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/251db9b9/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpAclFileAttributeView.java
----------------------------------------------------------------------
diff --git 
a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpAclFileAttributeView.java
 
b/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpAclFileAttributeView.java
deleted file mode 100644
index 7cada6e..0000000
--- 
a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpAclFileAttributeView.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.sshd.client.subsystem.sftp;
-
-import java.io.IOException;
-import java.nio.file.LinkOption;
-import java.nio.file.Path;
-import java.nio.file.attribute.AclEntry;
-import java.nio.file.attribute.AclFileAttributeView;
-import java.nio.file.attribute.PosixFileAttributes;
-import java.nio.file.attribute.UserPrincipal;
-import java.util.List;
-
-import 
org.apache.sshd.client.subsystem.sftp.impl.AbstractSftpFileAttributeView;
-
-/**
- * @author <a href="mailto:d...@mina.apache.org";>Apache MINA SSHD Project</a>
- */
-public class SftpAclFileAttributeView extends AbstractSftpFileAttributeView 
implements AclFileAttributeView {
-    public SftpAclFileAttributeView(SftpFileSystemProvider provider, Path 
path, LinkOption... options) {
-        super(provider, path, options);
-    }
-
-    @Override
-    public UserPrincipal getOwner() throws IOException {
-        PosixFileAttributes v = provider.readAttributes(path, 
PosixFileAttributes.class, options);
-        return v.owner();
-    }
-
-    @Override
-    public void setOwner(UserPrincipal owner) throws IOException {
-        provider.setAttribute(path, "posix", "owner", owner, options);
-    }
-
-    @Override
-    public String name() {
-        return "acl";
-    }
-
-    @Override
-    public List<AclEntry> getAcl() throws IOException {
-        return readRemoteAttributes().getAcl();
-    }
-
-    @Override
-    public void setAcl(List<AclEntry> acl) throws IOException {
-        writeRemoteAttributes(new SftpClient.Attributes().acl(acl));
-    }
-
-}

Reply via email to