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 @ 46517
History | View | Annotate | Download (8.13 KB)
1 | 40559 | jjdelcerro | /**
|
---|---|---|---|
2 | * gvSIG. Desktop Geographic Information System.
|
||
3 | 40435 | jjdelcerro | *
|
4 | 40559 | jjdelcerro | * Copyright (C) 2007-2013 gvSIG Association.
|
5 | 40435 | jjdelcerro | *
|
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 | 40559 | jjdelcerro | * as published by the Free Software Foundation; either version 3
|
9 | 40435 | jjdelcerro | * 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 | 40559 | jjdelcerro | * For any additional information, do not hesitate to contact us
|
22 | * at info AT gvsig.com, or visit our website www.gvsig.com.
|
||
23 | 40435 | jjdelcerro | */
|
24 | |||
25 | package org.gvsig.fmap.dal.feature.spi; |
||
26 | |||
27 | import java.util.Iterator; |
||
28 | 45473 | fdiaz | import org.gvsig.expressionevaluator.Expression; |
29 | 40435 | jjdelcerro | import org.gvsig.fmap.dal.DataStoreParameters; |
30 | 45650 | jjdelcerro | import org.gvsig.fmap.dal.DataTransaction; |
31 | 40435 | jjdelcerro | 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 | 45425 | jjdelcerro | import org.gvsig.fmap.dal.feature.FeatureType.FeatureTypeChanged; |
39 | 40435 | jjdelcerro | import org.gvsig.fmap.dal.spi.DataStoreProvider; |
40 | 45650 | jjdelcerro | import org.gvsig.fmap.dal.spi.DataTransactionServices; |
41 | 40435 | jjdelcerro | 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 | 44871 | jjdelcerro | * Factory of {@link FeatureProvider}.
|
76 | * Create a new {@link FeatureProvider} instance valid for this Store.
|
||
77 | 40435 | jjdelcerro | *
|
78 | 44871 | jjdelcerro | * @param type, {@link FeatureType} of the {@link FeatureProvider}
|
79 | 40435 | jjdelcerro | * @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 | 44871 | jjdelcerro | * @param featureType
|
138 | 40435 | jjdelcerro | * @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 | 44871 | jjdelcerro | * @return true if write is supported
|
148 | 40435 | jjdelcerro | */
|
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 | 44871 | jjdelcerro | * @throws org.gvsig.fmap.dal.exception.DataException
|
183 | 40435 | jjdelcerro | */
|
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 | 41536 | jjdelcerro | |
225 | public void abortAppend() throws DataException; |
||
226 | 40435 | jjdelcerro | |
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 | 44871 | jjdelcerro | * @return true if it knows the real envelope.
|
233 | 40435 | jjdelcerro | */
|
234 | public boolean isKnownEnvelope(); |
||
235 | |||
236 | /**
|
||
237 | * Return if the maximum number of features provided by the
|
||
238 | * provider are limited.
|
||
239 | *
|
||
240 | 44871 | jjdelcerro | * @return true if there is a limit of features.
|
241 | 40435 | jjdelcerro | */
|
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 | 43020 | jjdelcerro | |
252 | public FeatureStore getFeatureStore();
|
||
253 | |||
254 | public DataStoreParameters getParameters();
|
||
255 | 44443 | jjdelcerro | |
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 | 45359 | omartinez | public boolean isTemporary(); |
264 | |||
265 | public void fixFeatureTypeFromParameters(); |
||
266 | 45425 | jjdelcerro | |
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 | 46369 | fdiaz | public void passThroughDelete(Expression filter) throws DataException; |
276 | |||
277 | 45473 | fdiaz | public void passThroughUpdate(Object[] parameters, Expression filter); |
278 | |||
279 | 40435 | jjdelcerro | } |