public class JschSession extends Object implements RemoteSession2
This class is the default session implementation using Jsch. Note that
JschConfigSessionFactory
is used to create
the actual session passed to the constructor.
Constructor and Description |
---|
JschSession(com.jcraft.jsch.Session session,
URIish uri)
Create a new session object by passing the real Jsch session and the URI
information.
|
Modifier and Type | Method and Description |
---|---|
void |
disconnect()
Disconnects the remote session.
|
Process |
exec(String command,
int timeout)
Creates a new remote
Process to execute the given command. |
Process |
exec(String command,
Map<String,String> environment,
int timeout)
Creates a new remote
Process to execute the given command. |
FtpChannel |
getFtpChannel()
Obtains an
FtpChannel for performing FTP operations over this
RemoteSession . |
com.jcraft.jsch.Channel |
getSftpChannel()
Deprecated.
since 5.2; use
getFtpChannel() instead |
public JschSession(com.jcraft.jsch.Session session, URIish uri)
session
- the real Jsch session created elsewhere.uri
- the URI information for the remote connectionpublic Process exec(String command, int timeout) throws IOException
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
command
- 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 command, Map<String,String> environment, int timeout) throws IOException
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
command
- 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).public void disconnect()
disconnect
in interface RemoteSession
@Deprecated public com.jcraft.jsch.Channel getSftpChannel() throws com.jcraft.jsch.JSchException
getFtpChannel()
insteadTransportSftp
to get
an Sftp channel from Jsch. Ideally, this method would be generic, which
would require implementing generic Sftp channel operations in the
RemoteSession class.com.jcraft.jsch.JSchException
- on problems getting the channel.public FtpChannel getFtpChannel()
FtpChannel
for performing FTP operations over this
RemoteSession
. The default implementation returns null
.getFtpChannel
in interface RemoteSession
FtpChannel
Copyright © 2021 Eclipse JGit Project. All rights reserved.