public class SshdSession extends Object implements RemoteSession2
RemoteSession
based on Apache MINA sshd.Modifier and Type | Method and Description |
---|---|
void |
addCloseListener(SessionCloseListener listener)
Adds a
SessionCloseListener to this session. |
void |
disconnect()
Disconnects the remote session.
|
Process |
exec(String commandName,
int timeout)
Creates a new remote
Process to execute the given command. |
Process |
exec(String commandName,
Map<String,String> environment,
int timeout)
Creates a new remote
Process to execute the given command. |
FtpChannel |
getFtpChannel()
Obtain an
FtpChannel to perform SFTP operations in this
SshdSession . |
void |
removeCloseListener(SessionCloseListener listener)
Removes the given
listener ; has no effect if the listener is not
currently registered with this session. |
public void addCloseListener(@NonNull SessionCloseListener listener)
SessionCloseListener
to this session. Has no effect if the
given listener
is already registered with this session.listener
- to addpublic void removeCloseListener(@NonNull SessionCloseListener listener)
listener
; has no effect if the listener is not
currently registered with this session.listener
- to removepublic Process exec(String commandName, int timeout) throws IOException
RemoteSession
Process
to execute the given command. The
returned process's streams exist and are connected, and execution of the
process is already started.exec
in interface RemoteSession
commandName
- command to executetimeout
- timeout value, in seconds, for creating the remote processIOException
- 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).public Process exec(String commandName, Map<String,String> environment, int timeout) throws IOException
RemoteSession2
Process
to execute the given command. The
returned process's streams exist and are connected, and execution of the
process is already started.exec
in interface RemoteSession2
commandName
- command to executeenvironment
- environment variables to pass ontimeout
- timeout value, in seconds, for creating the remote processIOException
- 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).@NonNull public FtpChannel getFtpChannel()
FtpChannel
to perform SFTP operations in this
SshdSession
.getFtpChannel
in interface RemoteSession
FtpChannel
public void disconnect()
RemoteSession
disconnect
in interface RemoteSession
Copyright © 2021 Eclipse JGit Project. All rights reserved.