Statistics
| Revision:

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

History | View | Annotate | Download (6.25 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 the name of the provider.
61
         *
62
         * @return
63
         */
64
        public String getName();
65

    
66
        /**
67
         * Return a new OID valid for a new feature.
68
         *
69
         * @return a new OID
70
         * @see {@link FeatureStoreProvider#getOIDType()}
71
         */
72
        public Object createNewOID();
73

    
74
        /**
75
         * Return OID data type (from {@link DataTypes}) of this store.
76
         *
77
         * @return OID data type
78
         * @see {@link FeatureStoreProvider#createNewOID()} {@link DataTypes}
79
         */
80
        public int getOIDType();
81

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

    
92
        /**
93
         * Factory of {@link FeatureSelection}. Create a new
94
         * {@link FeatureSelection} instance valid for this Store.
95
         *
96
         * @return
97
         * @throws DataException
98
         */
99
        public FeatureSelection createFeatureSelection() throws DataException;
100

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

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

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

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

    
158
        /**
159
         *Informs that store supports write a geometry.
160
         *
161
         * @param geometryType
162
         * @param geometrySubType
163
         * @return
164
         * @throws DataException
165
         */
166
        public boolean canWriteGeometry(int geometryType, int geometrySubType) throws DataException;
167

    
168

    
169
        public interface FeatureTypeChanged {
170
                FeatureType getSource();
171

    
172
                FeatureType getTarget();
173
        }
174

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

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

    
199
        /**
200
         * Informs if store supports locks
201
         *
202
         * @return
203
         */
204
        public boolean isLocksSupported();
205

    
206
        /**
207
         * Return {@link FeatureStoreProviderServices} for this store
208
         *
209
         * @return
210
         */
211
        public FeatureStoreProviderServices getStoreServices();
212

    
213
        /**
214
         * Inform if the store provider supports automatic values for attributues
215
         * (autonumeric)
216
         *
217
         * @return <code>true</code> if supported
218
         */
219
        public boolean allowAutomaticValues();
220

    
221
        /**
222
         * Returns total feature count of this store.
223
         *
224
         * @return
225
         * @throws DataException
226
         */
227
        public long getFeatureCount() throws DataException;
228

    
229

    
230
        public boolean supportsAppendMode();
231

    
232
        public void beginAppend() throws DataException;
233

    
234
        public void endAppend() throws DataException;
235

    
236
        public void append(FeatureProvider featureProvider) throws DataException;
237

    
238

    
239

    
240
}