org.eclipse.remote.telnet.core

## Class TelnetConnection

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

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

    public class TelnetConnection
    extends java.lang.Object
    implements IRemoteConnectionControlService, IRemoteCommandShellService, IRemoteConnectionHostService, IRemoteConnectionChangeListener

### Nested Class Summary

Nested Classes
`static class` `TelnetConnection.Factory`

### Field Summary

Fields
`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`

### Method Summary

All Methods Instance Methods Concrete Methods
`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.

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

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

### Field Detail

#### DEFAULT_PORT

    public static int DEFAULT_PORT

#### DEFAULT_TIMEOUT

    public static int DEFAULT_TIMEOUT

#### HOSTNAME_ATTR

    public static final java.lang.String HOSTNAME_ATTR

See Also:
  Constant Field Values

#### USERNAME_ATTR

    public static final java.lang.String USERNAME_ATTR

See Also:
  Constant Field Values

#### PASSWORD_ATTR

    public static final java.lang.String PASSWORD_ATTR

See Also:
  Constant Field Values

#### PORT_ATTR

    public static final java.lang.String PORT_ATTR

See Also:
  Constant Field Values

#### TIMEOUT_ATTR

    public static final java.lang.String TIMEOUT_ATTR

See Also:
  Constant Field Values

### Method Detail

#### getRemoteConnection

    public IRemoteConnection getRemoteConnection()

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

#### getCommandShell

    public IRemoteProcess getCommandShell(int flags)
                                   throws java.io.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:
  `java.io.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 java.lang.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 java.lang.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(java.lang.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(java.lang.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(java.lang.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(java.lang.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 java.lang.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 java.lang.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