Package org.eclipse.jgit.transport.sshd
Class SshdSession
- java.lang.Object
-
- org.eclipse.jgit.transport.sshd.SshdSession
-
- All Implemented Interfaces:
RemoteSession
public class SshdSession extends Object implements RemoteSession
An implementation ofRemoteSession
based on Apache MINA sshd.- Since:
- 5.2
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addCloseListener(SessionCloseListener listener)
Adds aSessionCloseListener
to this session.void
disconnect()
Disconnect the remote sessionProcess
exec(String commandName, int timeout)
Generate a new remote process to execute the given command.FtpChannel
getFtpChannel()
Obtain anFtpChannel
to perform SFTP operations in thisSshdSession
.void
removeCloseListener(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 aSessionCloseListener
to this session. Has no effect if the givenlistener
is 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:RemoteSession
Generate a new remote process to execute the given command. This function should also start execution and may need to create the streams prior to execution.- Specified by:
exec
in interfaceRemoteSession
- Parameters:
commandName
- command to executetimeout
- timeout value, in seconds, for command execution- Returns:
- a new remote process
- 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 anFtpChannel
to perform SFTP operations in thisSshdSession
.- Specified by:
getFtpChannel
in interfaceRemoteSession
- Returns:
- the
FtpChannel
-
disconnect
public void disconnect()
Description copied from interface:RemoteSession
Disconnect the remote session- Specified by:
disconnect
in interfaceRemoteSession
-
-