|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.apache.jetspeed.cache.disk.JetspeedDiskCacheEntry
A cache entry represents a data source that can be stored locally for efficiency.
It can deliver a string with its contents, but the preferred way to access to the entry contents is through a Reader that will get characters from it.
There are two kinds of entries:
Remote entries can be in the following states:
TODO: Some data sources need to be written (i. e., are writable). For those, a mechanism need to be provided to write back the resource. We currently think about HTTP PUT as a mechanism.
| Constructor Summary | |
protected |
JetspeedDiskCacheEntry(java.io.File file)
Build a DiskCacheEntry that is based on a cached filesystem entry |
|
JetspeedDiskCacheEntry(java.lang.String url)
Build a DiskCacheEntry that is based on a remote URL and may be (or not) backed on disk. |
| Method Summary | |
java.lang.String |
getData()
Open this URL and read its data, then return it as a string |
long |
getExpirationTime()
Set the expiration date of this entry. |
java.io.File |
getFile()
Get the File that this URL obtains within the cache. |
java.io.InputStream |
getInputStream()
Get an input stream from this entry |
long |
getLastModified()
Return the last modified date of this entry. |
java.io.Reader |
getReader()
Get a Reader from this entry. |
java.lang.String |
getSourceURL()
Reconstruct the original URL based on this URL. |
java.lang.String |
getURL()
Get the URL that was cached. |
java.io.Writer |
getWriter()
Get a Writer to update this entry. |
boolean |
hasExpired()
Test if the entry is expired |
void |
init()
Initialize the file variable, if it is null & the url is not local |
boolean |
isLocal()
Test if the entry is a Local (fake) disk cache entry |
void |
setExpirationTime(long time)
Set the expiration date of this entry. |
void |
setFile(java.io.File file)
Set the file. |
void |
setLastModified(long time)
Set the last modified date of this entry. |
void |
setURL(java.lang.String url)
Set the url on which this is based. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
protected JetspeedDiskCacheEntry(java.io.File file)
Build a DiskCacheEntry that is based on a cached filesystem entry
This is used to reconstruct the entries from the cache at boot time
public JetspeedDiskCacheEntry(java.lang.String url)
| Method Detail |
public void init()
public java.lang.String getURL()
DiskCacheEntry
getURL in interface DiskCacheEntrypublic java.lang.String getSourceURL()
getSourceURL in interface DiskCacheEntrypublic java.io.File getFile()
getFile in interface DiskCacheEntrypublic void setFile(java.io.File file)
public java.lang.String getData()
throws java.io.IOException
getData in interface DiskCacheEntryjava.io.IOException
public java.io.InputStream getInputStream()
throws java.io.IOException
getInputStream in interface DiskCacheEntryjava.io.IOException
public java.io.Reader getReader()
throws java.io.IOException
getReader in interface DiskCacheEntryjava.io.IOException
public java.io.Writer getWriter()
throws java.io.IOException
getWriter in interface DiskCacheEntryjava.io.IOExceptionpublic long getLastModified()
getLastModified in interface DiskCacheEntrypublic void setLastModified(long time)
setLastModified in interface DiskCacheEntrypublic void setURL(java.lang.String url)
public long getExpirationTime()
getExpirationTime in interface DiskCacheEntrypublic void setExpirationTime(long time)
setExpirationTime in interface DiskCacheEntrypublic boolean hasExpired()
DiskCacheEntry
hasExpired in interface DiskCacheEntrypublic boolean isLocal()
DiskCacheEntry
isLocal in interface DiskCacheEntry
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||