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

History | View | Annotate | Download (6.75 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.store.jdbc.JDBCConnectionParameters;
43
import org.gvsig.fmap.dal.store.jdbc.JDBCNewStoreParameters;
44
import org.gvsig.fmap.dal.store.jdbc.JDBCServerExplorerParameters;
45
import org.gvsig.fmap.dal.store.jdbc.JDBCStoreParameters;
46
import org.gvsig.fmap.dal.store.jdbc2.ResulSetControler.ResultSetEntry;
47
import org.gvsig.fmap.geom.Geometry;
48
import org.gvsig.fmap.geom.GeometryManager;
49
import org.gvsig.fmap.dal.store.jdbc2.spi.SRSSolver;
50
import org.gvsig.tools.evaluator.Evaluator;
51

    
52
public interface JDBCHelper extends AutoCloseable {
53

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

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

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

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

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

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

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

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

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

    
145
    public Connection getConnection() throws AccessResourceException;
146

    
147
    public Connection getConnectionWritable() throws AccessResourceException;
148

    
149
    public String getConnectionURL();
150
    
151
    public JDBCConnectionParameters getConnectionParameters();
152

    
153
    public void closeConnection(Connection connection);
154

    
155
    public void closeConnectionQuietly(Connection connection);
156

    
157
    public GeometryManager getGeometryManager();
158

    
159
    public ResulSetControler getResulSetControler();
160

    
161
    public String getSourceId();
162

    
163
    public ResourceProvider getResource();
164

    
165
    public void dispose();
166

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

    
179
    public Geometry getGeometryFromColumn(
180
            ResultSet rs, 
181
            int index
182
    ) throws DataException;
183

    
184
    public Geometry getGeometryFromColumn(
185
            ResultSetEntry rs, 
186
            int index
187
    ) throws DataException;
188

    
189
    public OperationsFactory getOperations();
190

    
191
    public FeatureProvider createFeature(
192
            FeatureType featureType
193
    ) throws DataException;
194

    
195
    public JDBCStoreProvider createProvider(
196
            JDBCStoreParameters parameters,
197
            DataStoreProviderServices providerServices
198
    ) throws InitializeException;
199

    
200
    public JDBCServerExplorer createServerExplorer(
201
            JDBCServerExplorerParameters parameters, 
202
            DataServerExplorerProviderServices providerServices
203
    ) throws InitializeException;
204

    
205
    public SRSSolver getSRSSolver();
206
    
207
    public JDBCNewStoreParameters createNewStoreParameters();
208

    
209
    public JDBCStoreParameters createOpenStoreParameters();
210
    
211
    public JDBCStoreParameters createOpenStoreParameters(JDBCServerExplorerParameters serverParameters);
212
    
213
    public JDBCServerExplorerParameters createServerExplorerParameters();
214

    
215
    public String getSourceId(JDBCStoreParameters parameters);
216

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