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
public abstract class SshTransport extends TcpTransport
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
-
Fields inherited from class org.eclipse.jgit.transport.Transport
DEFAULT_FETCH_THIN, DEFAULT_PUSH_THIN, local, REFSPEC_PUSH_ALL, REFSPEC_TAGS, uri
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
protected RemoteSession
getSession()
Get the default SSH sessionSshSessionFactory
getSshSessionFactory()
Get 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
-
-
-
-
Constructor Detail
-
SshTransport
protected SshTransport(Repository local, URIish uri)
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
protected SshTransport(URIish uri)
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 Detail
-
setSshSessionFactory
public void setSshSessionFactory(SshSessionFactory factory)
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
public SshSessionFactory getSshSessionFactory()
Get the SSH session factory- Returns:
- the SSH session factory that will be used for creating SSH sessions
-
getSession
protected RemoteSession getSession() throws TransportException
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
-
-