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 -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Close the connection.voidNotifies this listener that the status of a connection has changed.getCommandShell(int flags) Get a remote process that runs a command shell on the remote system.Obtain the hostname associated with this connection.Get the pass phrase associated with this connection.Get the password associated with this connection.intgetPort()Obtain the port associated with this connectionintObtain the timeout used when establishing the connection.Obtain the username associated with this connection.booleanisOpen()Test if the connection is open.voidopen(org.eclipse.core.runtime.IProgressMonitor monitor) Open the connection.voidsetHostname(String hostname) Set the hostname associated with this connection.voidsetPassphrase(String passphrase) Set the pass phrase associated with this connection.voidsetPassword(String password) Set the password associated with this connection.voidsetPort(int port) Set the port used for the connection.voidsetTimeout(int timeout) Set the timeout used when establishing the connection.voidsetUseLoginShell(boolean useLogingShell) Set the flag indicating a login shell should be stated for this connection.voidsetUsePassword(boolean usePassword) Set the connection to try password authentication first.voidsetUsername(String username) Set the username associated with this connection.protected voidterminated(TelnetCommandShell shell) booleanObtain the flag that indicates a login shell should be started once the connection is establishedbooleanGet the value of the use password authentication flag.
-
Field Details
-
DEFAULT_PORT
public static int DEFAULT_PORT -
DEFAULT_TIMEOUT
public static int DEFAULT_TIMEOUT -
HOSTNAME_ATTR
- See Also:
-
USERNAME_ATTR
- See Also:
-
PASSWORD_ATTR
- See Also:
-
PORT_ATTR
- See Also:
-
TIMEOUT_ATTR
- See Also:
-
-
Method Details
-
getRemoteConnection
- Specified by:
getRemoteConnectionin interfaceIRemoteConnection.Service
-
getCommandShell
Description copied from interface:IRemoteCommandShellServiceGet 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 useIRemoteProcessBuilder.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)- Specified by:
getCommandShellin interfaceIRemoteCommandShellService- Parameters:
flags- bitwise-or of flags- Returns:
- remote process object
- Throws:
IOException
-
getPort
public int getPort()Description copied from interface:IRemoteConnectionHostServiceObtain the port associated with this connection- Specified by:
getPortin interfaceIRemoteConnectionHostService- Returns:
- port
-
getTimeout
public int getTimeout()Description copied from interface:IRemoteConnectionHostServiceObtain the timeout used when establishing the connection.- Specified by:
getTimeoutin interfaceIRemoteConnectionHostService- Returns:
- timeout
-
close
public void close()Description copied from interface:IRemoteConnectionControlServiceClose the connection. Must be called to terminate the connection.- Specified by:
closein interfaceIRemoteConnectionControlService
-
getHostname
Description copied from interface:IRemoteConnectionHostServiceObtain the hostname associated with this connection.- Specified by:
getHostnamein interfaceIRemoteConnectionHostService- Returns:
- hostname
-
useLoginShell
public boolean useLoginShell()Description copied from interface:IRemoteConnectionHostServiceObtain the flag that indicates a login shell should be started once the connection is established- Specified by:
useLoginShellin interfaceIRemoteConnectionHostService- Returns:
- login shell flag
-
getUsername
Description copied from interface:IRemoteConnectionHostServiceObtain the username associated with this connection.- Specified by:
getUsernamein interfaceIRemoteConnectionHostService- Returns:
-
setHostname
Description copied from interface:IRemoteConnectionHostServiceSet the hostname associated with this connection. Note, this method can only be used for an IRemoteConnectionWorkingCopy and will have no effect otherwise.- Specified by:
setHostnamein interfaceIRemoteConnectionHostService- Parameters:
hostname- new hostname for connection
-
setPassphrase
Description copied from interface:IRemoteConnectionHostServiceSet 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:
setPassphrasein interfaceIRemoteConnectionHostService- Parameters:
passphrase-
-
setPassword
Description copied from interface:IRemoteConnectionHostServiceSet the password associated with this connection. Note, this method can only be used for an IRemoteConnectionWorkingCopy and will have no effect otherwise.- Specified by:
setPasswordin interfaceIRemoteConnectionHostService- Parameters:
password- new password for connection
-
setPort
public void setPort(int port) Description copied from interface:IRemoteConnectionHostServiceSet the port used for the connection. Note, this method can only be used forh an IRemoteConnectionWorkingCopy and will have no effect otherwise.- Specified by:
setPortin interfaceIRemoteConnectionHostService- Parameters:
port- new port for connection
-
setTimeout
public void setTimeout(int timeout) Description copied from interface:IRemoteConnectionHostServiceSet 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:
setTimeoutin interfaceIRemoteConnectionHostService- Parameters:
timeout- new timeout value
-
setUseLoginShell
public void setUseLoginShell(boolean useLogingShell) Description copied from interface:IRemoteConnectionHostServiceSet 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:
setUseLoginShellin interfaceIRemoteConnectionHostService- Parameters:
useLogingShell- true to start a login shell
-
setUsePassword
public void setUsePassword(boolean usePassword) Description copied from interface:IRemoteConnectionHostServiceSet 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:
setUsePasswordin interfaceIRemoteConnectionHostService- Parameters:
usePassword- use password authentication
-
setUsername
Description copied from interface:IRemoteConnectionHostServiceSet the username associated with this connection. Note, this method can only be used for an IRemoteConnectionWorkingCopy and will have no effect otherwise.- Specified by:
setUsernamein interfaceIRemoteConnectionHostService- Parameters:
username- new username for connection
-
open
public void open(org.eclipse.core.runtime.IProgressMonitor monitor) throws RemoteConnectionException Description copied from interface:IRemoteConnectionControlServiceOpen the connection. Must be called before the connection can be used.- Specified by:
openin interfaceIRemoteConnectionControlService- 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:IRemoteConnectionControlServiceTest if the connection is open.- Specified by:
isOpenin interfaceIRemoteConnectionControlService- Returns:
- true if connection is open.
-
connectionChanged
Description copied from interface:IRemoteConnectionChangeListenerNotifies this listener that the status of a connection has changed.- Specified by:
connectionChangedin interfaceIRemoteConnectionChangeListener- Parameters:
event- the connection change event
-
terminated
-
getPassphrase
Description copied from interface:IRemoteConnectionHostServiceGet the pass phrase associated with this connection.- Specified by:
getPassphrasein interfaceIRemoteConnectionHostService- Returns:
- pass phrase
-
getPassword
Description copied from interface:IRemoteConnectionHostServiceGet the password associated with this connection.- Specified by:
getPasswordin interfaceIRemoteConnectionHostService- Returns:
- password
-
usePassword
public boolean usePassword()Description copied from interface:IRemoteConnectionHostServiceGet the value of the use password authentication flag. If true, the connection will try using a password first.- Specified by:
usePasswordin interfaceIRemoteConnectionHostService- Returns:
- use password authentication flag
-