public abstract class SshSessionFactory extends Object
Different implementations of the session factory may be used to control communicating with the end-user as well as reading their personal SSH configuration settings, such as known hosts and private keys.
A RemoteSession
must be returned to the factory that created it.
Callers are encouraged to retain the SshSessionFactory for the duration of
the period they are using the session.
Constructor and Description |
---|
SshSessionFactory() |
Modifier and Type | Method and Description |
---|---|
static SshSessionFactory |
getInstance()
Gets the currently configured JVM-wide factory.
|
static String |
getLocalUserName()
Retrieves the local user name as defined by the system property
"user.name".
|
abstract RemoteSession |
getSession(URIish uri,
CredentialsProvider credentialsProvider,
FS fs,
int tms)
Opens (or reuses) a session to a host.
|
abstract String |
getType()
The name of the type of session factory.
|
void |
releaseSession(RemoteSession session)
Closes (or recycles) a session to a host.
|
static void |
setInstance(SshSessionFactory newFactory)
Changes the JVM-wide factory to a different implementation.
|
public static SshSessionFactory getInstance()
By default the factory will read from the user's $HOME/.ssh
and
assume OpenSSH compatibility.
public static void setInstance(SshSessionFactory newFactory)
newFactory
- factory for future sessions to be created through; if
null
the default factory will be restored.public static String getLocalUserName()
public abstract RemoteSession getSession(URIish uri, CredentialsProvider credentialsProvider, FS fs, int tms) throws TransportException
uri
- URI of the remote host to connect tocredentialsProvider
- provider to support authentication, may be null
if no
user input for authentication is neededfs
- the file system abstraction to use for certain file
operations, such as reading configuration filestms
- connection timeout for creating the session, in millisecondsuri
TransportException
- if the session could not be createdpublic abstract String getType()
public void releaseSession(RemoteSession session)
session
- a session previously obtained from this factory's
getSession(URIish, CredentialsProvider, FS, int)
method.Copyright © 2020 Eclipse JGit Project. All rights reserved.