|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.foxsmart.ic.net.AbstractCliProtocolHandler
com.foxsmart.ic.net.PlinkSshProtocolHandler
public class PlinkSshProtocolHandler
The PlinkSshProtocolHandler class helps with the handling of sending and receiving of data to and from an SSH client using the plink external process.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface com.foxsmart.ic.net.ProtocolHandler |
|---|
ProtocolHandler.Protocol |
| Field Summary | |
|---|---|
static int |
DEFAULT_SSH_PORT
The default SSH socket port. |
protected org.apache.commons.logging.Log |
log
|
static java.lang.String |
PARAM_PASSWORD
|
static java.lang.String |
PARAM_PORT
|
static java.lang.String |
PARAM_SSH_PROTOCOL
|
static java.lang.String |
PARAM_USERNAME
|
static java.lang.String |
PLINK_PROGRAM
|
protected java.lang.String |
plinkPath
|
protected java.lang.Process |
process
|
static java.lang.String |
WINDOWS_EXE_EXTENSION
|
| Fields inherited from class com.foxsmart.ic.net.AbstractCliProtocolHandler |
|---|
defaultNoDataReadDelay, defaultProtocolTimeout, PASSWORD_MASK |
| Fields inherited from interface com.foxsmart.ic.net.CliProtocolHandler |
|---|
CR, DEFAULT_NO_DATA_READ_DELAY, PASSWORD_PROMPT, USERNAME_PROMPT |
| Fields inherited from interface com.foxsmart.ic.net.ProtocolHandler |
|---|
DEFAULT_PROTOCOL_TIMEOUT_SECONDS |
| Constructor Summary | |
|---|---|
PlinkSshProtocolHandler()
Default Constructor. |
|
| Method Summary | |
|---|---|
void |
connect(java.lang.String hostname,
java.lang.Integer port,
java.lang.String username,
java.lang.String password,
java.lang.Integer timeout)
Connects to the hostname at the specified port number and authenticates with the remote device. |
void |
disconnect()
This method sets the usernameUsed and passwordUsed flags to false. |
boolean |
getAvailable()
Returns whether this protocol handler is available. |
java.io.InputStream |
getInputStream()
Returns the connection input stream. |
java.io.OutputStream |
getOutputStream()
Returns the connection output stream. |
java.lang.String |
getPlinkPath()
|
ProtocolHandler.Protocol |
getProtocol()
Returns the SSH protocol. |
boolean |
isConnected()
Returns true if the client is currently connected to a server. |
void |
setPlinkPath(java.lang.String plinkPath)
|
| Methods inherited from class com.foxsmart.ic.net.AbstractCliProtocolHandler |
|---|
expect, expect, expect, expect, expect, expect, getAscii, getDefaultNoDataReadDelay, getDefaultProtocolTimeout, getPasswordUsed, getUsernameUsed, read, read, sendCommand, sendCommand, setDefaultNoDataReadDelay, setDefaultProtocolTimeout, setPasswordUsed, setUsernameUsed, toString, write |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected org.apache.commons.logging.Log log
public static final int DEFAULT_SSH_PORT
public static final java.lang.String PLINK_PROGRAM
public static final java.lang.String WINDOWS_EXE_EXTENSION
public static final java.lang.String PARAM_SSH_PROTOCOL
public static final java.lang.String PARAM_PORT
public static final java.lang.String PARAM_USERNAME
public static final java.lang.String PARAM_PASSWORD
protected java.lang.Process process
protected java.lang.String plinkPath
| Constructor Detail |
|---|
public PlinkSshProtocolHandler()
| Method Detail |
|---|
public ProtocolHandler.Protocol getProtocol()
public boolean getAvailable()
getAvailable in interface ProtocolHandlergetAvailable in class AbstractCliProtocolHandler
public void connect(java.lang.String hostname,
java.lang.Integer port,
java.lang.String username,
java.lang.String password,
java.lang.Integer timeout)
throws java.lang.Exception
CliProtocolHandler
hostname - The name of the remote host.port - The port to connect to on the remote host. If null is passed in, a default port will be used.username - The username to connect with. Null should be passed in if no username is required.password - The password to connect with. Null should be passed in if no password is required.timeout - The timeout in seconds. If null is passed in, a default timeout will be used.
AuthenticationFailedException - when a successful connection could not be made
java.net.SocketException - if the socket timeout could not be set.
java.io.IOException - if the socket could not be opened. In most cases you will only want to catch IOException
since SocketException is derived from it.
ThreadTimeoutException - if a timeout occurred while connecting to the router.
java.net.UnknownHostException - If the hostname cannot be resolved.
java.lang.Exception - if any other problems were encountered.CliProtocolHandler.connect(String, Integer, String, String, Integer)public boolean isConnected()
public void disconnect()
throws java.io.IOException
AbstractCliProtocolHandler
disconnect in interface CliProtocolHandlerdisconnect in class AbstractCliProtocolHandlerjava.io.IOException - If there is an error closing the socket.CliProtocolHandler.disconnect().public java.io.InputStream getInputStream()
CliProtocolHandler
CliProtocolHandler.getInputStream()public java.io.OutputStream getOutputStream()
CliProtocolHandler
CliProtocolHandler.getOutputStream()public java.lang.String getPlinkPath()
public void setPlinkPath(java.lang.String plinkPath)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||