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