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