com.sshtools.common.ui

Class SessionProviderInternalFrame

Implemented Interfaces:
SessionManager, SshToolsApplicationContainer

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

Field Summary

Fields inherited from class com.sshtools.common.ui.SshToolsApplicationInternalFrame

PREF_LAST_FRAME_GEOMETRY, aboutAction, exitAction, log, newWindowAction, toolSeparator

Constructor Summary

SessionProviderInternalFrame(SshToolsConnectionProfile profile, SshClient ssh, SessionProvider provider)
Construct a new Session Provider frame.

Method Summary

void
addEventHandler(SshEventAdapter eventHandler)
Implementation of the SessionManager method, simply calls the SshClient method addEventHandler.
void
allowChannelOpen(String channelType, ChannelFactory cf)
Implemenation of the SessionManager method, simply calls the SshClient method allowChannelOpen.
void
applyProfileChanges(SshToolsConnectionProfile profile)
Implementation of the SessionManager method, this does nothing.
boolean
canExit()
Called by the application framework when testing exit state
void
exit()
Called by the framework when exiting.
ForwardingClient
getForwardingClient()
Implementation of the SessionManager method, simply calls the SshClient method getForwardingClient.
SshToolsConnectionProfile
getProfile()
Gets the profile currently attached to the frame.
int
getRemoteEOL()
Returns the guessed EOL setting of the remote computer
String
getServerId()
Implemenation of the SessionManager method, simply calls the SshClient method getServerId.
SshToolsApplicationSessionPanel
getSessionPanel()
Get the attached session provider panel.
boolean
initFrame(SshToolsApplication app)
Initialize the frame and open the remote session
boolean
isConnected()
Implementation of the SessionManager method, this simply calls the SshClient method isConnected.
boolean
openChannel(Channel channel)
Implementation of the SessionManager method, this simply calls the SshClient method openChannel.
SessionChannelClient
openSession()
Implementation of the SessionManager method, simply calls the SshClient openSession method.
SftpClient
openSftpClient()
Implementation of the SessionManager method, this simply calls the SshClient method openSftpClient.
boolean
requestDisconnect()
Implementation of the SessionManager method, this simply returns false.
byte[]
sendGlobalRequest(String requestname, boolean wantreply, byte[] requestdata)
Implementation of the SessionManager method, simply calls the SshClient method sendGlobalRequest.
void
setDisconnectOnClose(boolean disconnectOnClose)
When the session closes, should the connection be disconnected?

Methods inherited from class com.sshtools.common.ui.SshToolsApplicationInternalFrame

closeContainer, getApplication, getApplicationPanel, init, isContainerVisible, setContainerTitle, setContainerVisible, showAboutBox, showExitAction, showNewWindowAction

Constructor Details

SessionProviderInternalFrame

public SessionProviderInternalFrame(SshToolsConnectionProfile profile,
                                    SshClient ssh,
                                    SessionProvider provider)
            throws IOException,
                   SshToolsApplicationException
Construct a new Session Provider frame.
Parameters:
profile - The profile of the connection
ssh - the client connection
provider - the provider instance

Method Details

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 -

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 -

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 -

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.

getForwardingClient

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

getProfile

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

getRemoteEOL

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

getServerId

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

getSessionPanel

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

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:

isConnected

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

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:

openSession

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

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:

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:

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:

setDisconnectOnClose

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

Copyright © 2002-2003 Lee David Painter & Contributors. All Rights Reserved.