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

net::sourceforge::jnlp::cache::ResourceTracker Class Reference

List of all members.


Detailed Description

This class tracks the downloading of various resources of a JNLP file to local files in the cache. It can be used to download icons, jnlp and extension files, jars, and jardiff files using the version based protocol or any file using the basic download protocol (jardiff and version not implemented yet).

The resource tracker can be configured to prefetch resources, which are downloaded in the order added to the media tracker.

Multiple threads are used to download and cache resources that are actively being waited for (blocking a caller) or those that have been started downloading by calling the startDownload method. Resources that are prefetched are downloaded one at a time and only if no other trackers have requested downloads. This allows the tracker to start downloading many items without using many system resources, but still quickly download items as needed.

Author:
Jon A. Maxwell (JAM) - initial author
Version:
Revision
1.22

Definition at line 69 of file ResourceTracker.java.


Public Member Functions

void addDownloadListener (DownloadListener listener)
void addResource (URL location, Version version, UpdatePolicy updatePolicy)
boolean checkResource (URL location)
long getAmountRead (URL location)
File getCacheFile (URL location)
URL getCacheURL (URL location)
InputStream getInputStream (URL location) throws IOException
long getTotalSize (URL location)
void removeDownloadListener (DownloadListener listener)
void removeResource (URL location)
 ResourceTracker (boolean prefetch)
 ResourceTracker ()
boolean startResource (URL location)
boolean waitForResource (URL location, long timeout) throws InterruptedException
boolean waitForResources (URL urls[], long timeout) throws InterruptedException

Protected Member Functions

void fireDownloadEvent (Resource resource)
void startThread ()

Private Member Functions

boolean checkCache (Resource resource, UpdatePolicy updatePolicy)
void downloadResource (Resource resource)
void endThread ()
Resource getResource (URL location)
URL getVersionedResourceURL (Resource resource)
void initializeResource (Resource resource)
void processResource (Resource resource)
void queueResource (Resource resource)
boolean startResource (Resource resource)
boolean wait (Resource resources[], long timeout) throws InterruptedException

Static Private Member Functions

static Resource getPrefetch ()
static Resource selectByFlag (List source, int flag, int notflag)
static Resource selectNextResource ()

Private Attributes

List listeners = new ArrayList()
boolean prefetch
List resources = new ArrayList()

Static Private Attributes

static ArrayList active = new ArrayList()
static final int CONNECT = Resource.CONNECT
static final int CONNECTED = Resource.CONNECTED
static final int CONNECTING = Resource.CONNECTING
static final int DOWNLOAD = Resource.DOWNLOAD
static final int DOWNLOADED = Resource.DOWNLOADED
static final int DOWNLOADING = Resource.DOWNLOADING
static final int ERROR = Resource.ERROR
static Object lock = new Integer(0)
static final int maxThreads = 5
static WeakList prefetchTrackers = new WeakList()
static ArrayList queue = new ArrayList()
static final int STARTED = Resource.STARTED
static int threads = 0
static final int UNINITIALIZED = Resource.UNINITIALIZED

Classes

class  Downloader

The documentation for this class was generated from the following file:

Generated by  Doxygen 1.6.0   Back to index