jste.template
Class FileRepository

java.lang.Object
  extended by jste.template.FileRepository
All Implemented Interfaces:
Repository

public class FileRepository
extends java.lang.Object
implements Repository

The FileRepository implements the Repository interface on the file system. A FileRepository instance is created for a specific directory and holds files in that directory's subtree.


Constructor Summary
FileRepository(java.lang.String rootDirectory)
          Construct a FileRepository representing all the files in the directory tree rooted at the given directory.
 
Method Summary
 java.lang.String getResource(java.lang.String fileName)
          Return the content of the file with the specified name in the repository.
 java.util.Date lastModifiedTime(java.lang.String fileName)
          Return the last modified time of the file with the specified name in the repository.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileRepository

public FileRepository(java.lang.String rootDirectory)
Construct a FileRepository representing all the files in the directory tree rooted at the given directory.

Method Detail

getResource

public java.lang.String getResource(java.lang.String fileName)
                             throws java.io.IOException
Return the content of the file with the specified name in the repository.

Specified by:
getResource in interface Repository
Parameters:
fileName - the name of the file relative to the FileRepository's root directory.
Returns:
the content of the specified file, or null if the file does not exist.
Throws:
java.io.IOException

lastModifiedTime

public java.util.Date lastModifiedTime(java.lang.String fileName)
                                throws java.io.IOException
Return the last modified time of the file with the specified name in the repository.

Specified by:
lastModifiedTime in interface Repository
Parameters:
fileName - the name of the file relative to the FileRepository's root directory.
Returns:
the content of the specified file, or null if the file does not exist.
Throws:
java.io.IOException