Class SessionProviderInternalFrame

All Implemented Interfaces:
SessionManager, SshToolsApplicationContainer, ImageObserver, MenuContainer, Serializable, Accessible, RootPaneContainer, WindowConstants

public class SessionProviderInternalFrame extends SshToolsApplicationInternalFrame implements SessionManager

This frame class embeds a SessionProvider and manages the connection on behalf of the caller. To invoke a session provider from an external application is a straight forward procedure. Assuming that the connection has already been established [see SshClient] you can invoke a frame using the following code:

 // Create an SshClient connection
 SshClient ssh = new SshClient();

 // Connection code goes here - see SshClient for more details

 SessionProviderFrame frame = new SessionProviderFrame(null,
                            new SshToolsConnectionProfile(),
                                                        ssh,
          SessionProviderFactory.getInstance().getProvider("sshterm"));
 frame.pack();
 frame.show();
 
Version:
$Id: SessionProviderInternalFrame.java,v 1.3 2003/09/24 11:26:32 martianx Exp $
Author:
Lee David Painter
See Also:
  • Constructor Details

  • Method Details

    • initFrame

      public boolean initFrame(SshToolsApplication app) throws IOException, SshToolsApplicationException
      Initialize the frame and open the remote session
      Parameters:
      app - the application object, can be null
      Returns:
      Throws:
      IOException
      SshToolsApplicationException
    • getSessionPanel

      public SshToolsApplicationSessionPanel getSessionPanel()
      Get the attached session provider panel.
      Returns:
    • canExit

      public boolean canExit()
      Called by the application framework when testing exit state
      Returns:
    • exit

      public void exit()
      Called by the framework when exiting. Can also be called to close the session.
    • openSession

      public SessionChannelClient openSession() throws IOException
      Implementation of the SessionManager method, simply calls the SshClient openSession method.
      Specified by:
      openSession in interface SessionManager
      Returns:
      Throws:
      IOException
    • getRemoteEOL

      public int getRemoteEOL()
      Returns the guessed EOL setting of the remote computer
      Specified by:
      getRemoteEOL in interface SessionManager
      Returns:
    • applyProfileChanges

      public void applyProfileChanges(SshToolsConnectionProfile profile)
      Implementation of the SessionManager method, this does nothing. Overide this method to provide additional functionality to save changes made by the session to the profile.
      Specified by:
      applyProfileChanges in interface SessionManager
      Parameters:
      profile -
    • openSftpClient

      public SftpClient openSftpClient() throws IOException
      Implementation of the SessionManager method, this simply calls the SshClient method openSftpClient.
      Specified by:
      openSftpClient in interface SessionManager
      Returns:
      Throws:
      IOException
    • openChannel

      public boolean openChannel(Channel channel) throws IOException
      Implementation of the SessionManager method, this simply calls the SshClient method openChannel.
      Specified by:
      openChannel in interface SessionManager
      Parameters:
      channel -
      Returns:
      Throws:
      IOException
    • isConnected

      public boolean isConnected()
      Implementation of the SessionManager method, this simply calls the SshClient method isConnected.
      Specified by:
      isConnected in interface SessionManager
      Returns:
    • setDisconnectOnClose

      public void setDisconnectOnClose(boolean disconnectOnClose)
      When the session closes, should the connection be disconnected?
      Parameters:
      disconnectOnClose -
    • requestDisconnect

      public boolean requestDisconnect()
      Implementation of the SessionManager method, this simply returns false. Overide to change this behaviour
      Specified by:
      requestDisconnect in interface SessionManager
      Returns:
    • getForwardingClient

      public ForwardingClient getForwardingClient()
      Implementation of the SessionManager method, simply calls the SshClient method getForwardingClient.
      Specified by:
      getForwardingClient in interface SessionManager
      Returns:
    • sendGlobalRequest

      public byte[] sendGlobalRequest(String requestname, boolean wantreply, byte[] requestdata) throws IOException
      Implementation of the SessionManager method, simply calls the SshClient method sendGlobalRequest.
      Specified by:
      sendGlobalRequest in interface SessionManager
      Parameters:
      requestname -
      wantreply -
      requestdata -
      Returns:
      Throws:
      IOException
    • addEventHandler

      public void addEventHandler(SshEventAdapter eventHandler)
      Implementation of the SessionManager method, simply calls the SshClient method addEventHandler.
      Specified by:
      addEventHandler in interface SessionManager
      Parameters:
      eventHandler -
    • getServerId

      public String getServerId()
      Implemenation of the SessionManager method, simply calls the SshClient method getServerId.
      Specified by:
      getServerId in interface SessionManager
      Returns:
    • allowChannelOpen

      public void allowChannelOpen(String channelType, ChannelFactory cf) throws IOException
      Implemenation of the SessionManager method, simply calls the SshClient method allowChannelOpen.
      Specified by:
      allowChannelOpen in interface SessionManager
      Parameters:
      channelType -
      cf -
      Throws:
      IOException
    • getProfile

      public SshToolsConnectionProfile getProfile()
      Gets the profile currently attached to the frame.
      Specified by:
      getProfile in interface SessionManager
      Returns: