Package net.sourceforge.jnlp.cache
Class CacheEntry
java.lang.Object
net.sourceforge.jnlp.cache.CacheEntry
Describes an entry in the cache.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCacheEntry(URL location, Version version) Create a CacheEntry for the resources specified as a remote URL. -
Method Summary
Modifier and TypeMethodDescriptionlonglongReturns the time in the local system clock that the file was most recently checked for an update.Returns the remote location this entry caches.longbooleanisCached()Returns true if the cache has a local copy of the contents of the URL matching the specified version string.booleanbooleanisCurrent(long lastModified) Returns whether there is a version of the URL contents in the cache and it is up to date.booleanprotected booleanprotected voidlock()Lock cache item.voidMark this entry for deletion at shutdown.voidsetJnlpPath(String jnlpPath) voidsetLastModified(long modifyTime) voidsetLastUpdated(long updatedTime) Sets the time in the local system clock that the file was most recently checked for an update.voidsetRemoteContentLength(long length) protected booleanstore()Save the current information for the cache entry.protected booleantryLock()protected voidunlock()Unlock cache item.
-
Field Details
-
KEY_JNLP_PATH
- See Also:
-
-
Constructor Details
-
CacheEntry
Create a CacheEntry for the resources specified as a remote URL.- Parameters:
location- the remote resource locationversion- the version of the resource
-
-
Method Details
-
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
-
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
-
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
-
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
-