Package org.eclipse.jgit.transport
Class SshTransport
java.lang.Object
org.eclipse.jgit.transport.Transport
org.eclipse.jgit.transport.TcpTransport
org.eclipse.jgit.transport.SshTransport
- All Implemented Interfaces:
AutoCloseable
- Direct Known Subclasses:
TransportGitSsh
,TransportSftp
The base class for transports that use SSH protocol. This class allows
customizing SSH connection settings.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.eclipse.jgit.transport.Transport
Transport.Operation
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate SshSessionFactory
private RemoteSession
The open SSH sessionFields inherited from class org.eclipse.jgit.transport.Transport
DEFAULT_FETCH_THIN, DEFAULT_PUSH_THIN, local, protocol, REFSPEC_PUSH_ALL, REFSPEC_TAGS, uri
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
SshTransport
(Repository local, URIish uri) Create a new transport instance.protected
SshTransport
(URIish uri) Create a new transport instance without a local repository. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
protected RemoteSession
Get the default SSH sessionGet the SSH session factoryvoid
setSshSessionFactory
(SshSessionFactory factory) Set SSH session factory instead of the default one for this instance of the transport.Methods inherited from class org.eclipse.jgit.transport.Transport
applyConfig, fetch, fetch, findRemoteRefUpdatesFor, findRemoteRefUpdatesFor, findRemoteRefUpdatesFor, findRemoteRefUpdatesFor, getCredentialsProvider, getFilterBlobLimit, getFilterSpec, getObjectChecker, getOptionReceivePack, getOptionUploadPack, getPackConfig, getPushOptions, getTagOpt, getTimeout, getTransportProtocols, getURI, isCheckFetchedObjects, isDryRun, isFetchThin, isPushAtomic, isPushThin, isRemoveDeletedRefs, open, open, open, open, open, open, open, openAll, openAll, openAll, openAll, openFetch, openFetch, openPush, push, push, register, setCheckFetchedObjects, setCredentialsProvider, setDryRun, setFetchThin, setFilterBlobLimit, setFilterSpec, setObjectChecker, setOptionReceivePack, setOptionUploadPack, setPackConfig, setPushAtomic, setPushOptions, setPushThin, setRemoveDeletedRefs, setTagOpt, setTimeout, unregister
-
Field Details
-
sch
-
sock
The open SSH session
-
-
Constructor Details
-
SshTransport
Create a new transport instance.- Parameters:
local
- the repository this instance will fetch into, or push out of. This must be the repository passed toTransport.open(Repository, URIish)
.uri
- the URI used to access the remote repository. This must be the URI passed toTransport.open(Repository, URIish)
.
-
SshTransport
Create a new transport instance without a local repository.- Parameters:
uri
- the URI used to access the remote repository. This must be the URI passed toTransport.open(URIish)
.- Since:
- 3.5
-
-
Method Details
-
setSshSessionFactory
Set SSH session factory instead of the default one for this instance of the transport.- Parameters:
factory
- a factory to set, must not be null- Throws:
IllegalStateException
- if session has been already created.
-
getSshSessionFactory
Get the SSH session factory- Returns:
- the SSH session factory that will be used for creating SSH sessions
-
getSession
Get the default SSH session- Returns:
- a remote session
- Throws:
TransportException
- in case of error with opening SSH session
-
close
public void close()Close any resources used by this transport.
If the remote repository is contacted by a network socket this method must close that network socket, disconnecting the two peers. If the remote repository is actually local (same system) this method must close any open file handles used to read the "remote" repository.
AutoClosable.close()
declares that it throwsException
. Implementers shouldn't throw checked exceptions. This override narrows the signature to prevent them from doing so.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in classTransport
-