root / branches / v2_0_0_prep / libraries / libFMap_dal / src / org / gvsig / fmap / dal / DataStore.java @ 37297
History | View | Annotate | Download (9.2 KB)
1 | 24496 | jmvivo | package org.gvsig.fmap.dal; |
---|---|---|---|
2 | 23754 | jjdelcerro | |
3 | 37297 | jpiera | import java.util.Collection; |
4 | 23754 | jjdelcerro | import java.util.Iterator; |
5 | |||
6 | 24505 | jmvivo | import org.gvsig.fmap.dal.exception.DataException; |
7 | 27723 | jmvivo | import org.gvsig.fmap.dal.exception.ValidateDataParametersException; |
8 | 25785 | jmvivo | import org.gvsig.metadata.Metadata; |
9 | 37297 | jpiera | import org.gvsig.timesupport.Interval; |
10 | import org.gvsig.timesupport.RelativeInterval; |
||
11 | import org.gvsig.timesupport.Time; |
||
12 | 31284 | cordinyana | import org.gvsig.tools.dispose.Disposable; |
13 | import org.gvsig.tools.exception.BaseException; |
||
14 | 24268 | jjdelcerro | import org.gvsig.tools.observer.ComplexWeakReferencingObservable; |
15 | 23754 | jjdelcerro | import org.gvsig.tools.observer.Observer; |
16 | 24079 | jjdelcerro | import org.gvsig.tools.persistence.Persistent; |
17 | 31284 | cordinyana | import org.gvsig.tools.visitor.Visitable; |
18 | import org.gvsig.tools.visitor.Visitor; |
||
19 | 23754 | jjdelcerro | |
20 | /**
|
||
21 | 25785 | jmvivo | * <p>
|
22 | * This is the basic interface for all data stores. Depending on the context, it
|
||
23 | * can represent a geographic layer, an alphanumeric database table or any data
|
||
24 | * file. DataStore offers generic services like:
|
||
25 | * <ul>
|
||
26 | 25815 | jiyarza | * <li>Open and close data stores</li>
|
27 | 25785 | jmvivo | * <li>Access to data sets, with the possibility of loading data in background.</li>
|
28 | * <li>Use of selection and locks, as well as data sets</li>
|
||
29 | * <li>Editing</li>
|
||
30 | 25815 | jiyarza | * <li>Register event observers through the Observable interface</li>
|
31 | * <li>Access to embedded data stores (like GML)</li>
|
||
32 | 25785 | jmvivo | * <li>Information about the Spatial Reference Systems used by the data store</li>
|
33 | * </ul>
|
||
34 | 23754 | jjdelcerro | * </p>
|
35 | * <br>
|
||
36 | 27575 | jmvivo | *
|
37 | 23754 | jjdelcerro | */
|
38 | 31284 | cordinyana | public interface DataStore extends ComplexWeakReferencingObservable, |
39 | Persistent, Metadata, Disposable, Visitable { |
||
40 | 23754 | jjdelcerro | |
41 | 32880 | jjdelcerro | public static final String METADATA_DEFINITION_NAME = "DataProvider"; |
42 | 25785 | jmvivo | |
43 | 32880 | jjdelcerro | public static final String FEATURE_METADATA_DEFINITION_NAME = "FeatureProvider"; |
44 | |||
45 | public static final String SPATIAL_METADATA_DEFINITION_NAME = "SpatialProvider"; |
||
46 | |||
47 | 24395 | jiyarza | /**
|
48 | 32880 | jjdelcerro | * Metadata property name for the provider name provided by the data provider.
|
49 | *
|
||
50 | * This metadata is provided by all data providers.
|
||
51 | */
|
||
52 | public static final String METADATA_PROVIDER = "ProviderName"; |
||
53 | |||
54 | /**
|
||
55 | * Metadata property name for Container name provided by the data provider.
|
||
56 | * By explample, in a dbf file, this is the name of dbf.
|
||
57 | *
|
||
58 | * This metadata is provided by all data providers.
|
||
59 | */
|
||
60 | public static final String METADATA_CONTAINERNAME = "ContainerName"; |
||
61 | |||
62 | /**
|
||
63 | * Metadata property name for the feature type provided by the data provider.
|
||
64 | *
|
||
65 | * This metadata is provided by all tabular data providers.
|
||
66 | */
|
||
67 | public static final String METADATA_FEATURETYPE = "FeatureType"; |
||
68 | |||
69 | /**
|
||
70 | * Metadata property name for CRS provided by the data provider.
|
||
71 | *
|
||
72 | * This metadata is only provided by data provider with spatial
|
||
73 | * information.
|
||
74 | */
|
||
75 | public static final String METADATA_CRS = "CRS"; |
||
76 | |||
77 | /**
|
||
78 | * Metadata property name for Envelope provided by the data provider
|
||
79 | *
|
||
80 | * This metadata is only provided by data provider with spatial
|
||
81 | * information.
|
||
82 | */
|
||
83 | public static final String METADATA_ENVELOPE = "Envelope"; |
||
84 | |||
85 | /**
|
||
86 | 33717 | jjdelcerro | * Returns the name associated to the store.
|
87 | * This name is provided for informational purposes only.
|
||
88 | * Explamples:
|
||
89 | *
|
||
90 | * In a dbf the filename without the path
|
||
91 | *
|
||
92 | * In a DDBB table the name of the table
|
||
93 | *
|
||
94 | * In a WFS layer the name of the layer.
|
||
95 | 27575 | jmvivo | *
|
96 | 24395 | jiyarza | * @return String containing this store's name.
|
97 | */
|
||
98 | 23754 | jjdelcerro | public String getName(); |
99 | 33717 | jjdelcerro | |
100 | /**
|
||
101 | * Returns a more descriptive name for the store that getName.
|
||
102 | * This name is provided for informational purposes only.
|
||
103 | * Explamples:
|
||
104 | *
|
||
105 | * In a file based store may return the full name of the filename, path and filename.
|
||
106 | *
|
||
107 | * In a data base based store may return "server:dbname:tablename"
|
||
108 | *
|
||
109 | * In a WFS layer based store may return "server:layername"
|
||
110 | *
|
||
111 | * @return String Containing the full name of the store
|
||
112 | */
|
||
113 | public String getFullName(); |
||
114 | 23754 | jjdelcerro | |
115 | /**
|
||
116 | * Return the of parameters of this store
|
||
117 | *
|
||
118 | * @return parameters of this store
|
||
119 | */
|
||
120 | public DataStoreParameters getParameters();
|
||
121 | |||
122 | 24395 | jiyarza | /**
|
123 | 32880 | jjdelcerro | * Return the provider name that use this store.
|
124 | *
|
||
125 | * @return provider name of this store
|
||
126 | */
|
||
127 | public String getProviderName(); |
||
128 | |||
129 | /**
|
||
130 | 24395 | jiyarza | * Refreshes this store state.
|
131 | 27575 | jmvivo | *
|
132 | 24395 | jiyarza | * @throws DataException
|
133 | */
|
||
134 | 23772 | jjdelcerro | public void refresh() throws DataException; |
135 | 23754 | jjdelcerro | |
136 | 24395 | jiyarza | /**
|
137 | * Returns all available data.
|
||
138 | 23754 | jjdelcerro | *
|
139 | 24395 | jiyarza | * @return a set of data
|
140 | * @throws DataException
|
||
141 | * if there is any error while loading the data
|
||
142 | 23754 | jjdelcerro | */
|
143 | 23842 | jjdelcerro | DataSet getDataSet() throws DataException;
|
144 | 23754 | jjdelcerro | |
145 | /**
|
||
146 | * Returns a subset of data taking into account the properties and
|
||
147 | * restrictions of the DataQuery.
|
||
148 | *
|
||
149 | 24395 | jiyarza | * @param dataQuery
|
150 | * defines the properties of the requested data
|
||
151 | * @return a set of data
|
||
152 | * @throws DataException
|
||
153 | * if there is any error while loading the data
|
||
154 | 23754 | jjdelcerro | */
|
155 | 23842 | jjdelcerro | DataSet getDataSet(DataQuery dataQuery) throws DataException;
|
156 | 23754 | jjdelcerro | |
157 | 34827 | cordinyana | /**
|
158 | * Provides each value of this Store to the provided {@link Visitor}.
|
||
159 | * The values received through the {@link Visitor#visit(Object)} method
|
||
160 | * may be transient, reused or externally modifiable, so they can't
|
||
161 | * be used to be stored in any external form out of the visit method.
|
||
162 | *
|
||
163 | * If you need to store any of the values out of the
|
||
164 | * {@link Visitor#visit(Object)} method execution, create a copy or clone
|
||
165 | * the received value in order to be stored.
|
||
166 | *
|
||
167 | * @param visitor
|
||
168 | * the visitor to apply to each value.
|
||
169 | * @exception BaseException
|
||
170 | * if there is an error while performing the visit
|
||
171 | */
|
||
172 | public void accept(Visitor visitor) throws BaseException; |
||
173 | |||
174 | 23754 | jjdelcerro | /**
|
175 | 34827 | cordinyana | * Provides each value of this Store to the provided {@link Visitor}.
|
176 | * The values received through the {@link Visitor#visit(Object)} method
|
||
177 | * may be transient, reused or externally modifiable, so they can't
|
||
178 | * be used to be stored in any external form out of the visit method.
|
||
179 | *
|
||
180 | * If you need to store any of the values out of the
|
||
181 | * {@link Visitor#visit(Object)} method execution, create a copy or clone
|
||
182 | * the received value in order to be stored.
|
||
183 | *
|
||
184 | * @param visitor
|
||
185 | * the visitor to apply to each value.
|
||
186 | * @param dataQuery
|
||
187 | * defines the properties of the data to visit
|
||
188 | * @exception BaseException
|
||
189 | * if there is an error while performing the visit
|
||
190 | */
|
||
191 | 31284 | cordinyana | public void accept(Visitor visitor, DataQuery dataQuery) |
192 | throws BaseException;
|
||
193 | |||
194 | /**
|
||
195 | 24395 | jiyarza | * Loads all available data and notifies the observer for each loaded block of data.
|
196 | 23754 | jjdelcerro | *
|
197 | * @param observer
|
||
198 | 24395 | jiyarza | * to be notified for each block of data loaded
|
199 | 23754 | jjdelcerro | * @throws DataException
|
200 | 24395 | jiyarza | * if there is any error while loading the data
|
201 | 23754 | jjdelcerro | */
|
202 | 23842 | jjdelcerro | void getDataSet(Observer observer) throws DataException; |
203 | 23754 | jjdelcerro | |
204 | /**
|
||
205 | * Loads a subset of data taking into account the properties and
|
||
206 | * restrictions of the DataQuery. Data loading is performed by calling the
|
||
207 | 24395 | jiyarza | * Observer, once each data block is loaded.
|
208 | 27575 | jmvivo | *
|
209 | 24395 | jiyarza | * @param dataQuery
|
210 | 25785 | jmvivo | * defines the properties of the requested data
|
211 | 23754 | jjdelcerro | * @param observer
|
212 | 24395 | jiyarza | * to be notified for each block of data loaded
|
213 | 23754 | jjdelcerro | * @throws DataException
|
214 | 24395 | jiyarza | * if there is any error while loading the data
|
215 | 23754 | jjdelcerro | */
|
216 | 24395 | jiyarza | void getDataSet(DataQuery dataQuery, Observer observer) throws DataException; |
217 | 23754 | jjdelcerro | |
218 | /**
|
||
219 | 24395 | jiyarza | * Returns the selected set of data
|
220 | 27575 | jmvivo | *
|
221 | 24395 | jiyarza | * @return DataSet
|
222 | 23754 | jjdelcerro | */
|
223 | |||
224 | 23842 | jjdelcerro | public DataSet getSelection() throws DataException; |
225 | 23754 | jjdelcerro | |
226 | /**
|
||
227 | 24395 | jiyarza | * Sets the current data selection with the given data set.
|
228 | 27575 | jmvivo | *
|
229 | 23842 | jjdelcerro | * @param DataSet
|
230 | 23754 | jjdelcerro | * selection
|
231 | * @throws DataException
|
||
232 | */
|
||
233 | 23842 | jjdelcerro | public void setSelection(DataSet selection) throws DataException; |
234 | 23754 | jjdelcerro | |
235 | /**
|
||
236 | 24395 | jiyarza | * Creates a new selection.
|
237 | 27575 | jmvivo | *
|
238 | 24395 | jiyarza | * @return DataSet that contains the selection
|
239 | 27575 | jmvivo | *
|
240 | 24395 | jiyarza | * @throws DataException
|
241 | 23754 | jjdelcerro | */
|
242 | 23842 | jjdelcerro | public DataSet createSelection() throws DataException; |
243 | 23754 | jjdelcerro | |
244 | 24395 | jiyarza | /**
|
245 | * Returns an iterator over this store children
|
||
246 | 27575 | jmvivo | *
|
247 | 24395 | jiyarza | * @return Iterator over this DataStore children
|
248 | */
|
||
249 | public Iterator getChildren(); |
||
250 | 23754 | jjdelcerro | |
251 | /**
|
||
252 | 25785 | jmvivo | * Returns the DataServerExplorer to which this DataStore belongs, if there
|
253 | * is any.
|
||
254 | 27723 | jmvivo | *
|
255 | 25785 | jmvivo | * @return DataServerExplorer to which this DataStore belongs, or
|
256 | * <code>null</code> if this was not accessed through any
|
||
257 | * DataServerExplorer.
|
||
258 | 27723 | jmvivo | *
|
259 | 24395 | jiyarza | * @throws DataException
|
260 | 27723 | jmvivo | * @throws ValidateDataParametersException
|
261 | 23754 | jjdelcerro | */
|
262 | 27723 | jmvivo | public DataServerExplorer getExplorer() throws DataException, |
263 | ValidateDataParametersException; |
||
264 | 23754 | jjdelcerro | |
265 | 27575 | jmvivo | |
266 | /**
|
||
267 | * Returns a new instance of a {@link DataQuery}.
|
||
268 | *
|
||
269 | * @return new {@link DataQuery} instance.
|
||
270 | *
|
||
271 | * @throws DataException
|
||
272 | */
|
||
273 | public DataQuery createQuery();
|
||
274 | 37297 | jpiera | |
275 | /**
|
||
276 | * Gets the {@link Interval} of the store, that means the temporal
|
||
277 | * interval where the store has valid data.
|
||
278 | * @return
|
||
279 | * a time interval or null if there is not time support
|
||
280 | */
|
||
281 | public Interval getInterval();
|
||
282 | |||
283 | /**
|
||
284 | * Gets all the possible values of time for which the store has data.
|
||
285 | * @return
|
||
286 | * a collection of {@link Time} objects.
|
||
287 | */
|
||
288 | public Collection getTimes(); |
||
289 | |||
290 | /**
|
||
291 | * Gets all the possible values of time for which the store has data
|
||
292 | * and intersects with an interval.
|
||
293 | * @param interval
|
||
294 | * the interval of time
|
||
295 | * @return
|
||
296 | * a collection of {@link Time} objects.
|
||
297 | */
|
||
298 | public Collection getTimes(Interval interval); |
||
299 | 23754 | jjdelcerro | } |