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.ObjectRepresents 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 $
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringBLACKLIST_FOR_JNLP_PROPERTIESstatic java.lang.StringBLACKLISTED_PROPERTIES_SEPARATORprivate static java.lang.StringDEPLOYMENT_SYSPROPprivate static java.lang.StringDEPLOYMENT_SYSPROP_VALUEprivate JNLPFilefilethe fileprivate java.lang.ThreadGroupgroupthe thread groupprivate booleanisSignedwhether or not this application is signedprivate javax.swing.event.EventListenerListlistenerslist of application listenersprivate JNLPClassLoaderloaderthe classloaderprivate static LoggerLOGprivate booleanstoppedwhether the application has stopped runningprivate WeakList<java.awt.Window>weakWindowsweak list of windows opened by the application
-
Constructor Summary
Constructors Constructor Description ApplicationInstance(JNLPFile file, java.lang.ThreadGroup group, JNLPClassLoader loader)Create an application instance for the file.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) voidaddWindow(java.awt.Window window)Adds a window that this application opened.private java.util.List<PropertyDesc>collectPropertiesFromJnlpHierarchy(java.util.List<PropertyDesc> props, JNLPFile jnlpFile)Collects properties from the full hierarchy of JNLP filesvoiddestroy()Stop the application and destroy its resources.voidfinalize()Releases the application's resources before it is collected.private voidfireDestroyed()Notify listeners that the application has been terminated.static java.util.Set<java.lang.String>getBlackListedJnlpProperties()JNLPClassLoadergetClassLoader()Returns the classloader.JNLPFilegetJNLPFile()Returns the jnlpfile on which is this application basedjava.lang.StringgetMainClassName()java.lang.ThreadGroupgetThreadGroup()Returns the thread group.java.lang.StringgetTitle()Returns the application title.voidinitialize()Initialize the application's environment (installs environment variables, etc).private voidinstallEnvironment()Install the environment variables.booleanisRunning()Returns whether the application is running.booleanisSigned()private voidsetSystemPropertiesFromJnlp()private voidsetSystemProperty(PropertyDesc propDesc)
-
-
-
Field Detail
-
LOG
private static final Logger LOG
-
DEPLOYMENT_SYSPROP
private static final java.lang.String DEPLOYMENT_SYSPROP
- See Also:
- Constant Field Values
-
DEPLOYMENT_SYSPROP_VALUE
private static final java.lang.String DEPLOYMENT_SYSPROP_VALUE
- See Also:
- Constant Field Values
-
BLACKLIST_FOR_JNLP_PROPERTIES
public static final java.lang.String BLACKLIST_FOR_JNLP_PROPERTIES
- See Also:
- Constant Field Values
-
BLACKLISTED_PROPERTIES_SEPARATOR
public static final java.lang.String BLACKLISTED_PROPERTIES_SEPARATOR
- See Also:
- Constant Field Values
-
file
private final JNLPFile file
the file
-
group
private final java.lang.ThreadGroup group
the thread group
-
loader
private final JNLPClassLoader loader
the classloader
-
stopped
private boolean stopped
whether the application has stopped running
-
weakWindows
private final WeakList<java.awt.Window> weakWindows
weak list of windows opened by the application
-
listeners
private final javax.swing.event.EventListenerList listeners
list of application listeners
-
isSigned
private boolean isSigned
whether or not this application is signed
-
-
Constructor Detail
-
ApplicationInstance
public ApplicationInstance(JNLPFile file, java.lang.ThreadGroup group, JNLPClassLoader loader)
Create an application instance for the file. This should be done in the appropriateThreadGrouponly.- Parameters:
file- jnlpfile for which the instance do existsgroup- thread group to which it belongsloader- loader for this application
-
-
Method Detail
-
getBlackListedJnlpProperties
public static java.util.Set<java.lang.String> getBlackListedJnlpProperties()
-
fireDestroyed
private 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:
finalizein classjava.lang.Object
-
installEnvironment
private void installEnvironment()
Install the environment variables.
-
setSystemPropertiesFromJnlp
private void setSystemPropertiesFromJnlp()
-
setSystemProperty
private void setSystemProperty(PropertyDesc propDesc)
-
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.IllegalStateExceptionReturns 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 JNLPClassLoader 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
-
getMainClassName
public java.lang.String getMainClassName() throws java.io.IOException- Throws:
java.io.IOException
-
addWindow
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.
-
collectPropertiesFromJnlpHierarchy
private java.util.List<PropertyDesc> collectPropertiesFromJnlpHierarchy(java.util.List<PropertyDesc> props, JNLPFile jnlpFile)
Collects properties from the full hierarchy of JNLP files- Parameters:
props- a list of all properties collected so farjnlpFile- the current tip of the jnlp hierarchy- Returns:
- a list of properties collected from the full hierarchy of JNLP files
-
-