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

History | View | Annotate | Download (5.15 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.cresques.cts.IProjection;
7
import org.gvsig.fmap.dal.exception.DataException;
8
import org.gvsig.fmap.dal.exception.InitializeException;
9
import org.gvsig.fmap.dal.ExpressionBuilder.GeometrySupportType;
10
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
11
import org.gvsig.fmap.dal.feature.FeatureType;
12
import org.gvsig.fmap.dal.feature.spi.FeatureProvider;
13
import org.gvsig.fmap.dal.resource.exception.AccessResourceException;
14
import org.gvsig.fmap.dal.resource.spi.ResourceProvider;
15
import org.gvsig.fmap.dal.spi.DataServerExplorerProviderServices;
16
import org.gvsig.fmap.dal.spi.DataStoreProviderServices;
17
import org.gvsig.fmap.dal.store.jdbc.JDBCConnectionParameters;
18
import org.gvsig.fmap.dal.store.jdbc.JDBCNewStoreParameters;
19
import org.gvsig.fmap.dal.store.jdbc.JDBCServerExplorerParameters;
20
import org.gvsig.fmap.dal.store.jdbc.JDBCStoreParameters;
21
import org.gvsig.fmap.dal.store.jdbc2.ResulSetControler.ResultSetEntry;
22
import org.gvsig.fmap.geom.Geometry;
23
import org.gvsig.fmap.geom.GeometryManager;
24

    
25
public interface JDBCHelper extends AutoCloseable {
26

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

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

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

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

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

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

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

    
87
    /**
88
     * Indica si la BBDD tiene soporte espacial.
89
     *
90
     * @return
91
     */
92
    public boolean hasSpatialFunctions();
93

    
94
    /**
95
     * Indica si podemos escribir el tipo de geometria indicado.
96
     *
97
     * @param geometryType
98
     * @param geometrySubtype
99
     * @return
100
     */
101
    public boolean canWriteGeometry(
102
            int geometryType, 
103
            int geometrySubtype
104
    );
105

    
106
    public Connection getConnection() throws AccessResourceException;
107

    
108
    public String getConnectionURL();
109
    
110
    public JDBCConnectionParameters getConnectionParameters();
111

    
112
    public void closeConnection(
113
            Connection connection
114
    );
115

    
116
    public GeometryManager getGeometryManager();
117

    
118
    public ResulSetControler getResulSetControler();
119

    
120
    public String getSourceId();
121

    
122
    public ResourceProvider getResource();
123

    
124
    public void dispose();
125

    
126
    public void fetchFeature(
127
            FeatureProvider feature, 
128
            ResultSet rs,
129
            FeatureAttributeDescriptor[] columns
130
    ) throws DataException;
131
    
132
    public void fetchFeature(
133
            FeatureProvider feature, 
134
            ResultSetEntry rs
135
    ) throws DataException;
136

    
137
    public Geometry getGeometryFromColumn(
138
            ResultSet rs, 
139
            int index
140
    ) throws DataException;
141

    
142
    public Geometry getGeometryFromColumn(
143
            ResultSetEntry rs, 
144
            int index
145
    ) throws DataException;
146

    
147
    public OperationsFactory getOperations();
148

    
149
    public FeatureProvider createFeature(
150
            FeatureType featureType
151
    ) throws DataException;
152

    
153
    public JDBCStoreProvider createProvider(
154
            JDBCStoreParameters parameters,
155
            DataStoreProviderServices providerServices
156
    ) throws InitializeException;
157

    
158
    public JDBCServerExplorer createServerExplorer(
159
            JDBCServerExplorerParameters parameters, 
160
            DataServerExplorerProviderServices providerServices
161
    ) throws InitializeException;
162

    
163
    public String getDatabaseCodeFromProyection(IProjection proj);
164
    
165
    public IProjection getProjectionFromDatabaseCode(String databaseCode);
166
    
167
    /**
168
     * @param crs
169
     * @return 
170
     * @deprecated use getDatabaseCodeFromProyection
171
     */
172
    public int getSRSCode(IProjection crs);
173
    
174
    /**
175
     * @param srsid
176
     * @return 
177
     * @deprecated use getProjectionFromDatabaseCode
178
     */
179
    public IProjection getProjectionFromSRSId(int srsid);
180

    
181
    public JDBCNewStoreParameters createNewStoreParameters();
182

    
183
    public JDBCStoreParameters createOpenStoreParameters();
184
    
185
    public JDBCServerExplorerParameters createServerExplorerParameters();
186

    
187
    public String getSourceId(JDBCStoreParameters parameters);
188

    
189
}