Class Factory
- java.lang.Object
-
- org.eclipse.jgit.internal.transport.sshd.agent.connector.Factory
-
- All Implemented Interfaces:
ConnectorFactory
public class Factory extends Object implements ConnectorFactory
AnConnectorFactory
for connecting to an OpenSSH SSH agent.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.eclipse.jgit.transport.sshd.agent.ConnectorFactory
ConnectorFactory.ConnectorDescriptor
-
-
Constructor Summary
Constructors Constructor Description Factory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Connector
create(String identityAgent, File homeDir)
Creates a newConnector
.ConnectorFactory.ConnectorDescriptor
getDefaultConnector()
Tells what kind ofConnector
thisConnectorFactory
creates ifConnectorFactory.create(String, File)
is called withidentityAgent == null
.String
getName()
Retrieves a name for this factory.Collection<ConnectorFactory.ConnectorDescriptor>
getSupportedConnectors()
Tells which kinds of SSH agents thisConnectorFactory
supports.boolean
isSupported()
Tells whether thisConnectorFactory
is applicable on the currently running platform.
-
-
-
Method Detail
-
create
public Connector create(String identityAgent, File homeDir) throws IOException
Description copied from interface:ConnectorFactory
Creates a newConnector
.- Specified by:
create
in interfaceConnectorFactory
- Parameters:
identityAgent
- identifies the wanted agent connection; ifnull
, the factory is free to provide aConnector
to a default agent. The value will typically come from theIdentityAgent
setting 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
public boolean isSupported()
Description copied from interface:ConnectorFactory
Tells whether thisConnectorFactory
is applicable on the currently running platform.- Specified by:
isSupported
in interfaceConnectorFactory
- Returns:
true
if the factory can be used,false
otherwise
-
getName
public String getName()
Description copied from interface:ConnectorFactory
Retrieves a name for this factory.- Specified by:
getName
in interfaceConnectorFactory
- Returns:
- the name
-
getSupportedConnectors
public Collection<ConnectorFactory.ConnectorDescriptor> getSupportedConnectors()
Tells which kinds of SSH agents thisConnectorFactory
supports.An implementation of this method should document the possible values it returns.
This factory returns on Windows a
ConnectorDescriptor
for the internal name "pageant"; on Unix one for "SSH_AUTH_SOCK".- Specified by:
getSupportedConnectors
in interfaceConnectorFactory
- Returns:
- an immutable collection of
ConnectorFactory.ConnectorDescriptor
s, includingConnectorFactory.getDefaultConnector()
and not including a descriptor for internal name "none"
-
getDefaultConnector
public ConnectorFactory.ConnectorDescriptor getDefaultConnector()
Description copied from interface:ConnectorFactory
Tells what kind ofConnector
thisConnectorFactory
creates ifConnectorFactory.create(String, File)
is called withidentityAgent == null
.- Specified by:
getDefaultConnector
in interfaceConnectorFactory
- Returns:
- a
ConnectorFactory.ConnectorDescriptor
for the default connector
-
-