Statistics
| Revision:

root / branches / dal_time_support / libraries / libFMap_dal / src / org / gvsig / fmap / dal / feature / spi / FeatureStoreProvider.java @ 34620

History | View | Annotate | Download (7.24 KB)

1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 */
22

    
23
/*
24
 * AUTHORS (In addition to CIT):
25
 * 2008 {{Company}}   {{Task}}
26
 */
27

    
28

    
29
package org.gvsig.fmap.dal.feature.spi;
30

    
31
import java.util.Collection;
32
import java.util.Iterator;
33

    
34
import org.gvsig.fmap.dal.DataStoreParameters;
35
import org.gvsig.fmap.dal.DataTypes;
36
import org.gvsig.fmap.dal.exception.DataException;
37
import org.gvsig.fmap.dal.feature.FeatureLocks;
38
import org.gvsig.fmap.dal.feature.FeatureQuery;
39
import org.gvsig.fmap.dal.feature.FeatureSelection;
40
import org.gvsig.fmap.dal.feature.FeatureStore;
41
import org.gvsig.fmap.dal.feature.FeatureType;
42
import org.gvsig.fmap.dal.spi.DataStoreProvider;
43
import org.gvsig.fmap.geom.primitive.Envelope;
44
import org.gvsig.timesupport.Interval;
45
import org.gvsig.timesupport.Period;
46

    
47
/**
48
 *
49
 * Interface for all feature based data providers.<br>
50
 * <br>
51
 * 
52
 * 
53
 * A FeatureStoreProvier must have a contructor like this:<br>
54
 * <br>
55
 * <code>
56
 * FeatureStoreProvider({@link DataStoreParameters}, {@link FeatureStoreProviderServices})
57
 * </code>
58
 * 
59
 */
60
public interface FeatureStoreProvider extends DataStoreProvider {
61

    
62
        /**
63
         * Return a new OID valid for a new feature.
64
         *
65
         * @return a new OID
66
         * @see {@link FeatureStoreProvider#getOIDType()}
67
         */
68
        public Object createNewOID();
69

    
70
        /**
71
         * Return OID data type (from {@link DataTypes}) of this store.
72
         *
73
         * @return OID data type
74
         * @see {@link FeatureStoreProvider#createNewOID()} {@link DataTypes}
75
         */
76
        public int getOIDType();
77

    
78
        /**
79
         * Factory of {@link FeatureProvider}. Create a new {@link FeatureProvider} instance
80
         * valid for this Store.
81
         *
82
         * @param {@link FeatureType} of the {@link FeatureProvider}
83
         * @return
84
         * @throws DataException
85
         */
86
        public FeatureProvider createFeatureProvider(FeatureType type) throws DataException;
87

    
88
        /**
89
         * Factory of {@link FeatureSelection}. Create a new
90
         * {@link FeatureSelection} instance valid for this Store.
91
         *
92
         * @return
93
         * @throws DataException
94
         */
95
        public FeatureSelection createFeatureSelection() throws DataException;
96

    
97
        /**
98
         * Factory of {@link FeatureLocks}. Create a new {@link FeatureLocks}
99
         * instance valid for this Store.
100
         *
101
         *
102
         * @return {@link FeatureLocks} or <code>null</code> if not
103
         *         {@link FeatureStoreProvider#isLocksSupported()}
104
         * @throws DataException
105
         */
106
        public FeatureLocks createFeatureLocks() throws DataException;
107

    
108
        /**
109
         * Factory of {@link FeatureSetProvider}. Create a new
110
         * {@link FeatureSetProvider} that represents result of {@link FeatureQuery}
111
         * .
112
         *
113
         * @param query
114
         *            (never will be null)
115
         * @param featureType
116
         *            (never will be null)
117
         * @return
118
         * @throws DataException
119
         */
120
        public FeatureSetProvider createSet(FeatureQuery query,
121
                        FeatureType featureType) throws DataException;
122

    
123
        /**
124
         * Return {@link FeatureProvider} from a
125
         * {@link FeatureReferenceProviderServices} using
126
         * {@link FeatureStore#getDefaultFeatureType()} as {@link FeatureType}
127
         *
128
         * @param reference
129
         * @return
130
         * @throws DataException
131
         */
132
        public FeatureProvider getFeatureProviderByReference(FeatureReferenceProviderServices reference)
133
                        throws DataException;
134

    
135
        /**
136
         * Return {@link FeatureProvider} from a
137
         * {@link FeatureReferenceProviderServices} using <code>featureType</code>
138
         * as {@link FeatureType}
139
         *
140
         * @param reference
141
         * @return
142
         * @throws DataException
143
         */
144
        public FeatureProvider getFeatureProviderByReference(
145
                        FeatureReferenceProviderServices reference, FeatureType featureType)
146
                        throws DataException;
147
        /**
148
         * Informs that store supports write.
149
         *
150
         * @return <true> if write is supported
151
         */
152
        public boolean allowWrite();
153

    
154
        /**
155
         *Informs that store supports write a geometry.
156
         *
157
         * @param geometryType
158
         * @param geometrySubType
159
         * @return
160
         * @throws DataException
161
         */
162
        public boolean canWriteGeometry(int geometryType, int geometrySubType) throws DataException;
163

    
164

    
165
        public interface FeatureTypeChanged {
166
                FeatureType getSource();
167

    
168
                FeatureType getTarget();
169
        }
170

    
171
        /**
172
         * Perform changes on store.
173
         *
174
         * @param deleteds
175
         *            iterator of {@link FeatureReferenceProviderServices}
176
         * @param inserteds
177
         *            iterator of {@link FeatureProvider}
178
         * @param updateds
179
         *            iterator of {@link FeatureProvider}
180
         * @param featureTypesChanged
181
         *            iterator of {@link FeatureTypeChanged}
182
         *
183
         * @throws DataException
184
         */
185
        public void performChanges(Iterator deleteds, Iterator inserteds, Iterator updateds, Iterator featureTypesChanged) throws DataException;
186

    
187
        /**
188
         * Returns this store's total envelope (extent).
189
         *
190
         * @return this store's total envelope (extent) or <code>null</code> if
191
         *         store not have geometry information
192
         */
193
        public Envelope getEnvelope() throws DataException;
194

    
195
        /**
196
         * Informs if store supports locks
197
         *
198
         * @return
199
         */
200
        public boolean isLocksSupported();
201

    
202
        /**
203
         * Return {@link FeatureStoreProviderServices} for this store
204
         *
205
         * @return
206
         */
207
        public FeatureStoreProviderServices getStoreServices();
208

    
209
        /**
210
         * Inform if the store provider supports automatic values for attributues
211
         * (autonumeric)
212
         *
213
         * @return <code>true</code> if supported
214
         */
215
        public boolean allowAutomaticValues();
216

    
217
        /**
218
         * Returns total feature count of this store.
219
         *
220
         * @return
221
         * @throws DataException
222
         */
223
        public long getFeatureCount() throws DataException;
224

    
225

    
226
        public boolean supportsAppendMode();
227

    
228
        public void beginAppend() throws DataException;
229

    
230
        public void endAppend() throws DataException;
231

    
232
        public void append(FeatureProvider featureProvider) throws DataException;
233

    
234
        /**
235
         * Return if the provider knows the real envelope of a layer. If not,
236
         * the {@link FeatureStoreProvider#getEnvelope()} method doesn't return
237
         * the full envelope.
238
         * 
239
         * @return
240
         * <true> if it knows the real envelope.
241
         */
242
        public boolean isKnownEnvelope(); 
243
        
244
        /**
245
         * Return if the maximum number of features provided by the
246
         * provider are limited.
247
         * 
248
         * @return
249
         * <true> if there is a limit of features.
250
         */
251
        public boolean hasRetrievedFeaturesLimit();
252
        
253
        /**
254
         * If the {@link FeatureStoreProvider#hasRetrievedFeaturesLimit()} returns true,
255
         * it returns the limit of features retrieved from the provider.
256
         * @return
257
         * The limit of the retrieved features.
258
         */
259
        public int getRetrievedFeaturesLimit();
260
        
261
        public Interval getInterval();
262
    
263
    public Collection getInstants();
264
    
265
    public Collection getInstants(Interval interval);
266
    
267
    public Period getPeriod();
268
    
269
    public Collection getPartials();
270
    
271
    public Collection getPartials(Period period);
272
}