Interface ConnectorFactory

  • All Known Implementing Classes:
    Factory

    public interface ConnectorFactory
    A factory for creating Connectors. This is a service provider interface; implementations are discovered via the ServiceLoader, or can be set explicitly on a SshdSessionFactory.
    Since:
    6.0
    • Method Detail

      • getDefault

        static ConnectorFactory getDefault()
        Retrieves the currently set default ConnectorFactory. This is the factory that is used unless overridden by the SshdSessionFactory.
        Returns:
        the current default factory; may be null if none is set and the ServiceLoader cannot find any suitable implementation
      • setDefault

        static void setDefault​(ConnectorFactory factory)
        Sets a default ConnectorFactory. This is the factory that is used unless overridden by the SshdSessionFactory.

        If no default factory is set programmatically, an implementation is discovered via the ServiceLoader.

        Parameters:
        factory - ConnectorFactory to set, or null to revert to the default behavior of using the ServiceLoader.
      • create

        @NonNull
        Connector create​(java.lang.String identityAgent,
                         java.io.File homeDir)
                  throws java.io.IOException
        Creates a new Connector.
        Parameters:
        identityAgent - identifies the wanted agent connection; if null, the factory is free to provide a Connector to a default agent. The value will typically come from the IdentityAgent setting in ~/.ssh/config.
        homeDir - the current local user's home directory as configured in the SshdSessionFactory
        Returns:
        a new Connector
        Throws:
        java.io.IOException - if no connector can be created
      • isSupported

        boolean isSupported()
        Tells whether this ConnectorFactory is applicable on the currently running platform.
        Returns:
        true if the factory can be used, false otherwise
      • getName

        java.lang.String getName()
        Retrieves a name for this factory.
        Returns:
        the name