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 @ 40767
History | View | Annotate | Download (6.85 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 | * Factory of {@link FeatureProvider}. Create a new {@link FeatureProvider} instance
|
||
73 | * valid for this Store.
|
||
74 | *
|
||
75 | * @param {@link FeatureType} of the {@link FeatureProvider}
|
||
76 | * @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 | * @return
|
||
135 | * @throws DataException
|
||
136 | */
|
||
137 | public FeatureProvider getFeatureProviderByReference(
|
||
138 | FeatureReferenceProviderServices reference, FeatureType featureType) |
||
139 | throws DataException;
|
||
140 | /**
|
||
141 | * Informs that store supports write.
|
||
142 | *
|
||
143 | * @return <true> if write is supported
|
||
144 | */
|
||
145 | public boolean allowWrite(); |
||
146 | |||
147 | /**
|
||
148 | *Informs that store supports write a geometry.
|
||
149 | *
|
||
150 | * @param geometryType
|
||
151 | * @param geometrySubType
|
||
152 | * @return
|
||
153 | * @throws DataException
|
||
154 | */
|
||
155 | public boolean canWriteGeometry(int geometryType, int geometrySubType) throws DataException; |
||
156 | |||
157 | |||
158 | public interface FeatureTypeChanged { |
||
159 | FeatureType getSource(); |
||
160 | |||
161 | FeatureType getTarget(); |
||
162 | } |
||
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 | */
|
||
186 | public Envelope getEnvelope() throws DataException; |
||
187 | |||
188 | /**
|
||
189 | * Informs if store supports locks
|
||
190 | *
|
||
191 | * @return
|
||
192 | */
|
||
193 | public boolean isLocksSupported(); |
||
194 | |||
195 | /**
|
||
196 | * Return {@link FeatureStoreProviderServices} for this store
|
||
197 | *
|
||
198 | * @return
|
||
199 | */
|
||
200 | public FeatureStoreProviderServices getStoreServices();
|
||
201 | |||
202 | /**
|
||
203 | * Inform if the store provider supports automatic values for attributues
|
||
204 | * (autonumeric)
|
||
205 | *
|
||
206 | * @return <code>true</code> if supported
|
||
207 | */
|
||
208 | public boolean allowAutomaticValues(); |
||
209 | |||
210 | /**
|
||
211 | * Returns total feature count of this store.
|
||
212 | *
|
||
213 | * @return
|
||
214 | * @throws DataException
|
||
215 | */
|
||
216 | public long getFeatureCount() throws DataException; |
||
217 | |||
218 | |||
219 | public boolean supportsAppendMode(); |
||
220 | |||
221 | public void beginAppend() throws DataException; |
||
222 | |||
223 | public void endAppend() throws DataException; |
||
224 | |||
225 | public void append(FeatureProvider featureProvider) 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
|
||
233 | * <true> if it knows the real envelope.
|
||
234 | */
|
||
235 | public boolean isKnownEnvelope(); |
||
236 | |||
237 | /**
|
||
238 | * Return if the maximum number of features provided by the
|
||
239 | * provider are limited.
|
||
240 | *
|
||
241 | * @return
|
||
242 | * <true> if there is a limit of features.
|
||
243 | */
|
||
244 | public boolean hasRetrievedFeaturesLimit(); |
||
245 | |||
246 | /**
|
||
247 | * If the {@link FeatureStoreProvider#hasRetrievedFeaturesLimit()} returns true,
|
||
248 | * it returns the limit of features retrieved from the provider.
|
||
249 | * @return
|
||
250 | * The limit of the retrieved features.
|
||
251 | */
|
||
252 | public int getRetrievedFeaturesLimit(); |
||
253 | } |