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
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interface -
Method Summary
Modifier and TypeMethodDescriptionCreates a newConnector.static ConnectorFactoryRetrieves the currently set defaultConnectorFactory.Tells what kind ofConnectorthisConnectorFactorycreates ifcreate(String, File)is called withidentityAgent == null.getName()Retrieves a name for this factory.Tells which kinds of SSH agents thisConnectorFactorysupports.booleanTells whether thisConnectorFactoryis applicable on the currently running platform.static voidsetDefault(ConnectorFactory factory) Sets a defaultConnectorFactory.
-
Method Details
-
getDefault
Retrieves the currently set defaultConnectorFactory. This is the factory that is used unless overridden by theSshdSessionFactory.- Returns:
- the current default factory; may be
nullif none is set and theServiceLoadercannot find any suitable implementation
-
setDefault
Sets a defaultConnectorFactory. This is the factory that is used unless overridden by theSshdSessionFactory.If no default factory is set programmatically, an implementation is discovered via the
ServiceLoader.- Parameters:
factory-ConnectorFactoryto set, ornullto revert to the default behavior of using theServiceLoader.
-
create
Creates a newConnector.- Parameters:
identityAgent- identifies the wanted agent connection; ifnull, the factory is free to provide aConnectorto a default agent. The value will typically come from theIdentityAgentsetting in~/.ssh/config.homeDir- the current local user's home directory as configured in theSshdSessionFactory- Returns:
- a new
Connector - Throws:
IOException- if no connector can be created
-
isSupported
boolean isSupported()Tells whether thisConnectorFactoryis applicable on the currently running platform.- Returns:
trueif the factory can be used,falseotherwise
-
getName
String getName()Retrieves a name for this factory.- Returns:
- the name
-
getSupportedConnectors
Tells which kinds of SSH agents thisConnectorFactorysupports.An implementation of this method should document the possible values it returns.
- Returns:
- an immutable collection of
ConnectorFactory.ConnectorDescriptors, includinggetDefaultConnector()and not including a descriptor for internal name "none"
-
getDefaultConnector
ConnectorFactory.ConnectorDescriptor getDefaultConnector()Tells what kind ofConnectorthisConnectorFactorycreates ifcreate(String, File)is called withidentityAgent == null.- Returns:
- a
ConnectorFactory.ConnectorDescriptorfor the default connector
-