public class TelnetConnection extends java.lang.Object implements IRemoteConnectionControlService, IRemoteCommandShellService, IRemoteConnectionHostService, IRemoteConnectionChangeListener
Modifier and Type | Class and Description |
---|---|
static class |
TelnetConnection.Factory |
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_PORT |
static int |
DEFAULT_TIMEOUT |
static java.lang.String |
HOSTNAME_ATTR |
static java.lang.String |
PASSWORD_ATTR |
static java.lang.String |
PORT_ATTR |
static java.lang.String |
TIMEOUT_ATTR |
static java.lang.String |
USERNAME_ATTR |
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the connection.
|
void |
connectionChanged(RemoteConnectionChangeEvent event)
Notifies this listener that the status of a connection has changed.
|
IRemoteProcess |
getCommandShell(int flags)
Get a remote process that runs a command shell on the remote system.
|
java.lang.String |
getHostname()
Obtain the hostname associated with this connection.
|
java.lang.String |
getPassphrase()
Get the pass phrase associated with this connection.
|
java.lang.String |
getPassword()
Get the password associated with this connection.
|
int |
getPort()
Obtain the port associated with this connection
|
IRemoteConnection |
getRemoteConnection() |
int |
getTimeout()
Obtain the timeout used when establishing the connection.
|
java.lang.String |
getUsername()
Obtain the username associated with this connection.
|
boolean |
isOpen()
Test if the connection is open.
|
void |
open(org.eclipse.core.runtime.IProgressMonitor monitor)
Open the connection.
|
void |
setHostname(java.lang.String hostname)
Set the hostname associated with this connection.
|
void |
setPassphrase(java.lang.String passphrase)
Set the pass phrase associated with this connection.
|
void |
setPassword(java.lang.String password)
Set the password associated with this connection.
|
void |
setPort(int port)
Set the port used for the connection.
|
void |
setTimeout(int timeout)
Set the timeout used when establishing the connection.
|
void |
setUseLoginShell(boolean useLogingShell)
Set the flag indicating a login shell should be stated for this connection.
|
void |
setUsePassword(boolean usePassword)
Set the connection to try password authentication first.
|
void |
setUsername(java.lang.String username)
Set the username associated with this connection.
|
protected void |
terminated(TelnetCommandShell shell) |
boolean |
useLoginShell()
Obtain the flag that indicates a login shell should be started once the connection is established
|
boolean |
usePassword()
Get the value of the use password authentication flag.
|
public static int DEFAULT_PORT
public static int DEFAULT_TIMEOUT
public static final java.lang.String HOSTNAME_ATTR
public static final java.lang.String USERNAME_ATTR
public static final java.lang.String PASSWORD_ATTR
public static final java.lang.String PORT_ATTR
public static final java.lang.String TIMEOUT_ATTR
public IRemoteConnection getRemoteConnection()
getRemoteConnection
in interface IRemoteConnection.Service
public IRemoteProcess getCommandShell(int flags) throws java.io.IOException
IRemoteCommandShellService
IRemoteProcessBuilder.getSupportedFlags()
to find out the flags
supported by the service provider.
Current flags are:IRemoteProcessBuilder.NONE
- disable any flagsIRemoteProcessBuilder.ALLOCATE_PTY
- allocate a pseudo-terminal for the process (RFC-4254 Sec. 6.2)IRemoteProcessBuilder.FORWARD_X11
- enable X11 forwarding (RFC-4254 Sec. 6.3)
getCommandShell
in interface IRemoteCommandShellService
flags
- bitwise-or of flagsjava.io.IOException
public int getPort()
IRemoteConnectionHostService
getPort
in interface IRemoteConnectionHostService
public int getTimeout()
IRemoteConnectionHostService
getTimeout
in interface IRemoteConnectionHostService
public void close()
IRemoteConnectionControlService
close
in interface IRemoteConnectionControlService
public java.lang.String getHostname()
IRemoteConnectionHostService
getHostname
in interface IRemoteConnectionHostService
public boolean useLoginShell()
IRemoteConnectionHostService
useLoginShell
in interface IRemoteConnectionHostService
public java.lang.String getUsername()
IRemoteConnectionHostService
getUsername
in interface IRemoteConnectionHostService
public void setHostname(java.lang.String hostname)
IRemoteConnectionHostService
setHostname
in interface IRemoteConnectionHostService
hostname
- new hostname for connectionpublic void setPassphrase(java.lang.String passphrase)
IRemoteConnectionHostService
setPassphrase
in interface IRemoteConnectionHostService
public void setPassword(java.lang.String password)
IRemoteConnectionHostService
setPassword
in interface IRemoteConnectionHostService
password
- new password for connectionpublic void setPort(int port)
IRemoteConnectionHostService
setPort
in interface IRemoteConnectionHostService
port
- new port for connectionpublic void setTimeout(int timeout)
IRemoteConnectionHostService
setTimeout
in interface IRemoteConnectionHostService
timeout
- new timeout valuepublic void setUseLoginShell(boolean useLogingShell)
IRemoteConnectionHostService
setUseLoginShell
in interface IRemoteConnectionHostService
useLogingShell
- true to start a login shellpublic void setUsePassword(boolean usePassword)
IRemoteConnectionHostService
setUsePassword
in interface IRemoteConnectionHostService
usePassword
- use password authenticationpublic void setUsername(java.lang.String username)
IRemoteConnectionHostService
setUsername
in interface IRemoteConnectionHostService
username
- new username for connectionpublic void open(org.eclipse.core.runtime.IProgressMonitor monitor) throws RemoteConnectionException
IRemoteConnectionControlService
open
in interface IRemoteConnectionControlService
monitor
- the progress monitor to use for reporting progress to the user. It is the caller's responsibility to call done()
on the given monitor. Accepts null, indicating that no progress should be reported and that the operation cannot
be cancelled.RemoteConnectionException
public boolean isOpen()
IRemoteConnectionControlService
isOpen
in interface IRemoteConnectionControlService
public void connectionChanged(RemoteConnectionChangeEvent event)
IRemoteConnectionChangeListener
connectionChanged
in interface IRemoteConnectionChangeListener
event
- the connection change eventprotected void terminated(TelnetCommandShell shell)
public java.lang.String getPassphrase()
IRemoteConnectionHostService
getPassphrase
in interface IRemoteConnectionHostService
public java.lang.String getPassword()
IRemoteConnectionHostService
getPassword
in interface IRemoteConnectionHostService
public boolean usePassword()
IRemoteConnectionHostService
usePassword
in interface IRemoteConnectionHostService