Statistics
| Revision:

root / trunk / libraries / libGDBMS / src / main / java / com / hardcode / gdbms / engine / data / driver / FileDriver.java @ 10627

History | View | Annotate | Download (2.21 KB)

1
package com.hardcode.gdbms.engine.data.driver;
2

    
3
import java.io.File;
4

    
5
import com.hardcode.gdbms.driver.exceptions.CloseDriverException;
6
import com.hardcode.gdbms.driver.exceptions.OpenDriverException;
7
import com.hardcode.gdbms.driver.exceptions.ReadDriverException;
8
import com.hardcode.gdbms.driver.exceptions.WriteDriverException;
9
import com.hardcode.gdbms.engine.data.file.FileDataWare;
10

    
11

    
12
/**
13
 * Interface to the files.
14
 */
15
public interface FileDriver extends ReadAccess, GDBMSDriver {
16
    /**
17
     * M?todo invocado al comienzo para abrir el fichero. A partir de la
18
     * invocaci?n de este m?todo todos las operaciones se har?n sobre el File
19
     * que se pasa como par?metro
20
     *
21
     * @param file Fichero que se debe de abrir
22
     * @throws OpenDriverException TODO
23
     */
24
    void open(File file) throws OpenDriverException;
25

    
26
    /**
27
     * Cierra el Fichero sobre el que se estaba accediendo
28
     * @throws CloseDriverException TODO
29
     */
30
    void close() throws CloseDriverException;
31

    
32
    /**
33
     * devuelve true si el driver puede leer el fichero que se pasa como
34
     * par?metro, false en caso contrario
35
     *
36
     * @param f Fichero que se quiere comprobar
37
     *
38
     * @return DOCUMENT ME!
39
     */
40
    boolean fileAccepted(File f);
41

    
42
    /**
43
     * Writes the content in the DataWare to the last opened file (method open).
44
     * The data must be written to a buffer (memory or disk) and then copied
45
     * to the file because if the file is modified the dataWare data may be
46
     * corrupted. A temporary file can be obtained from the DataSourceFactory
47
     * passed to the setDataSourceFactory method to delegate clean tasks to the
48
     * system
49
     *
50
     * @param dataWare DataWare with the contents
51
     * @throws WriteDriverException TODO
52
     * @throws ReadDriverException
53
     */
54
    void writeFile(FileDataWare dataWare) throws WriteDriverException, ReadDriverException;
55

    
56
    /**
57
     * Creates a new file with the given field names and types
58
     *
59
     * @param path Path to the new file
60
     * @param fieldNames Names of the fields
61
     * @param fieldTypes Types of the fields
62
     * @throws ReadDriverException TODO
63
     */
64
    void createSource(String path, String[] fieldNames, int[] fieldTypes) throws ReadDriverException;
65
}