Classloader that takes it's resources from a JNLP file. If the
JNLP file defines extensions, separate classloaders for these
will be created automatically. Classes are loaded with the
security context when the classloader was created.
activateJars
protected void activateJars(List jars)
Ensures that the list of jars have all been transferred, and
makes them available to the classloader. If a jar contains
native code, the libraries will be extracted and placed in
the path.
jars
- the list of jars to load
activateNative
protected void activateNative(JARDesc jar)
Enable the native code contained in a JAR by copying the
native files into the filesystem. Called in the security
context of the classloader.
addAvailable
protected void addAvailable()
Adds whatever resources have already been downloaded in the
background.
addNextResource
protected JNLPClassLoader addNextResource()
Adds the next unused resource to the classloader. That
resource and all those in the same part will be downloaded
and added to the classloader before returning. If there are
no more resources to add, the method returns immediately.
- the classloader that resources were added to, or null
enableCodeBase
public void enableCodeBase()
Add applet's codebase URL. This allows compatibility with
applets that load resources from their codebase instead of
through JARs, but can slow down resource loading. Resources
loaded from the codebase are not cached.
fillInPartJars
protected void fillInPartJars(List jars)
Adds to the specified list of JARS any other JARs that need
to be loaded at the same time as the JARs specified (ie, are
in the same part).
findClass
protected Class findClass(String name)
throws ClassNotFoundException
Find the class in this loader or any of its extension loaders.
findLibrary
public String findLibrary(String lib)
Return the absolute path to the native library.
findLibraryExt
protected String findLibraryExt(String lib)
Try to find the library path from another peer classloader.
findLoadedClassAll
protected Class findLoadedClassAll(String name)
Find the loaded class in this loader or any of its extension loaders.
findResources
public Enumeration findResources(String name)
throws IOException
Finds the resource in this, the parent, or the extension
class loaders.
getApplication
public ApplicationInstance getApplication()
Returns the JNLP app for this classloader
getExtensionHREF
public String getExtensionHREF()
getExtensionName
public String getExtensionName()
getInstance
public static JNLPClassLoader getInstance(URL location,
UpdatePolicy policy)
throws IOException,
ParseException
Returns a JNLP classloader for the JNLP file at the specified
location.
location
- the file's locationpolicy
- the update policy to use when downloading resources
getInstance
public static JNLPClassLoader getInstance(JNLPFile file,
UpdatePolicy policy)
Returns a JNLP classloader for the specified JNLP file.
file
- the file to load classes forpolicy
- the update policy to use when downloading resources
getJNLPFile
public JNLPFile getJNLPFile()
Returns the JNLP file the classloader was created from.
getNativeDir
protected File getNativeDir()
Return the base directory to store native code files in.
This method does not need to return the same directory across
calls.
getPermissions
protected PermissionCollection getPermissions(CodeSource cs)
Returns the permissions for the CodeSource.
getResource
public URL getResource(String name)
Finds the resource in this, the parent, or the extension
class loaders.
initializeExtensions
(package private) void initializeExtensions()
Load the extensions specified in the JNLP file.
initializePermissions
(package private) void initializePermissions()
Make permission objects for the classpath.
initializeResources
(package private) void initializeResources()
Load all of the JARs used in this JNLP file into the
ResourceTracker for downloading.
loadClass
public Class loadClass(String name)
throws ClassNotFoundException
Find a JAR in the shared 'extension' classloaders, this
classloader, or one of the classloaders for the JNLP file's
extensions.
setApplication
public void setApplication(ApplicationInstance app)
Sets the JNLP app this group is for; can only be called once.