Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.compat.cdc / org.gvsig.fmap.dal / org.gvsig.fmap.dal.spi / src / main / java / org / gvsig / fmap / dal / feature / spi / FeatureStoreProvider.java @ 47779

History | View | Annotate | Download (8.4 KB)

1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 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

    
25
package org.gvsig.fmap.dal.feature.spi;
26

    
27
import java.util.Iterator;
28
import org.gvsig.expressionevaluator.Expression;
29
import org.gvsig.fmap.dal.DataStoreParameters;
30
import org.gvsig.fmap.dal.DataTypes;
31
import org.gvsig.fmap.dal.exception.DataException;
32
import org.gvsig.fmap.dal.feature.FeatureLocks;
33
import org.gvsig.fmap.dal.feature.FeatureQuery;
34
import org.gvsig.fmap.dal.feature.FeatureSelection;
35
import org.gvsig.fmap.dal.feature.FeatureStore;
36
import org.gvsig.fmap.dal.feature.FeatureType;
37
import org.gvsig.fmap.dal.feature.FeatureType.FeatureTypeChanged;
38
import org.gvsig.fmap.dal.spi.DataStoreProvider;
39
import org.gvsig.fmap.geom.primitive.Envelope;
40

    
41
/**
42
 *
43
 * Interface for all feature based data providers.<br>
44
 * <br>
45
 * 
46
 * 
47
 * A FeatureStoreProvier must have a contructor like this:<br>
48
 * <br>
49
 * <code>
50
 * FeatureStoreProvider({@link DataStoreParameters}, {@link FeatureStoreProviderServices})
51
 * </code>
52
 * 
53
 */
54
public interface FeatureStoreProvider extends DataStoreProvider {
55

    
56
        /**
57
         * Return a new OID valid for a new feature.
58
         *
59
         * @return a new OID
60
         * @see {@link FeatureStoreProvider#getOIDType()}
61
         */
62
        public Object createNewOID();
63

    
64
        /**
65
         * Return OID data type (from {@link DataTypes}) of this store.
66
         *
67
         * @return OID data type
68
         * @see {@link FeatureStoreProvider#createNewOID()} {@link DataTypes}
69
         */
70
        public int getOIDType();
71

    
72
        /**
73
         * Factory of {@link FeatureProvider}. 
74
   * Create a new {@link FeatureProvider} instance valid for this Store.
75
         *
76
         * @param type, {@link FeatureType} of the {@link FeatureProvider}
77
         * @return
78
         * @throws DataException
79
         */
80
        public FeatureProvider createFeatureProvider(FeatureType type) throws DataException;
81

    
82
        /**
83
         * Factory of {@link FeatureSelection}. Create a new
84
         * {@link FeatureSelection} instance valid for this Store.
85
         *
86
         * @return
87
         * @throws DataException
88
         */
89
        public FeatureSelection createFeatureSelection() throws DataException;
90

    
91
        /**
92
         * Factory of {@link FeatureLocks}. Create a new {@link FeatureLocks}
93
         * instance valid for this Store.
94
         *
95
         *
96
         * @return {@link FeatureLocks} or <code>null</code> if not
97
         *         {@link FeatureStoreProvider#isLocksSupported()}
98
         * @throws DataException
99
         */
100
        public FeatureLocks createFeatureLocks() throws DataException;
101

    
102
        /**
103
         * Factory of {@link FeatureSetProvider}. Create a new
104
         * {@link FeatureSetProvider} that represents result of {@link FeatureQuery}
105
         * .
106
         *
107
         * @param query
108
         *            (never will be null)
109
         * @param featureType
110
         *            (never will be null)
111
         * @return
112
         * @throws DataException
113
         */
114
        public FeatureSetProvider createSet(FeatureQuery query,
115
                        FeatureType featureType) throws DataException;
116

    
117
        public FeatureSetProvider createSet(FeatureQuery query,
118
                        FeatureType providerFeatureType, FeatureType storeFeatureType) throws DataException;
119

    
120
        /**
121
         * Return {@link FeatureProvider} from a
122
         * {@link FeatureReferenceProviderServices} using
123
         * {@link FeatureStore#getDefaultFeatureType()} as {@link FeatureType}
124
         *
125
         * @param reference
126
         * @return
127
         * @throws DataException
128
         */
129
        public FeatureProvider getFeatureProviderByReference(FeatureReferenceProviderServices reference)
130
                        throws DataException;
131

    
132
        /**
133
         * Return {@link FeatureProvider} from a
134
         * {@link FeatureReferenceProviderServices} using <code>featureType</code>
135
         * as {@link FeatureType}
136
         *
137
         * @param reference
138
   * @param featureType
139
         * @return
140
         * @throws DataException
141
         */
142
        public FeatureProvider getFeatureProviderByReference(
143
                        FeatureReferenceProviderServices reference, FeatureType featureType)
144
                        throws DataException;
145
        /**
146
         * Informs that store supports write.
147
         *
148
         * @return true if write is supported
149
         */
150
        public boolean allowWrite();
151

    
152
        /**
153
         *Informs that store supports write a geometry.
154
         *
155
         * @param geometryType
156
         * @param geometrySubType
157
         * @return
158
         * @throws DataException
159
         */
160
        public boolean canWriteGeometry(int geometryType, int geometrySubType) throws DataException;
161

    
162
        /**
163
         * Perform changes on store.
164
         *
165
         * @param deleteds
166
         *            iterator of {@link FeatureReferenceProviderServices}
167
         * @param inserteds
168
         *            iterator of {@link FeatureProvider}
169
         * @param updateds
170
         *            iterator of {@link FeatureProvider}
171
         * @param featureTypesChanged
172
         *            iterator of {@link FeatureTypeChanged}
173
         *
174
         * @throws DataException
175
         */
176
        public void performChanges(Iterator deleteds, Iterator inserteds, Iterator updateds, Iterator featureTypesChanged) throws DataException;
177

    
178
        /**
179
         * Returns this store's total envelope (extent).
180
         *
181
         * @return this store's total envelope (extent) or <code>null</code> if
182
         *         store not have geometry information
183
   * @throws org.gvsig.fmap.dal.exception.DataException
184
         */
185
        public Envelope getEnvelope() throws DataException;
186
        
187
    public Envelope getEnvelope(String geomname) throws DataException;
188

    
189
        /**
190
         * Informs if store supports locks
191
         *
192
         * @return
193
         */
194
        public boolean isLocksSupported();
195

    
196
        /**
197
         * Return {@link FeatureStoreProviderServices} for this store
198
         *
199
         * @return
200
         */
201
        public FeatureStoreProviderServices getStoreServices();
202

    
203
        /**
204
         * Inform if the store provider supports automatic values for attributues
205
         * (autonumeric)
206
         *
207
         * @return <code>true</code> if supported
208
         */
209
        public boolean allowAutomaticValues();
210

    
211
        /**
212
         * Returns total feature count of this store.
213
         *
214
         * @return
215
         * @throws DataException
216
         */
217
        public long getFeatureCount() throws DataException;
218

    
219

    
220
        public boolean supportsAppendMode();
221

    
222
        public void beginAppend() throws DataException;
223

    
224
        public void beginAppend(int submode) throws DataException;
225

    
226
        public void endAppend() throws DataException;
227

    
228
        public void append(FeatureProvider featureProvider) throws DataException;
229
        
230
        public void abortAppend() throws DataException;
231

    
232
        /**
233
         * Return if the provider knows the real envelope of a layer. If not,
234
         * the {@link FeatureStoreProvider#getEnvelope()} method doesn't return
235
         * the full envelope.
236
         * 
237
         * @return true if it knows the real envelope.
238
         */
239
        public boolean isKnownEnvelope(); 
240
        
241
        /**
242
         * Return if the maximum number of features provided by the
243
         * provider are limited.
244
         * 
245
         * @return true if there is a limit of features.
246
         */
247
        public boolean hasRetrievedFeaturesLimit();
248
        
249
        /**
250
         * If the {@link FeatureStoreProvider#hasRetrievedFeaturesLimit()} returns true,
251
         * it returns the limit of features retrieved from the provider.
252
         * @return
253
         * The limit of the retrieved features.
254
         */
255
        public int getRetrievedFeaturesLimit();
256
        
257
        public FeatureStore getFeatureStore();
258
        
259
        public DataStoreParameters getParameters();
260
        
261
        /**
262
         * Indicates if the storage is temporary.
263
         * There is no guarantee that a temporary store can be recovered from 
264
         * its parameters. In general these will not be persistent.
265
         * 
266
         * @return true if the store is temporary, otherwise false.
267
         */
268
        public boolean isTemporary();      
269
        
270
        public void fixFeatureTypeFromParameters();
271
        
272
             public boolean supportsPassThroughMode();
273
        
274
        public void passThroughInsert(FeatureProvider featureProvider) throws DataException;
275

    
276
        public void passThroughInsertOrUpdate(FeatureProvider featureProvider) throws DataException;
277

    
278
        public void passThroughUpdate(FeatureProvider featureProvider) throws DataException;
279

    
280
        public void passThroughDelete(FeatureReferenceProviderServices featureReference) throws DataException;
281

    
282
        public void passThroughDelete(Expression filter) throws DataException;
283

    
284
        public void passThroughUpdate(Object[] parameters, Expression filter);
285
        
286
}