Eclipse Platform
Release 3.3

org.eclipse.jsch.core
Interface IJSchService


public interface IJSchService

A service whose purpose is to ensure that all the JSch preferences are properly pushed into JSch before a Session is created. The service is registered as an OSGi service. Clients can obtain an instance of the service from their bundle context or from a service tracker.

Since:
1.0

Method Summary
 void connect(com.jcraft.jsch.Proxy proxy, String host, int port, int timeout, IProgressMonitor monitor)
          Connect to the given host and port using the given proxy.
 void connect(com.jcraft.jsch.Session session, int timeout, IProgressMonitor monitor)
          Connect the session using a responsive socket factory.
 com.jcraft.jsch.Session createSession(String host, int port, String username)
          Create a Session that can be used to make SSH2 connections.
 com.jcraft.jsch.Proxy getProxyForHost(String host, String proxyType)
          Return the proxy that should be used to connect to the given host or null if no proxy is specified for the host.
 

Method Detail

createSession

public com.jcraft.jsch.Session createSession(String host,
                                             int port,
                                             String username)
                                      throws com.jcraft.jsch.JSchException
Create a Session that can be used to make SSH2 connections. This method ensures that all preferences are properly propagated into JSch before creating the session and also ensures that the session uses the appropriate proxy settings.

Calling this method does not connect the session (see connect(Session, int, IProgressMonitor), if connection throws an exception, clients should check to see if the session is still connected (see Session.isConnected(). If it is, they should call Session.disconnect().

Parameters:
host - the host name
port - the port or -1 if the default port is to be used
username - the user name or null if there is no user name or the user name is not known
Returns:
the created session
Throws:
com.jcraft.jsch.JSchException - if errors occur

connect

public void connect(com.jcraft.jsch.Session session,
                    int timeout,
                    IProgressMonitor monitor)
             throws com.jcraft.jsch.JSchException
Connect the session using a responsive socket factory. The timeout value is used for socket creation only. Clients that desire a timeout on the session must call Session.setTimeout(int). If session connection fails due to an exception, the session will be disconnected by this method.

Parameters:
session - the session to be connected
timeout - a timeout in milliseconds
monitor - a progress monitor or null if progress and cancelation is not desired
Throws:
com.jcraft.jsch.JSchException - if an exception occurs connecting the session.

getProxyForHost

public com.jcraft.jsch.Proxy getProxyForHost(String host,
                                             String proxyType)
Return the proxy that should be used to connect to the given host or null if no proxy is specified for the host.

Parameters:
host - the host
proxyType - the proxy type (either IProxyData.HTTPS_PROXY_TYPE or IProxyData.SOCKS_PROXY_TYPE)
Returns:
the proxy that should be used to connect to the given host or null if no proxy is specified for the host

connect

public void connect(com.jcraft.jsch.Proxy proxy,
                    String host,
                    int port,
                    int timeout,
                    IProgressMonitor monitor)
             throws com.jcraft.jsch.JSchException
Connect to the given host and port using the given proxy. This method calls Proxy.connect(SocketFactory, String, int, int) and provides a SocketFactory that responds to cancelation.

Parameters:
proxy - the proxy
host - the host name
port - the port
timeout - a timeout in milliseconds
monitor - a progress monitor or null if progress and cancelation is not desired
Throws:
com.jcraft.jsch.JSchException

Eclipse Platform
Release 3.3

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp. and others 2000, 2007. All rights reserved.