ccs.cpc
Class ViewerRuntime

java.lang.Object
  extended by ccs.cpc.ViewerRuntime
Direct Known Subclasses:
HelperAppRuntime, PluginRuntime

public abstract class ViewerRuntime
extends java.lang.Object

The superclass of all running "viewers", ie. plugins and helper apps. This hierarchy concerns itself with runtime / lifecycle behaviour, rather than with information about the viewer that is common to all instances thereof; for that, see Viewer.


Field Summary
protected  VFile target
           
 
Constructor Summary
ViewerRuntime()
           
 
Method Summary
 void cleanup()
          Cleanup after the viewer.
 VFile getTarget()
          Gets the target VFile.
abstract  void kill()
          Destroy the viewer.
abstract  void launch()
          Prepare and launch the viewer.
 void setTarget(VFile target)
          Sets the target VFile.
abstract  void waitFor()
          block until the viewer has finished.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

target

protected VFile target
Constructor Detail

ViewerRuntime

public ViewerRuntime()
Method Detail

setTarget

public final void setTarget(VFile target)
Sets the target VFile. I'd just like to point out that writing doc comments for getter/setter methods gets really old, really quickly. Thanks for listening.

Parameters:
target - The target. Gosh, you don't say.

getTarget

public final VFile getTarget()
Gets the target VFile.

Returns:
The target, not that you could have guessed that or anything..

launch

public abstract void launch()
                     throws java.io.IOException
Prepare and launch the viewer.

Throws:
java.io.IOException

waitFor

public abstract void waitFor()
                      throws java.lang.InterruptedException
block until the viewer has finished. The throws clause is a convenience for implementors; it is not expected that a ReaperThread (which will call this) will ever be interrupted.

Throws:
java.lang.InterruptedException

kill

public abstract void kill()
Destroy the viewer. This must cause waitFor to return.


cleanup

public void cleanup()
             throws java.io.IOException
Cleanup after the viewer. Called from the reaper thread. This is called after the viewer has finished (either naturally or by being killed. The default implementation does nothing. NB. Viewers which are plugins are not always garbage-collected as promptly as one might expect: under some circumstances, they remain reachable via the window manager long after one would have expected them to be collected. This can cause significant heap-leaks. To ameliorate this, plug-ins should manually null all references they hold to user data, so that this at least can be collected promptly.

Throws:
java.io.IOException