svn-gvsig-desktop / tags / v2_0_0_Build_2020 / libraries / libFMap_dal / src / org / gvsig / fmap / dal / DataStore.java @ 33784
History | View | Annotate | Download (7.16 KB)
1 | 24496 | jmvivo | package org.gvsig.fmap.dal; |
---|---|---|---|
2 | 23754 | jjdelcerro | |
3 | import java.util.Iterator; |
||
4 | |||
5 | 24505 | jmvivo | import org.gvsig.fmap.dal.exception.DataException; |
6 | 27723 | jmvivo | import org.gvsig.fmap.dal.exception.ValidateDataParametersException; |
7 | 25785 | jmvivo | import org.gvsig.metadata.Metadata; |
8 | 31284 | cordinyana | import org.gvsig.tools.dispose.Disposable; |
9 | import org.gvsig.tools.exception.BaseException; |
||
10 | 24268 | jjdelcerro | import org.gvsig.tools.observer.ComplexWeakReferencingObservable; |
11 | 23754 | jjdelcerro | import org.gvsig.tools.observer.Observer; |
12 | 24079 | jjdelcerro | import org.gvsig.tools.persistence.Persistent; |
13 | 31284 | cordinyana | import org.gvsig.tools.visitor.Visitable; |
14 | import org.gvsig.tools.visitor.Visitor; |
||
15 | 23754 | jjdelcerro | |
16 | /**
|
||
17 | 25785 | jmvivo | * <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 | 25815 | jiyarza | * <li>Open and close data stores</li>
|
23 | 25785 | jmvivo | * <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 | 25815 | jiyarza | * <li>Register event observers through the Observable interface</li>
|
27 | * <li>Access to embedded data stores (like GML)</li>
|
||
28 | 25785 | jmvivo | * <li>Information about the Spatial Reference Systems used by the data store</li>
|
29 | * </ul>
|
||
30 | 23754 | jjdelcerro | * </p>
|
31 | * <br>
|
||
32 | 27575 | jmvivo | *
|
33 | 23754 | jjdelcerro | */
|
34 | 31284 | cordinyana | public interface DataStore extends ComplexWeakReferencingObservable, |
35 | Persistent, Metadata, Disposable, Visitable { |
||
36 | 23754 | jjdelcerro | |
37 | 32880 | jjdelcerro | public static final String METADATA_DEFINITION_NAME = "DataProvider"; |
38 | 25785 | jmvivo | |
39 | 32880 | jjdelcerro | public static final String FEATURE_METADATA_DEFINITION_NAME = "FeatureProvider"; |
40 | |||
41 | public static final String SPATIAL_METADATA_DEFINITION_NAME = "SpatialProvider"; |
||
42 | |||
43 | 24395 | jiyarza | /**
|
44 | 32880 | jjdelcerro | * 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 | 33717 | jjdelcerro | * 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 | 27575 | jmvivo | *
|
92 | 24395 | jiyarza | * @return String containing this store's name.
|
93 | */
|
||
94 | 23754 | jjdelcerro | public String getName(); |
95 | 33717 | jjdelcerro | |
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 | 23754 | jjdelcerro | |
111 | /**
|
||
112 | * Return the of parameters of this store
|
||
113 | *
|
||
114 | * @return parameters of this store
|
||
115 | */
|
||
116 | public DataStoreParameters getParameters();
|
||
117 | |||
118 | 24395 | jiyarza | /**
|
119 | 32880 | jjdelcerro | * Return the provider name that use this store.
|
120 | *
|
||
121 | * @return provider name of this store
|
||
122 | */
|
||
123 | public String getProviderName(); |
||
124 | |||
125 | /**
|
||
126 | 24395 | jiyarza | * Refreshes this store state.
|
127 | 27575 | jmvivo | *
|
128 | 24395 | jiyarza | * @throws DataException
|
129 | */
|
||
130 | 23772 | jjdelcerro | public void refresh() throws DataException; |
131 | 23754 | jjdelcerro | |
132 | 24395 | jiyarza | /**
|
133 | * Returns all available data.
|
||
134 | 23754 | jjdelcerro | *
|
135 | 24395 | jiyarza | * @return a set of data
|
136 | * @throws DataException
|
||
137 | * if there is any error while loading the data
|
||
138 | 23754 | jjdelcerro | */
|
139 | 23842 | jjdelcerro | DataSet getDataSet() throws DataException;
|
140 | 23754 | jjdelcerro | |
141 | /**
|
||
142 | * Returns a subset of data taking into account the properties and
|
||
143 | * restrictions of the DataQuery.
|
||
144 | *
|
||
145 | 24395 | jiyarza | * @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 | 23754 | jjdelcerro | */
|
151 | 23842 | jjdelcerro | DataSet getDataSet(DataQuery dataQuery) throws DataException;
|
152 | 23754 | jjdelcerro | |
153 | /**
|
||
154 | 31284 | cordinyana | * Provides each value of this container to the provided {@link Visitor}.
|
155 | *
|
||
156 | * @param visitor
|
||
157 | * the visitor to apply to each value.
|
||
158 | * @param dataQuery
|
||
159 | * defines the properties of the data to visit
|
||
160 | * @exception BaseException
|
||
161 | * if there is an error while performing the visit
|
||
162 | */
|
||
163 | public void accept(Visitor visitor, DataQuery dataQuery) |
||
164 | throws BaseException;
|
||
165 | |||
166 | /**
|
||
167 | 24395 | jiyarza | * Loads all available data and notifies the observer for each loaded block of data.
|
168 | 23754 | jjdelcerro | *
|
169 | * @param observer
|
||
170 | 24395 | jiyarza | * to be notified for each block of data loaded
|
171 | 23754 | jjdelcerro | * @throws DataException
|
172 | 24395 | jiyarza | * if there is any error while loading the data
|
173 | 23754 | jjdelcerro | */
|
174 | 23842 | jjdelcerro | void getDataSet(Observer observer) throws DataException; |
175 | 23754 | jjdelcerro | |
176 | /**
|
||
177 | * Loads a subset of data taking into account the properties and
|
||
178 | * restrictions of the DataQuery. Data loading is performed by calling the
|
||
179 | 24395 | jiyarza | * Observer, once each data block is loaded.
|
180 | 27575 | jmvivo | *
|
181 | 24395 | jiyarza | * @param dataQuery
|
182 | 25785 | jmvivo | * defines the properties of the requested data
|
183 | 23754 | jjdelcerro | * @param observer
|
184 | 24395 | jiyarza | * to be notified for each block of data loaded
|
185 | 23754 | jjdelcerro | * @throws DataException
|
186 | 24395 | jiyarza | * if there is any error while loading the data
|
187 | 23754 | jjdelcerro | */
|
188 | 24395 | jiyarza | void getDataSet(DataQuery dataQuery, Observer observer) throws DataException; |
189 | 23754 | jjdelcerro | |
190 | /**
|
||
191 | 24395 | jiyarza | * Returns the selected set of data
|
192 | 27575 | jmvivo | *
|
193 | 24395 | jiyarza | * @return DataSet
|
194 | 23754 | jjdelcerro | */
|
195 | |||
196 | 23842 | jjdelcerro | public DataSet getSelection() throws DataException; |
197 | 23754 | jjdelcerro | |
198 | /**
|
||
199 | 24395 | jiyarza | * Sets the current data selection with the given data set.
|
200 | 27575 | jmvivo | *
|
201 | 23842 | jjdelcerro | * @param DataSet
|
202 | 23754 | jjdelcerro | * selection
|
203 | * @throws DataException
|
||
204 | */
|
||
205 | 23842 | jjdelcerro | public void setSelection(DataSet selection) throws DataException; |
206 | 23754 | jjdelcerro | |
207 | /**
|
||
208 | 24395 | jiyarza | * Creates a new selection.
|
209 | 27575 | jmvivo | *
|
210 | 24395 | jiyarza | * @return DataSet that contains the selection
|
211 | 27575 | jmvivo | *
|
212 | 24395 | jiyarza | * @throws DataException
|
213 | 23754 | jjdelcerro | */
|
214 | 23842 | jjdelcerro | public DataSet createSelection() throws DataException; |
215 | 23754 | jjdelcerro | |
216 | 24395 | jiyarza | /**
|
217 | * Returns an iterator over this store children
|
||
218 | 27575 | jmvivo | *
|
219 | 24395 | jiyarza | * @return Iterator over this DataStore children
|
220 | */
|
||
221 | public Iterator getChildren(); |
||
222 | 23754 | jjdelcerro | |
223 | /**
|
||
224 | 25785 | jmvivo | * Returns the DataServerExplorer to which this DataStore belongs, if there
|
225 | * is any.
|
||
226 | 27723 | jmvivo | *
|
227 | 25785 | jmvivo | * @return DataServerExplorer to which this DataStore belongs, or
|
228 | * <code>null</code> if this was not accessed through any
|
||
229 | * DataServerExplorer.
|
||
230 | 27723 | jmvivo | *
|
231 | 24395 | jiyarza | * @throws DataException
|
232 | 27723 | jmvivo | * @throws ValidateDataParametersException
|
233 | 23754 | jjdelcerro | */
|
234 | 27723 | jmvivo | public DataServerExplorer getExplorer() throws DataException, |
235 | ValidateDataParametersException; |
||
236 | 23754 | jjdelcerro | |
237 | 27575 | jmvivo | |
238 | /**
|
||
239 | * Returns a new instance of a {@link DataQuery}.
|
||
240 | *
|
||
241 | * @return new {@link DataQuery} instance.
|
||
242 | *
|
||
243 | * @throws DataException
|
||
244 | */
|
||
245 | public DataQuery createQuery();
|
||
246 | 23754 | jjdelcerro | } |