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