Package org.eclipse.remote.telnet.core

# Class TelnetConnection

java.lang.Object
org.eclipse.remote.telnet.core.TelnetConnection

All Implemented Interfaces:
  `EventListener`, `IRemoteCommandShellService`, `IRemoteConnection.Service`, `IRemoteConnectionChangeListener`, `IRemoteConnectionControlService`, `IRemoteConnectionHostService`

public class TelnetConnection extends Object implements IRemoteConnectionControlService, IRemoteCommandShellService, IRemoteConnectionHostService, IRemoteConnectionChangeListener

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`static class`
`TelnetConnection.Factory`

## Field Summary

Fields
Modifier and Type
Field
Description
`static int`
`DEFAULT_PORT`
`static int`
`DEFAULT_TIMEOUT`
`static final String`
`HOSTNAME_ATTR`
`static final String`
`PASSWORD_ATTR`
`static final String`
`PORT_ATTR`
`static final String`
`TIMEOUT_ATTR`
`static final String`
`USERNAME_ATTR`

## Method Summary

Modifier and Type
Method
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.
`String`
`getHostname()`
Obtain the hostname associated with this connection.
`String`
`getPassphrase()`
Get the pass phrase associated with this connection.
`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.
`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(String hostname)`
Set the hostname associated with this connection.
`void`
`setPassphrase(String passphrase)`
Set the pass phrase associated with this connection.
`void`
`setPassword(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(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.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### DEFAULT_PORT

public static int DEFAULT_PORT

### DEFAULT_TIMEOUT

public static int DEFAULT_TIMEOUT

### HOSTNAME_ATTR

public static final String HOSTNAME_ATTR

See Also:
  - Constant Field Values

### USERNAME_ATTR

public static final String USERNAME_ATTR

See Also:
  - Constant Field Values

### PASSWORD_ATTR

public static final String PASSWORD_ATTR

See Also:
  - Constant Field Values

### PORT_ATTR

public static final String PORT_ATTR

See Also:
  - Constant Field Values

### TIMEOUT_ATTR

public static final String TIMEOUT_ATTR

See Also:
  - Constant Field Values

## Method Details

### getRemoteConnection

public IRemoteConnection getRemoteConnection()

Specified by:
  `getRemoteConnection` in interface `IRemoteConnection.Service`

### getCommandShell

public IRemoteProcess getCommandShell(int flags) throws IOException
Description copied from interface: `IRemoteCommandShellService`
Get a remote process that runs a command shell on the remote system. The shell will be the user's default shell on the remote system. The flags may be used to modify behavior of the remote process. These flags may only be supported by specific types of remote service providers. Clients can use `IRemoteProcessBuilder.getSupportedFlags()` to find out the flags supported by the service provider.

     Current flags are:
       IRemoteProcessBuilder.NONE                        - disable any flags
       IRemoteProcessBuilder.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)

Specified by:
  `getCommandShell` in interface `IRemoteCommandShellService`
Parameters:
  `flags` - bitwise-or of flags
Returns:
  remote process object
Throws:
  `IOException`

### getPort

public int getPort()
Description copied from interface: `IRemoteConnectionHostService`
Obtain the port associated with this connection

Specified by:
  `getPort` in interface `IRemoteConnectionHostService`
Returns:
  port

### getTimeout

public int getTimeout()
Description copied from interface: `IRemoteConnectionHostService`
Obtain the timeout used when establishing the connection.

Specified by:
  `getTimeout` in interface `IRemoteConnectionHostService`
Returns:
  timeout

### close

public void close()
Description copied from interface: `IRemoteConnectionControlService`
Close the connection. Must be called to terminate the connection.

Specified by:
  `close` in interface `IRemoteConnectionControlService`

### getHostname

public String getHostname()
Description copied from interface: `IRemoteConnectionHostService`
Obtain the hostname associated with this connection.

Specified by:
  `getHostname` in interface `IRemoteConnectionHostService`
Returns:
  hostname

### useLoginShell

public boolean useLoginShell()
Description copied from interface: `IRemoteConnectionHostService`
Obtain the flag that indicates a login shell should be started once the connection is established

Specified by:
  `useLoginShell` in interface `IRemoteConnectionHostService`
Returns:
  login shell flag

### getUsername

public String getUsername()
Description copied from interface: `IRemoteConnectionHostService`
Obtain the username associated with this connection.

Specified by:
  `getUsername` in interface `IRemoteConnectionHostService`
Returns:

### setHostname

public void setHostname(String hostname)
Description copied from interface: `IRemoteConnectionHostService`
Set the hostname associated with this connection. Note, this method can only be used for an IRemoteConnectionWorkingCopy and will have no effect otherwise.

Specified by:
  `setHostname` in interface `IRemoteConnectionHostService`
Parameters:
  `hostname` - new hostname for connection

### setPassphrase

public void setPassphrase(String passphrase)
Description copied from interface: `IRemoteConnectionHostService`
Set the pass phrase associated with this connection. Note, this method can only be used for an IRemoteConnectionWorkingCopy and will have no effect otherwise.

Specified by:
  `setPassphrase` in interface `IRemoteConnectionHostService`

### setPassword

public void setPassword(String password)
Description copied from interface: `IRemoteConnectionHostService`
Set the password associated with this connection. Note, this method can only be used for an IRemoteConnectionWorkingCopy and will have no effect otherwise.

Specified by:
  `setPassword` in interface `IRemoteConnectionHostService`
Parameters:
  `password` - new password for connection

### setPort

public void setPort(int port)
Description copied from interface: `IRemoteConnectionHostService`
Set the port used for the connection. Note, this method can only be used forh an IRemoteConnectionWorkingCopy and will have no effect otherwise.

Specified by:
  `setPort` in interface `IRemoteConnectionHostService`
Parameters:
  `port` - new port for connection

### setTimeout

public void setTimeout(int timeout)
Description copied from interface: `IRemoteConnectionHostService`
Set the timeout used when establishing the connection. A timeout of 0 means infinite. Note, this method can only be used for an IRemoteConnectionWorkingCopy and will have no effect otherwise.

Specified by:
  `setTimeout` in interface `IRemoteConnectionHostService`
Parameters:
  `timeout` - new timeout value

### setUseLoginShell

public void setUseLoginShell(boolean useLogingShell)
Description copied from interface: `IRemoteConnectionHostService`
Set the flag indicating a login shell should be stated for this connection. Note, this method can only be used for an IRemoteConnectionWorkingCopy and will have no effect otherwise.

Specified by:
  `setUseLoginShell` in interface `IRemoteConnectionHostService`
Parameters:
  `useLogingShell` - true to start a login shell

### setUsePassword

public void setUsePassword(boolean usePassword)
Description copied from interface: `IRemoteConnectionHostService`
Set the connection to try password authentication first. Note, this method can only be used for an IRemoteConnectionWorkingCopy and will have no effect otherwise.

Specified by:
  `setUsePassword` in interface `IRemoteConnectionHostService`
Parameters:
  `usePassword` - use password authentication

### setUsername

public void setUsername(String username)
Description copied from interface: `IRemoteConnectionHostService`
Set the username associated with this connection. Note, this method can only be used for an IRemoteConnectionWorkingCopy and will have no effect otherwise.

Specified by:
  `setUsername` in interface `IRemoteConnectionHostService`
Parameters:
  `username` - new username for connection

### open

public void open(org.eclipse.core.runtime.IProgressMonitor monitor) throws RemoteConnectionException
Description copied from interface: `IRemoteConnectionControlService`
Open the connection. Must be called before the connection can be used.

Specified by:
  `open` in interface `IRemoteConnectionControlService`
Parameters:
  `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.
Throws:
  `RemoteConnectionException`

### isOpen

public boolean isOpen()
Description copied from interface: `IRemoteConnectionControlService`
Test if the connection is open.

Specified by:
  `isOpen` in interface `IRemoteConnectionControlService`
Returns:
  true if connection is open.

### connectionChanged

public void connectionChanged(RemoteConnectionChangeEvent event)
Description copied from interface: `IRemoteConnectionChangeListener`
Notifies this listener that the status of a connection has changed.

Specified by:
  `connectionChanged` in interface `IRemoteConnectionChangeListener`
Parameters:
  `event` - the connection change event

### terminated

protected void terminated(TelnetCommandShell shell)

### getPassphrase

public String getPassphrase()
Description copied from interface: `IRemoteConnectionHostService`
Get the pass phrase associated with this connection.

Specified by:
  `getPassphrase` in interface `IRemoteConnectionHostService`
Returns:
  pass phrase

### getPassword

public String getPassword()
Description copied from interface: `IRemoteConnectionHostService`
Get the password associated with this connection.

Specified by:
  `getPassword` in interface `IRemoteConnectionHostService`
Returns:
  password

### usePassword

public boolean usePassword()
Description copied from interface: `IRemoteConnectionHostService`
Get the value of the use password authentication flag. If true, the connection will try using a password first.

Specified by:
  `usePassword` in interface `IRemoteConnectionHostService`
Returns:
  use password authentication flag