examples
public final class BasicClient extends java.awt.event.WindowAdapter implements SSH2Interactor, TerminalMenuListener, java.lang.Runnable
Usage:
java -cp examples.jar examples.BasicClient
[props_file_name]
Username and password as well as server can be stored in the properties file.
It can also read portforwards from properties. Create properties named 'localN' or 'remoteN' where N is an integer 0-31. The contents of the properties is in the following format:
[/plugin/][local_host:]local_port:remote_host:remote_portThis client understands the
ftp and sniff
plugins.SSH2FTPProxyFilter,
SSH2StreamSniffer| Constructor and Description |
|---|
BasicClient(java.util.Properties props)
Simple constructor where all required properties have good default
values so no properties have to be provided.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close(TerminalMenuHandler origMenu)
Called when the user has selected close in the menu
|
void |
doClose()
Close the connection to the server (if any) in a controlled way.
|
int |
getExitStatus()
Get the exit status from the SSH2ConsoleRemote instance
|
static void |
main(java.lang.String[] argv)
Run the application
|
java.lang.String |
promptLine(java.lang.String prompt,
boolean echo)
Prompt for a single string.
|
int |
promptList(java.lang.String name,
java.lang.String instruction,
java.lang.String[] choices)
This function is only used by AppGate internal code so there is
no need to actually implement it in any other code.
|
java.lang.String[] |
promptMulti(java.lang.String[] prompts,
boolean[] echos)
Prompt for multiple strings.
|
java.lang.String[] |
promptMultiFull(java.lang.String name,
java.lang.String instruction,
java.lang.String[] prompts,
boolean[] echos)
Prompt for multiple strings.
|
void |
run()
Actually runs the client.
|
void |
update()
Called when the menu is updated
|
void |
windowClosing(java.awt.event.WindowEvent e)
Overide corresponding function in java.awt.event.WindowAdapter
|
public BasicClient(java.util.Properties props)
props - SSH2 protocol properties.public void run()
main function.run in interface java.lang.Runnablepublic int getExitStatus()
public void doClose()
public void windowClosing(java.awt.event.WindowEvent e)
windowClosing in interface java.awt.event.WindowListenerwindowClosing in class java.awt.event.WindowAdapterpublic void close(TerminalMenuHandler origMenu)
TerminalMenuListenerclose in interface TerminalMenuListenerorigMenu - the menu where close was selectedpublic void update()
TerminalMenuListenerupdate in interface TerminalMenuListenerpublic static void main(java.lang.String[] argv)
public java.lang.String promptLine(java.lang.String prompt,
boolean echo)
throws SSH2UserCancelException
SSH2InteractorpromptLine in interface SSH2Interactorprompt - The prompt string to showecho - True if the text the user enters should be
echoed.SSH2UserCancelExceptionpublic java.lang.String[] promptMulti(java.lang.String[] prompts,
boolean[] echos)
throws SSH2UserCancelException
SSH2InteractorpromptMulti in interface SSH2Interactorprompts - List of prompts to showechos - List of boolean values which indicates if the
text entered for the corresponding prompt should
be echoed.SSH2UserCancelExceptionpublic java.lang.String[] promptMultiFull(java.lang.String name,
java.lang.String instruction,
java.lang.String[] prompts,
boolean[] echos)
throws SSH2UserCancelException
SSH2InteractorpromptMultiFull in interface SSH2Interactorname - Suggested title of the dialoginstruction - Instructions to show to user in the dialogprompts - List of prompts to showechos - List of boolean values which indicates if the
text entered for the corresponding prompt should
be echoed.SSH2UserCancelExceptionpublic int promptList(java.lang.String name,
java.lang.String instruction,
java.lang.String[] choices)
throws SSH2UserCancelException
SSH2InteractorIt is used to let the user select one element in a list.
promptList in interface SSH2Interactorname - Suggested title of dialoginstruction - Instructions to show to userchoices - Array of possible choicesSSH2UserCancelException