[ 
https://issues.apache.org/jira/browse/SSHD-816?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16440443#comment-16440443
 ] 

Guillaume Nodet commented on SSHD-816:
--------------------------------------

The way I've seen it done (including in the JDK itself) is to grab a system 
property, and if not set, use the ServiceLoader.
Something along:

 {code}
    static SftpClientFactory instance() {
        String clazz = System.getProperty(SftpClientFactory.class.getName());
        if (clazz != null) {
            try {
                return (SftpClientFactory) Class.forName(clazz).newInstance();
            } catch (Throwable e) {
                // LOG
            }
        }
        ServiceLoader<SftpClientFactory> sl = 
ServiceLoader.load(SftpClientFactory.class);
        Iterator<SftpClientFactory> it = sl.iterator();
        if (it.hasNext()) {
            return it.next();
        } else {
            return DefaultSftpClientFactory.INSTANCE;
        }
    }
{code}

> Provide some way for the SSHD command line server to detect and configure the 
> (split) SFTP subsystem
> ----------------------------------------------------------------------------------------------------
>
>                 Key: SSHD-816
>                 URL: https://issues.apache.org/jira/browse/SSHD-816
>             Project: MINA SSHD
>          Issue Type: Improvement
>    Affects Versions: 1.8.0
>            Reporter: Goldstein Lyor
>            Assignee: Goldstein Lyor
>            Priority: Major
>              Labels: SFTP, sftp
>
> h5. Description
> Following SSHD-815, the SFTP subsystem resides in its own module. We need to 
> figure out a way to allow the {{sshd.sh/bat}} files to provide some way to 
> add the SFTP sub-system to the server instance, configure and run it.
> h5. Implementation notes
> Consider founding {{sshd-cli}} module that depends on all the others and 
> export *all* the command line utilities from it (SFTP, SCP, SSH) and not just 
> the server.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to