Package org.eclipse.jgit.transport.sshd
Class SshdSession
- java.lang.Object
-
- org.eclipse.jgit.transport.sshd.SshdSession
-
- All Implemented Interfaces:
RemoteSession,RemoteSession2
public class SshdSession extends Object implements RemoteSession2
An implementation ofRemoteSessionbased on Apache MINA sshd.- Since:
- 5.2
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddCloseListener(SessionCloseListener listener)Adds aSessionCloseListenerto this session.voiddisconnect()Disconnects the remote session.Processexec(String commandName, int timeout)Creates a new remoteProcessto execute the given command.Processexec(String commandName, Map<String,String> environment, int timeout)Creates a new remoteProcessto execute the given command.FtpChannelgetFtpChannel()Obtain anFtpChannelto perform SFTP operations in thisSshdSession.voidremoveCloseListener(SessionCloseListener listener)Removes the givenlistener; has no effect if the listener is not currently registered with this session.
-
-
-
Method Detail
-
addCloseListener
public void addCloseListener(@NonNull SessionCloseListener listener)
Adds aSessionCloseListenerto this session. Has no effect if the givenlisteneris already registered with this session.- Parameters:
listener- to add
-
removeCloseListener
public void removeCloseListener(@NonNull SessionCloseListener listener)
Removes the givenlistener; has no effect if the listener is not currently registered with this session.- Parameters:
listener- to remove
-
exec
public Process exec(String commandName, int timeout) throws IOException
Description copied from interface:RemoteSessionCreates a new remoteProcessto execute the given command. The returned process's streams exist and are connected, and execution of the process is already started.- Specified by:
execin interfaceRemoteSession- Parameters:
commandName- command to executetimeout- timeout value, in seconds, for creating the remote process- Returns:
- a new remote process, already started
- Throws:
IOException- may be thrown in several cases. For example, on problems opening input or output streams or on problems connecting or communicating with the remote host. For the latter two cases, a TransportException may be thrown (a subclass of java.io.IOException).
-
exec
public Process exec(String commandName, Map<String,String> environment, int timeout) throws IOException
Description copied from interface:RemoteSession2Creates a new remoteProcessto execute the given command. The returned process's streams exist and are connected, and execution of the process is already started.- Specified by:
execin interfaceRemoteSession2- Parameters:
commandName- command to executeenvironment- environment variables to pass ontimeout- timeout value, in seconds, for creating the remote process- Returns:
- a new remote process, already started
- Throws:
IOException- may be thrown in several cases. For example, on problems opening input or output streams or on problems connecting or communicating with the remote host. For the latter two cases, a TransportException may be thrown (a subclass of java.io.IOException).
-
getFtpChannel
@NonNull public FtpChannel getFtpChannel()
Obtain anFtpChannelto perform SFTP operations in thisSshdSession.- Specified by:
getFtpChannelin interfaceRemoteSession- Returns:
- the
FtpChannel
-
disconnect
public void disconnect()
Description copied from interface:RemoteSessionDisconnects the remote session.- Specified by:
disconnectin interfaceRemoteSession
-
-