org.xmlecho.palomar.cache
Class ReaderObjectHolder

java.lang.Object
  extended byorg.xmlecho.palomar.cache.Holder
      extended byorg.xmlecho.palomar.cache.ObjectHolder
          extended byorg.xmlecho.palomar.cache.ReaderObjectHolder

public class ReaderObjectHolder
extends ObjectHolder

holds an object which is presented as a Reader for caching large objects to files on disk.


Field Summary
 
Fields inherited from class org.xmlecho.palomar.cache.Holder
_cachedAtTime, _cachedObject, _myCache, _next, _objectKey, _objectPolicies, _prev
 
Constructor Summary
ReaderObjectHolder()
           
 
Method Summary
 void clean()
          remove the cached file, and any reference to it
 java.lang.String getFileUrl()
           
 java.lang.Object getObject()
          returns a Reader for a stream which we cached to the fileSystem
 void setFileUrl(java.lang.String fileUrl)
           
 java.lang.Object setObject(java.lang.Object outputStream)
          cache an OutputStream to disk.
 
Methods inherited from class org.xmlecho.palomar.cache.Holder
getCache, getCachedAtTime, getNext, getObjectKey, getPolicies, getPrev, setCache, setCachedAtTime, setNext, setObjectKey, setPolicies, setPrev
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReaderObjectHolder

public ReaderObjectHolder()
Method Detail

getFileUrl

public java.lang.String getFileUrl()

setFileUrl

public void setFileUrl(java.lang.String fileUrl)

setObject

public java.lang.Object setObject(java.lang.Object outputStream)
cache an OutputStream to disk. We return an new OutputStream to the client to write to. We split the stream to two places: 1) a file on the disk which we'll read from when the client code gets the object later, and 2) the original OutputStream.

Overrides:
setObject in class Holder
Parameters:
outputStream - object to be cached
Returns:
an OutputStream for the client to write to

getObject

public java.lang.Object getObject()
returns a Reader for a stream which we cached to the fileSystem

Overrides:
getObject in class Holder
Returns:
Object the object that is cached.

clean

public void clean()
remove the cached file, and any reference to it

Overrides:
clean in class ObjectHolder