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 @ 46104

History | View | Annotate | Download (7.02 KB)

1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2020 gvSIG Association.
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 3
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
package org.gvsig.fmap.dal.store.jdbc2;
25

    
26
import org.gvsig.fmap.dal.store.jdbc2.spi.JDBCSQLBuilderBase;
27
import java.sql.Connection;
28
import java.sql.ResultSet;
29
import java.util.List;
30
import org.gvsig.expressionevaluator.GeometryExpressionBuilderHelper.GeometrySupportType;
31
import org.gvsig.fmap.dal.SQLBuilder;
32
import org.gvsig.fmap.dal.exception.DataException;
33
import org.gvsig.fmap.dal.exception.InitializeException;
34
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
35
import org.gvsig.fmap.dal.feature.FeatureQueryOrder;
36
import org.gvsig.fmap.dal.feature.FeatureType;
37
import org.gvsig.fmap.dal.feature.spi.FeatureProvider;
38
import org.gvsig.fmap.dal.resource.exception.AccessResourceException;
39
import org.gvsig.fmap.dal.resource.spi.ResourceProvider;
40
import org.gvsig.fmap.dal.spi.DataServerExplorerProviderServices;
41
import org.gvsig.fmap.dal.spi.DataStoreProviderServices;
42
import org.gvsig.fmap.dal.spi.DataTransactionServices;
43
import org.gvsig.fmap.dal.store.jdbc.JDBCConnectionParameters;
44
import org.gvsig.fmap.dal.store.jdbc.JDBCNewStoreParameters;
45
import org.gvsig.fmap.dal.store.jdbc.JDBCServerExplorerParameters;
46
import org.gvsig.fmap.dal.store.jdbc.JDBCStoreParameters;
47
import org.gvsig.fmap.dal.store.jdbc2.ResulSetControler.ResultSetEntry;
48
import org.gvsig.fmap.geom.Geometry;
49
import org.gvsig.fmap.geom.GeometryManager;
50
import org.gvsig.fmap.dal.store.jdbc2.spi.SRSSolver;
51
import org.gvsig.tools.evaluator.Evaluator;
52

    
53
public interface JDBCHelper extends AutoCloseable {
54

    
55
    /**
56
     * Return the name of the driver.
57
     * 
58
     * By default rerturn "JDBC".
59
     * 
60
     * @return 
61
     */
62
    public String getProviderName();
63
    
64
    /**
65
     * Indica como deben ser guardadas las geometrias en la BBDD. Pueden
66
     * guardarse en WKT, WKB o EWKB.
67
     *
68
     * @return
69
     */
70
    public GeometrySupportType getGeometrySupportType();
71

    
72
    /**
73
     * Devuelve un SQLBuilder adaptado al proveedor. Por ejemplo, uno especifico
74
     * para PostgreSQL, MySQL, Oracle, MSSQLServer...
75
     *
76
     * @return
77
     */
78
    public JDBCSQLBuilderBase createSQLBuilder();
79

    
80
    /**
81
     * Devuelve las comillas que han de usaese para los identificadores.
82
     *
83
     * @return
84
     */
85
    public String getQuoteForIdentifiers();
86

    
87
    /**
88
     * Devuelve las comillas que han de usaese en las constantes de cadena.
89
     *
90
     * @return
91
     */
92
    public String getQuoteForStrings();
93
    
94
    public FeatureType getProviderFeatureType();
95
    
96
    /**
97
     * @param providerFeatureType the providerFeatureType to set
98
     */
99
    public void setProviderFeatureType(FeatureType providerFeatureType);
100

    
101
    /**
102
     * Indica si la BBDD soporta valores automaticos, tipo serial.
103
     *
104
     * @return
105
     */
106
    public boolean allowAutomaticValues();
107

    
108
    /**
109
     * Indica si la BBDD soporta el uso de OFFSET en la sentencia select.
110
     *
111
     * @return
112
     */
113
    public boolean supportOffsetInSelect();
114

    
115
    /**
116
     * Indica si se especifico un subquery al abrir el proveedor.
117
     *
118
     * @return
119
     */
120
    public boolean useSubquery();
121

    
122
    /**
123
     * Indica si la BBDD tiene soporte espacial.
124
     *
125
     * @return
126
     */
127
    public boolean hasSpatialFunctions();
128

    
129
    public boolean supportFilter(FeatureType type, Evaluator evaluator);
130
    
131
    public boolean supportExpression(final FeatureType type, String sql);
132
    
133
    public boolean supportOrder(FeatureType type, FeatureQueryOrder order);
134
    
135
    public boolean allowNestedOperations();
136
    /**
137
     * Indica si podemos escribir el tipo de geometria indicado.
138
     *
139
     * @param geometryType
140
     * @param geometrySubtype
141
     * @return
142
     */
143
    public boolean canWriteGeometry(
144
            int geometryType, 
145
            int geometrySubtype
146
    );
147

    
148
    public Connection getConnection() throws AccessResourceException;
149

    
150
    public Connection getConnectionWritable() throws AccessResourceException;
151

    
152
    public String getConnectionURL();
153
    
154
    public JDBCConnectionParameters getConnectionParameters();
155

    
156
    public void closeConnection(Connection connection);
157

    
158
    public void closeConnectionQuietly(Connection connection);
159

    
160
    public GeometryManager getGeometryManager();
161

    
162
    public ResulSetControler getResulSetControler();
163

    
164
    public String getSourceId();
165

    
166
    public ResourceProvider getResource();
167

    
168
    public void dispose();
169

    
170
    public void fetchFeature(
171
            FeatureProvider feature, 
172
            ResultSet rs,
173
            FeatureAttributeDescriptor[] columns,
174
            String[] extraValueNames
175
    ) throws DataException;
176
    
177
    public void fetchFeature(
178
            FeatureProvider feature, 
179
            ResultSetEntry rs
180
    ) throws DataException;
181

    
182
    public Geometry getGeometryFromColumn(
183
            ResultSet rs, 
184
            int index
185
    ) throws DataException;
186

    
187
    public Geometry getGeometryFromColumn(
188
            ResultSetEntry rs, 
189
            int index
190
    ) throws DataException;
191

    
192
    public OperationsFactory getOperations();
193

    
194
    public FeatureProvider createFeature(
195
            FeatureType featureType
196
    ) throws DataException;
197

    
198
    public JDBCStoreProvider createProvider(
199
            JDBCStoreParameters parameters,
200
            DataStoreProviderServices providerServices
201
    ) throws InitializeException;
202

    
203
    public JDBCServerExplorer createServerExplorer(
204
            JDBCServerExplorerParameters parameters, 
205
            DataServerExplorerProviderServices providerServices
206
    ) throws InitializeException;
207

    
208
    public SRSSolver getSRSSolver();
209
    
210
    public JDBCNewStoreParameters createNewStoreParameters();
211

    
212
    public JDBCStoreParameters createOpenStoreParameters();
213
    
214
    public JDBCStoreParameters createOpenStoreParameters(JDBCServerExplorerParameters serverParameters);
215
    
216
    public JDBCServerExplorerParameters createServerExplorerParameters();
217

    
218
    public String getSourceId(JDBCStoreParameters parameters);
219

    
220
    public boolean isThreadSafe();
221
    
222
    public void processSpecialFunctions(
223
            SQLBuilder sqlbuilder, 
224
            FeatureType type,
225
            List<String> extra_column_names // Output param
226
    );
227

    
228
    public void setTransaction(DataTransactionServices transaction);
229
    
230
    public void expandCalculedColumns(JDBCSQLBuilderBase sqlbuilder);
231
    
232
}