>>  Now our requirement is once we use SCP from  this filezila,
winscp,putty then also we need to call same class and same method as above
for SFTP.

Why would you want to do that ? SSHD supports SCP no need to go through
SFTP...


  SshServer server = SshServer.setupDefaultServer();
...more initializations..

...initialize SFTP

server.setCommandFactory(new ScpCommandFactory());


Anyway here is a suggestion to get you on your way if you really (really,
really) need to do this

SshServer server = SshServer.setupDefaultServer();
...more initializations...
FileSystemFactory fsFactory = new FileSystemFactory() {
    @Override
    public FileSystem createFileSystem(Session session) throws IOException {
        if (..whatever condition...) {
            ClientSession client = ...establish a client session to
wherever you want using some SshClient...
            // it does not have to be to the local server - it can be to
ANY server...
            return SftpClientFactory.instance().createSftpFileSystem(
client )
        } else {
            return
NativeFileSystemFactory.INSTANCE.createFileSystem(session);
        }
    }
};
server.setFileSystemFactory(fsFactory);


Start with that.... there are more details - depending on what you want to
accomplish (which is not clear...) - ask for more help as you go along...

Reply via email to