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

History | View | Annotate | Download (8.05 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
        /**
120
         * Return {@link FeatureProvider} from a
121
         * {@link FeatureReferenceProviderServices} using
122
         * {@link FeatureStore#getDefaultFeatureType()} as {@link FeatureType}
123
         *
124
         * @param reference
125
         * @return
126
         * @throws DataException
127
         */
128
        public FeatureProvider getFeatureProviderByReference(FeatureReferenceProviderServices reference)
129
                        throws DataException;
130

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

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

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

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

    
186
        /**
187
         * Informs if store supports locks
188
         *
189
         * @return
190
         */
191
        public boolean isLocksSupported();
192

    
193
        /**
194
         * Return {@link FeatureStoreProviderServices} for this store
195
         *
196
         * @return
197
         */
198
        public FeatureStoreProviderServices getStoreServices();
199

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

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

    
216

    
217
        public boolean supportsAppendMode();
218

    
219
        public void beginAppend() throws DataException;
220

    
221
        public void endAppend() throws DataException;
222

    
223
        public void append(FeatureProvider featureProvider) throws DataException;
224
        
225
        public void abortAppend() throws DataException;
226

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

    
271
        public void passThroughUpdate(FeatureProvider featureProvider) throws DataException;
272

    
273
        public void passThroughDelete(FeatureReferenceProviderServices featureReference) throws DataException;
274

    
275
        public void passThroughUpdate(Object[] parameters, Expression filter);
276

    
277
}