Statistics
| Revision:

root / branches / v2_0_0_prep / libraries / libFMap_dal / src / org / gvsig / fmap / dal / feature / FeatureStore.java @ 24496

History | View | Annotate | Download (6.87 KB)

1
package org.gvsig.fmap.dal.feature;
2

    
3
import java.util.List;
4

    
5
import org.gvsig.fmap.dal.DataStore;
6
import org.gvsig.fmap.dal.DataStoreParameters;
7
import org.gvsig.fmap.dal.exceptions.DataException;
8
import org.gvsig.fmap.dal.exceptions.ReadException;
9
import org.gvsig.fmap.dal.feature.exceptions.FeatureIndexException;
10
import org.gvsig.fmap.dal.feature.exceptions.NeedEditingModeException;
11
import org.gvsig.fmap.geom.primitive.Envelope;
12
import org.gvsig.tools.observer.Observer;
13

    
14
/**
15
 * <p>Is a specialization of DataStore to use alfanumeric and
16
 * vectorial data.</p>
17
 * <ul>
18
 *   <il>It has suport to the diferent <i>Feature</i> definitions
19
 *   (or types) represented by <i>FeatureType</i>, but always
20
 *   use one by default. (The GML format, for example, can use
21
 *   diferent <i>Feature</i> types.</il>
22
 *   <il>Allows access to a subcollection data filtered and/or
23
 *   sort it (as well load in a background mode).
24
 *   </il>
25
 *   <il>Allowed filters will be <i>alfanumerics</i> and/or
26
 *   <i>Spatial</i> and/or <i>Feature type</i>.</il>
27
 *   <il>Adds support to <i>Feature</i> edition level.</il>
28
 *   <il>Adds support to modify structure (<i>FeatureType</i>).</il>
29
 *   <il>Give information about contained geometry types.</il>
30
 *
31
 * </ul>
32
 *
33
 * @author
34
 *
35
 */
36
public interface FeatureStore extends DataStore {
37

    
38
        final static int MODE_QUERY = 0;
39
        final static int MODE_FULLEDIT = 1;
40
        final static int MODE_APPEND = 2;
41

    
42
        /*
43
         * =============================================================
44
         *
45
         * information related services
46
         */
47

    
48
        public boolean allowWrite();
49

    
50
        public FeatureType getDefaultFeatureType() throws DataException;
51

    
52
        public List getFeatureTypes() throws DataException;
53

    
54
        public DataStoreParameters getParameters();
55

    
56
        /**
57
         *@throws DataException
58
         * @deprecated Mirar de cambiarlo a metadatos
59
         */
60
        public boolean canWriteGeometry(int gvSIGgeometryType) throws DataException;
61

    
62
        public Envelope getEnvelope();
63

    
64
        /**
65
         *
66
         * @deprecated use getDefaultFeatureType().getDefaultSRS()
67
         * @return
68
         * @throws DataException
69
         */
70
        public String getSRSDefaultGeometry() throws DataException;
71

    
72
        public void export(FeatureExplorer explorer, FeatureStoreParameters params)
73
                        throws DataException;
74

    
75
        /*
76
         * =============================================================
77
         *
78
         * Query related services
79
         */
80

    
81
        /**
82
         * Returns all available features in the store.
83
         *
84
         * @return a collection of features
85
         * @throws ReadException
86
         *             if there is any error while reading the features
87
         */
88
        FeatureSet getFeatureSet() throws DataException;
89

    
90
        /**
91
         * Returns a subset of features taking into account the properties and
92
         * restrictions of the FeatureQuery.
93
         *
94
         * @param featureQuery
95
         *            defines the characteristics of the features to return
96
         * @return a collection of features
97
         * @throws ReadException
98
         *             if there is any error while reading the features
99
         */
100
        FeatureSet getFeatureSet(FeatureQuery featureQuery)
101
         throws DataException;
102

    
103
        /**
104
         * Loads a subset of features taking into account the properties and
105
         * restrictions of the FeatureQuery. Feature loading is performed by calling
106
         * the Observer, once each loaded Feature.
107
         *
108
         * @param featureQuery
109
         *            defines the characteristics of the features to return
110
         * @param observer
111
         *            to be notified of each loaded Feature
112
         * @throws DataException
113
         *             if there is any error while loading the features
114
         */
115
        void getFeatureSet(FeatureQuery featureQuery, Observer observer)
116
        throws DataException;
117

    
118
        /**
119
         * Loads all available feature in the store. The loading of Features is
120
         * performed by calling the Observer, once each loaded Feature.
121
         *
122
         * @param observer
123
         *            to be notified of each loaded Feature
124
         * @throws DataException
125
         *             if there is any error while loading the features
126
         */
127
        void getFeatureSet(Observer observer) throws DataException;
128

    
129
        /**
130
         * Return the feature asociated with the passed reference.
131
         *
132
         * @param reference
133
         * @return
134
         * @throws DataException
135
         */
136
        public Feature getFeatureByReference(FeatureReference reference) throws DataException;
137

    
138
        public Feature getFeatureByReference(FeatureReference reference, FeatureType featureType)
139
                        throws DataException;
140

    
141
        /*
142
         * =============================================================
143
         *
144
         * Editing related services
145
         */
146

    
147
        public void edit() throws DataException;
148

    
149
        public void edit(int mode) throws DataException;
150

    
151
        public void cancelEditing() throws DataException;
152

    
153
        public void finishEditing() throws DataException;
154

    
155
        public boolean isEditing();
156

    
157
        public boolean isAppending();
158

    
159
        public void update(EditableFeatureType featureType) throws DataException;
160

    
161
        public void update(EditableFeature feature) throws DataException;
162

    
163
        public void delete(Feature feature) throws DataException;
164

    
165
        public void insert(EditableFeature feature) throws DataException;
166

    
167
        public void undo() throws DataException;
168

    
169
        public void redo() throws DataException;
170

    
171
        public CommandsRecord getCommandsRecord() throws DataException;
172

    
173
        public EditableFeature createNewFeature() throws DataException;
174

    
175
        public EditableFeature createNewFeature(FeatureType type,
176
                        Feature defaultValues) throws DataException;
177

    
178
        public EditableFeature createNewFeature(FeatureType type,
179
                        boolean defaultValues) throws DataException;
180

    
181
        public EditableFeature createNewFeature(boolean defaultValues)
182
                        throws DataException;
183

    
184
        public void validateFeatures(int mode) throws DataException;
185

    
186
        public boolean isAppendModeSupported();
187

    
188
        /*
189
         * =============================================================
190
         *
191
         * Index related services
192
         */
193

    
194
        /**
195
         * Creates a DataIndex with name indexName, given the attributeName and its featureType.
196
         * @param featureType
197
         * @param attributeName
198
         * @param indexName
199
         * @return
200
         * @throws FeatureIndexException
201
         */
202
        public FeatureIndex createIndex(FeatureType featureType,
203
                        String attributeName, String indexName) throws DataException;
204

    
205
        /**
206
         * Returns a FeatureIndexes structure containing all available indexes in
207
         * the store.
208
         *
209
         * @return
210
         */
211
        public FeatureIndexes getIndexes();
212

    
213
        /*
214
         * =============================================================
215
         *
216
         * Selection related services
217
         */
218

    
219
        public void setSelection(FeatureSet selection) throws DataException;
220

    
221
        public FeatureSelection createFeatureSelection() throws DataException;
222

    
223
        public FeatureSelection getFeatureSelection() throws DataException;
224

    
225
        /*
226
         * =============================================================
227
         *
228
         * Lock related services
229
         */
230

    
231
        public boolean isLocksSupported();
232

    
233
        public FeatureSet getLocks() throws DataException;
234

    
235
        public void beginEditingGroup(String description)
236
                        throws NeedEditingModeException;
237

    
238
        public void endEditingGroup() throws NeedEditingModeException;
239

    
240
}
241