java.lang.Object
org.eclipse.jgit.transport.ssh.jsch.JschSession
All Implemented Interfaces:
org.eclipse.jgit.transport.RemoteSession, org.eclipse.jgit.transport.RemoteSession2

public class JschSession extends Object implements org.eclipse.jgit.transport.RemoteSession2
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.

Since:
6.0
  • Constructor Details

    • JschSession

      public JschSession(com.jcraft.jsch.Session session, org.eclipse.jgit.transport.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 Details

    • exec

      public Process exec(String command, int timeout) throws IOException
      Specified by:
      exec in interface org.eclipse.jgit.transport.RemoteSession
      Throws:
      IOException
    • exec

      public Process exec(String command, Map<String,String> environment, int timeout) throws IOException
      Specified by:
      exec in interface org.eclipse.jgit.transport.RemoteSession2
      Throws:
      IOException
    • disconnect

      public void disconnect()
      Specified by:
      disconnect in interface org.eclipse.jgit.transport.RemoteSession
    • getSftpChannel

      @Deprecated public com.jcraft.jsch.Channel getSftpChannel() throws com.jcraft.jsch.JSchException
      Deprecated.
      since 5.2; use getFtpChannel() instead
      A kludge to allow TransportSftp 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.
    • getFtpChannel

      public org.eclipse.jgit.transport.FtpChannel getFtpChannel()
      Specified by:
      getFtpChannel in interface org.eclipse.jgit.transport.RemoteSession
      Since:
      5.2