Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.compat.cdc / org.gvsig.fmap.dal / org.gvsig.fmap.dal.db / org.gvsig.fmap.dal.db.jdbc / src / main / java / org / gvsig / fmap / dal / store / jdbc2 / JDBCHelper.java @ 44376

History | View | Annotate | Download (5.4 KB)

1
package org.gvsig.fmap.dal.store.jdbc2;
2

    
3
import org.gvsig.fmap.dal.store.jdbc2.spi.JDBCSQLBuilderBase;
4
import java.sql.Connection;
5
import java.sql.ResultSet;
6
import java.util.List;
7
import org.gvsig.expressionevaluator.ExpressionBuilder.GeometrySupportType;
8
import org.gvsig.fmap.dal.SQLBuilder;
9
import org.gvsig.fmap.dal.exception.DataException;
10
import org.gvsig.fmap.dal.exception.InitializeException;
11
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
12
import org.gvsig.fmap.dal.feature.FeatureQueryOrder;
13
import org.gvsig.fmap.dal.feature.FeatureType;
14
import org.gvsig.fmap.dal.feature.spi.FeatureProvider;
15
import org.gvsig.fmap.dal.resource.exception.AccessResourceException;
16
import org.gvsig.fmap.dal.resource.spi.ResourceProvider;
17
import org.gvsig.fmap.dal.spi.DataServerExplorerProviderServices;
18
import org.gvsig.fmap.dal.spi.DataStoreProviderServices;
19
import org.gvsig.fmap.dal.store.jdbc.JDBCConnectionParameters;
20
import org.gvsig.fmap.dal.store.jdbc.JDBCNewStoreParameters;
21
import org.gvsig.fmap.dal.store.jdbc.JDBCServerExplorerParameters;
22
import org.gvsig.fmap.dal.store.jdbc.JDBCStoreParameters;
23
import org.gvsig.fmap.dal.store.jdbc2.ResulSetControler.ResultSetEntry;
24
import org.gvsig.fmap.geom.Geometry;
25
import org.gvsig.fmap.geom.GeometryManager;
26
import org.gvsig.fmap.dal.store.jdbc2.spi.SRSSolver;
27
import org.gvsig.tools.evaluator.Evaluator;
28

    
29
public interface JDBCHelper extends AutoCloseable {
30

    
31
    /**
32
     * Return the name of the driver.
33
     * 
34
     * By default rerturn "JDBC".
35
     * 
36
     * @return 
37
     */
38
    public String getProviderName();
39
    
40
    /**
41
     * Indica como deben ser guardadas las geometrias en la BBDD. Pueden
42
     * guardarse en WKT, WKB o EWKB.
43
     *
44
     * @return
45
     */
46
    public GeometrySupportType getGeometrySupportType();
47

    
48
    /**
49
     * Devuelbe un SQLBuilder adaptado al proveedor. Por ejemplo, uno especifico
50
     * para PostgreSQL, MySQL, Oracle, MSSQLServer...
51
     *
52
     * @return
53
     */
54
    public JDBCSQLBuilderBase createSQLBuilder();
55

    
56
    /**
57
     * Devueble las comillas que han de usaese para los identificadores.
58
     *
59
     * @return
60
     */
61
    public String getQuoteForIdentifiers();
62

    
63
    /**
64
     * Devueble las comillas que han de usaese en las constantes de cadena.
65
     *
66
     * @return
67
     */
68
    public String getQuoteForStrings();
69

    
70
    /**
71
     * Indica si la BBDD soporta valores automaticos, tipo serial.
72
     *
73
     * @return
74
     */
75
    public boolean allowAutomaticValues();
76

    
77
    /**
78
     * Indica si la BBDD soporta el uso de OFFSET en la sentencia select.
79
     *
80
     * @return
81
     */
82
    public boolean supportOffsetInSelect();
83

    
84
    /**
85
     * Indica si se especifico un subquery al abrir el proveedor.
86
     *
87
     * @return
88
     */
89
    public boolean useSubquery();
90

    
91
    /**
92
     * Indica si la BBDD tiene soporte espacial.
93
     *
94
     * @return
95
     */
96
    public boolean hasSpatialFunctions();
97

    
98
    public boolean supportFilter(FeatureType type, Evaluator evaluator);
99
    
100
    public boolean supportOrder(FeatureType type, FeatureQueryOrder order);
101
    
102
    public boolean allowNestedOperations();
103
    /**
104
     * Indica si podemos escribir el tipo de geometria indicado.
105
     *
106
     * @param geometryType
107
     * @param geometrySubtype
108
     * @return
109
     */
110
    public boolean canWriteGeometry(
111
            int geometryType, 
112
            int geometrySubtype
113
    );
114

    
115
    public Connection getConnection() throws AccessResourceException;
116

    
117
    public Connection getConnectionWritable() throws AccessResourceException;
118

    
119
    public String getConnectionURL();
120
    
121
    public JDBCConnectionParameters getConnectionParameters();
122

    
123
    public void closeConnection(Connection connection);
124

    
125
    public void closeConnectionQuietly(Connection connection);
126

    
127
    public GeometryManager getGeometryManager();
128

    
129
    public ResulSetControler getResulSetControler();
130

    
131
    public String getSourceId();
132

    
133
    public ResourceProvider getResource();
134

    
135
    public void dispose();
136

    
137
    public void fetchFeature(
138
            FeatureProvider feature, 
139
            ResultSet rs,
140
            FeatureAttributeDescriptor[] columns,
141
            String[] extraValueNames
142
    ) throws DataException;
143
    
144
    public void fetchFeature(
145
            FeatureProvider feature, 
146
            ResultSetEntry rs
147
    ) throws DataException;
148

    
149
    public Geometry getGeometryFromColumn(
150
            ResultSet rs, 
151
            int index
152
    ) throws DataException;
153

    
154
    public Geometry getGeometryFromColumn(
155
            ResultSetEntry rs, 
156
            int index
157
    ) throws DataException;
158

    
159
    public OperationsFactory getOperations();
160

    
161
    public FeatureProvider createFeature(
162
            FeatureType featureType
163
    ) throws DataException;
164

    
165
    public JDBCStoreProvider createProvider(
166
            JDBCStoreParameters parameters,
167
            DataStoreProviderServices providerServices
168
    ) throws InitializeException;
169

    
170
    public JDBCServerExplorer createServerExplorer(
171
            JDBCServerExplorerParameters parameters, 
172
            DataServerExplorerProviderServices providerServices
173
    ) throws InitializeException;
174

    
175
    public SRSSolver getSRSSolver();
176
    
177
    public JDBCNewStoreParameters createNewStoreParameters();
178

    
179
    public JDBCStoreParameters createOpenStoreParameters();
180
    
181
    public JDBCServerExplorerParameters createServerExplorerParameters();
182

    
183
    public String getSourceId(JDBCStoreParameters parameters);
184

    
185
    public boolean isThreadSafe();
186
    
187
    public String[] replaceForeingValueFunction(SQLBuilder sqlbuilder, FeatureType type);
188
}