Homepage

netx.jnlp.runtime
Class ApplicationInstance

    java.lang.Object
    |
    +--netx.jnlp.runtime.ApplicationInstance
Direct Known Subclasses:
AppletInstance

public class ApplicationInstance
extends java.lang.Object

Represents a running instance of an application described in a JNLPFile. This class provides a way to track the application's resources and destroy the application.

Version:
$Revision: 1.1 $
Author:
Jon A. Maxwell (JAM) - initial author

Constructor Summary
ApplicationInstance(JNLPFile file, java.lang.ThreadGroup group, java.lang.ClassLoader loader)
          Create an application instance for the file.
 
Method Summary
 void addApplicationListener(ApplicationListener listener)
          Add an Application listener
protected  void addWindow(java.awt.Window window)
          Adds a window that this application opened.
 void destroy()
          Stop the application and destroy its resources.
 void finalize()
          Releases the application's resources before it is collected.
protected  void fireDestroyed()
          Notify listeners that the application has been terminated.
 java.lang.ClassLoader getClassLoader()
          Returns the classloader.
 JNLPFile getJNLPFile()
          Returns the JNLP file for this task.
 java.lang.ThreadGroup getThreadGroup()
          Returns the thread group.
 java.lang.String getTitle()
          Returns the application title.
 void initialize()
          Initialize the application's environment (installs environment variables, etc).
(package private)  void installEnvironment()
          Install the environment variables.
 boolean isRunning()
          Returns whether the application is running.
 void removeApplicationListener(ApplicationListener listener)
          Remove an Application Listener
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ApplicationInstance

    public ApplicationInstance(JNLPFile file,
    java.lang.ThreadGroup group,
    java.lang.ClassLoader loader)
Create an application instance for the file.

Method Detail

addApplicationListener

    public void addApplicationListener(ApplicationListener listener)
Add an Application listener


removeApplicationListener

    public void removeApplicationListener(ApplicationListener listener)
Remove an Application Listener


fireDestroyed

    protected void fireDestroyed()
Notify listeners that the application has been terminated.


initialize

    public void initialize()
Initialize the application's environment (installs environment variables, etc).


finalize

    public void finalize()
Releases the application's resources before it is collected. Only collectable if classloader and thread group are also collectable so basically is almost never called (an application would have to close its windows and exit its threads but not call System.exit).

Overrides:
finalize in class java.lang.Object

installEnvironment

    void installEnvironment()
Install the environment variables.


getJNLPFile

    public JNLPFile getJNLPFile()
Returns the JNLP file for this task.


getTitle

    public java.lang.String getTitle()
Returns the application title.


isRunning

    public boolean isRunning()
Returns whether the application is running.


destroy

    public void destroy()
Stop the application and destroy its resources.


getThreadGroup

    public java.lang.ThreadGroup getThreadGroup()
    throws java.lang.IllegalStateException
Returns the thread group.

Throws:
java.lang.IllegalStateException - if the app is not running

getClassLoader

    public java.lang.ClassLoader getClassLoader()
    throws java.lang.IllegalStateException
Returns the classloader.

Throws:
java.lang.IllegalStateException - if the app is not running

addWindow

    protected void addWindow(java.awt.Window window)
Adds a window that this application opened. When the application is disposed, these windows will also be disposed.


Homepage