svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.compat.cdc / org.gvsig.fmap.dal / org.gvsig.fmap.dal.api / src / main / java / org / gvsig / fmap / dal / DataStore.java @ 40435
History | View | Annotate | Download (9.2 KB)
1 |
package org.gvsig.fmap.dal; |
---|---|
2 |
|
3 |
import java.util.Collection; |
4 |
import java.util.Iterator; |
5 |
|
6 |
import org.gvsig.fmap.dal.exception.DataException; |
7 |
import org.gvsig.fmap.dal.exception.ValidateDataParametersException; |
8 |
import org.gvsig.metadata.Metadata; |
9 |
import org.gvsig.timesupport.Interval; |
10 |
import org.gvsig.timesupport.RelativeInterval; |
11 |
import org.gvsig.timesupport.Time; |
12 |
import org.gvsig.tools.dispose.Disposable; |
13 |
import org.gvsig.tools.exception.BaseException; |
14 |
import org.gvsig.tools.observer.ComplexWeakReferencingObservable; |
15 |
import org.gvsig.tools.observer.Observer; |
16 |
import org.gvsig.tools.persistence.Persistent; |
17 |
import org.gvsig.tools.visitor.Visitable; |
18 |
import org.gvsig.tools.visitor.Visitor; |
19 |
|
20 |
/**
|
21 |
* <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 |
* <li>Open and close data stores</li>
|
27 |
* <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 |
* <li>Register event observers through the Observable interface</li>
|
31 |
* <li>Access to embedded data stores (like GML)</li>
|
32 |
* <li>Information about the Spatial Reference Systems used by the data store</li>
|
33 |
* </ul>
|
34 |
* </p>
|
35 |
* <br>
|
36 |
*
|
37 |
*/
|
38 |
public interface DataStore extends ComplexWeakReferencingObservable, |
39 |
Persistent, Metadata, Disposable, Visitable { |
40 |
|
41 |
public static final String METADATA_DEFINITION_NAME = "DataProvider"; |
42 |
|
43 |
public static final String FEATURE_METADATA_DEFINITION_NAME = "FeatureProvider"; |
44 |
|
45 |
public static final String SPATIAL_METADATA_DEFINITION_NAME = "SpatialProvider"; |
46 |
|
47 |
/**
|
48 |
* 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 |
* 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 |
*
|
96 |
* @return String containing this store's name.
|
97 |
*/
|
98 |
public String getName(); |
99 |
|
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 |
|
115 |
/**
|
116 |
* Return the of parameters of this store
|
117 |
*
|
118 |
* @return parameters of this store
|
119 |
*/
|
120 |
public DataStoreParameters getParameters();
|
121 |
|
122 |
/**
|
123 |
* Return the provider name that use this store.
|
124 |
*
|
125 |
* @return provider name of this store
|
126 |
*/
|
127 |
public String getProviderName(); |
128 |
|
129 |
/**
|
130 |
* Refreshes this store state.
|
131 |
*
|
132 |
* @throws DataException
|
133 |
*/
|
134 |
public void refresh() throws DataException; |
135 |
|
136 |
/**
|
137 |
* Returns all available data.
|
138 |
*
|
139 |
* @return a set of data
|
140 |
* @throws DataException
|
141 |
* if there is any error while loading the data
|
142 |
*/
|
143 |
DataSet getDataSet() throws DataException;
|
144 |
|
145 |
/**
|
146 |
* Returns a subset of data taking into account the properties and
|
147 |
* restrictions of the DataQuery.
|
148 |
*
|
149 |
* @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 |
*/
|
155 |
DataSet getDataSet(DataQuery dataQuery) throws DataException;
|
156 |
|
157 |
/**
|
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 |
/**
|
175 |
* 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 |
public void accept(Visitor visitor, DataQuery dataQuery) |
192 |
throws BaseException;
|
193 |
|
194 |
/**
|
195 |
* Loads all available data and notifies the observer for each loaded block of data.
|
196 |
*
|
197 |
* @param observer
|
198 |
* to be notified for each block of data loaded
|
199 |
* @throws DataException
|
200 |
* if there is any error while loading the data
|
201 |
*/
|
202 |
void getDataSet(Observer observer) throws DataException; |
203 |
|
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 |
* Observer, once each data block is loaded.
|
208 |
*
|
209 |
* @param dataQuery
|
210 |
* defines the properties of the requested data
|
211 |
* @param observer
|
212 |
* to be notified for each block of data loaded
|
213 |
* @throws DataException
|
214 |
* if there is any error while loading the data
|
215 |
*/
|
216 |
void getDataSet(DataQuery dataQuery, Observer observer) throws DataException; |
217 |
|
218 |
/**
|
219 |
* Returns the selected set of data
|
220 |
*
|
221 |
* @return DataSet
|
222 |
*/
|
223 |
|
224 |
public DataSet getSelection() throws DataException; |
225 |
|
226 |
/**
|
227 |
* Sets the current data selection with the given data set.
|
228 |
*
|
229 |
* @param DataSet
|
230 |
* selection
|
231 |
* @throws DataException
|
232 |
*/
|
233 |
public void setSelection(DataSet selection) throws DataException; |
234 |
|
235 |
/**
|
236 |
* Creates a new selection.
|
237 |
*
|
238 |
* @return DataSet that contains the selection
|
239 |
*
|
240 |
* @throws DataException
|
241 |
*/
|
242 |
public DataSet createSelection() throws DataException; |
243 |
|
244 |
/**
|
245 |
* Returns an iterator over this store children
|
246 |
*
|
247 |
* @return Iterator over this DataStore children
|
248 |
*/
|
249 |
public Iterator getChildren(); |
250 |
|
251 |
/**
|
252 |
* Returns the DataServerExplorer to which this DataStore belongs, if there
|
253 |
* is any.
|
254 |
*
|
255 |
* @return DataServerExplorer to which this DataStore belongs, or
|
256 |
* <code>null</code> if this was not accessed through any
|
257 |
* DataServerExplorer.
|
258 |
*
|
259 |
* @throws DataException
|
260 |
* @throws ValidateDataParametersException
|
261 |
*/
|
262 |
public DataServerExplorer getExplorer() throws DataException, |
263 |
ValidateDataParametersException; |
264 |
|
265 |
|
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 |
|
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 |
} |
300 |
|