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

public abstract Class SshSessionFactory

extends Object
Class Inheritance
Imports
java.util.Iterator, .ServiceLoader, org.eclipse.jgit.errors.TransportException, org.eclipse.jgit.lib.Constants, org.eclipse.jgit.util.FS, .SystemReader

Creates and destroys SSH connections to a remote system.

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.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static SshSessionFactory

Returns:

factory the current factory for this JVM.
getInstance
()

Gets the currently configured JVM-wide factory.

public static String

Returns:

the user name
getLocalUserName
()

Retrieves the local user name as defined by the system property "user.name".

public abstract RemoteSession

Returns:

a connected and authenticated session for communicating with the remote host given by the uri
getSession
(URIish
URI of the remote host to connect to
uri
,
CredentialsProvider
provider to support authentication, may be null if no user input for authentication is needed
credentialsProvider
,
FS
the file system abstraction to use for certain file operations, such as reading configuration files
fs
,
int
connection timeout for creating the session, in milliseconds
tms
)

Opens (or reuses) a session to a host.

public abstract String

Returns:

the name of the type of session factory.
getType
()

The name of the type of session factory.

public void
releaseSession(RemoteSession
a session previously obtained from this factory's getSession(URIish, CredentialsProvider, FS, int) method.
session
)

Closes (or recycles) a session to a host.

public static void
setInstance(SshSessionFactory
factory for future sessions to be created through; if null the default factory will be restored.
newFactory
)

Changes the JVM-wide factory to a different implementation.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

SshSessionFactoryback to summary
public SshSessionFactory()

Method Detail

getInstanceback to summary
public static SshSessionFactory getInstance()

Gets the currently configured JVM-wide factory.

By default the factory will read from the user's $HOME/.ssh and assume OpenSSH compatibility.

Returns:SshSessionFactory

factory the current factory for this JVM.

getLocalUserNameback to summary
public static String getLocalUserName()

Retrieves the local user name as defined by the system property "user.name".

Returns:String

the user name

Since
5.2
getSessionback to summary
public abstract RemoteSession getSession(URIish uri, CredentialsProvider credentialsProvider, FS fs, int tms) throws TransportException

Opens (or reuses) a session to a host. The returned session is connected and authenticated and is ready for further use.

Parameters
uri:URIish

URI of the remote host to connect to

credentialsProvider:CredentialsProvider

provider to support authentication, may be null if no user input for authentication is needed

fs:FS

the file system abstraction to use for certain file operations, such as reading configuration files

tms:int

connection timeout for creating the session, in milliseconds

Returns:RemoteSession

a connected and authenticated session for communicating with the remote host given by the uri

Exceptions
TransportException:
if the session could not be created
getTypeback to summary
public abstract String getType()

The name of the type of session factory.

Returns:String

the name of the type of session factory.

Since
5.8
releaseSessionback to summary
public void releaseSession(RemoteSession session)

Closes (or recycles) a session to a host.

Parameters
session:RemoteSession

a session previously obtained from this factory's getSession(URIish, CredentialsProvider, FS, int) method.

setInstanceback to summary
public static void setInstance(SshSessionFactory newFactory)

Changes the JVM-wide factory to a different implementation.

Parameters
newFactory:SshSessionFactory

factory for future sessions to be created through; if null the default factory will be restored.

org.eclipse.jgit.transport back to summary

private Class SshSessionFactory.DefaultFactory

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
private static volatile SshSessionFactory

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static SshSessionFactory
private static SshSessionFactory
public static void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

INSTANCEback to summary
private static volatile SshSessionFactory INSTANCE

Constructor Detail

DefaultFactoryback to summary
private DefaultFactory()

Method Detail

getInstanceback to summary
public static SshSessionFactory getInstance()
loadSshSessionFactoryback to summary
private static SshSessionFactory loadSshSessionFactory()
setInstanceback to summary
public static void setInstance(SshSessionFactory newFactory)