next up previous contents
Next: Class PrototypeFileRepo Up: Design Previous: Class ZipFileRepo   Contents


Class TempFileRepo

Class TempFileRepo is an abstract class. Its purpose is to provide common functionality to create a repository of temporary files. In addition, TempFileRepo uses ``lazy'' approach (see section 3.3.1) to create files in the file system only when those files are requested.

In order to implement the ``lazy'' approach, TempFileRepo maintains a set of all file names that it already created. If a file is requested with getFile(name), TempFileRepo is going to check whether the name belongs to that set. If not, TempFileRepo needs to create a new temporary file with the specified name and store that name in the set. If yes, TempFileRepo is going to return a handle to previously created temporary file with the specified name. (See figure 19).

Figure 19: Operations of TempFileRepo
\includegraphics[scale=.4]{tempfilerepo.eps}

All temporary files created by TempFileRepo will be placed under a common temporary directory. This temporary directory serves a basedir to the super class FileRepo.

TempFileRepo uses the Factory Method design pattern. Method getFileData(name) defines an interface for the subclasses to provide data for files with specified names. (See figure 20). Thus, the subclasses need only to implement method getFileData(name).

Figure 20: Class TempFileRepo
\includegraphics[scale=.4]{tempfilerepoclass.eps}


next up previous contents
Next: Class PrototypeFileRepo Up: Design Previous: Class ZipFileRepo   Contents