public class RuntimeProcess extends PlatformObject implements IProcess
IProcess that wrappers a system
process (java.lang.Process).
Clients may subclass this class. Clients that need to replace the implementation
of a streams proxy associated with an IProcess should subclass this
class. Generally clients should not instantiate this class directly, but should
instead call DebugPlugin.newProcess(...), which can delegate to an
IProcessFactory if one is referenced by the associated launch configuration.
IProcess,
IProcessFactoryATTR_CMDLINE, ATTR_PROCESS_LABEL, ATTR_PROCESS_TYPE| Constructor and Description |
|---|
RuntimeProcess(ILaunch launch,
Process process,
String name,
Map attributes)
Constructs a RuntimeProcess on the given system process
with the given name, adding this process to the given
launch.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
canTerminate()
Returns whether this element can be terminated.
|
protected IStreamsProxy |
createStreamsProxy()
Returns the streams proxy associated with this process.
|
protected void |
fireChangeEvent()
Fires a change event.
|
protected void |
fireCreationEvent()
Fires a creation event.
|
protected void |
fireEvent(DebugEvent event)
Fires the given debug event.
|
protected void |
fireTerminateEvent()
Fires a terminate event.
|
Object |
getAdapter(Class adapter)
Returns an object which is an instance of the given class
associated with this object.
|
String |
getAttribute(String key)
Returns the value of a client defined attribute.
|
int |
getExitValue()
Returns the exit value of this process.
|
String |
getLabel()
Returns a human-readable label for this process.
|
ILaunch |
getLaunch()
Returns the launch this element originated from.
|
IStreamsProxy |
getStreamsProxy()
Returns a proxy to the standard input, output, and error streams
for this process, or
null if not supported. |
protected Process |
getSystemProcess()
Returns the underlying system process associated with this process.
|
boolean |
isTerminated()
Returns whether this element is terminated.
|
void |
setAttribute(String key,
String value)
Sets the value of a client defined attribute.
|
protected void |
setLaunch(ILaunch launch)
Sets the launch this process is contained in
|
void |
terminate()
Causes this element to terminate, generating a
TERMINATE event. |
protected void |
terminated()
Notification that the system process associated with this process
has terminated.
|
public RuntimeProcess(ILaunch launch, Process process, String name, Map attributes)
launch - the launch this process will be parented byprocess - underlying system processname - the label used for this processattributes - map of attributes used to initialize the attributes
of this process, or null if nonepublic boolean canTerminate()
ITerminatecanTerminate in interface ITerminateITerminate.canTerminate()public String getLabel()
IProcessgetLabel in interface IProcessIProcess.getLabel()protected void setLaunch(ILaunch launch)
launch - the launch this process is contained inpublic ILaunch getLaunch()
IProcessgetLaunch in interface IProcessIProcess.getLaunch()protected Process getSystemProcess()
public boolean isTerminated()
ITerminateisTerminated in interface ITerminateITerminate.isTerminated()public void terminate()
throws DebugException
ITerminateTERMINATE event.
Implementations may be blocking or non-blocking.terminate in interface ITerminateDebugException - on failure. Reasons include:ITerminate.terminate()protected void terminated()
public IStreamsProxy getStreamsProxy()
IProcessnull if not supported.getStreamsProxy in interface IProcessnull if not supportedIProcess.getStreamsProxy()protected IStreamsProxy createStreamsProxy()
protected void fireCreationEvent()
protected void fireEvent(DebugEvent event)
event - debug event to fireprotected void fireTerminateEvent()
protected void fireChangeEvent()
public void setAttribute(String key, String value)
IProcesssetAttribute in interface IProcesskey - the attribute keyvalue - the attribute valueIProcess.setAttribute(String, String)public String getAttribute(String key)
IProcessgetAttribute in interface IProcesskey - the attribute keynull if undefinedIProcess.getAttribute(String)public Object getAdapter(Class adapter)
PlatformObjectnull if
no such object can be found.
This implementation of the method declared by IAdaptable
passes the request along to the platform's adapter manager; roughly
Platform.getAdapterManager().getAdapter(this, adapter).
Subclasses may override this method (however, if they do so, they
should invoke the method on their superclass to ensure that the
Platform's adapter manager is consulted).
getAdapter in interface IAdaptablegetAdapter in class PlatformObjectadapter - the class to adapt tonullIAdaptable.getAdapter(Class),
Platform.getAdapterManager()public int getExitValue()
throws DebugException
IProcessgetExitValue in interface IProcessDebugException - if this process has not yet terminatedIProcess.getExitValue()Guidelines for using Eclipse APIs. Copyright (c) IBM Corp. and others 2000, 2006. All rights reserved.