Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.compat.cdc / org.gvsig.fmap.dal / org.gvsig.fmap.dal.spi / src / main / java / org / gvsig / fmap / dal / feature / spi / FeatureStoreProvider.java @ 40435

History | View | Annotate | Download (6.87 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.Iterator;
32

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

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

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

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

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

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

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

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

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

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

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

    
161

    
162
        public interface FeatureTypeChanged {
163
                FeatureType getSource();
164

    
165
                FeatureType getTarget();
166
        }
167

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

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

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

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

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

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

    
222

    
223
        public boolean supportsAppendMode();
224

    
225
        public void beginAppend() throws DataException;
226

    
227
        public void endAppend() throws DataException;
228

    
229
        public void append(FeatureProvider featureProvider) throws DataException;
230

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