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

History | View | Annotate | Download (8.27 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.DataTransaction;
31
import org.gvsig.fmap.dal.DataTypes;
32
import org.gvsig.fmap.dal.exception.DataException;
33
import org.gvsig.fmap.dal.feature.FeatureLocks;
34
import org.gvsig.fmap.dal.feature.FeatureQuery;
35
import org.gvsig.fmap.dal.feature.FeatureSelection;
36
import org.gvsig.fmap.dal.feature.FeatureStore;
37
import org.gvsig.fmap.dal.feature.FeatureType;
38
import org.gvsig.fmap.dal.feature.FeatureType.FeatureTypeChanged;
39
import org.gvsig.fmap.dal.spi.DataStoreProvider;
40
import org.gvsig.fmap.dal.spi.DataTransactionServices;
41
import org.gvsig.fmap.geom.primitive.Envelope;
42

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

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

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

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

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

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

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

    
119
        public FeatureSetProvider createSet(FeatureQuery query,
120
                        FeatureType providerFeatureType, FeatureType storeFeatureType) throws DataException;
121

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

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

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

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

    
180
        /**
181
         * Returns this store's total envelope (extent).
182
         *
183
         * @return this store's total envelope (extent) or <code>null</code> if
184
         *         store not have geometry information
185
   * @throws org.gvsig.fmap.dal.exception.DataException
186
         */
187
        public Envelope getEnvelope() 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 endAppend() throws DataException;
225

    
226
        public void append(FeatureProvider featureProvider) throws DataException;
227
        
228
        public void abortAppend() throws DataException;
229

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

    
274
        public void passThroughUpdate(FeatureProvider featureProvider) throws DataException;
275

    
276
        public void passThroughDelete(FeatureReferenceProviderServices featureReference) throws DataException;
277

    
278
        public void passThroughDelete(Expression filter) throws DataException;
279

    
280
        public void passThroughUpdate(Object[] parameters, Expression filter);
281

    
282
}