Package org.eclipse.jgit.transport
Class JschSession
- java.lang.Object
-
- org.eclipse.jgit.transport.JschSession
-
- All Implemented Interfaces:
RemoteSession
public class JschSession extends java.lang.Object implements RemoteSession
Run remote commands using Jsch.This class is the default session implementation using Jsch. Note that
JschConfigSessionFactory
is used to create the actual session passed to the constructor.
-
-
Constructor Summary
Constructors Constructor Description JschSession(com.jcraft.jsch.Session session, URIish uri)
Create a new session object by passing the real Jsch session and the URI information.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
disconnect()
Disconnect the remote sessionjava.lang.Process
exec(java.lang.String command, int timeout)
Generate a new remote process to execute the given command.com.jcraft.jsch.Channel
getSftpChannel()
A kludge to allowTransportSftp
to get an Sftp channel from Jsch.
-
-
-
Constructor Detail
-
JschSession
public JschSession(com.jcraft.jsch.Session session, URIish uri)
Create a new session object by passing the real Jsch session and the URI information.- Parameters:
session
- the real Jsch session created elsewhere.uri
- the URI information for the remote connection
-
-
Method Detail
-
exec
public java.lang.Process exec(java.lang.String command, int timeout) throws java.io.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:
command
- command to executetimeout
- timeout value, in seconds, for command execution- Returns:
- a new remote process
- Throws:
java.io.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 IOException).
-
disconnect
public void disconnect()
Description copied from interface:RemoteSession
Disconnect the remote session- Specified by:
disconnect
in interfaceRemoteSession
-
getSftpChannel
public com.jcraft.jsch.Channel getSftpChannel() throws com.jcraft.jsch.JSchException
A kludge to allowTransportSftp
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.- Returns:
- a channel suitable for Sftp operations.
- Throws:
com.jcraft.jsch.JSchException
- on problems getting the channel.
-
-