Class CacheEntry

java.lang.Object
net.sourceforge.jnlp.cache.CacheEntry

public class CacheEntry extends Object
Describes an entry in the cache.
  • Field Details

  • Constructor Details

    • CacheEntry

      public CacheEntry(URL location, Version version)
      Create a CacheEntry for the resources specified as a remote URL.
      Parameters:
      location - the remote resource location
      version - the version of the resource
  • Method Details

    • getLocation

      public URL getLocation()
      Returns the remote location this entry caches.
      Returns:
      URL same as the one on which this entry was created
    • getLastUpdated

      public long getLastUpdated()
      Returns the time in the local system clock that the file was most recently checked for an update.
      Returns:
      when the item was updated (in ms)
    • setLastUpdated

      public void setLastUpdated(long updatedTime)
      Sets the time in the local system clock that the file was most recently checked for an update.
      Parameters:
      updatedTime - the time (in ms) to be set as last updated time
    • getRemoteContentLength

      public long getRemoteContentLength()
    • setRemoteContentLength

      public void setRemoteContentLength(long length)
    • setJnlpPath

      public void setJnlpPath(String jnlpPath)
    • getLastModified

      public long getLastModified()
    • setLastModified

      public void setLastModified(long modifyTime)
    • isCurrent

      public boolean isCurrent(long lastModified)
      Returns whether there is a version of the URL contents in the cache and it is up to date.
      Parameters:
      lastModified - - current time as get from server (in ms). Mostly value of "Last-Modified" http header'?
      Returns:
      whether the cache contains the version
    • isCurrent

      public boolean isCurrent(long lastModified, File cachedFile)
    • isCached

      public boolean isCached()
      Returns true if the cache has a local copy of the contents of the URL matching the specified version string.
      Returns:
      true if the resource is in the cache
    • isCached

      public boolean isCached(File cachedFile)
    • store

      protected boolean store()
      Save the current information for the cache entry.
      Returns:
      True if successfuly stored into file, false otherwise
    • markForDelete

      public void markForDelete()
      Mark this entry for deletion at shutdown.
    • lock

      protected void lock()
      Lock cache item.
    • unlock

      protected void unlock()
      Unlock cache item. Does not do anything if not holding the lock.
    • tryLock

      protected boolean tryLock()
    • isHeldByCurrentThread

      protected boolean isHeldByCurrentThread()
    • getLocalFile

      public File getLocalFile()