KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > jnlp > DownloadServiceListener


1 /*
2  * @(#)DownloadServiceListener.java 1.8 04/03/12
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package javax.jnlp;
9
10 import java.net.URL;
11
12 /**
13  * The <code>DownloadServiceListener</code> provides an interface for a
14  * callback object implementation, which may be used by a DownloadService
15  * implementation. The <code>DownloadServiceListener</code> implementation's
16  * methods should be invoked by the <code>DownloadService</code> implementation
17  * at various stages of the download, allowing an application that uses the
18  * JNLP API to display a progress bar during a <code>DownloadService</code> download.
19  *
20  * @since 1.0
21  * @see DownloadService
22  */

23
24 public interface DownloadServiceListener {
25     /**
26      * A JNLP client's <code>DownloadService</code> implementation should call this method
27      * several times during a download. A <code>DownloadServiceListener</code> implementation
28      * may display a progress bar and / or update information based on the parameters.
29      *
30      * @param url The URL representing the resource being downloaded.
31      *
32      * @param version The version of the resource being downloaded.
33      *
34      * @param readSoFar The number of bytes downloaded so far.
35      *
36      * @param total The total number of bytes to be downloaded, or -1 if the
37      * number is unknown.
38      *
39      * @param overallPercent The percentage of the overall update operation that is complete,
40      * or -1 if the percentage is unknown.
41      */

42     public void progress(URL url, String version, long readSoFar, long total, int overallPercent);
43     
44     /**
45      * A JNLP client's <code>DownloadService</code> implementation should call this method
46      * at least several times during validation of a download. Validation often includes
47      * ensuring that downloaded resources are authentic (appropriately signed). A
48      * <code>DownloadServiceListener</code> implementation may display a progress bar and / or
49      * update information based on the parameters.
50      *
51      * @param url The URL representing the resource being validated.
52      *
53      * @param version The version of the resource being validated.
54      *
55      * @param entry The number of JAR entries validated so far.
56      *
57      * @param total The total number of entries to be validated.
58      *
59      * @param overallPercent The percentage of the overall update operation that is complete,
60      * or -1 if the percentage is unknown.
61      */

62     public void validating(URL url, String version, long entry, long total, int overallPercent);
63     
64     /**
65      * A JNLP client's <code>DownloadService</code> implementation should call this method
66      * at least several times when applying an incremental update to an in-cache resource. A
67      * <code>DownloadServiceListener</code> implementation may display a progress bar and / or
68      * update information based on the parameters.
69      *
70      * @param url The URL representing the resource being patched.
71      *
72      * @param version The version of the resource being patched.
73      *
74      * @param patchPercent The percentage of the patch operation that is complete, or -1
75      * if the percentage is unknown.
76      *
77      * @param overallPercent The percentage of the overall update operation that is complete,
78      * or -1 if the percentage is unknown.
79      */

80     public void upgradingArchive(URL url, String version, int patchPercent, int overallPercent);
81     
82     /**
83      * A JNLP client's <code>DownloadService</code> implementation should call this method
84      * if a download fails or aborts unexpectedly. In response, a
85      * <code>DownloadServiceListener implementation may display update information to the user
86      * to reflect this.
87      *
88      * @param url The URL representing the resource for which the download failed.
89      *
90      * @param version The version of the resource for which the download failed.
91      */

92     public void downloadFailed(URL url, String version);
93 }
94
95
96
Popular Tags