| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.quicksetup.webstart; |
| | |
| | | import java.io.IOException; |
| | | import java.net.MalformedURLException; |
| | | import java.net.URL; |
| | | import java.util.logging.Level; |
| | | import java.util.logging.Logger; |
| | | |
| | | import javax.jnlp.DownloadService; |
| | | import javax.jnlp.DownloadServiceListener; |
| | |
| | | * ProgressStep.DOWNLOADING step. |
| | | */ |
| | | public class WebStartDownloader implements DownloadServiceListener { |
| | | |
| | | static private final Logger LOG = |
| | | Logger.getLogger(WebStartDownloader.class.getName()); |
| | | |
| | | |
| | | /** |
| | |
| | | try |
| | | { |
| | | startDownload(forceDownload); |
| | | } catch (ApplicationException ex) |
| | | { |
| | | WebStartDownloader.this.ex = ex; |
| | | } catch (MalformedURLException mfe) |
| | | { |
| | | // This is a bug |
| | |
| | | * @throws MalformedURLException if there is an error with the URLs that we |
| | | * get from the property SetupUtils.LAZY_JAR_URLS |
| | | * @throws IOException if a network problem occurs. |
| | | * @throws ApplicationException if the download service is not available. |
| | | */ |
| | | private void startDownload(boolean forceDownload) |
| | | throws IOException |
| | | throws IOException, ApplicationException |
| | | { |
| | | DownloadService ds; |
| | | String serviceName = "javax.jnlp.DownloadService"; |
| | | try |
| | | { |
| | | ds = |
| | |
| | | "javax.jnlp.DownloadService"); |
| | | } catch (UnavailableServiceException e) |
| | | { |
| | | ds = null; |
| | | LOG.log(Level.SEVERE, "Could not find service: "+serviceName, e); |
| | | throw new ApplicationException( |
| | | ReturnCode.DOWNLOAD_ERROR, |
| | | getThrowableMsg( |
| | | INFO_DOWNLOADING_ERROR_NO_SERVICE_FOUND.get(serviceName), e), e); |
| | | } |
| | | |
| | | if (ds != null) |
| | | { |
| | | String[] urls = getJarUrls(); |
| | | String[] versions = getJarVersions(); |
| | | |
| | |
| | | } |
| | | downloadPercentage = currentPercMax; |
| | | } |
| | | } |
| | | isFinished = true; |
| | | } |
| | | |