proai.cache
Class RCDisk

java.lang.Object
  extended by proai.cache.RCDisk

public class RCDisk
extends java.lang.Object

The file-based portion of the record cache.


Field Summary
static java.lang.String PATH_DATE_PATTERN
           
 
Constructor Summary
RCDisk(java.io.File baseDir)
           
 
Method Summary
 void cancel(java.lang.String path)
          Deletes path and all files created after it while pruning any empty directories that come about as a result.
 void delete(java.lang.String path)
           
 CachedContent getContent(java.lang.String path)
           
 CachedContent getContent(java.lang.String path, java.lang.String dateStamp, boolean headerOnly)
           
 java.io.File getFile(java.lang.String path)
           
 RCDiskWriter getNewWriter()
          Get a new RCDiskWriter backed by a new file in the disk cache.
 void pruneEmptyDirs()
          This should be pretty fast.
 java.lang.String write(Writable writable)
          Write the content of the given Writable to a new file and return the path of the file, relative to the disk cache base directory.
 void writeAllPaths(java.io.PrintWriter writer)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PATH_DATE_PATTERN

public static final java.lang.String PATH_DATE_PATTERN
See Also:
Constant Field Values
Constructor Detail

RCDisk

public RCDisk(java.io.File baseDir)
Method Detail

getNewWriter

public RCDiskWriter getNewWriter()
                          throws ServerException
Get a new RCDiskWriter backed by a new file in the disk cache.

Throws:
ServerException

write

public java.lang.String write(Writable writable)
                       throws ServerException
Write the content of the given Writable to a new file and return the path of the file, relative to the disk cache base directory.

Throws:
ServerException

getFile

public java.io.File getFile(java.lang.String path)

getContent

public CachedContent getContent(java.lang.String path)

getContent

public CachedContent getContent(java.lang.String path,
                                java.lang.String dateStamp,
                                boolean headerOnly)

delete

public void delete(java.lang.String path)

cancel

public void cancel(java.lang.String path)
            throws ServerException
Deletes path and all files created after it while pruning any empty directories that come about as a result.

Throws:
ServerException

pruneEmptyDirs

public void pruneEmptyDirs()
This should be pretty fast. It relies on a specific number of directories and the fact that File.delete() won't delete a directory if it is non-empty.


writeAllPaths

public void writeAllPaths(java.io.PrintWriter writer)