Statistics
| Revision:

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

History | View | Annotate | Download (7.07 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

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

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

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

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

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

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

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

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

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

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

    
163

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

    
167
                FeatureType getTarget();
168
        }
169

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

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

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

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

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

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

    
224

    
225
        public boolean supportsAppendMode();
226

    
227
        public void beginAppend() throws DataException;
228

    
229
        public void endAppend() throws DataException;
230

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

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