Statistics
| Revision:

svn-gvsig-desktop / branches / v2_0_0_prep / libraries / libFMap_dal / src / org / gvsig / fmap / dal / DataStore.java @ 29046

History | View | Annotate | Download (4.47 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 24268 jjdelcerro
import org.gvsig.tools.observer.ComplexWeakReferencingObservable;
9 23754 jjdelcerro
import org.gvsig.tools.observer.Observer;
10 24079 jjdelcerro
import org.gvsig.tools.persistence.Persistent;
11 23754 jjdelcerro
12
/**
13 25785 jmvivo
 * <p>
14
 * This is the basic interface for all data stores. Depending on the context, it
15
 * can represent a geographic layer, an alphanumeric database table or any data
16
 * file. DataStore offers generic services like:
17
 * <ul>
18 25815 jiyarza
 * <li>Open and close data stores</li>
19 25785 jmvivo
 * <li>Access to data sets, with the possibility of loading data in background.</li>
20
 * <li>Use of selection and locks, as well as data sets</li>
21
 * <li>Editing</li>
22 25815 jiyarza
 * <li>Register event observers through the Observable interface</li>
23
 * <li>Access to embedded data stores (like GML)</li>
24 25785 jmvivo
 * <li>Information about the Spatial Reference Systems used by the data store</li>
25
 * </ul>
26 23754 jjdelcerro
 * </p>
27
 * <br>
28 27575 jmvivo
 *
29 23754 jjdelcerro
 */
30 25547 jjdelcerro
public interface DataStore extends ComplexWeakReferencingObservable, Persistent,
31 25785 jmvivo
                Metadata {
32 23754 jjdelcerro
33 25785 jmvivo
        public static final String DYNCLASS_NAME = "DataStore";
34
35 24395 jiyarza
        /**
36
         * Returns this store's name.
37 27575 jmvivo
         *
38 24395 jiyarza
         * @return String containing this store's name.
39
         */
40 23754 jjdelcerro
        public String getName();
41
42
        /**
43
         * Return the of parameters of this store
44
         *
45
         * @return parameters of this store
46
         */
47
        public DataStoreParameters getParameters();
48
49 24395 jiyarza
        /**
50
         * Refreshes this store state.
51 27575 jmvivo
         *
52 24395 jiyarza
         * @throws DataException
53
         */
54 23772 jjdelcerro
        public void refresh() throws DataException;
55 23754 jjdelcerro
56 24395 jiyarza
        /**
57
         * Frees this store's resources
58 27575 jmvivo
         *
59 24395 jiyarza
         * @throws DataException
60
         */
61 23772 jjdelcerro
        public void dispose() throws DataException;
62 23754 jjdelcerro
63
        /**
64 24395 jiyarza
         * Returns all available data.
65 23754 jjdelcerro
         *
66 24395 jiyarza
         * @return a set of data
67
         * @throws DataException
68
         *             if there is any error while loading the data
69 23754 jjdelcerro
         */
70 23842 jjdelcerro
        DataSet getDataSet() throws DataException;
71 23754 jjdelcerro
72
        /**
73
         * Returns a subset of data taking into account the properties and
74
         * restrictions of the DataQuery.
75
         *
76 24395 jiyarza
         * @param dataQuery
77
         *            defines the properties of the requested data
78
         * @return a set of data
79
         * @throws DataException
80
         *             if there is any error while loading the data
81 23754 jjdelcerro
         */
82 23842 jjdelcerro
        DataSet getDataSet(DataQuery dataQuery) throws DataException;
83 23754 jjdelcerro
84
        /**
85 24395 jiyarza
         * Loads all available data and notifies the observer for each loaded block of data.
86 23754 jjdelcerro
         *
87
         * @param observer
88 24395 jiyarza
         *            to be notified for each block of data loaded
89 23754 jjdelcerro
         * @throws DataException
90 24395 jiyarza
         *             if there is any error while loading the data
91 23754 jjdelcerro
         */
92 23842 jjdelcerro
        void getDataSet(Observer observer) throws DataException;
93 23754 jjdelcerro
94
        /**
95
         * Loads a subset of data taking into account the properties and
96
         * restrictions of the DataQuery. Data loading is performed by calling the
97 24395 jiyarza
         * Observer, once each data block is loaded.
98 27575 jmvivo
         *
99 24395 jiyarza
         * @param dataQuery
100 25785 jmvivo
         *            defines the properties of the requested data
101 23754 jjdelcerro
         * @param observer
102 24395 jiyarza
         *            to be notified for each block of data loaded
103 23754 jjdelcerro
         * @throws DataException
104 24395 jiyarza
         *             if there is any error while loading the data
105 23754 jjdelcerro
         */
106 24395 jiyarza
        void getDataSet(DataQuery dataQuery, Observer observer) throws DataException;
107 23754 jjdelcerro
108
        /**
109 24395 jiyarza
         * Returns the selected set of data
110 27575 jmvivo
         *
111 24395 jiyarza
         * @return DataSet
112 23754 jjdelcerro
         */
113
114 23842 jjdelcerro
        public DataSet getSelection() throws DataException;
115 23754 jjdelcerro
116
        /**
117 24395 jiyarza
         * Sets the current data selection with the given data set.
118 27575 jmvivo
         *
119 23842 jjdelcerro
         * @param DataSet
120 23754 jjdelcerro
         *            selection
121
         * @throws DataException
122
         */
123 23842 jjdelcerro
        public void setSelection(DataSet selection) throws DataException;
124 23754 jjdelcerro
125
        /**
126 24395 jiyarza
         * Creates a new selection.
127 27575 jmvivo
         *
128 24395 jiyarza
         * @return DataSet that contains the selection
129 27575 jmvivo
         *
130 24395 jiyarza
         * @throws DataException
131 23754 jjdelcerro
         */
132 23842 jjdelcerro
        public DataSet createSelection() throws DataException;
133 23754 jjdelcerro
134 24395 jiyarza
        /**
135
         * Returns an iterator over this store children
136 27575 jmvivo
         *
137 24395 jiyarza
         * @return Iterator over this DataStore children
138
         */
139
        public Iterator getChildren();
140 23754 jjdelcerro
141
        /**
142 25785 jmvivo
         * Returns the DataServerExplorer to which this DataStore belongs, if there
143
         * is any.
144 27723 jmvivo
         *
145 25785 jmvivo
         * @return DataServerExplorer to which this DataStore belongs, or
146
         *         <code>null</code> if this was not accessed through any
147
         *         DataServerExplorer.
148 27723 jmvivo
         *
149 24395 jiyarza
         * @throws DataException
150 27723 jmvivo
         * @throws ValidateDataParametersException
151 23754 jjdelcerro
         */
152 27723 jmvivo
        public DataServerExplorer getExplorer() throws DataException,
153
                        ValidateDataParametersException;
154 23754 jjdelcerro
155 27575 jmvivo
156
        /**
157
         * Returns a new instance of a {@link DataQuery}.
158
         *
159
         * @return new {@link DataQuery} instance.
160
         *
161
         * @throws DataException
162
         */
163
        public DataQuery createQuery();
164 23754 jjdelcerro
}