Top Description Inners Fields Methods
org.eclipse.jgit.transport

public Interface SshConfigStore

Known Direct Implementers
org.eclipse.jgit.internal.transport.ssh.OpenSshConfigFile
Imports
java.util.Collections, .List, .Map, org.eclipse.jgit.annotations.NonNull

An abstraction for a SSH config storage, like the OpenSSH ~/.ssh/config file.
Since
5.8

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface
SshConfigStore.HostConfig

A host entry from the ssh config.

Field Summary

Modifier and TypeField and Description
public static final SshConfigStore.HostConfig

Method Summary

Modifier and TypeMethod and Description
public SshConfigStore.HostConfig

Returns:

the configuration for the requested name.
lookup
(String
to look up
hostName
,
int
the user supplied; <= 0 if none
port
,
String
the user supplied, may be null or empty if none given
userName
)

Locate the configuration for a specific host request.

public SshConfigStore.HostConfig

Returns:

the configuration for the requested name.
lookupDefault
(String
host name to look up
hostName
,
int
port number; <= 0 if none
port
,
String
the user name, may be null or empty if none given
userName
)

Locate the configuration for a specific host request and if the configuration has no values for SshConstants#HOST_NAME, SshConstants#PORT, SshConstants#USER, or SshConstants#CONNECTION_ATTEMPTS, fill those values with defaults from the arguments:

Description of arguments ssh config key value from argument HostNamehostNamePortport > 0 ?

Field Detail

EMPTY_CONFIGback to summary
public static final SshConfigStore.HostConfig EMPTY_CONFIG

An empty HostConfig.

Method Detail

lookupback to summary
public SshConfigStore.HostConfig lookup(String hostName, int port, String userName)

Locate the configuration for a specific host request.

Parameters
hostName:String

to look up

port:int

the user supplied; <= 0 if none

userName:String

the user supplied, may be null or empty if none given

Returns:SshConfigStore.HostConfig

the configuration for the requested name.

Annotations
@NonNull
lookupDefaultback to summary
public SshConfigStore.HostConfig lookupDefault(String hostName, int port, String userName)

Locate the configuration for a specific host request and if the configuration has no values for SshConstants#HOST_NAME, SshConstants#PORT, SshConstants#USER, or SshConstants#CONNECTION_ATTEMPTS, fill those values with defaults from the arguments:

Description of arguments
ssh config key value from argument
HostName hostName
Port port > 0 ? port : 22
User userName
ConnectionAttempts 1
Parameters
hostName:String

host name to look up

port:int

port number; <= 0 if none

userName:String

the user name, may be null or empty if none given

Returns:SshConfigStore.HostConfig

the configuration for the requested name.

Annotations
@NonNull
Since
6.0
org.eclipse.jgit.transport back to summary

public Interface SshConfigStore.HostConfig

Known Direct Implementers
org.eclipse.jgit.internal.transport.ssh.OpenSshConfigFile.HostEntry

A host entry from the ssh config. Any merging of global values and of several matching host entries, %-substitutions, and ~ replacement have all been done.

Method Summary

Modifier and TypeMethod and Description
public Map<String, List<String>>

Returns:

all multi-valued options
getMultiValuedOptions
()

Retrieves an unmodifiable map of all multi- or list-valued options, with case-insensitive lookup by keys.

public Map<String, String>

Returns:

all single-valued options
getOptions
()

Retrieves an unmodifiable map of all single-valued options, with case-insensitive lookup by keys.

public String

Returns:

the value, or null if none
getValue
(String
to get the value of
key
)

Retrieves the value of a single-valued key, or the first if the key has multiple values.

public List<String>

Returns:

a possibly empty list of values
getValues
(String
to get the values of
key
)

Retrieves the values of a multi- or list-valued key.

Method Detail

getMultiValuedOptionsback to summary
public Map<String, List<String>> getMultiValuedOptions()

Retrieves an unmodifiable map of all multi- or list-valued options, with case-insensitive lookup by keys.

Returns:Map<String, List<String>>

all multi-valued options

Annotations
@NonNull
getOptionsback to summary
public Map<String, String> getOptions()

Retrieves an unmodifiable map of all single-valued options, with case-insensitive lookup by keys.

Returns:Map<String, String>

all single-valued options

Annotations
@NonNull
getValueback to summary
public String getValue(String key)

Retrieves the value of a single-valued key, or the first if the key has multiple values. Keys are case-insensitive, so getValue("HostName") == getValue("HOSTNAME").

Parameters
key:String

to get the value of

Returns:String

the value, or null if none

getValuesback to summary
public List<String> getValues(String key)

Retrieves the values of a multi- or list-valued key. Keys are case-insensitive, so getValue("HostName") == getValue("HOSTNAME").

Parameters
key:String

to get the values of

Returns:List<String>

a possibly empty list of values