|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.jthomas.mailfaces.FaceCache
Class to Manage the Cache of Face Images used by MailFaces.
The cache saved on disk consists of a single index file and some number of icon files (gif images). The index file consists of a list of FaceCachEntry entries in String format. At startup, the index file is read and a number of hashtables are built with the data portion being the FaceCacheEntry _ByUser - key is Userid@host _ByHost - key is host _ByURL - key is URL There is also a Vecter _Entries that contains all of the FaceCachEntry objects. When MailFaces is stopped normally, the current entries are written back to the index file.
Field Summary | |
boolean |
_Active
true if Cache is being used. |
Constructor Summary | |
FaceCache(java.lang.String directory)
Constructor Uses the specified directory to setup the Cache. |
Method Summary | |
void |
actionPerformed(FaceEvent e)
actionPerformed is the required implementation of FaceEventListener. |
void |
addIndex(com.jthomas.mailfaces.FaceCacheEntry entry)
addIndex(FaceCacheEntry entry) This adds an entry to the Cache It updates the in-memory indexes and adds it to the list of entries |
void |
clearIndex()
clearIndex() Clears the Cache Index file |
void |
deleteIndex(com.jthomas.mailfaces.FaceCacheEntry entry)
deleteIndex(FaceCacheEntry entry) This deletes an entry to the Cache by deleting it from the in-memory indexes and and setting a flag so it will not be rewritten when the index is rewritten |
int |
getCount()
getCount Get the current count of index entries |
java.lang.String |
getHost(java.lang.String host)
getHost(String host) returns -> String CacheURL Return the URL of the cached image if present. |
java.lang.String |
getURL(java.lang.String url)
getURL(String url) returns -> String CacheURL Return the URL of the cached image if present. |
java.lang.String |
getUser(java.lang.String user,
java.lang.String host)
getUser(String user,String host) returns -> String CacheURL Return the URL of the cached image if present. |
void |
listIndex()
listIndex() Lists the Cache Index file |
static void |
main(java.lang.String[] args)
Adding this makes this class self-testing |
void |
verify(int verifyAge)
verify Runs thru the index and verifies that the entries are correct This is currently unused (no menuitem to call it) |
void |
writeIndex()
writeIndex() Writes the Cache Index file |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public boolean _Active
Constructor Detail |
public FaceCache(java.lang.String directory) throws java.io.IOException
directory
- where the cache info is stored.
java.io.IOException
- if problems writing cache entriesMethod Detail |
public void actionPerformed(FaceEvent e)
actionPerformed
in interface FaceEventListener
public void addIndex(com.jthomas.mailfaces.FaceCacheEntry entry)
public void deleteIndex(com.jthomas.mailfaces.FaceCacheEntry entry)
public void writeIndex()
public void listIndex()
public void clearIndex()
public java.lang.String getHost(java.lang.String host)
public java.lang.String getUser(java.lang.String user, java.lang.String host)
There is a special case here. We can have a cache entry for user@host that has a null url that represents that we searched the PIconDB and did not find an entry. So if the url in the entry is null than we return "" instead of null. to indicate that there is no reason to search the PiconDB again.
public java.lang.String getURL(java.lang.String url)
public int getCount()
public void verify(int verifyAge)
public static void main(java.lang.String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |