Statistics
| Revision:

root / branches / v2_0_0_prep / libraries / libFMap_dal / src / org / gvsig / fmap / dal / DataStore.java @ 25481

History | View | Annotate | Download (4.2 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.metadata.Metadatable;
7
import org.gvsig.tools.observer.ComplexWeakReferencingObservable;
8
import org.gvsig.tools.observer.Observer;
9
import org.gvsig.tools.operations.Operations;
10
import org.gvsig.tools.persistence.Persistent;
11

    
12
/**
13
 * <p>This is the basic interface for all data stores. Depending on the context, 
14
 * it can represent a geographic layer, an alphanumeric database table or any data file. 
15
 * DataStore offers generic services like:
16
 *   <ul>
17
 *     <li>Open, close and reject data stores</li>
18
 *     <li>Access to data sets, with the possibility of loading data 
19
 *             in background.</li>
20
 *     <li>Use of selection and locks, as well as data sets</li>
21
 *     <li>Editing</li>
22
 *     <li>Register of event observers through the Observable interface</li>
23
 *     <li>Access to data stores embedded into itself (like GML)</li>
24
 *     <li>Information about the Spatial Reference Systems used by the data store</li>
25
 *   </ul>
26
 * </p>
27
 * <br>
28
 *
29
 */
30
public interface DataStore extends ComplexWeakReferencingObservable, Metadatable, Persistent,
31
                Operations {
32

    
33
        /**
34
         * Returns this store's name.
35
         * 
36
         * @return String containing this store's name.
37
         */
38
        public String getName();
39

    
40
        /**
41
         * Return the of parameters of this store
42
         *
43
         * @return parameters of this store
44
         */
45
        public DataStoreParameters getParameters();
46

    
47

    
48
        /**
49
         * Refreshes this store state.
50
         * 
51
         * @throws DataException
52
         */
53
        public void refresh() throws DataException;
54

    
55
        /**
56
         * Frees this store's resources
57
         * 
58
         * @throws DataException
59
         */
60
        public void dispose() throws DataException;
61

    
62
        /**
63
         * Returns all available data.
64
         *
65
         * @return a set of data
66
         * @throws DataException
67
         *             if there is any error while loading the data
68
         */
69
        DataSet getDataSet() throws DataException;
70

    
71
        /**
72
         * Returns a subset of data taking into account the properties and
73
         * restrictions of the DataQuery.
74
         *
75
         * @param dataQuery
76
         *            defines the properties of the requested data
77
         * @return a set of data
78
         * @throws DataException
79
         *             if there is any error while loading the data
80
         */
81
        DataSet getDataSet(DataQuery dataQuery) throws DataException;
82

    
83
        /**
84
         * Loads all available data and notifies the observer for each loaded block of data.
85
         *
86
         * @param observer
87
         *            to be notified for each block of data loaded
88
         * @throws DataException
89
         *             if there is any error while loading the data
90
         */
91
        void getDataSet(Observer observer) throws DataException;
92

    
93
        /**
94
         * Loads a subset of data taking into account the properties and
95
         * restrictions of the DataQuery. Data loading is performed by calling the
96
         * Observer, once each data block is loaded.
97
         *
98
         * @param dataQuery
99
         *            defines the properties of the requested data         
100
         * @param observer
101
         *            to be notified for each block of data loaded
102
         * @throws DataException
103
         *             if there is any error while loading the data
104
         */
105
        void getDataSet(DataQuery dataQuery, Observer observer) throws DataException;
106

    
107
        /**
108
         * Returns the selected set of data
109
         * 
110
         * @return DataSet
111
         */
112

    
113
        public DataSet getSelection() throws DataException;
114

    
115
        /**
116
         * Sets the current data selection with the given data set.
117
         * 
118
         * @param DataSet
119
         *            selection
120
         * @throws DataException
121
         */
122
        public void setSelection(DataSet selection) throws DataException;
123

    
124
        /**
125
         * Creates a new selection.
126
         *
127
         * @return DataSet that contains the selection
128
         * 
129
         * @throws DataException
130
         */
131
        public DataSet createSelection() throws DataException;
132

    
133
        /**
134
         * Returns an iterator over this store children
135
         * 
136
         * @return Iterator over this DataStore children
137
         */
138
        public Iterator getChildren();
139

    
140
        /**
141
         * Returns the DataServerExplorer to which this DataStore belongs, if there is any.
142
         * 
143
         * @return DataServerExplorer to which this DataStore belongs, or <code>null</code> if 
144
         *                    this was not accessed through any DataServerExplorer.
145
         * 
146
         * @throws DataException
147
         */
148
        public DataServerExplorer getExplorer() throws DataException;
149

    
150
}
151