public class JNLPClassLoader
extends java.net.URLClassLoader
Modifier and Type | Class and Description |
---|---|
static class |
JNLPClassLoader.CodeBaseClassLoader |
static class |
JNLPClassLoader.DownloadAction
Actions to specify how cache is to be managed *
|
static interface |
JNLPClassLoader.SecurityDelegate
SecurityDelegate, in real usage, relies on having a "parent"
JNLPClassLoader instance.
|
static class |
JNLPClassLoader.SecurityDelegateImpl
Handles security decision logic for the JNLPClassLoader, eg which
permission level to assign to JARs.
|
static class |
JNLPClassLoader.SigningState |
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
APPLICATION |
static java.lang.String |
TEMPLATE
Signed JNLP File and Template
|
Modifier | Constructor and Description |
---|---|
protected |
JNLPClassLoader(JNLPFile file,
UpdatePolicy policy)
Create a new JNLPClassLoader from the specified file.
|
protected |
JNLPClassLoader(JNLPFile file,
UpdatePolicy policy,
java.lang.String mainName,
boolean enableCodeBase)
Create a new JNLPClassLoader from the specified file.
|
Modifier and Type | Method and Description |
---|---|
protected void |
activateJars(java.util.List<JARDesc> jars)
Ensures that the list of jars have all been transferred, and makes them
available to the classloader.
|
protected void |
addAvailable()
Adds whatever resources have already been downloaded in the background.
|
protected JNLPClassLoader |
addNextResource()
Adds the next unused resource to the classloader.
|
protected void |
addPermission(java.security.Permission p) |
java.lang.String |
checkForAttributeInJars(java.util.List<JARDesc> jars,
java.util.jar.Attributes.Name name)
*
Checks for the jar that contains the attribute.
|
void |
decrementLoaderUseCount()
Decrements loader use count by 1
If count reaches 0, loader is removed from list of available loaders
|
void |
enableCodeBase()
Add applet's codebase URL.
|
protected void |
fillInPartJars(java.util.List<JARDesc> 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).
|
protected java.lang.Class<?> |
findClass(java.lang.String name)
Find the class in this loader or any of its extension loaders.
|
protected java.lang.String |
findLibrary(java.lang.String lib)
Return the absolute path to the native library.
|
protected java.lang.String |
findLibraryExt(java.lang.String lib)
Try to find the library path from another peer classloader.
|
protected java.lang.Class<?> |
findLoadedClassAll(java.lang.String name)
Find the loaded class in this loader or any of its extension loaders.
|
java.net.URL |
findResource(java.lang.String name)
Finds the resource in this, the parent, or the extension class loaders.
|
java.util.Enumeration<java.net.URL> |
findResources(java.lang.String name)
Find the resources in this, the parent, or the extension class loaders.
|
java.security.AccessControlContext |
getAccessControlContextForClassLoading()
Returns an appropriate AccessControlContext for loading classes in the
running instance.
|
ApplicationInstance |
getApplication() |
protected SecurityDesc |
getCodeSourceSecurity(java.net.URL source)
Returns the security descriptor for given code source URL
|
java.lang.String |
getExtensionHREF()
Deprecated.
|
java.lang.String |
getExtensionName()
Deprecated.
|
static JNLPClassLoader |
getInstance(JNLPFile file,
UpdatePolicy policy,
boolean enableCodeBase)
Returns a JNLP classloader for the specified JNLP file.
|
static JNLPClassLoader |
getInstance(JNLPFile file,
UpdatePolicy policy,
java.lang.String mainName,
boolean enableCodeBase)
Returns a JNLP classloader for the specified JNLP file.
|
static JNLPClassLoader |
getInstance(java.net.URL location,
java.lang.String uniqueKey,
Version version,
ParserSettings settings,
UpdatePolicy policy,
java.lang.String mainName,
boolean enableCodeBase)
Returns a JNLP classloader for the JNLP file at the specified location.
|
JNLPFile |
getJNLPFile() |
java.lang.String |
getMainClass() |
java.lang.String |
getManifestAttribute(java.net.URL location,
java.util.jar.Attributes.Name attribute)
Gets the name of the main method if specified in the manifest
|
protected java.security.PermissionCollection |
getPermissions(java.security.CodeSource cs)
Returns the permissions for the CodeSource.
|
protected SecurityDesc |
getSecurity() |
boolean |
getSigning() |
JNLPClassLoader.SigningState |
getSigningState() |
boolean |
hasMainJar() |
static boolean |
isCertUnderestimated() |
boolean |
isStrict() |
java.lang.Class<?> |
loadClass(java.lang.String name)
Find a JAR in the shared 'extension' classloaders, this classloader, or
one of the classloaders for the JNLP file's extensions.
|
boolean |
resourceAvailableLocally(java.lang.String s)
Returns if the specified resource is available locally from a cached jar
|
void |
setApplication(ApplicationInstance app)
Sets the JNLP app this group is for; can only be called once.
|
void |
setRunInSandbox() |
boolean |
userPromptedForSandbox() |
addURL, close, definePackage, getProtectionDomainInternal, getResourceAsStream, getURLs, newInstance, newInstance
defineClass, defineClass, getProtectionDomain
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findLoadedClass, findSystemClass, getClassLoadingLock, getPackage, getPackages, getParent, getResource, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, registerAsParallelCapable, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
public static final java.lang.String TEMPLATE
public static final java.lang.String APPLICATION
protected JNLPClassLoader(JNLPFile file, UpdatePolicy policy) throws LaunchException
file
- the JNLP filepolicy
- update policy of loaderLaunchException
- if app can not be loadedprotected JNLPClassLoader(JNLPFile file, UpdatePolicy policy, java.lang.String mainName, boolean enableCodeBase) throws LaunchException
file
- the JNLP filepolicy
- the UpdatePolicy for this class loadermainName
- name of the application's main classenableCodeBase
- switch whether this classloader can search in
codebase or notLaunchException
- when need to kill an app
comes.public static boolean isCertUnderestimated()
public boolean isStrict()
public static JNLPClassLoader getInstance(JNLPFile file, UpdatePolicy policy, boolean enableCodeBase) throws LaunchException
file
- the file to load classes forpolicy
- the update policy to use when downloading resourcesenableCodeBase
- true if codebase can be searched (ok for
applets,false for apps)LaunchException
- when launch is doomedpublic static JNLPClassLoader getInstance(JNLPFile file, UpdatePolicy policy, java.lang.String mainName, boolean enableCodeBase) throws LaunchException
file
- the file to load classes forpolicy
- the update policy to use when downloading resourcesmainName
- Overrides the main class name of the applicationenableCodeBase
- ue if codebase can be searched (ok for
applets,false for apps)LaunchException
- when launch is doomedpublic static JNLPClassLoader getInstance(java.net.URL location, java.lang.String uniqueKey, Version version, ParserSettings settings, UpdatePolicy policy, java.lang.String mainName, boolean enableCodeBase) throws java.io.IOException, ParseException, LaunchException
location
- the file's locationuniqueKey
- key to manage applets/applications in shared vmversion
- the file's versionsettings
- settings of parserpolicy
- the update policy to use when downloading resourcesmainName
- Overrides the main class name of the applicationenableCodeBase
- whether to enable codebase search or notjava.io.IOException
- when IO failsParseException
- when parsing failsLaunchException
- when launch is doomedpublic java.lang.String checkForAttributeInJars(java.util.List<JARDesc> jars, java.util.jar.Attributes.Name name)
jars
- Jars that are checked to see if they contain the main classname
- attribute to be foundpublic java.lang.String getManifestAttribute(java.net.URL location, java.util.jar.Attributes.Name attribute)
location
- The JAR locationattribute
- name of the attribute to findpublic boolean hasMainJar()
public void setRunInSandbox() throws LaunchException
LaunchException
public boolean userPromptedForSandbox()
public void enableCodeBase()
public void setApplication(ApplicationInstance app)
app
- application to be ser to this grouppublic ApplicationInstance getApplication()
public JNLPFile getJNLPFile()
protected java.security.PermissionCollection getPermissions(java.security.CodeSource cs)
getPermissions
in class java.net.URLClassLoader
protected void addPermission(java.security.Permission p)
protected void fillInPartJars(java.util.List<JARDesc> jars)
jars
- jar archives to be addedprotected void activateJars(java.util.List<JARDesc> jars)
jars
- the list of jars to loadprotected java.lang.String findLibrary(java.lang.String lib)
findLibrary
in class java.lang.ClassLoader
protected java.lang.String findLibraryExt(java.lang.String lib)
lib
- library to be foundprotected java.lang.Class<?> findLoadedClassAll(java.lang.String name)
name
- name of classpublic java.lang.Class<?> loadClass(java.lang.String name) throws java.lang.ClassNotFoundException
loadClass
in class java.lang.ClassLoader
java.lang.ClassNotFoundException
protected java.lang.Class<?> findClass(java.lang.String name) throws java.lang.ClassNotFoundException
findClass
in class java.net.URLClassLoader
java.lang.ClassNotFoundException
public java.net.URL findResource(java.lang.String name)
findResource
in class java.net.URLClassLoader
URL
for the resource, or null
if the resource
could not be found.public java.util.Enumeration<java.net.URL> findResources(java.lang.String name) throws java.io.IOException
findResources
in class java.net.URLClassLoader
java.io.IOException
public boolean resourceAvailableLocally(java.lang.String s)
s
- The name of the resourceprotected void addAvailable()
protected JNLPClassLoader addNextResource() throws LaunchException
LaunchException
- Thrown if the signed JNLP file, within the main
jar, fails to be verified or does not match@Deprecated public java.lang.String getExtensionName()
@Deprecated public java.lang.String getExtensionHREF()
public boolean getSigning()
public JNLPClassLoader.SigningState getSigningState()
protected SecurityDesc getSecurity()
protected SecurityDesc getCodeSourceSecurity(java.net.URL source)
source
- the origin (remote) url of the codepublic void decrementLoaderUseCount()
java.lang.SecurityException
- if caller is not trustedpublic java.security.AccessControlContext getAccessControlContextForClassLoading()
public java.lang.String getMainClass()