Verified Owner
Top Description Inners Fields Constructors Methods
org.jabref.logic.git

public Class SshAgentConnectorFactory

extends Object
implements ConnectorFactory
Class Inheritance
All Implemented Interfaces
org.eclipse.jgit.transport.sshd.agent.ConnectorFactory
Annotations
@NullMarked
Imports
java.io.File, .IOException, java.util.Collection, org.jabref.logic.util.strings.StringUtil, org.eclipse.jgit.transport.sshd.agent.Connector, .ConnectorFactory, org.eclipse.jgit.util.SystemReader, org.jspecify.annotations.NullMarked, .Nullable, org.slf4j.Logger, .LoggerFactory

On Windows, jgit only talks to Pageant unless IdentityAgent is set in ~/.ssh/config. This factory keeps that default but falls back to the Windows OpenSSH agent's named pipe when Pageant is not running, so either agent works without configuration. Explicitly configured agents are passed through untouched.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static interface
pack-priv static class
SshAgentConnectorFactory.FallbackConnector

Connects to the primary agent; if that is unavailable, switches to the fallback for the rest of the session.

Field Summary

Modifier and TypeField and Description
private final ConnectorFactory
private static final Logger
pack-priv static final String

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public Connector
public ConnectorFactory.ConnectorDescriptor
public String
getName()

Implements org.eclipse.jgit.transport.sshd.agent.ConnectorFactory.getName.

Retrieves a name for this factory.

public Collection<ConnectorFactory.ConnectorDescriptor>
public static void
install()

Registers the fallback as jgit's default connector factory.

public boolean
isSupported()

Implements org.eclipse.jgit.transport.sshd.agent.ConnectorFactory.isSupported.

Tells whether this ConnectorFactory is applicable on the currently running platform.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

delegateback to summary
private final ConnectorFactory delegate
LOGGERback to summary
private static final Logger LOGGER
OPENSSH_AGENT_PIPEback to summary
pack-priv static final String OPENSSH_AGENT_PIPE

Constructor Detail

SshAgentConnectorFactoryback to summary
pack-priv SshAgentConnectorFactory(ConnectorFactory delegate)

Method Detail

createback to summary
public Connector create(@Nullable String identityAgent, File homeDir) throws IOException

Implements org.eclipse.jgit.transport.sshd.agent.ConnectorFactory.create.

Doc from org.eclipse.jgit.transport.sshd.agent.ConnectorFactory.create.

Creates a new Connector.

Annotations
@Override
Exceptions
IOException:
if no connector can be created
getDefaultConnectorback to summary
public ConnectorFactory.ConnectorDescriptor getDefaultConnector()

Implements org.eclipse.jgit.transport.sshd.agent.ConnectorFactory.getDefaultConnector.

Doc from org.eclipse.jgit.transport.sshd.agent.ConnectorFactory.getDefaultConnector.

Tells what kind of Connector this ConnectorFactory creates if ConnectorFactory#create(String, File) is called with identityAgent == null.

Annotations
@Override
getNameback to summary
public String getName()

Implements org.eclipse.jgit.transport.sshd.agent.ConnectorFactory.getName.

Doc from org.eclipse.jgit.transport.sshd.agent.ConnectorFactory.getName.

Retrieves a name for this factory.

Annotations
@Override
getSupportedConnectorsback to summary
public Collection<ConnectorFactory.ConnectorDescriptor> getSupportedConnectors()

Implements org.eclipse.jgit.transport.sshd.agent.ConnectorFactory.getSupportedConnectors.

Doc from org.eclipse.jgit.transport.sshd.agent.ConnectorFactory.getSupportedConnectors.

Tells which kinds of SSH agents this ConnectorFactory supports.

An implementation of this method should document the possible values it returns.

Annotations
@Override
installback to summary
public static void install()

Registers the fallback as jgit's default connector factory. No-op outside Windows, where jgit already honors SSH_AUTH_SOCK.

isSupportedback to summary
public boolean isSupported()

Implements org.eclipse.jgit.transport.sshd.agent.ConnectorFactory.isSupported.

Doc from org.eclipse.jgit.transport.sshd.agent.ConnectorFactory.isSupported.

Tells whether this ConnectorFactory is applicable on the currently running platform.

Annotations
@Override
org.jabref.logic.git back to summary

pack-priv Interface SshAgentConnectorFactory.ConnectorSupplier

Annotations
@FunctionalInterface

Method Summary

Modifier and TypeMethod and Description
public Connector
get()

Method Detail

getback to summary
public Connector get() throws IOException
org.jabref.logic.git back to summary

pack-priv Class SshAgentConnectorFactory.FallbackConnector

extends Object
implements Connector
Class Inheritance
  • java.lang.Object
  • org.jabref.logic.git.SshAgentConnectorFactory.FallbackConnector
All Implemented Interfaces
org.eclipse.jgit.transport.sshd.agent.Connector, java.io.Closeable, java.lang.AutoCloseable

Connects to the primary agent; if that is unavailable, switches to the fallback for the rest of the session.

Field Summary

Modifier and TypeField and Description
private Connector
private final SshAgentConnectorFactory.ConnectorSupplier

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
close()

Implements java.io.Closeable.close.

Closes this stream and releases any system resources associated with it.

public boolean
connect()

Implements org.eclipse.jgit.transport.sshd.agent.Connector.connect.

Connects to an SSH agent if there is one running.

public byte[]
rpc(byte command, byte[] message)

Implements org.eclipse.jgit.transport.sshd.agent.Connector.rpc.

Performs a remote call to the SSH agent and returns the result.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

activeback to summary
private Connector active
fallbackback to summary
private final SshAgentConnectorFactory.ConnectorSupplier fallback

Constructor Detail

FallbackConnectorback to summary
pack-priv FallbackConnector(Connector primary, SshAgentConnectorFactory.ConnectorSupplier fallback)

Method Detail

closeback to summary
public void close() throws IOException

Implements java.io.Closeable.close.

Doc from java.io.Closeable.close.

Closes this stream and releases any system resources associated with it. If the stream is already closed then invoking this method has no effect.

As noted in AutoCloseable#close(), cases where the close may fail require careful attention. It is strongly advised to relinquish the underlying resources and to internally mark the Closeable as closed, prior to throwing the IOException.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs
connectback to summary
public boolean connect() throws IOException

Implements org.eclipse.jgit.transport.sshd.agent.Connector.connect.

Doc from org.eclipse.jgit.transport.sshd.agent.Connector.connect.

Connects to an SSH agent if there is one running. If called when already connected just returns true.

Annotations
@Override
Exceptions
IOException:
if connecting to the SSH agent failed
rpcback to summary
public byte[] rpc(byte command, byte[] message) throws IOException

Implements org.eclipse.jgit.transport.sshd.agent.Connector.rpc.

Doc from org.eclipse.jgit.transport.sshd.agent.Connector.rpc.

Performs a remote call to the SSH agent and returns the result.

Annotations
@Override
Exceptions
IOException:
if an error occurs