Statistics
| Revision:

svn-gvsig-desktop / trunk / libraries / libGDBMS / src / main / java / com / hardcode / gdbms / engine / strategies / Strategy.java @ 4048

History | View | Annotate | Download (3.39 KB)

1
package com.hardcode.gdbms.engine.strategies;
2

    
3
import com.hardcode.driverManager.DriverLoadException;
4
import com.hardcode.gdbms.engine.data.driver.DriverException;
5
import com.hardcode.gdbms.engine.instruction.CustomAdapter;
6
import com.hardcode.gdbms.engine.instruction.EvaluationException;
7
import com.hardcode.gdbms.engine.instruction.SelectAdapter;
8
import com.hardcode.gdbms.engine.instruction.SemanticException;
9
import com.hardcode.gdbms.engine.instruction.UnionAdapter;
10
import com.hardcode.gdbms.parser.ParseException;
11

    
12
import java.io.IOException;
13

    
14

    
15
/**
16
 * Interfaz que define las operaciones que se pueden realizar con los
17
 * DataSource. Las distintas implementaciones de esta interfaz ser?n las
18
 * encargadas del uso de los indices, del algoritmo usado para cada operaci?n,
19
 * ...
20
 */
21
public abstract class Strategy {
22
    /**
23
     * Realiza una select a partir de la instrucci?n que se pasa como par?metro
24
     *
25
     * @param instr Objeto con la informaci?n sobre las tablas que entran en
26
     *        juego en la instrucci?n, campos, expresiones condicionales, ...
27
     *
28
     * @return DataSource con el resultado de la instruccion
29
     *
30
     * @throws DriverException Excepci?n que indica error del driver accediendo
31
     *         a  los datos
32
     * @throws SemanticException Si se produce alg?n error sem?ntico
33
     * @throws IOException Si se produce un error accediendo a las estructuras
34
     *         de datos internas
35
     * @throws EvaluationException If the evaluation of any expression fails
36
     * @throws RuntimeException bug
37
     */
38
    public OperationDataSource select(SelectAdapter instr)
39
        throws DriverException, SemanticException, IOException, 
40
            EvaluationException {
41
        throw new RuntimeException(
42
            "This strategy does not support select execution");
43
    }
44

    
45
    /**
46
     * Realiza una union a partir de la instrucci?n que se pasa como par?metro
47
     *
48
     * @param instr Objeto con la informaci?n sobre las tablas que entran en
49
     *        juego en la instrucci?n
50
     *
51
     * @return DataSource con el resultado de la instruccion
52
     *
53
     * @throws DriverException Excepci?n que indica error del driver accediendo
54
     *         a  los datos
55
     * @throws IOException Si se produce un erro accediendo a los datos
56
     * @throws SemanticException Si se produce alg?n error sem?ntico
57
     * @throws EvaluationException If there's any problem during expresion evaluation
58
     * @throws ParseException If the union statement contains a select statement and its parse fails
59
     * @throws DriverLoadException If cannot find the suitable driver to access the data
60
     * @throws RuntimeException bug
61
     */
62
    public OperationDataSource union(UnionAdapter instr)
63
        throws DriverException, IOException, SemanticException, DriverLoadException, ParseException, EvaluationException {
64
        throw new RuntimeException(
65
            "This strategy does not support union execution");
66
    }
67

    
68
    /**
69
     * Makes a custom query
70
     *
71
     * @param instr The instruction specifying the custom query
72
     *
73
     * @return The result DataSource
74
     *
75
     * @throws SemanticException If there is some semantic error in the
76
     *         expression
77
     * @throws RuntimeException bug
78
     */
79
    public OperationDataSource custom(CustomAdapter instr)
80
        throws SemanticException {
81
        throw new RuntimeException(
82
            "This strategy does not support custom queries execution");
83
    }
84
}