Statistics
| Revision:

root / branches / v2_0_0_prep / libraries / libFMap_dal / src / org / gvsig / fmap / dal / DataManager.java @ 32880

History | View | Annotate | Download (8.84 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 IVER T.I. S.A.   {{Task}}
26
 */
27
package org.gvsig.fmap.dal;
28

    
29
import java.util.List;
30

    
31
import org.gvsig.fmap.dal.exception.InitializeException;
32
import org.gvsig.fmap.dal.exception.ProviderNotRegisteredException;
33
import org.gvsig.fmap.dal.exception.ValidateDataParametersException;
34
import org.gvsig.fmap.dal.feature.FeatureIndex;
35
import org.gvsig.fmap.dal.feature.spi.index.FeatureIndexProvider;
36
import org.gvsig.fmap.dal.resource.ResourceManager;
37
import org.gvsig.tools.dynobject.DynObject;
38
import org.gvsig.tools.evaluator.Evaluator;
39

    
40
/**
41
 * There are two top level management roles within DAL: data access and resource
42
 * management.
43
 * 
44
 * This class is responsible of the data access management role. It provides
45
 * ways for registering and instantiating {@link DataServerExplorer}(s),
46
 * {@link DataStore}(s), {@link Evaluator}(s) and {@link FeatureIndex}(es).
47
 * 
48
 * @see ResourceManager
49
 * 
50
 */
51

    
52
public interface DataManager {
53

    
54
        /**
55
         * Returns the default DAL's temporary directory
56
         * 
57
         * @return Temporary directory name
58
         */
59
        public String getTemporaryDirectory();
60

    
61
        /*
62
         * ====================================================================
63
         * 
64
         * Store related services
65
         */
66

    
67
        /**
68
         * Creates, initializes and returns an instance of DataStoreParameters given
69
         * the name with which their provider is registered.
70
         * 
71
         * @param name
72
         *            provider name
73
         * 
74
         * @throws InitializeException
75
         * 
76
         * @throws InitializeException
77
         * @throws ProviderNotRegisteredException
78
         **/
79
        public DataStoreParameters createStoreParameters(String name)
80
                        throws InitializeException, ProviderNotRegisteredException;
81

    
82
        /**
83
         * Creates, initializes and returns an instance of NewDataStoreParameters
84
         * given the name with which their provider is registered.
85
         * 
86
         * @param name
87
         * 
88
         * @throws InitializeException
89
         * @throws ProviderNotRegisteredException
90
         */
91
        public NewDataStoreParameters createNewStoreParameters(String explorer, String provider)
92
                        throws InitializeException, ProviderNotRegisteredException;
93

    
94
        /**
95
         * 
96
         * Creates, initializes and returns an instance of DataStore given the
97
         * DataStoreParameters.
98
         * 
99
         * @param name of the provider
100
         * @param parameters
101
         *            parameters used to instantiate and initialize the DataStore
102
         * 
103
         * @throws InitializeException
104
         * 
105
         * @throws ProviderNotRegisteredException
106
         * @throws ValidateDataParametersException
107
         **/
108
        public DataStore openStore(String provider, DataStoreParameters parameters)
109
                        throws InitializeException, ProviderNotRegisteredException,
110
                        ValidateDataParametersException;
111

    
112
        /**
113
         * @deprecated see openStore
114
         */
115
        public DataStore createStore(DataStoreParameters parameters)
116
                        throws InitializeException, ProviderNotRegisteredException,
117
                        ValidateDataParametersException;
118

    
119
        /**
120
         * Create a new physical store 
121
         *  
122
         * @param parameters
123
         *
124
         * @throws InitializeException
125
         * @throws ProviderNotRegisteredException
126
         * @throws ValidateDataParametersException
127
         */
128
        public void newStore(String explorer, String provider, NewDataStoreParameters parameters, boolean overwrite)
129
                        throws InitializeException, ProviderNotRegisteredException,
130
                        ValidateDataParametersException;
131

    
132
        /**
133
         * Returns a list of Strings containing the names of all available DataStore
134
         * providers.
135
         * 
136
         * @return list of String containing available DataStore provider names
137
         */
138
        public List getStoreProviders();
139

    
140
        /**
141
         * Returns a list of Strings containing the names of all available DataStore
142
         * providers for an explorer.
143
         * 
144
         * @param explorer
145
         *            name
146
         */
147
        public List getStoreProviders(String name);
148

    
149
        /*
150
         * ====================================================================
151
         * 
152
         * Explorer related services
153
         */
154
        /**
155
         * Returns an instance of {@link DataServerExplorerParameters} corresponding
156
         * to the given name.
157
         * 
158
         * @param name
159
         *            name of a registered server explorer provider
160
         * 
161
         * @throws InitializeException
162
         *             if parameter initialization causes an error.
163
         * 
164
         * @throws ProviderNotRegisteredException
165
         *             if could not find a provider by the given name.
166
         * 
167
         **/
168
        public DataServerExplorerParameters createServerExplorerParameters(
169
                        String name) throws InitializeException,
170
                        ProviderNotRegisteredException;
171

    
172
        /**
173
         * Returns an instance of {@link DataServerExplorer} given its parameters.
174
         * 
175
         * @param name of the explorer
176
         * @param parameters
177
         *            parameters used to instantiate and initialize the
178
         *            {@link DataServerExplorer}.
179
         * 
180
         * @return an instance of {@link DataServerExplorer}.
181
         * 
182
         * @throws InitializeException
183
         * 
184
         * @throws ProviderNotRegisteredException
185
         * @throws ValidateDataParametersException
186
         */
187
        public DataServerExplorer openServerExplorer(
188
                        String name,
189
                        DataServerExplorerParameters parameters)
190
                        throws InitializeException, ProviderNotRegisteredException,
191
                        ValidateDataParametersException;
192

    
193
        /**
194
         * @deprecated see openServerExplorer
195
         */
196
        public DataServerExplorer createServerExplorer(
197
                        DataServerExplorerParameters parameters)
198
                        throws InitializeException, ProviderNotRegisteredException,
199
                        ValidateDataParametersException;
200

    
201
        /**
202
         * Returns a list of String containing the names of the available
203
         * DataServerExplorer providers.
204
         * 
205
         * @return list of String containing the names of the available
206
         *         DataServerExplorer providers.
207
         */
208
        public List getExplorerProviders();
209

    
210
        /*
211
         * ====================================================================
212
         * 
213
         * Expression evaluation related services
214
         */
215

    
216
        /**
217
         * Registers the default expression evaluator. It is used by DAL to evaluate
218
         * and resolve query filters and expressions.
219
         * 
220
         * @param evaluator
221
         *            Class that will be called to evaluate the expression. It must
222
         *            implement {@link Evaluator}.
223
         */
224
        public void registerDefaultEvaluator(Class evaluator);
225

    
226
        /**
227
         * Creates an instance of Evaluator that represents the given expression.
228
         * 
229
         * @param expression
230
         *            String containing a CQL expression.
231
         * @return instance of Evaluator representing the given expression.
232
         * @throws InitializeException
233
         */
234
        public Evaluator createExpresion(String expression)
235
                        throws InitializeException;
236

    
237
        /*
238
         * ====================================================================
239
         * 
240
         * Index related services
241
         */
242

    
243
        /**
244
         * Returns a list of String containing the names of the available index
245
         * providers.
246
         * 
247
         * @return list of strings with the names of the available index providers
248
         */
249
        public List getFeatureIndexProviders();
250

    
251
        /**
252
         * Sets the default DataIndexProvider for the given data type.
253
         * 
254
         * @param dataType
255
         *            one of the data types defined in {@link DataTypes}.
256
         * @param name
257
         *            Provider's name
258
         */
259
        public void setDefaultFeatureIndexProviderName(int dataType, String name);
260

    
261
        /**
262
         * Returns the default DataIndexProvider name, given a data type. Data types
263
         * are defined in {@link DataTypes}.
264
         * 
265
         * @param dataType
266
         *            one of the constants in {@link DataTypes}.
267
         * 
268
         * @return the name of the default {@link FeatureIndexProvider} if there is
269
         *         anyone available for the given data type.
270
         */
271
        public String getDefaultFeatureIndexProviderName(int dataType);
272

    
273
        /**
274
         * Returns a list of String containing the names of the available cache
275
         * providers.
276
         * 
277
         * @return list of strings with the names of the available cache providers
278
         */
279
        public List getFeatureCacheProviders();
280
    
281
        /**
282
         * Returns an instance of {@link DataServerExplorerParameters} corresponding to
283
         * the given name used by the cache to create a store to save the retrieved data.
284
         *
285
         * @param name
286
         *            name of a registered feature cache provider
287
         *
288
         * @throws InitializeException
289
         *                         if parameter initialization causes an error.
290
         *
291
         * @throws ProviderNotRegisteredException
292
         *                         if could not find a cache provider by the given name.
293
         *
294
         **/
295
    public DynObject createCacheParameters(String name) throws InitializeException, 
296
            ProviderNotRegisteredException;
297
    
298

    
299

    
300
}