Mercurial > hg > icedtea8
changeset 1944:bebe7bbde097
Netx: Use version based download protocol for JNLP files too
2009-07-13 Omair Majid <omajid@redhat.com>
* netx/net/sourceforge/jnlp/JNLPFile.java
(JNLPFile): Delegate to the Version-based constructor.
(JNLPFile): New constructor.
(JNLPFile): Modified to take an additional version argument used in
downloading the JNLP file.
(openURL): Take an additional version argument and use when downloading
the URL.
* netx/net/sourceforge/jnlp/Launcher.java
(toFile): Use the new JNLPFile constructor.
* netx/net/sourceforge/jnlp/cache/Resource.java
(Resource): Rearrange argument order.
(getResource): Likewise. Fix parameters to constructor.
* netx/net/sourceforge/jnlp/cache/ResourceTracker.java
(addResource): Fix arguments to Resource.getResource.
* netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java
(getInstance): Take additional version argument and use it when creating a
JNLPFile.
(initializeExtensions): Use the extension version when requesting a
JNLPClassLoader.
author | Omair Majid <omajid@redhat.com> |
---|---|
date | Mon, 13 Jul 2009 15:22:34 -0400 |
parents | 96a276fcaa9e |
children | b9dc9e08ed23 |
files | ChangeLog netx/net/sourceforge/jnlp/JNLPFile.java netx/net/sourceforge/jnlp/Launcher.java netx/net/sourceforge/jnlp/cache/Resource.java netx/net/sourceforge/jnlp/cache/ResourceTracker.java netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java |
diffstat | 6 files changed, 56 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Tue Aug 04 14:35:37 2009 +0100 +++ b/ChangeLog Mon Jul 13 15:22:34 2009 -0400 @@ -1,3 +1,25 @@ +2009-07-13 Omair Majid <omajid@redhat.com> + + * netx/net/sourceforge/jnlp/JNLPFile.java + (JNLPFile): Delegate to the Version-based constructor. + (JNLPFile): New constructor. + (JNLPFile): Modified to take an additional version argument used in + downloading the JNLP file. + (openURL): Take an additional version argument and use when downloading + the URL. + * netx/net/sourceforge/jnlp/Launcher.java + (toFile): Use the new JNLPFile constructor. + * netx/net/sourceforge/jnlp/cache/Resource.java + (Resource): Rearrange argument order. + (getResource): Likewise. Fix parameters to constructor. + * netx/net/sourceforge/jnlp/cache/ResourceTracker.java + (addResource): Fix arguments to Resource.getResource. + * netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java + (getInstance): Take additional version argument and use it when creating a + JNLPFile. + (initializeExtensions): Use the extension version when requesting a + JNLPClassLoader. + 2009-07-10 Deepak Bhole <dbhole@redhat.com> * Makefile.am: Update makefile to pick up plugin C++ files from new
--- a/netx/net/sourceforge/jnlp/JNLPFile.java Tue Aug 04 14:35:37 2009 +0100 +++ b/netx/net/sourceforge/jnlp/JNLPFile.java Mon Jul 13 15:22:34 2009 -0400 @@ -138,21 +138,36 @@ * @throws ParseException if the JNLP file was invalid */ public JNLPFile(URL location, boolean strict) throws IOException, ParseException { - this(location, strict, JNLPRuntime.getDefaultUpdatePolicy()); + this(location, (Version) null, strict); + } + + /** + * Create a JNLPFile from a URL and a Version checking for updates using + * the default policy. + * + * @param location the location of the JNLP file + * @param version the version of the JNLP file + * @param strict whether to enforce the spec when + * @throws IOException if an IO exception occurred + * @throws ParseException if the JNLP file was invalid + */ + public JNLPFile(URL location, Version version, boolean strict) throws IOException, ParseException { + this(location, version, strict, JNLPRuntime.getDefaultUpdatePolicy()); } /** - * Create a JNLPFile from a URL checking for updates using the - * specified policy. + * Create a JNLPFile from a URL and a version, checking for updates + * using the specified policy. * * @param location the location of the JNLP file + * @param version the version of the JNLP file * @param strict whether to enforce the spec when * @param policy the update policy * @throws IOException if an IO exception occurred * @throws ParseException if the JNLP file was invalid */ - public JNLPFile(URL location, boolean strict, UpdatePolicy policy) throws IOException, ParseException { - Node root = Parser.getRootNode(openURL(location, policy)); + public JNLPFile(URL location, Version version, boolean strict, UpdatePolicy policy) throws IOException, ParseException { + Node root = Parser.getRootNode(openURL(location, version, policy)); parse(root, strict, location); this.fileLocation = location; @@ -186,13 +201,13 @@ * Open the jnlp file URL from the cache if there, otherwise * download to the cache. Called from constructor. */ - private static InputStream openURL(URL location, UpdatePolicy policy) throws IOException { + private static InputStream openURL(URL location, Version version, UpdatePolicy policy) throws IOException { if (location == null || policy == null) throw new IllegalArgumentException(R("NullParameter")); try { ResourceTracker tracker = new ResourceTracker(false); // no prefetch - tracker.addResource(location, null/*version*/, policy); + tracker.addResource(location, version , policy); return tracker.getInputStream(location); }
--- a/netx/net/sourceforge/jnlp/Launcher.java Tue Aug 04 14:35:37 2009 +0100 +++ b/netx/net/sourceforge/jnlp/Launcher.java Mon Jul 13 15:22:34 2009 -0400 @@ -337,10 +337,10 @@ JNLPFile file = null; try { - file = new JNLPFile(location, true, updatePolicy); // strict + file = new JNLPFile(location, (Version) null, true, updatePolicy); // strict } catch (ParseException ex) { - file = new JNLPFile(location, false, updatePolicy); + file = new JNLPFile(location, (Version) null, false, updatePolicy); // only here if strict failed but lax did not fail LaunchException lex =
--- a/netx/net/sourceforge/jnlp/cache/Resource.java Tue Aug 04 14:35:37 2009 +0100 +++ b/netx/net/sourceforge/jnlp/cache/Resource.java Mon Jul 13 15:22:34 2009 -0400 @@ -95,7 +95,7 @@ /** * Create a resource. */ - private Resource(URL location, UpdatePolicy updatePolicy, Version requestVersion) { + private Resource(URL location, Version requestVersion, UpdatePolicy updatePolicy) { this.location = location; this.requestVersion = requestVersion; this.updatePolicy = updatePolicy; @@ -105,9 +105,9 @@ * Return a shared Resource object representing the given * location and version. */ - public static Resource getResource(URL location, UpdatePolicy updatePolicy, Version requestVersion) { + public static Resource getResource(URL location, Version requestVersion, UpdatePolicy updatePolicy) { synchronized (resources) { - Resource resource = new Resource(location, updatePolicy, requestVersion); + Resource resource = new Resource(location, requestVersion, updatePolicy); int index = resources.indexOf(resource); if (index >= 0) { // return existing object
--- a/netx/net/sourceforge/jnlp/cache/ResourceTracker.java Tue Aug 04 14:35:37 2009 +0100 +++ b/netx/net/sourceforge/jnlp/cache/ResourceTracker.java Mon Jul 13 15:22:34 2009 -0400 @@ -168,7 +168,7 @@ if (location == null) throw new IllegalArgumentException("location==null"); - Resource resource = Resource.getResource(location, updatePolicy, version); + Resource resource = Resource.getResource(location, version, updatePolicy); boolean downloaded = false; synchronized (resources) {
--- a/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java Tue Aug 04 14:35:37 2009 +0100 +++ b/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java Mon Jul 13 15:22:34 2009 -0400 @@ -51,6 +51,7 @@ import net.sourceforge.jnlp.PluginBridge; import net.sourceforge.jnlp.ResourcesDesc; import net.sourceforge.jnlp.SecurityDesc; +import net.sourceforge.jnlp.Version; import net.sourceforge.jnlp.cache.CacheUtil; import net.sourceforge.jnlp.cache.ResourceTracker; import net.sourceforge.jnlp.cache.UpdatePolicy; @@ -232,13 +233,15 @@ * location. * * @param location the file's location + * @param version the file's version * @param policy the update policy to use when downloading resources */ - public static JNLPClassLoader getInstance(URL location, UpdatePolicy policy) throws IOException, ParseException, LaunchException { + public static JNLPClassLoader getInstance(URL location, Version version, UpdatePolicy policy) + throws IOException, ParseException, LaunchException { JNLPClassLoader loader = (JNLPClassLoader) urlToLoader.get(location); if (loader == null) - loader = getInstance(new JNLPFile(location, false, policy), policy); + loader = getInstance(new JNLPFile(location, version, false, policy), policy); return loader; } @@ -256,7 +259,7 @@ //if (ext != null) { for (int i=0; i < ext.length; i++) { try { - JNLPClassLoader loader = getInstance(ext[i].getLocation(), updatePolicy); + JNLPClassLoader loader = getInstance(ext[i].getLocation(), ext[i].getVersion(), updatePolicy); loaderList.add(loader); } catch (Exception ex) {