netx.jnlp.runtime

Class ApplicationInstance

Known Direct 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.15 $
Author:
Jon A. Maxwell (JAM) - initial author

Constructor Summary

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

Method Summary

void
addApplicationListener(ApplicationListener listener)
Add an Application listener
protected void
addWindow(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.
ClassLoader
getClassLoader()
Returns the classloader.
JNLPFile
getJNLPFile()
Returns the JNLP file for this task.
ThreadGroup
getThreadGroup()
Returns the thread group.
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

Constructor Details

ApplicationInstance

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

Method Details

addApplicationListener

public void addApplicationListener(ApplicationListener listener)
Add an Application listener

addWindow

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

destroy

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

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).

fireDestroyed

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

getClassLoader

public ClassLoader getClassLoader()
            throws IllegalStateException
Returns the classloader.

getJNLPFile

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

getThreadGroup

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

getTitle

public String getTitle()
Returns the application title.

initialize

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

installEnvironment

(package private)  void installEnvironment()
Install the environment variables.

isRunning

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

removeApplicationListener

public void removeApplicationListener(ApplicationListener listener)
Remove an Application Listener