org.stringtree.util
Class AbstractCache

java.lang.Object
  extended by org.stringtree.util.AbstractCache
All Implemented Interfaces:
Cached, Proxy

public abstract class AbstractCache
extends java.lang.Object
implements Cached


Field Summary
protected  java.lang.Object cache
           
protected  CacheStatus status
           
protected  java.util.Date timestamp
           
 
Fields inherited from interface org.stringtree.util.Cached
EMPTY, ERROR, FULL, LOADING
 
Constructor Summary
AbstractCache()
           
AbstractCache(java.lang.Object cache)
           
 
Method Summary
protected abstract  boolean doLoad()
           
protected abstract  void doUnload()
           
 void ensure()
           
 int getCachedStatus()
           
protected  java.lang.Object getObject()
           
 java.util.Date getTimestamp()
           
 java.lang.Object getValue()
           
 void load()
           
private  void mark(int status, long stamp)
           
private  void markEmpty()
           
private  void markError()
           
private  void markFull()
           
private  void markLoading()
           
 void reload()
           
 void unload()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

status

protected CacheStatus status

timestamp

protected java.util.Date timestamp

cache

protected java.lang.Object cache
Constructor Detail

AbstractCache

public AbstractCache(java.lang.Object cache)

AbstractCache

public AbstractCache()
Method Detail

getCachedStatus

public int getCachedStatus()
Specified by:
getCachedStatus in interface Cached

getObject

protected java.lang.Object getObject()

getValue

public java.lang.Object getValue()
Specified by:
getValue in interface Proxy

getTimestamp

public java.util.Date getTimestamp()
Specified by:
getTimestamp in interface Cached

mark

private void mark(int status,
                  long stamp)

markFull

private void markFull()

markEmpty

private void markEmpty()

markLoading

private void markLoading()

markError

private void markError()

load

public void load()
Specified by:
load in interface Cached

unload

public void unload()
Specified by:
unload in interface Cached

ensure

public void ensure()
Specified by:
ensure in interface Cached

reload

public void reload()
Specified by:
reload in interface Cached

doLoad

protected abstract boolean doLoad()

doUnload

protected abstract void doUnload()