Logo Search packages:      
Sourcecode: icedtea-web version File versions  Download package

static JNLPClassLoader net::sourceforge::jnlp::runtime::JNLPClassLoader::getInstance ( JNLPFile  file,
UpdatePolicy  policy 
) throws LaunchException [inline, static]

Returns a JNLP classloader for the specified JNLP file.

Parameters:
file the file to load classes for
policy the update policy to use when downloading resources

Definition at line 270 of file JNLPClassLoader.java.

References file, net::sourceforge::jnlp::JNLPFile::getFileLocation(), getJNLPFile(), net::sourceforge::jnlp::JNLPFile::getUniqueKey(), JNLPClassLoader(), merge(), R(), signing, and urlToLoader.

Referenced by getInstance(), and initializeExtensions().

                                                                                                         {
        JNLPClassLoader baseLoader = null;
        JNLPClassLoader loader = null;
        String uniqueKey = file.getUniqueKey();

        if (uniqueKey != null)
            baseLoader = (JNLPClassLoader) urlToLoader.get(uniqueKey);

                try {

                    // If base loader is null, or the baseloader's file and this
                    // file is different, initialize a new loader
                    if (baseLoader == null ||
                        !baseLoader.getJNLPFile().getFileLocation().equals(file.getFileLocation())) {

                        loader = new JNLPClassLoader(file, policy);

                        // New loader init may have caused extentions to create a
                        // loader for this unique key. Check.
                        JNLPClassLoader extLoader = (JNLPClassLoader) urlToLoader.get(uniqueKey);

                        if (extLoader != null && extLoader != loader) {
                            if (loader.signing && !extLoader.signing)
                                if (!SecurityWarningDialog.showNotAllSignedWarningDialog(file))
                                    throw new LaunchException(file, null, R("LSFatal"), R("LCClient"), R("LSignedAppJarUsingUnsignedJar"), R("LSignedAppJarUsingUnsignedJarInfo"));

                                loader.merge(extLoader);
                        }

                // loader is now current + ext. But we also need to think of
                // the baseLoader
                        if (baseLoader != null && baseLoader != loader) {
                                loader.merge(baseLoader);
                }

                    } else {
                        // if key is same and locations match, this is the loader we want
                        loader = baseLoader;
                    }

                } catch (LaunchException e) {
                        throw e;
                }

        // loaders are mapped to a unique key. Only extensions and parent
        // share a key, so it is safe to always share based on it
        urlToLoader.put(uniqueKey, loader);

        return loader;
    }


Generated by  Doxygen 1.6.0   Back to index