Package net.sourceforge.jnlp.runtime
Class ApplicationInstance
- java.lang.Object
-
- net.sourceforge.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.
-
-
Constructor Summary
Constructors Constructor Description ApplicationInstance(JNLPFile file, java.lang.ThreadGroup group, java.lang.ClassLoader loader)
Create an application instance for the file.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addApplicationListener(ApplicationListener listener)
Add an Application listenerprotected 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.sun.awt.AppContext
getAppContext()
java.lang.ClassLoader
getClassLoader()
Returns the classloader.JNLPFile
getJNLPFile()
Returns the jnlpfile on which is this application basedjava.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).boolean
isRunning()
Returns whether the application is running.boolean
isSigned()
void
removeApplicationListener(ApplicationListener listener)
Remove an Application Listener
-
-
-
Constructor Detail
-
ApplicationInstance
public ApplicationInstance(JNLPFile file, java.lang.ThreadGroup group, java.lang.ClassLoader loader)
Create an application instance for the file. This should be done in the appropriateThreadGroup
only.- Parameters:
file
- jnlpfile for which the instance do existsgroup
- thread group to which it belongsloader
- loader for this application
-
-
Method Detail
-
addApplicationListener
public void addApplicationListener(ApplicationListener listener)
Add an Application listener- Parameters:
listener
- listener to be added
-
removeApplicationListener
public void removeApplicationListener(ApplicationListener listener)
Remove an Application Listener- Parameters:
listener
- to be removed
-
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 JNLPRuntime.exit).- Overrides:
finalize
in classjava.lang.Object
-
getJNLPFile
public JNLPFile getJNLPFile()
Returns the jnlpfile on which is this application based- Returns:
- JNLP file for this task.
-
getTitle
public java.lang.String getTitle()
Returns the application title.- Returns:
- the title of this application
-
isRunning
public boolean isRunning()
Returns whether the application is running.- Returns:
- state of application
-
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.- Returns:
- thread group of this application, unless it is stopped
- Throws:
java.lang.IllegalStateException
- if the app is not running
-
getClassLoader
public java.lang.ClassLoader getClassLoader() throws java.lang.IllegalStateException
Returns the classloader.- Returns:
- the classloader of this application, unless it is stopped
- 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.- Parameters:
window
- to be added
-
isSigned
public boolean isSigned()
- Returns:
- whether or not this application is signed.
-
getAppContext
public sun.awt.AppContext getAppContext()
- Returns:
- application context of this instance
-
-