net.sourceforge.jnlp.cache

## Class Resource

- java.lang.Object
- - net.sourceforge.jnlp.cache.Resource

-     public class Resource
      extends java.lang.Object

  Information about a single resource to download. This class tracks the downloading of various resources of a JNLP file to local files. 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.

  Resources can be put into download groups by specifying a part name for the resource. The resource tracker can also be configured to prefetch resources, which are downloaded in the order added to the media tracker.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `CONNECT`
    `static int` | `CONNECTED`
    `static int` | `CONNECTING`
    `static int` | `DOWNLOAD`
    `static int` | `DOWNLOADED`
    `static int` | `DOWNLOADING`
    `static int` | `ERROR`
    `static int` | `STARTED`
    `static int` | `UNINITIALIZED` status bits

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addTracker(ResourceTracker tracker)` Adds the tracker to the list of trackers monitoring this resource.
    `void` | `changeStatus(int clear, int add)` Changes the status by clearing the flags in the first parameter and setting the flags in the second.
    `boolean` | `equals(java.lang.Object other)`
    `protected void` | `fireDownloadEvent()` Instructs the trackers monitoring this resource to fire a download event.
    `java.net.URL` | `getDownloadLocation()` Returns the URL to use for downloading the resource.
    `java.net.URL` | `getLocation()` Returns the remote location of the resource.
    `static Resource` | `getResource(java.net.URL location, Version requestVersion, UpdatePolicy updatePolicy)` Return a shared Resource object representing the given location and version.
    `UpdatePolicy` | `getUpdatePolicy()` Returns the update policy for this resource
    `boolean` | `isSet(int flag)` Returns true if any of the specified flags are set.
    `void` | `removeTracker(ResourceTracker tracker)` Removes the tracker to the list of trackers monitoring this resource.
    `void` | `setDownloadLocation(java.net.URL location)` Set the url to use for downloading the resource
    `java.lang.String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### UNINITIALIZED

          public static final int UNINITIALIZED

      status bits
      See Also:
        Constant Field Values

    - #### CONNECT

          public static final int CONNECT

      See Also:
        Constant Field Values

    - #### CONNECTING

          public static final int CONNECTING

      See Also:
        Constant Field Values

    - #### CONNECTED

          public static final int CONNECTED

      See Also:
        Constant Field Values

    - #### DOWNLOAD

          public static final int DOWNLOAD

      See Also:
        Constant Field Values

    - #### DOWNLOADING

          public static final int DOWNLOADING

      See Also:
        Constant Field Values

    - #### DOWNLOADED

          public static final int DOWNLOADED

      See Also:
        Constant Field Values

    - #### ERROR

          public static final int ERROR

      See Also:
        Constant Field Values

    - #### STARTED

          public static final int STARTED

      See Also:
        Constant Field Values

  - ### Method Detail

    - #### getResource

          public static Resource getResource(java.net.URL location,
                             Version requestVersion,
                             UpdatePolicy updatePolicy)

      Return a shared Resource object representing the given location and version.

    - #### getLocation

          public java.net.URL getLocation()

      Returns the remote location of the resource.

    - #### getDownloadLocation

          public java.net.URL getDownloadLocation()

      Returns the URL to use for downloading the resource. This can be different from the original location since it may use a different file name to support versioning and compression
      Returns:
        the url to use when downloading

    - #### setDownloadLocation

          public void setDownloadLocation(java.net.URL location)

      Set the url to use for downloading the resource
      Parameters:
        `location` -

    - #### isSet

          public boolean isSet(int flag)

      Returns true if any of the specified flags are set.

    - #### getUpdatePolicy

          public UpdatePolicy getUpdatePolicy()

      Returns the update policy for this resource
      Returns:
        The update policy

    - #### changeStatus

          public void changeStatus(int clear,
                          int add)

      Changes the status by clearing the flags in the first parameter and setting the flags in the second. This method is synchronized on this resource.

    - #### removeTracker

          public void removeTracker(ResourceTracker tracker)

      Removes the tracker to the list of trackers monitoring this resource.

    - #### addTracker

          public void addTracker(ResourceTracker tracker)

      Adds the tracker to the list of trackers monitoring this resource.

    - #### fireDownloadEvent

          protected void fireDownloadEvent()

      Instructs the trackers monitoring this resource to fire a download event.

    - #### equals

          public boolean equals(java.lang.Object other)

      Overrides:
        `equals` in class `java.lang.Object`

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`

Submit a bug or feature