org.osesb.utilities.cache
Class TextFileCacheEntry

java.lang.Object
  extended by org.osesb.utilities.cache.CacheEntry
      extended by org.osesb.utilities.cache.TextFileCacheEntry
All Implemented Interfaces:
java.lang.Comparable
Direct Known Subclasses:
XMLSchemaCacheEntry, XSLTemplateCacheEntry

public class TextFileCacheEntry
extends CacheEntry

TextFileCacheEntry wraps a cached File in a TextFileCache.

Since:
Version .9

Field Summary
protected  java.lang.String fileText
          The text contents of the cached File.
protected  long lastModified
          The value of the File.lastModified() stamp when the File was cached.
 
Fields inherited from class org.osesb.utilities.cache.CacheEntry
accessCount, ACCESSCOUNT_EVICTIONSTRATEGY, cachedObject, cacheKey, compareField, lastAccessedTime, LASTACCESSTIME_EVICTIONSTRATEGY, log, thisClassName, toStringSDF, toStringTime
 
Constructor Summary
TextFileCacheEntry(java.io.File file)
          Constructs a TextFileCacheEntry object.
 
Method Summary
 java.io.File getCachedFile()
          Return the cached File.
 java.lang.String getFileText()
          Return the entry text.
 long getLastModified()
          Return the cache entry's last modified stamp.
 java.lang.String toString()
          Returns the String representation of this TextFileCacheEntry.
 
Methods inherited from class org.osesb.utilities.cache.CacheEntry
compareTo, getAccessCount, getCachedObject, getCacheKey, getCompareFieldName, getLastAccessedTime, incrementAccessCount, setAccessCount, setCompareField, setLastAccessedTime
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

fileText

protected java.lang.String fileText
The text contents of the cached File.


lastModified

protected long lastModified
The value of the File.lastModified() stamp when the File was cached. The value of lastModified is checked by TextFileCache.get(). If the File was modified since it was cached, it is re-cached.

Constructor Detail

TextFileCacheEntry

public TextFileCacheEntry(java.io.File file)
                   throws java.lang.Exception
Constructs a TextFileCacheEntry object.

Parameters:
file - The File to cache.
Throws:
java.lang.Exception - if file cannot be cached.
Method Detail

getCachedFile

public java.io.File getCachedFile()
Return the cached File.

Returns:
the cached File.

getLastModified

public long getLastModified()
Return the cache entry's last modified stamp. This is the value of File.lastModified() when the File was cached.

Returns:
the last modified stamp

getFileText

public java.lang.String getFileText()
Return the entry text.

Returns:
the entry text.

toString

public java.lang.String toString()
Returns the String representation of this TextFileCacheEntry.

Overrides:
toString in class CacheEntry
Returns:
the String representation of this TextFileCacheEntry.