net.sf.jame.service
Class DefaultFilesystemCache

java.lang.Object
  extended by net.sf.jame.service.DefaultFilesystemCache
All Implemented Interfaces:
FilesystemCache
Direct Known Subclasses:
RenderJobFilesystemCache, RenderProfileFilesystemCache

public abstract class DefaultFilesystemCache
extends java.lang.Object
implements FilesystemCache

Author:
Andrea Medeghini

Field Summary
protected  java.io.File workdir
           
 
Constructor Summary
DefaultFilesystemCache(java.io.File workdir)
           
 
Method Summary
 void create(int id)
           
protected  java.io.FilenameFilter createFilenameFilter()
           
 void delete(int id)
           
 void deleteAll()
           
static void deleteDir(java.io.File dir)
           
 boolean exists(int id)
           
protected  java.io.File getDirectory(int id)
           
abstract  java.io.InputStream getInputStream(int id)
           
abstract  java.io.OutputStream getOutputStream(int id)
           
abstract  ChunkedRandomAccessFile getRandomAccessFile(int id)
           
 java.io.File getWorkdir()
           
 java.io.File[] list()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

workdir

protected final java.io.File workdir
Constructor Detail

DefaultFilesystemCache

public DefaultFilesystemCache(java.io.File workdir)
                       throws java.io.IOException
Parameters:
workdir -
Throws:
java.io.IOException
Method Detail

getWorkdir

public java.io.File getWorkdir()
Returns:

deleteDir

public static void deleteDir(java.io.File dir)
Parameters:
dir -

list

public java.io.File[] list()
Specified by:
list in interface FilesystemCache
Returns:
See Also:
FilesystemCache.list()

create

public void create(int id)
            throws java.io.IOException
Specified by:
create in interface FilesystemCache
Throws:
java.io.IOException
See Also:
FilesystemCache.create(int)

delete

public void delete(int id)
            throws java.io.IOException
Specified by:
delete in interface FilesystemCache
Throws:
java.io.IOException
See Also:
FilesystemCache.delete(int)

deleteAll

public void deleteAll()
Specified by:
deleteAll in interface FilesystemCache
See Also:
FilesystemCache.deleteAll()

exists

public boolean exists(int id)
Specified by:
exists in interface FilesystemCache
Returns:
See Also:
FilesystemCache.exists(int)

getDirectory

protected java.io.File getDirectory(int id)
Parameters:
id -
Returns:

createFilenameFilter

protected java.io.FilenameFilter createFilenameFilter()
Returns:

getInputStream

public abstract java.io.InputStream getInputStream(int id)
                                            throws java.io.IOException
Specified by:
getInputStream in interface FilesystemCache
Returns:
Throws:
java.io.IOException
See Also:
FilesystemCache.getInputStream(int)

getOutputStream

public abstract java.io.OutputStream getOutputStream(int id)
                                              throws java.io.IOException
Specified by:
getOutputStream in interface FilesystemCache
Returns:
Throws:
java.io.IOException
See Also:
FilesystemCache.getOutputStream(int)

getRandomAccessFile

public abstract ChunkedRandomAccessFile getRandomAccessFile(int id)
                                                     throws java.io.IOException
Specified by:
getRandomAccessFile in interface FilesystemCache
Returns:
Throws:
java.io.IOException
See Also:
FilesystemCache.getRandomAccessFile(int)