javax.jnlp
Interface DownloadService


public interface DownloadService

DownloadService service allows an application to control how its own resources are cached, to determine which of its resources are currently cached, to force resources to be cached, and to remove resources from the cache. The JNLP Client is responsible for providing a specific implementation of this service.

Since:
1.0

Method Summary
 DownloadServiceListener getDefaultProgressWindow()
          Return a default DownloadServiceListener implementation which, when passed to a load method, should pop up and update a progress window as the load progresses.
 boolean isExtensionPartCached(java.net.URL ref, java.lang.String version, java.lang.String part)
          Returns true if the given part of the given extension is cached, and the extension and part are mentioned in the JNLP file for the application.
 boolean isExtensionPartCached(java.net.URL ref, java.lang.String version, java.lang.String[] parts)
          Returns true if the given parts of the given extension are cached, and the extension and parts are mentioned in the JNLP file for the application.
 boolean isPartCached(java.lang.String part)
          Returns true if the part referred to by the given string is cached, and that part is mentioned in the JNLP file for the application.
 boolean isPartCached(java.lang.String[] parts)
          Returns true if the parts referred to by the given array are cached, and those parts are mentioned in the JNLP file for the application.
 boolean isResourceCached(java.net.URL ref, java.lang.String version)
          Returns true if the resource referred to by the given URL and version is cached, and that resource is either mentioned in the calling applications JNLP file, is within the codebase of the calling applications JNLP file, or the calling application has been granted all-permissions.
 void loadExtensionPart(java.net.URL ref, java.lang.String version, java.lang.String[] parts, DownloadServiceListener progress)
          Downloads the given parts of the given extension, if the parts and the extension are mentioned in the JNLP file for the application.
 void loadExtensionPart(java.net.URL ref, java.lang.String version, java.lang.String part, DownloadServiceListener progress)
          Downloads the given part of the given extension, if the part and the extension are mentioned in the JNLP file for the application.
 void loadPart(java.lang.String[] parts, DownloadServiceListener progress)
          Downloads the given parts, if the parts are mentioned in the JNLP file for the application.
 void loadPart(java.lang.String part, DownloadServiceListener progress)
          Downloads the given part, if the part is mentioned in the JNLP file for the application.
 void loadResource(java.net.URL ref, java.lang.String version, DownloadServiceListener progress)
          Downloads the given resource, if the resource is either mentioned in the calling applications JNLP file, is within the codebase of the calling applications JNLP file, or if the calling application has been granted all-permissions.
 void removeExtensionPart(java.net.URL ref, java.lang.String version, java.lang.String part)
          Removes the given part of the given extension from the cache, if the part and the extension are mentioned in the JNLP file for the application.
 void removeExtensionPart(java.net.URL ref, java.lang.String version, java.lang.String[] parts)
          Removes the given parts of the given extension from the cache, if the parts and the extension are mentioned in the JNLP file for the application.
 void removePart(java.lang.String part)
          Removes the given part from the cache, if the part is mentioned in the JNLP file for the application.
 void removePart(java.lang.String[] parts)
          Removes the given parts from the cache, if the parts are mentioned in the JNLP file for the application.
 void removeResource(java.net.URL ref, java.lang.String version)
          Removes the given resource from the cache, if the resource is either mentioned in the calling applications JNLP file, is within the codebase of the calling applications JNLP file, or if the calling application has been granted all-permissions.
 

Method Detail

isResourceCached

boolean isResourceCached(java.net.URL ref,
                         java.lang.String version)
Returns true if the resource referred to by the given URL and version is cached, and that resource is either mentioned in the calling applications JNLP file, is within the codebase of the calling applications JNLP file, or the calling application has been granted all-permissions. .

Parameters:
ref - The URL for the resource.
version - The version string, or null for no version.
Returns:
true if the above conditions are met, and false otherwise.

isPartCached

boolean isPartCached(java.lang.String part)
Returns true if the part referred to by the given string is cached, and that part is mentioned in the JNLP file for the application.

Parameters:
part - The name of the part.
Returns:
true if the above conditions are met, and false otherwise.

isPartCached

boolean isPartCached(java.lang.String[] parts)
Returns true if the parts referred to by the given array are cached, and those parts are mentioned in the JNLP file for the application.

Parameters:
parts - An array of part names.
Returns:
true if the above conditions are met, and false otherwise.

isExtensionPartCached

boolean isExtensionPartCached(java.net.URL ref,
                              java.lang.String version,
                              java.lang.String part)
Returns true if the given part of the given extension is cached, and the extension and part are mentioned in the JNLP file for the application.

Parameters:
ref - The URL for the resource.
version - The version string, or null for no version.
part - The name of the part.
Returns:
true if the above conditions are met, and false otherwise.

isExtensionPartCached

boolean isExtensionPartCached(java.net.URL ref,
                              java.lang.String version,
                              java.lang.String[] parts)
Returns true if the given parts of the given extension are cached, and the extension and parts are mentioned in the JNLP file for the application.

Parameters:
ref - The URL for the resource.
version - The version string, or null for no version.
parts - An array of part names.
Returns:
true if the above conditions are met, and false otherwise.

loadResource

void loadResource(java.net.URL ref,
                  java.lang.String version,
                  DownloadServiceListener progress)
                  throws java.io.IOException
Downloads the given resource, if the resource is either mentioned in the calling applications JNLP file, is within the codebase of the calling applications JNLP file, or if the calling application has been granted all-permissions. This method will block until the download is completed or an exception occurs.

Parameters:
ref - The URL for the resource.
version - The version string, or null for no version.
progress - Download progress callback object.
Throws:
java.io.IOException

loadPart

void loadPart(java.lang.String part,
              DownloadServiceListener progress)
              throws java.io.IOException
Downloads the given part, if the part is mentioned in the JNLP file for the application. This method will block until the download is completed or an exception occurs.

Parameters:
part - The name of the part.
progress - Download progress callback object.
Throws:
java.io.IOException

loadPart

void loadPart(java.lang.String[] parts,
              DownloadServiceListener progress)
              throws java.io.IOException
Downloads the given parts, if the parts are mentioned in the JNLP file for the application. This method will block until the download is completed or an exception occurs.

Parameters:
parts - An array of part names.
progress - Download progress callback object.
Throws:
java.io.IOException

loadExtensionPart

void loadExtensionPart(java.net.URL ref,
                       java.lang.String version,
                       java.lang.String part,
                       DownloadServiceListener progress)
                       throws java.io.IOException
Downloads the given part of the given extension, if the part and the extension are mentioned in the JNLP file for the application. This method will block until the download is completed or an exception occurs.

Parameters:
ref - The URL for the resource.
version - The version string, or null for no version.
part - The name of the part.
progress - Download progress callback object.
Throws:
java.io.IOException

loadExtensionPart

void loadExtensionPart(java.net.URL ref,
                       java.lang.String version,
                       java.lang.String[] parts,
                       DownloadServiceListener progress)
                       throws java.io.IOException
Downloads the given parts of the given extension, if the parts and the extension are mentioned in the JNLP file for the application. This method will block until the download is completed or an exception occurs.

Parameters:
ref - The URL for the resource.
version - The version string, or null for no version.
parts - An array of part names to load.
progress - Download progress callback object.
Throws:
java.io.IOException

removeResource

void removeResource(java.net.URL ref,
                    java.lang.String version)
                    throws java.io.IOException
Removes the given resource from the cache, if the resource is either mentioned in the calling applications JNLP file, is within the codebase of the calling applications JNLP file, or if the calling application has been granted all-permissions.

Parameters:
ref - The URL for the resource.
version - The version string, or null for no version.
Throws:
java.io.IOException

removePart

void removePart(java.lang.String part)
                throws java.io.IOException
Removes the given part from the cache, if the part is mentioned in the JNLP file for the application.

Parameters:
part - The name of the part.
Throws:
java.io.IOException

removePart

void removePart(java.lang.String[] parts)
                throws java.io.IOException
Removes the given parts from the cache, if the parts are mentioned in the JNLP file for the application.

Parameters:
parts - An array of part names.
Throws:
java.io.IOException

removeExtensionPart

void removeExtensionPart(java.net.URL ref,
                         java.lang.String version,
                         java.lang.String part)
                         throws java.io.IOException
Removes the given part of the given extension from the cache, if the part and the extension are mentioned in the JNLP file for the application.

Parameters:
ref - The URL for the resource.
version - The version string, or null for no version.
part - The name of the part.
Throws:
java.io.IOException

removeExtensionPart

void removeExtensionPart(java.net.URL ref,
                         java.lang.String version,
                         java.lang.String[] parts)
                         throws java.io.IOException
Removes the given parts of the given extension from the cache, if the parts and the extension are mentioned in the JNLP file for the application.

Parameters:
ref - The URL for the resource.
version - The version string, or null for no version.
parts - An array of part names.
Throws:
java.io.IOException

getDefaultProgressWindow

DownloadServiceListener getDefaultProgressWindow()
Return a default DownloadServiceListener implementation which, when passed to a load method, should pop up and update a progress window as the load progresses.

Returns:
A DownloadServiceListener object representing a download progress listener.


Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved