KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > perseus > fos > api > FosAccess


1 /**
2  * Copyright (C) 2000
3  */

4
5 package org.objectweb.perseus.fos.api;
6
7 import java.util.Iterator JavaDoc;
8
9 /**
10  * Defines the means to manipulate transactional files for storing data objects.
11  * These data objects are stored into files (one file per data object). There
12  * are all stored into a root directory "dbdir". They can be stored directly
13  * under it or into a sub-directory "dirof" of it (at any depth).
14  * @author S. Chassande-Barrioz, P. Déchamboux
15  */

16 public interface FosAccess {
17     /**
18      * Deletes the file associated with a persistent object. This file is
19      * specified by the directory under which it is stored under dbDir, and
20      * its name (or id) within this directory.
21      * @param dirof The directory under dbDir where the deleted file is
22      * located.
23      * @param id The name of the file to delete (corresponding to the object
24      * identifier).
25      */

26     void delete(String JavaDoc dirof, String JavaDoc id) throws FosException;
27
28     /**
29      * Deletes a directory that stores persistent objects along with all object
30      * files stored under it.
31      * @param dirof The directory under dbDir to be deleted.
32      */

33     void deleteDir(String JavaDoc dirof) throws FosException;
34
35     /**
36      * Tests if the file associated to a persistent object exists. This file is
37      * specified by the directory under which it is stored under dbDir, and
38      * its name (or id) within this directory.
39      * @param dirof The directory under dbDir where the file should be located.
40      * @param id The name of the file to test (corresponding to the object
41      * identifier).
42      * @return true if the object file exists, else false.
43      */

44     boolean exist(String JavaDoc dirof, String JavaDoc id) throws FosException;
45
46     /**
47      * Tests if a directory that stores persistent objects exists.
48      * @param dirof The directory under dbDir to test the existence.
49      * @return true if the directory exists, else false.
50      */

51     boolean existDir(String JavaDoc dirof) throws FosException;
52
53     /**
54      * Reads the content of a persistent object from a file. This file is
55      * specified by the directory under which it is stored under dbDir, and
56      * its name (or id) within this directory. The object that actually reads
57      * the file is also given by the user.
58      * @param dirof The directory under dbDir where the read file is located.
59      * @param id The name of the file to read (corresponding to the object
60      * identifier).
61      * @param fs The user object for actually reading the file.
62      */

63     void read(String JavaDoc dirof, String JavaDoc id, FosStructure fs, Object JavaDoc ctxt)
64         throws FosException;
65
66     /**
67      * Gets an iterator in order to iterate over the names of the data
68      * object files stored into that sub-directory.
69      * @param dirof The sub-directory from which to scan the data
70      * object file names.
71      * @return The iterator in order to iterate over these names.
72      */

73     Iterator JavaDoc scan(String JavaDoc dirof) throws FosException;
74
75     /**
76      * Writes the content of a persistent object to a file. This file is
77      * specified by the directory under which it is stored under dbDir, and
78      * its name (or id) within this directory. The object that actually writes
79      * the file is also given by the user.
80      * @param dirof The directory under dbDir where the written file is
81      * located.
82      * @param id The name of the file to write (corresponding to the object
83      * identifier).
84      * @param fs The user object for actually writing the file.
85      */

86     void write(String JavaDoc dirof, String JavaDoc id, FosStructure fs, Object JavaDoc ctxt)
87         throws FosException;
88 }
89
Popular Tags