com.sshtools.profile
Interface ProfileTransport

All Known Subinterfaces:
TerminalProtocolTranport, VirtualSessionTransport
All Known Implementing Classes:
AbstractSshProtocolTransport

public interface ProfileTransport

ProfileTransport implementations are responsible for creating and maintaing a connection to a resource. The resource URI is determined from the ResourceProfile provided when connect() is called.

Version:
$Revision: 1.1 $
Author:
$Author: richard $

Method Summary
 ProfileTransport cloneVirtualSession(VirtualSession session)
          Clone the current virtual session.
 boolean connect(ResourceProfile profile)
          Connect to a host (or resource) using the URI provided in the ResourceProfile}.
 void disconnect()
          Disconnect from the currently connected resource.
 java.lang.String getHostDescription()
          If the host has provided some information about itself, this method will return it.
 ResourceProfile getProfile()
          Get the profile that was used to connect this transport.
 java.lang.String getProtocolDescription()
          Return a short description of the protocol, for example "Telnet" or "SSH2"
 java.lang.Object getProvider()
          Return the underlying provider of the terminal.
 java.lang.String getTransportDescription()
          Return a short description of the transport, for example "Socket" or "SOCKS5"
 boolean isCloneVirtualSessionSupported()
          Some transports may be capable of cloning the current virtual session (SSH for example).
 boolean isConnected()
          Get if a connection is currently being maintained.
 boolean isConnectionPending()
          Get if a connection is currently pending, e.g.
 

Method Detail

connect

public boolean connect(ResourceProfile profile)
                throws ProfileException,
                       AuthenticationException
Connect to a host (or resource) using the URI provided in the ResourceProfile}. The URI will supply such details as host, user etc. Any protocol specific authentication will also be performed.

Parameters:
profile - profile
Returns:
true if connected OK
Throws:
ProfileException - on any connection error
AuthenticationException - if authentication fails

disconnect

public void disconnect()
                throws java.io.IOException
Disconnect from the currently connected resource. If a connection is not currently being maintained, an IOException will be thrown.

Throws:
java.io.IOException - on any disconnection error

isConnected

public boolean isConnected()
Get if a connection is currently being maintained.

Returns:
connected

isConnectionPending

public boolean isConnectionPending()
Get if a connection is currently pending, e.g. unauthenticated.

Returns:
connection pending

getProvider

public java.lang.Object getProvider()
Return the underlying provider of the terminal. This should be used to return the underlying object that creates and maintains the terminal transport, its purpose is to allow additional features such as SFTP to be implemented in the terminal.

Returns:

isCloneVirtualSessionSupported

public boolean isCloneVirtualSessionSupported()
Some transports may be capable of cloning the current virtual session (SSH for example). Such transports should return true for this method.

Returns:
transport supports cloning

getProfile

public ResourceProfile getProfile()
Get the profile that was used to connect this transport. This will be null if disconnected.

Returns:
profile

getHostDescription

public java.lang.String getHostDescription()
If the host has provided some information about itself, this method will return it. Otherwise null will be returned.

Returns:
host description

getProtocolDescription

public java.lang.String getProtocolDescription()
Return a short description of the protocol, for example "Telnet" or "SSH2"

Returns:

getTransportDescription

public java.lang.String getTransportDescription()
Return a short description of the transport, for example "Socket" or "SOCKS5"

Returns:

cloneVirtualSession

public ProfileTransport cloneVirtualSession(VirtualSession session)
                                     throws java.lang.CloneNotSupportedException,
                                            ProfileException
Clone the current virtual session. The current connection should be cloned and a new instance of the appropriate transport will be returned.

Parameters:
session - the virtual session that is going to manage this newly cloned connection
Returns:
the cloned connection
Throws:
java.lang.CloneNotSupportedException - if cloning cannot take place
ProfileException - on any errors that may occur during cloning.


Copyright © 2003-2004 3SP LTD. All Rights Reserved.