|
RSE Release 3.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.core.runtime.PlatformObject
org.eclipse.rse.internal.services.terminals.AbstractTerminalShell
public abstract class AbstractTerminalShell
Abstract base class for clients to create an ITerminalShell instance.
This abstract base class provides valid default implementations for all
ITerminalShell
methods where possible. Clients should extend this
base class rather than implementing ITerminalShell directly, in order to
remain compatible when the ITerminalShell interface is evolved in the future.
EXPERIMENTAL. This class or interface has been added as part of a work in progress. There is no guarantee that this API will work or that it will remain the same. Please do not use this API without consulting with the Target Management team.
Constructor Summary | |
---|---|
AbstractTerminalShell()
|
Method Summary | |
---|---|
int |
exitValue()
Return the exit value of the Process connected by this shell. |
String |
getDefaultEncoding()
Return the default encoding that the terminal service had specified when creating this terminal connection, or that's known from the remote side to be expected. |
InputStream |
getErrorStream()
Get a remote-to-local InputStream connected to the standard error output of the underlying Process. |
String |
getPtyType()
Get the Terminal Type that's expected on this connection. |
protected long |
getWaitForPollInterval()
Return the interval (in milliseconds) for polling the method during the waitFor(long) method. |
boolean |
isLocalEcho()
Test if local echo is needed on this terminal connection. |
void |
setTerminalSize(int newWidth,
int newHeight)
Notify the remote site that the size of the terminal has changed. |
boolean |
waitFor(long timeout)
Wait for the shell to terminate. |
Methods inherited from class org.eclipse.core.runtime.PlatformObject |
---|
getAdapter |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.eclipse.rse.internal.services.terminals.IBaseShell |
---|
exit, getInputStream, getOutputStream, isActive |
Methods inherited from interface org.eclipse.core.runtime.IAdaptable |
---|
getAdapter |
Constructor Detail |
---|
public AbstractTerminalShell()
Method Detail |
---|
public String getDefaultEncoding()
ITerminalShell
null
.
TODO I'm not actually sure if this method is a good idea. Perhaps we
should use the IAdaptable mechanism for dealing with encodings, since our
shells basically deal with binary data only.
getDefaultEncoding
in interface ITerminalShell
null
if
unknown.public String getPtyType()
ITerminalShell
getPtyType
in interface ITerminalShell
null
if the ITerminalShell does not know what kind of Terminal Type is
expected.public boolean isLocalEcho()
ITerminalShell
false
if in doubt.
isLocalEcho
in interface ITerminalShell
true
if a local echo is needed.public void setTerminalSize(int newWidth, int newHeight)
ITerminalShell
setTerminalSize
in interface ITerminalShell
public InputStream getErrorStream()
IBaseShell
null
if they do not support
separate Streams for output and error.
Clients must not close the obtained InputStream themselves, since the
behavior that this may have on the underlying shell or process is
undefined. Use {#exit()} instead to terminate the shell if that is
desired, it will close all relevant Streams.
getErrorStream
in interface IBaseShell
null
if separate output and error
streams are not supported. Error output will be merged with the
Stream obtained from IBaseShell.getInputStream()
in that case.public int exitValue()
IBaseShell
exitValue
in interface IBaseShell
Process.exitValue()
protected long getWaitForPollInterval()
waitFor(long)
method. Subclasses may override
to return different poll intervals.
The interval may be changed dynamically as appropriate for the current
state of this shell. That way, wait polling mechanisms such as
exponential backoff can be implemented.
Or, a concrete implementation that supports a notification mechanism for
knowing when the shell terminates, can use this to tweak the waitFor()
method by returning Long.MAX_VALUE here (wait forever), but calling
Object.notifyAll()
when the shell is dead.
public boolean waitFor(long timeout) throws InterruptedException
getWaitForPollInterval()
.
waitFor
in interface IBaseShell
timeout
- the maximum time (in milliseconds) to wait.
Implementations may return sooner even if the underlying
Process has not yet terminated, so clients always need to keep
track of time themselves and need to check the return value. A
timeout value of zero causes this method to not limit the wait
time. Negative wait time has undefined behavior.
true
if the Shell is still active after waiting
(e.g. because the timeout has elapsed); false
if
the shell is no longer active.
InterruptedException
- if the waiting Thread has been interrupted,
e.g. because the main application is shutting down.IBaseShell.waitFor(long)
|
RSE Release 3.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |