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

History | View | Annotate | Download (5.39 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 org.gvsig.expressionevaluator.GeometryExpressionBuilderHelper.GeometrySupportType;
7
import org.gvsig.fmap.dal.SQLBuilder;
8
import org.gvsig.fmap.dal.exception.DataException;
9
import org.gvsig.fmap.dal.exception.InitializeException;
10
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
11
import org.gvsig.fmap.dal.feature.FeatureQueryOrder;
12
import org.gvsig.fmap.dal.feature.FeatureType;
13
import org.gvsig.fmap.dal.feature.spi.FeatureProvider;
14
import org.gvsig.fmap.dal.resource.exception.AccessResourceException;
15
import org.gvsig.fmap.dal.resource.spi.ResourceProvider;
16
import org.gvsig.fmap.dal.spi.DataServerExplorerProviderServices;
17
import org.gvsig.fmap.dal.spi.DataStoreProviderServices;
18
import org.gvsig.fmap.dal.store.jdbc.JDBCConnectionParameters;
19
import org.gvsig.fmap.dal.store.jdbc.JDBCNewStoreParameters;
20
import org.gvsig.fmap.dal.store.jdbc.JDBCServerExplorerParameters;
21
import org.gvsig.fmap.dal.store.jdbc.JDBCStoreParameters;
22
import org.gvsig.fmap.dal.store.jdbc2.ResulSetControler.ResultSetEntry;
23
import org.gvsig.fmap.geom.Geometry;
24
import org.gvsig.fmap.geom.GeometryManager;
25
import org.gvsig.fmap.dal.store.jdbc2.spi.SRSSolver;
26
import org.gvsig.tools.evaluator.Evaluator;
27

    
28
public interface JDBCHelper extends AutoCloseable {
29

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

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

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

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

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

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

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

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

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

    
114
    public Connection getConnection() throws AccessResourceException;
115

    
116
    public Connection getConnectionWritable() throws AccessResourceException;
117

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

    
122
    public void closeConnection(Connection connection);
123

    
124
    public void closeConnectionQuietly(Connection connection);
125

    
126
    public GeometryManager getGeometryManager();
127

    
128
    public ResulSetControler getResulSetControler();
129

    
130
    public String getSourceId();
131

    
132
    public ResourceProvider getResource();
133

    
134
    public void dispose();
135

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

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

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

    
158
    public OperationsFactory getOperations();
159

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

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

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

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

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

    
182
    public String getSourceId(JDBCStoreParameters parameters);
183

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