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 45065 jjdelcerro
/**
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 43020 jjdelcerro
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 44682 jjdelcerro
import java.util.List;
30 44644 jjdelcerro
import org.gvsig.expressionevaluator.GeometryExpressionBuilderHelper.GeometrySupportType;
31 44376 jjdelcerro
import org.gvsig.fmap.dal.SQLBuilder;
32 43020 jjdelcerro
import org.gvsig.fmap.dal.exception.DataException;
33
import org.gvsig.fmap.dal.exception.InitializeException;
34 43358 jjdelcerro
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
35 44191 jjdelcerro
import org.gvsig.fmap.dal.feature.FeatureQueryOrder;
36 43020 jjdelcerro
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 45650 jjdelcerro
import org.gvsig.fmap.dal.spi.DataTransactionServices;
43 43035 jjdelcerro
import org.gvsig.fmap.dal.store.jdbc.JDBCConnectionParameters;
44 43020 jjdelcerro
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 43606 jjdelcerro
import org.gvsig.fmap.dal.store.jdbc2.spi.SRSSolver;
51 44191 jjdelcerro
import org.gvsig.tools.evaluator.Evaluator;
52 43020 jjdelcerro
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 45152 fdiaz
     * Devuelve un SQLBuilder adaptado al proveedor. Por ejemplo, uno especifico
74 43020 jjdelcerro
     * para PostgreSQL, MySQL, Oracle, MSSQLServer...
75
     *
76
     * @return
77
     */
78
    public JDBCSQLBuilderBase createSQLBuilder();
79
80
    /**
81 45152 fdiaz
     * Devuelve las comillas que han de usaese para los identificadores.
82 43020 jjdelcerro
     *
83
     * @return
84
     */
85
    public String getQuoteForIdentifiers();
86
87
    /**
88 45152 fdiaz
     * Devuelve las comillas que han de usaese en las constantes de cadena.
89 43020 jjdelcerro
     *
90
     * @return
91
     */
92
    public String getQuoteForStrings();
93 45152 fdiaz
94
    public FeatureType getProviderFeatureType();
95
96
    /**
97
     * @param providerFeatureType the providerFeatureType to set
98
     */
99
    public void setProviderFeatureType(FeatureType providerFeatureType);
100 43020 jjdelcerro
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 44198 jjdelcerro
    public boolean supportFilter(FeatureType type, Evaluator evaluator);
130 44191 jjdelcerro
131 46010 jjdelcerro
    public boolean supportExpression(final FeatureType type, String sql);
132 45999 omartinez
133 44198 jjdelcerro
    public boolean supportOrder(FeatureType type, FeatureQueryOrder order);
134 44191 jjdelcerro
135
    public boolean allowNestedOperations();
136 43020 jjdelcerro
    /**
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 43377 jjdelcerro
    public Connection getConnectionWritable() throws AccessResourceException;
151
152 43035 jjdelcerro
    public String getConnectionURL();
153
154
    public JDBCConnectionParameters getConnectionParameters();
155
156 44191 jjdelcerro
    public void closeConnection(Connection connection);
157 43020 jjdelcerro
158 44191 jjdelcerro
    public void closeConnectionQuietly(Connection connection);
159
160 43020 jjdelcerro
    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 43358 jjdelcerro
            ResultSet rs,
173 44376 jjdelcerro
            FeatureAttributeDescriptor[] columns,
174
            String[] extraValueNames
175 43020 jjdelcerro
    ) throws DataException;
176 43358 jjdelcerro
177 43020 jjdelcerro
    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 43606 jjdelcerro
    public SRSSolver getSRSSolver();
209
210 43020 jjdelcerro
    public JDBCNewStoreParameters createNewStoreParameters();
211
212
    public JDBCStoreParameters createOpenStoreParameters();
213
214 45165 jjdelcerro
    public JDBCStoreParameters createOpenStoreParameters(JDBCServerExplorerParameters serverParameters);
215
216 43020 jjdelcerro
    public JDBCServerExplorerParameters createServerExplorerParameters();
217
218
    public String getSourceId(JDBCStoreParameters parameters);
219
220 44198 jjdelcerro
    public boolean isThreadSafe();
221 44376 jjdelcerro
222 44748 jjdelcerro
    public void processSpecialFunctions(
223 44682 jjdelcerro
            SQLBuilder sqlbuilder,
224
            FeatureType type,
225
            List<String> extra_column_names // Output param
226
    );
227 45650 jjdelcerro
228
    public void setTransaction(DataTransactionServices transaction);
229 44682 jjdelcerro
230 46104 omartinez
    public void expandCalculedColumns(JDBCSQLBuilderBase sqlbuilder);
231
232 43020 jjdelcerro
}