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 @ 44871
History | View | Annotate | Download (7.35 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 | |||
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.spi.DataStoreProvider; |
||
38 | import org.gvsig.fmap.geom.primitive.Envelope; |
||
39 | |||
40 | /**
|
||
41 | *
|
||
42 | * Interface for all feature based data providers.<br>
|
||
43 | * <br>
|
||
44 | *
|
||
45 | *
|
||
46 | * A FeatureStoreProvier must have a contructor like this:<br>
|
||
47 | * <br>
|
||
48 | * <code>
|
||
49 | * FeatureStoreProvider({@link DataStoreParameters}, {@link FeatureStoreProviderServices})
|
||
50 | * </code>
|
||
51 | *
|
||
52 | */
|
||
53 | public interface FeatureStoreProvider extends DataStoreProvider { |
||
54 | |||
55 | /**
|
||
56 | * Return a new OID valid for a new feature.
|
||
57 | *
|
||
58 | * @return a new OID
|
||
59 | * @see {@link FeatureStoreProvider#getOIDType()}
|
||
60 | */
|
||
61 | public Object createNewOID(); |
||
62 | |||
63 | /**
|
||
64 | * Return OID data type (from {@link DataTypes}) of this store.
|
||
65 | *
|
||
66 | * @return OID data type
|
||
67 | * @see {@link FeatureStoreProvider#createNewOID()} {@link DataTypes}
|
||
68 | */
|
||
69 | public int getOIDType(); |
||
70 | |||
71 | /**
|
||
72 | 44871 | jjdelcerro | * Factory of {@link FeatureProvider}.
|
73 | * Create a new {@link FeatureProvider} instance valid for this Store.
|
||
74 | 40435 | jjdelcerro | *
|
75 | 44871 | jjdelcerro | * @param type, {@link FeatureType} of the {@link FeatureProvider}
|
76 | 40435 | jjdelcerro | * @return
|
77 | * @throws DataException
|
||
78 | */
|
||
79 | public FeatureProvider createFeatureProvider(FeatureType type) throws DataException; |
||
80 | |||
81 | /**
|
||
82 | * Factory of {@link FeatureSelection}. Create a new
|
||
83 | * {@link FeatureSelection} instance valid for this Store.
|
||
84 | *
|
||
85 | * @return
|
||
86 | * @throws DataException
|
||
87 | */
|
||
88 | public FeatureSelection createFeatureSelection() throws DataException; |
||
89 | |||
90 | /**
|
||
91 | * Factory of {@link FeatureLocks}. Create a new {@link FeatureLocks}
|
||
92 | * instance valid for this Store.
|
||
93 | *
|
||
94 | *
|
||
95 | * @return {@link FeatureLocks} or <code>null</code> if not
|
||
96 | * {@link FeatureStoreProvider#isLocksSupported()}
|
||
97 | * @throws DataException
|
||
98 | */
|
||
99 | public FeatureLocks createFeatureLocks() throws DataException; |
||
100 | |||
101 | /**
|
||
102 | * Factory of {@link FeatureSetProvider}. Create a new
|
||
103 | * {@link FeatureSetProvider} that represents result of {@link FeatureQuery}
|
||
104 | * .
|
||
105 | *
|
||
106 | * @param query
|
||
107 | * (never will be null)
|
||
108 | * @param featureType
|
||
109 | * (never will be null)
|
||
110 | * @return
|
||
111 | * @throws DataException
|
||
112 | */
|
||
113 | public FeatureSetProvider createSet(FeatureQuery query,
|
||
114 | FeatureType featureType) throws DataException;
|
||
115 | |||
116 | /**
|
||
117 | * Return {@link FeatureProvider} from a
|
||
118 | * {@link FeatureReferenceProviderServices} using
|
||
119 | * {@link FeatureStore#getDefaultFeatureType()} as {@link FeatureType}
|
||
120 | *
|
||
121 | * @param reference
|
||
122 | * @return
|
||
123 | * @throws DataException
|
||
124 | */
|
||
125 | public FeatureProvider getFeatureProviderByReference(FeatureReferenceProviderServices reference)
|
||
126 | throws DataException;
|
||
127 | |||
128 | /**
|
||
129 | * Return {@link FeatureProvider} from a
|
||
130 | * {@link FeatureReferenceProviderServices} using <code>featureType</code>
|
||
131 | * as {@link FeatureType}
|
||
132 | *
|
||
133 | * @param reference
|
||
134 | 44871 | jjdelcerro | * @param featureType
|
135 | 40435 | jjdelcerro | * @return
|
136 | * @throws DataException
|
||
137 | */
|
||
138 | public FeatureProvider getFeatureProviderByReference(
|
||
139 | FeatureReferenceProviderServices reference, FeatureType featureType) |
||
140 | throws DataException;
|
||
141 | /**
|
||
142 | * Informs that store supports write.
|
||
143 | *
|
||
144 | 44871 | jjdelcerro | * @return true if write is supported
|
145 | 40435 | jjdelcerro | */
|
146 | public boolean allowWrite(); |
||
147 | |||
148 | /**
|
||
149 | *Informs that store supports write a geometry.
|
||
150 | *
|
||
151 | * @param geometryType
|
||
152 | * @param geometrySubType
|
||
153 | * @return
|
||
154 | * @throws DataException
|
||
155 | */
|
||
156 | public boolean canWriteGeometry(int geometryType, int geometrySubType) throws DataException; |
||
157 | |||
158 | /**
|
||
159 | * Perform changes on store.
|
||
160 | *
|
||
161 | * @param deleteds
|
||
162 | * iterator of {@link FeatureReferenceProviderServices}
|
||
163 | * @param inserteds
|
||
164 | * iterator of {@link FeatureProvider}
|
||
165 | * @param updateds
|
||
166 | * iterator of {@link FeatureProvider}
|
||
167 | * @param featureTypesChanged
|
||
168 | * iterator of {@link FeatureTypeChanged}
|
||
169 | *
|
||
170 | * @throws DataException
|
||
171 | */
|
||
172 | public void performChanges(Iterator deleteds, Iterator inserteds, Iterator updateds, Iterator featureTypesChanged) throws DataException; |
||
173 | |||
174 | /**
|
||
175 | * Returns this store's total envelope (extent).
|
||
176 | *
|
||
177 | * @return this store's total envelope (extent) or <code>null</code> if
|
||
178 | * store not have geometry information
|
||
179 | 44871 | jjdelcerro | * @throws org.gvsig.fmap.dal.exception.DataException
|
180 | 40435 | jjdelcerro | */
|
181 | public Envelope getEnvelope() throws DataException; |
||
182 | |||
183 | /**
|
||
184 | * Informs if store supports locks
|
||
185 | *
|
||
186 | * @return
|
||
187 | */
|
||
188 | public boolean isLocksSupported(); |
||
189 | |||
190 | /**
|
||
191 | * Return {@link FeatureStoreProviderServices} for this store
|
||
192 | *
|
||
193 | * @return
|
||
194 | */
|
||
195 | public FeatureStoreProviderServices getStoreServices();
|
||
196 | |||
197 | /**
|
||
198 | * Inform if the store provider supports automatic values for attributues
|
||
199 | * (autonumeric)
|
||
200 | *
|
||
201 | * @return <code>true</code> if supported
|
||
202 | */
|
||
203 | public boolean allowAutomaticValues(); |
||
204 | |||
205 | /**
|
||
206 | * Returns total feature count of this store.
|
||
207 | *
|
||
208 | * @return
|
||
209 | * @throws DataException
|
||
210 | */
|
||
211 | public long getFeatureCount() throws DataException; |
||
212 | |||
213 | |||
214 | public boolean supportsAppendMode(); |
||
215 | |||
216 | public void beginAppend() throws DataException; |
||
217 | |||
218 | public void endAppend() throws DataException; |
||
219 | |||
220 | public void append(FeatureProvider featureProvider) throws DataException; |
||
221 | 41536 | jjdelcerro | |
222 | public void abortAppend() throws DataException; |
||
223 | 40435 | jjdelcerro | |
224 | /**
|
||
225 | * Return if the provider knows the real envelope of a layer. If not,
|
||
226 | * the {@link FeatureStoreProvider#getEnvelope()} method doesn't return
|
||
227 | * the full envelope.
|
||
228 | *
|
||
229 | 44871 | jjdelcerro | * @return true if it knows the real envelope.
|
230 | 40435 | jjdelcerro | */
|
231 | public boolean isKnownEnvelope(); |
||
232 | |||
233 | /**
|
||
234 | * Return if the maximum number of features provided by the
|
||
235 | * provider are limited.
|
||
236 | *
|
||
237 | 44871 | jjdelcerro | * @return true if there is a limit of features.
|
238 | 40435 | jjdelcerro | */
|
239 | public boolean hasRetrievedFeaturesLimit(); |
||
240 | |||
241 | /**
|
||
242 | * If the {@link FeatureStoreProvider#hasRetrievedFeaturesLimit()} returns true,
|
||
243 | * it returns the limit of features retrieved from the provider.
|
||
244 | * @return
|
||
245 | * The limit of the retrieved features.
|
||
246 | */
|
||
247 | public int getRetrievedFeaturesLimit(); |
||
248 | 43020 | jjdelcerro | |
249 | public FeatureStore getFeatureStore();
|
||
250 | |||
251 | public DataStoreParameters getParameters();
|
||
252 | 44443 | jjdelcerro | |
253 | /**
|
||
254 | * Indicates if the storage is temporary.
|
||
255 | * There is no guarantee that a temporary store can be recovered from
|
||
256 | * its parameters. In general these will not be persistent.
|
||
257 | *
|
||
258 | * @return true if the store is temporary, otherwise false.
|
||
259 | */
|
||
260 | public boolean isTemporary(); |
||
261 | 40435 | jjdelcerro | } |