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

History | View | Annotate | Download (6.44 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
     * Devuelbe 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
     * Devueble las comillas que han de usaese para los identificadores.
81
     *
82
     * @return
83
     */
84
    public String getQuoteForIdentifiers();
85

    
86
    /**
87
     * Devueble las comillas que han de usaese en las constantes de cadena.
88
     *
89
     * @return
90
     */
91
    public String getQuoteForStrings();
92

    
93
    /**
94
     * Indica si la BBDD soporta valores automaticos, tipo serial.
95
     *
96
     * @return
97
     */
98
    public boolean allowAutomaticValues();
99

    
100
    /**
101
     * Indica si la BBDD soporta el uso de OFFSET en la sentencia select.
102
     *
103
     * @return
104
     */
105
    public boolean supportOffsetInSelect();
106

    
107
    /**
108
     * Indica si se especifico un subquery al abrir el proveedor.
109
     *
110
     * @return
111
     */
112
    public boolean useSubquery();
113

    
114
    /**
115
     * Indica si la BBDD tiene soporte espacial.
116
     *
117
     * @return
118
     */
119
    public boolean hasSpatialFunctions();
120

    
121
    public boolean supportFilter(FeatureType type, Evaluator evaluator);
122
    
123
    public boolean supportOrder(FeatureType type, FeatureQueryOrder order);
124
    
125
    public boolean allowNestedOperations();
126
    /**
127
     * Indica si podemos escribir el tipo de geometria indicado.
128
     *
129
     * @param geometryType
130
     * @param geometrySubtype
131
     * @return
132
     */
133
    public boolean canWriteGeometry(
134
            int geometryType, 
135
            int geometrySubtype
136
    );
137

    
138
    public Connection getConnection() throws AccessResourceException;
139

    
140
    public Connection getConnectionWritable() throws AccessResourceException;
141

    
142
    public String getConnectionURL();
143
    
144
    public JDBCConnectionParameters getConnectionParameters();
145

    
146
    public void closeConnection(Connection connection);
147

    
148
    public void closeConnectionQuietly(Connection connection);
149

    
150
    public GeometryManager getGeometryManager();
151

    
152
    public ResulSetControler getResulSetControler();
153

    
154
    public String getSourceId();
155

    
156
    public ResourceProvider getResource();
157

    
158
    public void dispose();
159

    
160
    public void fetchFeature(
161
            FeatureProvider feature, 
162
            ResultSet rs,
163
            FeatureAttributeDescriptor[] columns,
164
            String[] extraValueNames
165
    ) throws DataException;
166
    
167
    public void fetchFeature(
168
            FeatureProvider feature, 
169
            ResultSetEntry rs
170
    ) throws DataException;
171

    
172
    public Geometry getGeometryFromColumn(
173
            ResultSet rs, 
174
            int index
175
    ) throws DataException;
176

    
177
    public Geometry getGeometryFromColumn(
178
            ResultSetEntry rs, 
179
            int index
180
    ) throws DataException;
181

    
182
    public OperationsFactory getOperations();
183

    
184
    public FeatureProvider createFeature(
185
            FeatureType featureType
186
    ) throws DataException;
187

    
188
    public JDBCStoreProvider createProvider(
189
            JDBCStoreParameters parameters,
190
            DataStoreProviderServices providerServices
191
    ) throws InitializeException;
192

    
193
    public JDBCServerExplorer createServerExplorer(
194
            JDBCServerExplorerParameters parameters, 
195
            DataServerExplorerProviderServices providerServices
196
    ) throws InitializeException;
197

    
198
    public SRSSolver getSRSSolver();
199
    
200
    public JDBCNewStoreParameters createNewStoreParameters();
201

    
202
    public JDBCStoreParameters createOpenStoreParameters();
203
    
204
    public JDBCServerExplorerParameters createServerExplorerParameters();
205

    
206
    public String getSourceId(JDBCStoreParameters parameters);
207

    
208
    public boolean isThreadSafe();
209
    
210
    public void processSpecialFunctions(
211
            SQLBuilder sqlbuilder, 
212
            FeatureType type,
213
            List<String> extra_column_names // Output param
214
    );
215
    
216
}