Revision 36723
branches/v2_0_0_prep/libraries/libFMap_dal/src/org/gvsig/fmap/dal/impl/DefaultDataManager.java | ||
---|---|---|
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 |
*/ |
|
1 | 22 |
package org.gvsig.fmap.dal.impl; |
2 | 23 |
|
3 | 24 |
import java.io.File; |
... | ... | |
7 | 28 |
import java.util.List; |
8 | 29 |
import java.util.Map; |
9 | 30 |
|
31 |
import org.slf4j.Logger; |
|
32 |
import org.slf4j.LoggerFactory; |
|
33 |
|
|
10 | 34 |
import org.gvsig.fmap.dal.DALLocator; |
11 | 35 |
import org.gvsig.fmap.dal.DataManager; |
12 | 36 |
import org.gvsig.fmap.dal.DataServerExplorer; |
... | ... | |
58 | 82 |
import org.gvsig.tools.extensionpoint.ExtensionPoint.Extension; |
59 | 83 |
import org.gvsig.tools.extensionpoint.ExtensionPointManager; |
60 | 84 |
import org.gvsig.tools.operations.OperationManager; |
61 |
import org.slf4j.Logger; |
|
62 |
import org.slf4j.LoggerFactory; |
|
63 | 85 |
|
64 | 86 |
public class DefaultDataManager implements DataManager, |
65 |
DataManagerProviderServices {
|
|
87 |
DataManagerProviderServices {
|
|
66 | 88 |
|
67 |
private static Logger LOG = LoggerFactory
|
|
68 |
.getLogger(DefaultDataManager.class);
|
|
89 |
private static Logger LOG = LoggerFactory
|
|
90 |
.getLogger(DefaultDataManager.class);
|
|
69 | 91 |
|
70 |
final static private String DATA_MANAGER_STORE = "Data.manager.stores"; |
|
71 |
final static private String DATA_MANAGER_STORE_DESCRIPTION = "DAL stores providers"; |
|
92 |
final static private String DATA_MANAGER_STORE = "Data.manager.stores"; |
|
93 |
final static private String DATA_MANAGER_STORE_DESCRIPTION = |
|
94 |
"DAL stores providers"; |
|
72 | 95 |
|
73 |
final static private String DATA_MANAGER_STORE_PARAMS = "Data.manager.stores.params"; |
|
74 |
final static private String DATA_MANAGER_STORE_PARAMS_DESCRIPTION = "DAL stores providers parameters"; |
|
96 |
final static private String DATA_MANAGER_STORE_PARAMS = |
|
97 |
"Data.manager.stores.params"; |
|
98 |
final static private String DATA_MANAGER_STORE_PARAMS_DESCRIPTION = |
|
99 |
"DAL stores providers parameters"; |
|
75 | 100 |
|
76 |
final static private String DATA_MANAGER_EXPLORER = "Data.manager.explorers"; |
|
77 |
final static private String DATA_MANAGER_EXPLORER_DESCRIPTION = "DAL explorers providers"; |
|
101 |
final static private String DATA_MANAGER_EXPLORER = |
|
102 |
"Data.manager.explorers"; |
|
103 |
final static private String DATA_MANAGER_EXPLORER_DESCRIPTION = |
|
104 |
"DAL explorers providers"; |
|
78 | 105 |
|
79 |
final static private String DATA_MANAGER_EXPLORER_PARAMS = "Data.manager.explorers.params"; |
|
80 |
final static private String DATA_MANAGER_EXPLORER_PARAMS_DESCRIPTION = "DAL explorer providers parameters"; |
|
106 |
final static private String DATA_MANAGER_EXPLORER_PARAMS = |
|
107 |
"Data.manager.explorers.params"; |
|
108 |
final static private String DATA_MANAGER_EXPLORER_PARAMS_DESCRIPTION = |
|
109 |
"DAL explorer providers parameters"; |
|
81 | 110 |
|
82 |
final static private String DATA_MANAGER_INDEX = "Data.manager.indexes"; |
|
83 |
final static private String DATA_MANAGER_INDEX_DESCRIPTION = "DAL index providers"; |
|
111 |
final static private String DATA_MANAGER_INDEX = "Data.manager.indexes"; |
|
112 |
final static private String DATA_MANAGER_INDEX_DESCRIPTION = |
|
113 |
"DAL index providers"; |
|
84 | 114 |
|
85 |
final static private String DATA_MANAGER_CACHE = "Data.manager.caches"; |
|
86 |
final static private String DATA_MANAGER_CACHE_DESCRIPTION = "DAL cache providers"; |
|
115 |
final static private String DATA_MANAGER_CACHE = "Data.manager.caches"; |
|
116 |
final static private String DATA_MANAGER_CACHE_DESCRIPTION = |
|
117 |
"DAL cache providers"; |
|
87 | 118 |
|
88 |
final static private String DATA_MANAGER_EXPRESION_EVALUATOR = "Data.manager.expresion.evaluator"; |
|
89 |
final static private String DATA_MANAGER_EXPRESION_EVALUATOR_DEFAULT = "default"; |
|
90 |
final static private String DATA_MANAGER_EXPRESION_EVALUATOR_DESCRIPTION = "DAL expresion evaluators."; |
|
119 |
final static private String DATA_MANAGER_EXPRESION_EVALUATOR = |
|
120 |
"Data.manager.expresion.evaluator"; |
|
121 |
final static private String DATA_MANAGER_EXPRESION_EVALUATOR_DEFAULT = |
|
122 |
"default"; |
|
123 |
final static private String DATA_MANAGER_EXPRESION_EVALUATOR_DESCRIPTION = |
|
124 |
"DAL expresion evaluators."; |
|
91 | 125 |
|
92 |
final static private String DATA_MANAGER_STORE_FACTORY = "Data.manager.stores.factory"; |
|
93 |
final static private String DATA_MANAGER_STORE_FACTORY_DESCRIPTION = "DAL stores factories"; |
|
126 |
final static private String DATA_MANAGER_STORE_FACTORY = |
|
127 |
"Data.manager.stores.factory"; |
|
128 |
final static private String DATA_MANAGER_STORE_FACTORY_DESCRIPTION = |
|
129 |
"DAL stores factories"; |
|
94 | 130 |
|
95 |
final static private String DATA_MANAGER_STORE_PROVIDER_FACTORY = "Data.manager.providers.factory"; |
|
96 |
final static private String DATA_MANAGER_STORE_PROVIDER_FACTORY_DESCRIPTION = "DAL store provider factories"; |
|
131 |
final static private String DATA_MANAGER_STORE_PROVIDER_FACTORY = |
|
132 |
"Data.manager.providers.factory"; |
|
133 |
final static private String DATA_MANAGER_STORE_PROVIDER_FACTORY_DESCRIPTION = |
|
134 |
"DAL store provider factories"; |
|
97 | 135 |
|
98 |
/** This map contains the name of the default provider for each data type */
|
|
99 |
private Map defaultDataIndexProviders;
|
|
136 |
/** This map contains the name of the default provider for each data type */
|
|
137 |
private Map defaultDataIndexProviders;
|
|
100 | 138 |
|
101 |
private OpenErrorHandler openErrorHandler;
|
|
139 |
private OpenErrorHandler openErrorHandler;
|
|
102 | 140 |
|
103 |
private ArrayList dataTypes;
|
|
141 |
private ArrayList dataTypes;
|
|
104 | 142 |
|
105 |
public DefaultDataManager() {
|
|
106 |
/*
|
|
107 |
* Create te extensions point in te registry.
|
|
108 |
*/
|
|
109 |
ToolsLocator.getExtensionPointManager().add(DATA_MANAGER_STORE,
|
|
110 |
DATA_MANAGER_STORE_DESCRIPTION);
|
|
143 |
public DefaultDataManager() {
|
|
144 |
/*
|
|
145 |
* Create te extensions point in te registry.
|
|
146 |
*/
|
|
147 |
ToolsLocator.getExtensionPointManager().add(DATA_MANAGER_STORE,
|
|
148 |
DATA_MANAGER_STORE_DESCRIPTION);
|
|
111 | 149 |
|
112 |
ToolsLocator.getExtensionPointManager().add(DATA_MANAGER_STORE_PARAMS,
|
|
113 |
DATA_MANAGER_STORE_PARAMS_DESCRIPTION);
|
|
150 |
ToolsLocator.getExtensionPointManager().add(DATA_MANAGER_STORE_PARAMS,
|
|
151 |
DATA_MANAGER_STORE_PARAMS_DESCRIPTION);
|
|
114 | 152 |
|
115 |
ToolsLocator.getExtensionPointManager().add(DATA_MANAGER_EXPLORER,
|
|
116 |
DATA_MANAGER_EXPLORER_DESCRIPTION);
|
|
153 |
ToolsLocator.getExtensionPointManager().add(DATA_MANAGER_EXPLORER,
|
|
154 |
DATA_MANAGER_EXPLORER_DESCRIPTION);
|
|
117 | 155 |
|
118 |
ToolsLocator.getExtensionPointManager().add(
|
|
119 |
DATA_MANAGER_EXPLORER_PARAMS,
|
|
120 |
DATA_MANAGER_EXPLORER_PARAMS_DESCRIPTION);
|
|
156 |
ToolsLocator.getExtensionPointManager().add(
|
|
157 |
DATA_MANAGER_EXPLORER_PARAMS,
|
|
158 |
DATA_MANAGER_EXPLORER_PARAMS_DESCRIPTION);
|
|
121 | 159 |
|
122 |
ToolsLocator.getExtensionPointManager().add(DATA_MANAGER_INDEX,
|
|
123 |
DATA_MANAGER_INDEX_DESCRIPTION);
|
|
160 |
ToolsLocator.getExtensionPointManager().add(DATA_MANAGER_INDEX,
|
|
161 |
DATA_MANAGER_INDEX_DESCRIPTION);
|
|
124 | 162 |
|
125 |
ToolsLocator.getExtensionPointManager().add( |
|
126 |
DATA_MANAGER_EXPRESION_EVALUATOR, |
|
127 |
DATA_MANAGER_EXPRESION_EVALUATOR_DESCRIPTION); |
|
128 |
|
|
129 |
ToolsLocator.getExtensionPointManager().add( |
|
130 |
DATA_MANAGER_STORE_PROVIDER_FACTORY, |
|
131 |
DATA_MANAGER_STORE_PROVIDER_FACTORY_DESCRIPTION); |
|
163 |
ToolsLocator.getExtensionPointManager().add( |
|
164 |
DATA_MANAGER_EXPRESION_EVALUATOR, |
|
165 |
DATA_MANAGER_EXPRESION_EVALUATOR_DESCRIPTION); |
|
132 | 166 |
|
133 |
initializeIndexes(); |
|
134 |
} |
|
167 |
ToolsLocator.getExtensionPointManager().add( |
|
168 |
DATA_MANAGER_STORE_PROVIDER_FACTORY, |
|
169 |
DATA_MANAGER_STORE_PROVIDER_FACTORY_DESCRIPTION); |
|
135 | 170 |
|
136 |
/** |
|
137 |
* |
|
138 |
* @return ResourceManager |
|
139 |
*/ |
|
171 |
initializeIndexes(); |
|
172 |
} |
|
140 | 173 |
|
141 |
public ResourceManager getResourceManager() { |
|
142 |
return DALLocator.getResourceManager(); |
|
143 |
} |
|
174 |
/** |
|
175 |
* |
|
176 |
* @return ResourceManager |
|
177 |
*/ |
|
144 | 178 |
|
145 |
public OperationManager getOperationManager() {
|
|
146 |
return ToolsLocator.getOperationManager();
|
|
147 |
}
|
|
179 |
public ResourceManager getResourceManager() {
|
|
180 |
return DALLocator.getResourceManager();
|
|
181 |
}
|
|
148 | 182 |
|
149 |
public String getTemporaryDirectory() { |
|
150 |
// FIXME Define a better tempdir solution |
|
151 |
String tmp = System.getProperty("TMP"); |
|
152 |
if (tmp == null) { |
|
153 |
tmp = System.getProperty("TEMP"); |
|
154 |
} |
|
155 |
if (tmp == null) { |
|
156 |
File tmp_file = new File(System.getProperty("HOME"), "_daltmp_"); |
|
157 |
int i = 1; |
|
158 |
while (!tmp_file.exists() || !tmp_file.isDirectory()) { |
|
159 |
tmp_file = new File(tmp_file.getAbsolutePath() + i); |
|
160 |
i++; |
|
161 |
} |
|
162 |
if (!tmp_file.exists()) { |
|
163 |
tmp_file.mkdir(); |
|
164 |
} |
|
165 |
tmp = tmp_file.getAbsolutePath(); |
|
166 |
} |
|
167 |
return tmp; |
|
168 |
} |
|
183 |
public OperationManager getOperationManager() { |
|
184 |
return ToolsLocator.getOperationManager(); |
|
185 |
} |
|
169 | 186 |
|
170 |
/* |
|
171 |
* ==================================================================== |
|
172 |
* |
|
173 |
* Store related services |
|
174 |
*/ |
|
175 |
public void registerStoreProvider(String name, Class storeProviderClass, |
|
176 |
Class parametersClass) { |
|
177 |
if (name == null || storeProviderClass == null |
|
178 |
|| parametersClass == null) { |
|
179 |
// FIXME Exception |
|
180 |
throw new IllegalArgumentException("Any parameters can be null"); |
|
181 |
} |
|
187 |
public String getTemporaryDirectory() { |
|
188 |
// FIXME Define a better tempdir solution |
|
189 |
String tmp = System.getProperty("TMP"); |
|
190 |
if (tmp == null) { |
|
191 |
tmp = System.getProperty("TEMP"); |
|
192 |
} |
|
193 |
if (tmp == null) { |
|
194 |
File tmp_file = new File(System.getProperty("HOME"), "_daltmp_"); |
|
195 |
int i = 1; |
|
196 |
while (!tmp_file.exists() || !tmp_file.isDirectory()) { |
|
197 |
tmp_file = new File(tmp_file.getAbsolutePath() + i); |
|
198 |
i++; |
|
199 |
} |
|
200 |
if (!tmp_file.exists()) { |
|
201 |
tmp_file.mkdir(); |
|
202 |
} |
|
203 |
tmp = tmp_file.getAbsolutePath(); |
|
204 |
} |
|
205 |
return tmp; |
|
206 |
} |
|
182 | 207 |
|
183 |
if (!DataStoreParameters.class.isAssignableFrom(parametersClass)) { |
|
184 |
// FIXME Exception |
|
185 |
throw new IllegalArgumentException(parametersClass.getName() |
|
186 |
+ " must implement org.gvsig.fmap.dal.DataStoreParameters"); |
|
187 |
} |
|
208 |
/* |
|
209 |
* ==================================================================== |
|
210 |
* |
|
211 |
* Store related services |
|
212 |
*/ |
|
213 |
public void registerStoreProvider(String name, Class storeProviderClass, |
|
214 |
Class parametersClass) { |
|
215 |
if (name == null || storeProviderClass == null |
|
216 |
|| parametersClass == null) { |
|
217 |
// FIXME Exception |
|
218 |
throw new IllegalArgumentException("Any parameters can be null"); |
|
219 |
} |
|
188 | 220 |
|
189 |
if (CoverageStoreProvider.class.isAssignableFrom(storeProviderClass)) { |
|
190 |
ToolsLocator.getExtensionPointManager() |
|
191 |
.add(DATA_MANAGER_STORE, DATA_MANAGER_STORE_DESCRIPTION) |
|
192 |
.append(name, null, storeProviderClass); |
|
221 |
if (!DataStoreParameters.class.isAssignableFrom(parametersClass)) { |
|
222 |
// FIXME Exception |
|
223 |
throw new IllegalArgumentException(parametersClass.getName() |
|
224 |
+ " must implement org.gvsig.fmap.dal.DataStoreParameters"); |
|
225 |
} |
|
193 | 226 |
|
194 |
ToolsLocator |
|
195 |
.getExtensionPointManager() |
|
196 |
.add(DATA_MANAGER_STORE_PARAMS, |
|
197 |
DATA_MANAGER_STORE_PARAMS_DESCRIPTION) |
|
198 |
.append(name, null, parametersClass); |
|
199 |
return; |
|
200 |
} |
|
227 |
if (CoverageStoreProvider.class.isAssignableFrom(storeProviderClass)) { |
|
228 |
ToolsLocator.getExtensionPointManager() |
|
229 |
.add(DATA_MANAGER_STORE, DATA_MANAGER_STORE_DESCRIPTION) |
|
230 |
.append(name, null, storeProviderClass); |
|
201 | 231 |
|
202 |
if (FeatureStoreProvider.class.isAssignableFrom(storeProviderClass)) { |
|
203 |
// Envuelve al proveedor en una factoria por defecto. |
|
204 |
this.registerStoreProviderFactory(new BaseFeatureStoreProviderFactory(name, "", storeProviderClass, parametersClass)); |
|
205 |
return; |
|
206 |
} |
|
232 |
ToolsLocator |
|
233 |
.getExtensionPointManager() |
|
234 |
.add(DATA_MANAGER_STORE_PARAMS, |
|
235 |
DATA_MANAGER_STORE_PARAMS_DESCRIPTION) |
|
236 |
.append(name, null, parametersClass); |
|
237 |
return; |
|
238 |
} |
|
207 | 239 |
|
208 |
throw new IllegalArgumentException("Not supported implemtation: name=" |
|
209 |
+ name + " provider class=" + storeProviderClass.getName()); |
|
240 |
if (FeatureStoreProvider.class.isAssignableFrom(storeProviderClass)) { |
|
241 |
// Envuelve al proveedor en una factoria por defecto. |
|
242 |
this.registerStoreProviderFactory(new BaseFeatureStoreProviderFactory( |
|
243 |
name, "", storeProviderClass, parametersClass)); |
|
244 |
return; |
|
245 |
} |
|
210 | 246 |
|
211 |
} |
|
247 |
throw new IllegalArgumentException("Not supported implemtation: name=" |
|
248 |
+ name + " provider class=" + storeProviderClass.getName()); |
|
212 | 249 |
|
213 |
public void registerStoreProviderFactory(DataStoreProviderFactory factory) { |
|
214 |
ExtensionPoint factories = ToolsLocator.getExtensionPointManager().add( |
|
215 |
DATA_MANAGER_STORE_PROVIDER_FACTORY, |
|
216 |
DATA_MANAGER_STORE_PROVIDER_FACTORY_DESCRIPTION); |
|
217 |
factories.append(factory.getName(), factory.getDescription(), factory); |
|
250 |
} |
|
218 | 251 |
|
219 |
} |
|
252 |
public void registerStoreProviderFactory(DataStoreProviderFactory factory) { |
|
253 |
ExtensionPoint factories = |
|
254 |
ToolsLocator.getExtensionPointManager().add( |
|
255 |
DATA_MANAGER_STORE_PROVIDER_FACTORY, |
|
256 |
DATA_MANAGER_STORE_PROVIDER_FACTORY_DESCRIPTION); |
|
257 |
factories.append(factory.getName(), factory.getDescription(), factory); |
|
220 | 258 |
|
221 |
public void registerStoreFactory(String name, Class storeProviderClass) { |
|
222 |
if (name == null || storeProviderClass == null) { |
|
223 |
// FIXME Exception |
|
224 |
throw new IllegalArgumentException("Any parameters can be null"); |
|
225 |
} |
|
259 |
} |
|
226 | 260 |
|
227 |
if (!(DataStoreFactory.class.isAssignableFrom(storeProviderClass))) { |
|
228 |
// FIXME Exception |
|
229 |
throw new IllegalArgumentException( |
|
230 |
"Not supported implemtation: name=" + name |
|
231 |
+ " provider class=" + storeProviderClass.getName()); |
|
232 |
} |
|
261 |
public void registerStoreFactory(String name, Class storeProviderClass) { |
|
262 |
if (name == null || storeProviderClass == null) { |
|
263 |
// FIXME Exception |
|
264 |
throw new IllegalArgumentException("Any parameters can be null"); |
|
265 |
} |
|
233 | 266 |
|
234 |
ToolsLocator
|
|
235 |
.getExtensionPointManager()
|
|
236 |
.add(DATA_MANAGER_STORE_FACTORY,
|
|
237 |
DATA_MANAGER_STORE_FACTORY_DESCRIPTION)
|
|
238 |
.append(name, null, storeProviderClass);
|
|
239 |
}
|
|
267 |
if (!(DataStoreFactory.class.isAssignableFrom(storeProviderClass))) {
|
|
268 |
// FIXME Exception
|
|
269 |
throw new IllegalArgumentException(
|
|
270 |
"Not supported implemtation: name=" + name + " provider class="
|
|
271 |
+ storeProviderClass.getName());
|
|
272 |
}
|
|
240 | 273 |
|
241 |
public DataStoreParameters createStoreParameters(String name) |
|
242 |
throws InitializeException, ProviderNotRegisteredException { |
|
243 |
try { |
|
244 |
|
|
245 |
// Si hay una factoria para ese proveedor se los pedimos a la factoria |
|
246 |
DataStoreProviderFactory providerFactory = (DataStoreProviderFactory) ToolsLocator |
|
247 |
.getExtensionPointManager().get(DATA_MANAGER_STORE_PROVIDER_FACTORY) |
|
248 |
.create(name); |
|
249 |
if( providerFactory != null ) { |
|
250 |
return (DataStoreParameters) providerFactory.createParameters(); |
|
251 |
} |
|
252 |
|
|
253 |
// Si no hay factoria lo hacemos como se hacia antes por mantener |
|
254 |
// compatibilidad. |
|
255 |
DataStoreParameters params = (DataStoreParameters) ToolsLocator |
|
256 |
.getExtensionPointManager().get(DATA_MANAGER_STORE_PARAMS) |
|
257 |
.create(name); |
|
258 |
if (params == null) { |
|
259 |
throw new ProviderNotRegisteredException(name); |
|
260 |
} |
|
261 |
return params; |
|
262 |
} catch (InstantiationException e) { |
|
263 |
throw new InitializeException(e); |
|
264 |
} catch (IllegalAccessException e) { |
|
265 |
throw new InitializeException(e); |
|
266 |
} catch (SecurityException e) { |
|
267 |
throw new InitializeException(e); |
|
268 |
} catch (IllegalArgumentException e) { |
|
269 |
throw new InitializeException(e); |
|
270 |
} |
|
271 |
} |
|
274 |
ToolsLocator |
|
275 |
.getExtensionPointManager() |
|
276 |
.add(DATA_MANAGER_STORE_FACTORY, |
|
277 |
DATA_MANAGER_STORE_FACTORY_DESCRIPTION) |
|
278 |
.append(name, null, storeProviderClass); |
|
279 |
} |
|
272 | 280 |
|
273 |
private DataStore localOpenStore(String provider, |
|
274 |
DataStoreParameters parameters) throws InitializeException, |
|
275 |
ProviderNotRegisteredException, ValidateDataParametersException { |
|
276 |
String name = provider; // parameters.getDataStoreName(); |
|
281 |
public DataStoreParameters createStoreParameters(String name) |
|
282 |
throws InitializeException, ProviderNotRegisteredException { |
|
283 |
try { |
|
277 | 284 |
|
278 |
parameters.validate(); |
|
285 |
// Si hay una factoria para ese proveedor se los pedimos a la |
|
286 |
// factoria |
|
287 |
DataStoreProviderFactory providerFactory = |
|
288 |
(DataStoreProviderFactory) ToolsLocator |
|
289 |
.getExtensionPointManager() |
|
290 |
.get(DATA_MANAGER_STORE_PROVIDER_FACTORY).create(name); |
|
291 |
if (providerFactory != null) { |
|
292 |
return (DataStoreParameters) providerFactory.createParameters(); |
|
293 |
} |
|
279 | 294 |
|
280 |
DataStore store; |
|
281 |
try { |
|
282 |
DataStoreProviderFactory providerFactory; |
|
283 |
providerFactory = (DataStoreProviderFactory) ToolsLocator |
|
284 |
.getExtensionPointManager().get(DATA_MANAGER_STORE_PROVIDER_FACTORY) |
|
285 |
.create(name); |
|
286 |
if( providerFactory != null ) { |
|
287 |
if (FeatureStoreProviderFactory.class.isAssignableFrom(providerFactory.getClass())){ |
|
288 |
store = new DefaultFeatureStore(); |
|
289 |
this.intializeDataStore(store, parameters); |
|
290 |
return store; |
|
291 |
} |
|
292 |
} |
|
293 |
} catch (InstantiationException e1) { |
|
294 |
// ignore |
|
295 |
} catch (IllegalAccessException e1) { |
|
296 |
// ignore |
|
297 |
} |
|
295 |
// Si no hay factoria lo hacemos como se hacia antes por mantener |
|
296 |
// compatibilidad. |
|
297 |
DataStoreParameters params = |
|
298 |
(DataStoreParameters) ToolsLocator.getExtensionPointManager() |
|
299 |
.get(DATA_MANAGER_STORE_PARAMS).create(name); |
|
300 |
if (params == null) { |
|
301 |
throw new ProviderNotRegisteredException(name); |
|
302 |
} |
|
303 |
return params; |
|
304 |
} catch (InstantiationException e) { |
|
305 |
throw new InitializeException(e); |
|
306 |
} catch (IllegalAccessException e) { |
|
307 |
throw new InitializeException(e); |
|
308 |
} catch (SecurityException e) { |
|
309 |
throw new InitializeException(e); |
|
310 |
} catch (IllegalArgumentException e) { |
|
311 |
throw new InitializeException(e); |
|
312 |
} |
|
313 |
} |
|
298 | 314 |
|
315 |
private DataStore localOpenStore(String provider, |
|
316 |
DataStoreParameters parameters) throws InitializeException, |
|
317 |
ProviderNotRegisteredException, ValidateDataParametersException { |
|
318 |
String name = provider; // parameters.getDataStoreName(); |
|
299 | 319 |
|
300 |
Extension storeProviderExtension = ToolsLocator |
|
301 |
.getExtensionPointManager().get(DATA_MANAGER_STORE).get(name); |
|
320 |
parameters.validate(); |
|
302 | 321 |
|
303 |
if (storeProviderExtension == null) { |
|
304 |
throw new ProviderNotRegisteredException(name); |
|
305 |
} |
|
322 |
DataStore store; |
|
323 |
try { |
|
324 |
DataStoreProviderFactory providerFactory; |
|
325 |
providerFactory = |
|
326 |
(DataStoreProviderFactory) ToolsLocator |
|
327 |
.getExtensionPointManager() |
|
328 |
.get(DATA_MANAGER_STORE_PROVIDER_FACTORY).create(name); |
|
329 |
if (providerFactory != null) { |
|
330 |
if (FeatureStoreProviderFactory.class |
|
331 |
.isAssignableFrom(providerFactory.getClass())) { |
|
332 |
store = new DefaultFeatureStore(); |
|
333 |
this.intializeDataStore(store, parameters); |
|
334 |
return store; |
|
335 |
} |
|
336 |
} |
|
337 |
} catch (InstantiationException e1) { |
|
338 |
// ignore |
|
339 |
} catch (IllegalAccessException e1) { |
|
340 |
// ignore |
|
341 |
} |
|
306 | 342 |
|
307 |
Class providerClass = storeProviderExtension.getExtension(); |
|
308 |
if (providerClass == null) { |
|
309 |
throw new ProviderNotRegisteredException(name); |
|
310 |
} |
|
343 |
Extension storeProviderExtension = |
|
344 |
ToolsLocator.getExtensionPointManager().get(DATA_MANAGER_STORE) |
|
345 |
.get(name); |
|
311 | 346 |
|
312 |
if (CoverageStoreProvider.class.isAssignableFrom(providerClass)) { |
|
313 |
ExtensionPoint.Extension point = ToolsLocator |
|
314 |
.getExtensionPointManager().get(DATA_MANAGER_STORE_FACTORY) |
|
315 |
.get(name); |
|
316 |
DataStoreFactory factory = null; |
|
317 |
try { |
|
318 |
factory = (DataStoreFactory) point.create(); |
|
319 |
} catch (InstantiationException e) { |
|
320 |
throw new InitializeException(e); |
|
321 |
} catch (IllegalAccessException e) { |
|
322 |
throw new InitializeException(e); |
|
323 |
} |
|
324 |
factory.setParameters(parameters); |
|
325 |
store = factory.createStore(); |
|
326 |
} else if (FeatureStoreProvider.class.isAssignableFrom(providerClass)) { |
|
347 |
if (storeProviderExtension == null) { |
|
348 |
throw new ProviderNotRegisteredException(name); |
|
349 |
} |
|
327 | 350 |
|
328 |
store = new DefaultFeatureStore(); |
|
351 |
Class providerClass = storeProviderExtension.getExtension(); |
|
352 |
if (providerClass == null) { |
|
353 |
throw new ProviderNotRegisteredException(name); |
|
354 |
} |
|
329 | 355 |
|
330 |
} else { |
|
331 |
// FIXME Exception |
|
332 |
throw new InitializeException(name, new RuntimeException( |
|
333 |
"Not supported implemtation: name=" + name |
|
334 |
+ " provider class=" + providerClass.getName())); |
|
335 |
} |
|
356 |
if (CoverageStoreProvider.class.isAssignableFrom(providerClass)) { |
|
357 |
ExtensionPoint.Extension point = |
|
358 |
ToolsLocator.getExtensionPointManager() |
|
359 |
.get(DATA_MANAGER_STORE_FACTORY).get(name); |
|
360 |
DataStoreFactory factory = null; |
|
361 |
try { |
|
362 |
factory = (DataStoreFactory) point.create(); |
|
363 |
} catch (InstantiationException e) { |
|
364 |
throw new InitializeException(e); |
|
365 |
} catch (IllegalAccessException e) { |
|
366 |
throw new InitializeException(e); |
|
367 |
} |
|
368 |
factory.setParameters(parameters); |
|
369 |
store = factory.createStore(); |
|
370 |
} else |
|
371 |
if (FeatureStoreProvider.class.isAssignableFrom(providerClass)) { |
|
336 | 372 |
|
337 |
this.intializeDataStore(store, parameters);
|
|
373 |
store = new DefaultFeatureStore();
|
|
338 | 374 |
|
339 |
return store; |
|
340 |
} |
|
375 |
} else { |
|
376 |
// FIXME Exception |
|
377 |
throw new InitializeException(name, new RuntimeException( |
|
378 |
"Not supported implemtation: name=" + name |
|
379 |
+ " provider class=" + providerClass.getName())); |
|
380 |
} |
|
341 | 381 |
|
342 |
public DataStore openStore(String provider, DataStoreParameters parameters) |
|
343 |
throws InitializeException, ProviderNotRegisteredException, |
|
344 |
ValidateDataParametersException { |
|
382 |
this.intializeDataStore(store, parameters); |
|
345 | 383 |
|
346 |
return localOpenStore(provider, parameters);
|
|
347 |
}
|
|
384 |
return store;
|
|
385 |
}
|
|
348 | 386 |
|
349 |
/** |
|
350 |
* @deprecated see openStore |
|
351 |
*/ |
|
352 |
public DataStore createStore(DataStoreParameters parameters) |
|
353 |
throws InitializeException, ProviderNotRegisteredException, |
|
354 |
ValidateDataParametersException { |
|
355 |
try { |
|
356 |
int i = 1 / 0; |
|
357 |
} catch (Throwable e) { |
|
358 |
LOG.info( |
|
359 |
"Use of deprcated method. Replace calling to it by calling to openStore", |
|
360 |
e); |
|
361 |
} |
|
362 |
return openStore(parameters.getDataStoreName(), parameters); |
|
363 |
} |
|
387 |
public DataStore openStore(String provider, DataStoreParameters parameters) |
|
388 |
throws InitializeException, ProviderNotRegisteredException, |
|
389 |
ValidateDataParametersException { |
|
364 | 390 |
|
365 |
public List getStoreProviders() { |
|
366 |
ExtensionPointManager epmanager = ToolsLocator.getExtensionPointManager(); |
|
367 |
List names1 = epmanager.get(DATA_MANAGER_STORE).getNames(); |
|
368 |
List names2 = epmanager.get(DATA_MANAGER_STORE_PROVIDER_FACTORY).getNames(); |
|
369 |
List names3 = new ArrayList(); |
|
370 |
names3.addAll(names1); |
|
371 |
names3.addAll(names2); |
|
372 |
return names3; |
|
373 |
} |
|
391 |
return localOpenStore(provider, parameters); |
|
392 |
} |
|
374 | 393 |
|
375 |
public DataStoreProviderFactory getStoreProviderFactory(String name) { |
|
376 |
try { |
|
377 |
return (DataStoreProviderFactory) ToolsLocator |
|
378 |
.getExtensionPointManager() |
|
379 |
.get(DATA_MANAGER_STORE_PROVIDER_FACTORY).create(name); |
|
380 |
} catch (InstantiationException e) { |
|
381 |
return null; |
|
382 |
} catch (IllegalAccessException e) { |
|
383 |
return null; |
|
384 |
} |
|
385 |
} |
|
394 |
/** |
|
395 |
* @deprecated see openStore |
|
396 |
*/ |
|
397 |
public DataStore createStore(DataStoreParameters parameters) |
|
398 |
throws InitializeException, ProviderNotRegisteredException, |
|
399 |
ValidateDataParametersException { |
|
400 |
try { |
|
401 |
int i = 1 / 0; |
|
402 |
} catch (Throwable e) { |
|
403 |
LOG.info( |
|
404 |
"Use of deprcated method. Replace calling to it by calling to openStore", |
|
405 |
e); |
|
406 |
} |
|
407 |
return openStore(parameters.getDataStoreName(), parameters); |
|
408 |
} |
|
386 | 409 |
|
387 |
public List getStoreProviders(String name) { |
|
388 |
return getStoreProviders(); // FIXME: need filter from the name of |
|
389 |
// the explorer |
|
390 |
} |
|
410 |
public List getStoreProviders() { |
|
411 |
ExtensionPointManager epmanager = |
|
412 |
ToolsLocator.getExtensionPointManager(); |
|
413 |
List names1 = epmanager.get(DATA_MANAGER_STORE).getNames(); |
|
414 |
List names2 = |
|
415 |
epmanager.get(DATA_MANAGER_STORE_PROVIDER_FACTORY).getNames(); |
|
416 |
List names3 = new ArrayList(); |
|
417 |
names3.addAll(names1); |
|
418 |
names3.addAll(names2); |
|
419 |
return names3; |
|
420 |
} |
|
391 | 421 |
|
392 |
public NewDataStoreParameters createNewStoreParameters(String explorer, |
|
393 |
String provider) throws InitializeException, |
|
394 |
ProviderNotRegisteredException { |
|
422 |
public DataStoreProviderFactory getStoreProviderFactory(String name) { |
|
423 |
try { |
|
424 |
return (DataStoreProviderFactory) ToolsLocator |
|
425 |
.getExtensionPointManager() |
|
426 |
.get(DATA_MANAGER_STORE_PROVIDER_FACTORY).create(name); |
|
427 |
} catch (InstantiationException e) { |
|
428 |
return null; |
|
429 |
} catch (IllegalAccessException e) { |
|
430 |
return null; |
|
431 |
} |
|
432 |
} |
|
395 | 433 |
|
396 |
DataServerExplorerParameters parameters; |
|
397 |
DataServerExplorer server; |
|
398 |
try { |
|
399 |
parameters = this.createServerExplorerParameters(explorer); |
|
400 |
server = this.openServerExplorerWithoutValidate(explorer, |
|
401 |
parameters); |
|
402 |
return server.getAddParameters(provider); |
|
403 |
} catch (ValidateDataParametersException e) { |
|
404 |
throw new InitializeException(e); |
|
405 |
} catch (DataException e) { |
|
406 |
throw new InitializeException(e); |
|
407 |
} |
|
408 |
} |
|
434 |
public List getStoreProviders(String name) { |
|
435 |
return getStoreProviders(); // FIXME: need filter from the name of |
|
436 |
// the explorer |
|
437 |
} |
|
409 | 438 |
|
410 |
public void newStore(String explorer, String provider, |
|
411 |
NewDataStoreParameters parameters, boolean overwrite) |
|
412 |
throws InitializeException, ProviderNotRegisteredException, |
|
413 |
ValidateDataParametersException { |
|
439 |
public NewDataStoreParameters createNewStoreParameters(String explorer, |
|
440 |
String provider) throws InitializeException, |
|
441 |
ProviderNotRegisteredException { |
|
414 | 442 |
|
415 |
parameters.validate(); |
|
443 |
DataServerExplorerParameters parameters; |
|
444 |
DataServerExplorer server; |
|
445 |
try { |
|
446 |
parameters = this.createServerExplorerParameters(explorer); |
|
447 |
server = |
|
448 |
this.openServerExplorerWithoutValidate(explorer, parameters); |
|
449 |
return server.getAddParameters(provider); |
|
450 |
} catch (ValidateDataParametersException e) { |
|
451 |
throw new InitializeException(e); |
|
452 |
} catch (DataException e) { |
|
453 |
throw new InitializeException(e); |
|
454 |
} |
|
455 |
} |
|
416 | 456 |
|
417 |
DataServerExplorerParameters explorerParameters; |
|
418 |
DataServerExplorer server; |
|
419 |
explorerParameters = this.createServerExplorerParameters(explorer); |
|
420 |
server = this.openServerExplorerWithoutValidate(explorer, |
|
421 |
explorerParameters); |
|
422 |
try { |
|
423 |
server.add(provider, parameters, overwrite); |
|
424 |
} catch (DataException e) { |
|
425 |
throw new InitializeException(e); |
|
426 |
} |
|
427 |
} |
|
457 |
public void newStore(String explorer, String provider, |
|
458 |
NewDataStoreParameters parameters, boolean overwrite) |
|
459 |
throws InitializeException, ProviderNotRegisteredException, |
|
460 |
ValidateDataParametersException { |
|
428 | 461 |
|
429 |
/* |
|
430 |
* ==================================================================== |
|
431 |
* |
|
432 |
* Explorer related services |
|
433 |
*/ |
|
434 |
public void registerExplorerProvider(String name, Class explorerClass, |
|
435 |
Class parametersClass) { |
|
462 |
parameters.validate(); |
|
436 | 463 |
|
437 |
if (name == null || explorerClass == null || parametersClass == null) { |
|
438 |
// FIXME Exception |
|
439 |
throw new IllegalArgumentException("Any parameters can be null"); |
|
440 |
} |
|
464 |
DataServerExplorerParameters explorerParameters; |
|
465 |
DataServerExplorer server; |
|
466 |
explorerParameters = this.createServerExplorerParameters(explorer); |
|
467 |
server = |
|
468 |
this.openServerExplorerWithoutValidate(explorer, explorerParameters); |
|
469 |
try { |
|
470 |
server.add(provider, parameters, overwrite); |
|
471 |
} catch (DataException e) { |
|
472 |
throw new InitializeException(e); |
|
473 |
} |
|
474 |
} |
|
441 | 475 |
|
442 |
if (!DataServerExplorerParameters.class
|
|
443 |
.isAssignableFrom(parametersClass)) {
|
|
444 |
// FIXME Exception
|
|
445 |
throw new IllegalArgumentException(
|
|
446 |
parametersClass.getName()
|
|
447 |
+ " must implement org.gvsig.fmap.dal.DataServerExplorerParameters");
|
|
448 |
}
|
|
476 |
/*
|
|
477 |
* ====================================================================
|
|
478 |
*
|
|
479 |
* Explorer related services
|
|
480 |
*/
|
|
481 |
public void registerExplorerProvider(String name, Class explorerClass,
|
|
482 |
Class parametersClass) {
|
|
449 | 483 |
|
450 |
if (!DataServerExplorer.class.isAssignableFrom(explorerClass)) { |
|
451 |
// FIXME Exception |
|
452 |
throw new IllegalArgumentException(explorerClass.getName() |
|
453 |
+ " must implement org.gvsig.fmap.dal.DataServerExplorer"); |
|
454 |
} |
|
484 |
if (name == null || explorerClass == null || parametersClass == null) { |
|
485 |
// FIXME Exception |
|
486 |
throw new IllegalArgumentException("Any parameters can be null"); |
|
487 |
} |
|
455 | 488 |
|
456 |
ToolsLocator.getExtensionPointManager() |
|
457 |
.add(DATA_MANAGER_EXPLORER, DATA_MANAGER_EXPLORER_DESCRIPTION) |
|
458 |
.append(name, null, explorerClass); |
|
489 |
if (!DataServerExplorerParameters.class |
|
490 |
.isAssignableFrom(parametersClass)) { |
|
491 |
// FIXME Exception |
|
492 |
throw new IllegalArgumentException( |
|
493 |
parametersClass.getName() |
|
494 |
+ " must implement org.gvsig.fmap.dal.DataServerExplorerParameters"); |
|
495 |
} |
|
459 | 496 |
|
460 |
ToolsLocator |
|
461 |
.getExtensionPointManager() |
|
462 |
.add(DATA_MANAGER_EXPLORER_PARAMS, |
|
463 |
DATA_MANAGER_EXPLORER_PARAMS_DESCRIPTION) |
|
464 |
.append(name, null, parametersClass); |
|
465 |
} |
|
497 |
if (!DataServerExplorer.class.isAssignableFrom(explorerClass)) { |
|
498 |
// FIXME Exception |
|
499 |
throw new IllegalArgumentException(explorerClass.getName() |
|
500 |
+ " must implement org.gvsig.fmap.dal.DataServerExplorer"); |
|
501 |
} |
|
466 | 502 |
|
467 |
public DataServerExplorerParameters createServerExplorerParameters( |
|
468 |
String name) throws InitializeException, |
|
469 |
ProviderNotRegisteredException { |
|
470 |
try { |
|
471 |
DataServerExplorerParameters params = (DataServerExplorerParameters) ToolsLocator |
|
472 |
.getExtensionPointManager() |
|
473 |
.get(DATA_MANAGER_EXPLORER_PARAMS).create(name); |
|
474 |
if (params == null) { |
|
475 |
throw new ProviderNotRegisteredException(name); |
|
476 |
} |
|
477 |
return params; |
|
478 |
} catch (InstantiationException e) { |
|
479 |
throw new InitializeException(e); |
|
480 |
} catch (IllegalAccessException e) { |
|
481 |
throw new InitializeException(e); |
|
482 |
} catch (SecurityException e) { |
|
483 |
throw new InitializeException(e); |
|
484 |
} catch (IllegalArgumentException e) { |
|
485 |
throw new InitializeException(e); |
|
486 |
} |
|
487 |
} |
|
503 |
ToolsLocator.getExtensionPointManager() |
|
504 |
.add(DATA_MANAGER_EXPLORER, DATA_MANAGER_EXPLORER_DESCRIPTION) |
|
505 |
.append(name, null, explorerClass); |
|
488 | 506 |
|
489 |
public DataServerExplorer openServerExplorer(String explorer, |
|
490 |
DataServerExplorerParameters parameters) |
|
491 |
throws InitializeException, ProviderNotRegisteredException, |
|
492 |
ValidateDataParametersException { |
|
507 |
ToolsLocator |
|
508 |
.getExtensionPointManager() |
|
509 |
.add(DATA_MANAGER_EXPLORER_PARAMS, |
|
510 |
DATA_MANAGER_EXPLORER_PARAMS_DESCRIPTION) |
|
511 |
.append(name, null, parametersClass); |
|
512 |
} |
|
493 | 513 |
|
494 |
if (parameters != null) { |
|
495 |
parameters.validate(); |
|
496 |
} |
|
497 |
return this.openServerExplorerWithoutValidate(explorer, parameters); |
|
498 |
} |
|
514 |
public DataServerExplorerParameters createServerExplorerParameters( |
|
515 |
String name) throws InitializeException, ProviderNotRegisteredException { |
|
516 |
try { |
|
517 |
DataServerExplorerParameters params = |
|
518 |
(DataServerExplorerParameters) ToolsLocator |
|
519 |
.getExtensionPointManager() |
|
520 |
.get(DATA_MANAGER_EXPLORER_PARAMS).create(name); |
|
521 |
if (params == null) { |
|
522 |
throw new ProviderNotRegisteredException(name); |
|
523 |
} |
|
524 |
return params; |
|
525 |
} catch (InstantiationException e) { |
|
526 |
throw new InitializeException(e); |
|
527 |
} catch (IllegalAccessException e) { |
|
528 |
throw new InitializeException(e); |
|
529 |
} catch (SecurityException e) { |
|
530 |
throw new InitializeException(e); |
|
531 |
} catch (IllegalArgumentException e) { |
|
532 |
throw new InitializeException(e); |
|
533 |
} |
|
534 |
} |
|
499 | 535 |
|
500 |
private DataServerExplorer openServerExplorerWithoutValidate( |
|
501 |
String explorerName, DataServerExplorerParameters parameters) |
|
502 |
throws InitializeException, ProviderNotRegisteredException, |
|
503 |
ValidateDataParametersException { |
|
536 |
public DataServerExplorer openServerExplorer(String explorer, |
|
537 |
DataServerExplorerParameters parameters) throws InitializeException, |
|
538 |
ProviderNotRegisteredException, ValidateDataParametersException { |
|
504 | 539 |
|
505 |
String name = explorerName; // parameters.getExplorerName(); |
|
540 |
if (parameters != null) { |
|
541 |
parameters.validate(); |
|
542 |
} |
|
543 |
return this.openServerExplorerWithoutValidate(explorer, parameters); |
|
544 |
} |
|
506 | 545 |
|
507 |
try { |
|
508 |
DataServerExplorerProvider server = (DataServerExplorerProvider) ToolsLocator |
|
509 |
.getExtensionPointManager() |
|
510 |
.get(DATA_MANAGER_EXPLORER) |
|
511 |
.create(name, |
|
512 |
new Object[] { |
|
513 |
parameters, |
|
514 |
new DefaultDataServerExplorerProviderServices() }); |
|
515 |
if (server == null) { |
|
516 |
throw new ProviderNotRegisteredException(name); |
|
517 |
} |
|
518 |
return server; |
|
519 |
} catch (InstantiationException e) { |
|
520 |
throw new InitializeException(e); |
|
521 |
} catch (IllegalAccessException e) { |
|
522 |
throw new InitializeException(e); |
|
523 |
} catch (SecurityException e) { |
|
524 |
throw new InitializeException(e); |
|
525 |
} catch (IllegalArgumentException e) { |
|
526 |
throw new InitializeException(e); |
|
527 |
} catch (NoSuchMethodException e) { |
|
528 |
throw new InitializeException(e); |
|
529 |
} catch (InvocationTargetException e) { |
|
530 |
throw new InitializeException(e); |
|
531 |
} |
|
532 |
} |
|
546 |
private DataServerExplorer openServerExplorerWithoutValidate( |
|
547 |
String explorerName, DataServerExplorerParameters parameters) |
|
548 |
throws InitializeException, ProviderNotRegisteredException, |
|
549 |
ValidateDataParametersException { |
|
533 | 550 |
|
534 |
/** |
|
535 |
* @deprecated see openServerExplorer |
|
536 |
*/ |
|
537 |
public DataServerExplorer createServerExplorer( |
|
538 |
DataServerExplorerParameters parameters) |
|
539 |
throws InitializeException, ProviderNotRegisteredException, |
|
540 |
ValidateDataParametersException { |
|
541 |
return openServerExplorer(parameters.getExplorerName(), parameters); |
|
542 |
} |
|
551 |
String name = explorerName; // parameters.getExplorerName(); |
|
543 | 552 |
|
544 |
public List getExplorerProviders() { |
|
545 |
return ToolsLocator.getExtensionPointManager() |
|
546 |
.get(DATA_MANAGER_EXPLORER).getNames(); |
|
547 |
} |
|
553 |
try { |
|
554 |
DataServerExplorerProvider server = |
|
555 |
(DataServerExplorerProvider) ToolsLocator |
|
556 |
.getExtensionPointManager() |
|
557 |
.get(DATA_MANAGER_EXPLORER) |
|
558 |
.create( |
|
559 |
name, |
|
560 |
new Object[] { parameters, |
|
561 |
new DefaultDataServerExplorerProviderServices() }); |
|
562 |
if (server == null) { |
|
563 |
throw new ProviderNotRegisteredException(name); |
|
564 |
} |
|
565 |
return server; |
|
566 |
} catch (InstantiationException e) { |
|
567 |
throw new InitializeException(e); |
|
568 |
} catch (IllegalAccessException e) { |
|
569 |
throw new InitializeException(e); |
|
570 |
} catch (SecurityException e) { |
|
571 |
throw new InitializeException(e); |
|
572 |
} catch (IllegalArgumentException e) { |
|
573 |
throw new InitializeException(e); |
|
574 |
} catch (NoSuchMethodException e) { |
|
575 |
throw new InitializeException(e); |
|
576 |
} catch (InvocationTargetException e) { |
|
577 |
throw new InitializeException(e); |
|
578 |
} |
|
579 |
} |
|
548 | 580 |
|
549 |
/* |
|
550 |
* ==================================================================== |
|
551 |
* |
|
552 |
* Expresion evaluation related services |
|
553 |
*/ |
|
554 |
public Evaluator createExpresion(String expresion) |
|
555 |
throws InitializeException { |
|
556 |
try { |
|
557 |
return (Evaluator) ToolsLocator |
|
558 |
.getExtensionPointManager() |
|
559 |
.get(DATA_MANAGER_EXPRESION_EVALUATOR) |
|
560 |
.create(DATA_MANAGER_EXPRESION_EVALUATOR_DEFAULT, |
|
561 |
new Object[] { expresion }); |
|
562 |
} catch (SecurityException e) { |
|
563 |
throw new InitializeException(e); |
|
564 |
} catch (IllegalArgumentException e) { |
|
565 |
throw new InitializeException(e); |
|
566 |
} catch (NoSuchMethodException e) { |
|
567 |
throw new InitializeException(e); |
|
568 |
} catch (InstantiationException e) { |
|
569 |
throw new InitializeException(e); |
|
570 |
} catch (IllegalAccessException e) { |
|
571 |
throw new InitializeException(e); |
|
572 |
} catch (InvocationTargetException e) { |
|
573 |
throw new InitializeException(e); |
|
574 |
} |
|
575 |
} |
|
581 |
/** |
|
582 |
* @deprecated see openServerExplorer |
|
583 |
*/ |
|
584 |
public DataServerExplorer createServerExplorer( |
|
585 |
DataServerExplorerParameters parameters) throws InitializeException, |
|
586 |
ProviderNotRegisteredException, ValidateDataParametersException { |
|
587 |
return openServerExplorer(parameters.getExplorerName(), parameters); |
|
588 |
} |
|
576 | 589 |
|
577 |
public void registerDefaultEvaluator(Class evaluatorClass) { |
|
578 |
if (!Evaluator.class.isAssignableFrom(evaluatorClass)) { |
|
579 |
throw new ClassCastException(); |
|
580 |
} |
|
581 |
ToolsLocator |
|
582 |
.getExtensionPointManager() |
|
583 |
.add(DATA_MANAGER_EXPRESION_EVALUATOR, |
|
584 |
DATA_MANAGER_EXPRESION_EVALUATOR_DESCRIPTION) |
|
585 |
.append(DATA_MANAGER_EXPRESION_EVALUATOR_DEFAULT, |
|
586 |
"Default expresion evaluator for use in DAL", |
|
587 |
evaluatorClass); |
|
588 |
} |
|
590 |
public List getExplorerProviders() { |
|
591 |
return ToolsLocator.getExtensionPointManager() |
|
592 |
.get(DATA_MANAGER_EXPLORER).getNames(); |
|
593 |
} |
|
589 | 594 |
|
590 |
/* |
|
591 |
* ==================================================================== |
|
592 |
* |
|
593 |
* Index related services |
|
594 |
*/ |
|
595 |
/* |
|
596 |
* ==================================================================== |
|
597 |
* |
|
598 |
* Expresion evaluation related services |
|
599 |
*/ |
|
600 |
public Evaluator createExpresion(String expresion) |
|
601 |
throws InitializeException { |
|
602 |
try { |
|
603 |
return (Evaluator) ToolsLocator |
|
604 |
.getExtensionPointManager() |
|
605 |
.get(DATA_MANAGER_EXPRESION_EVALUATOR) |
|
606 |
.create(DATA_MANAGER_EXPRESION_EVALUATOR_DEFAULT, |
|
607 |
new Object[] { expresion }); |
|
608 |
} catch (SecurityException e) { |
|
609 |
throw new InitializeException(e); |
|
610 |
} catch (IllegalArgumentException e) { |
|
611 |
throw new InitializeException(e); |
|
612 |
} catch (NoSuchMethodException e) { |
|
613 |
throw new InitializeException(e); |
|
614 |
} catch (InstantiationException e) { |
|
615 |
throw new InitializeException(e); |
|
616 |
} catch (IllegalAccessException e) { |
|
617 |
throw new InitializeException(e); |
|
618 |
} catch (InvocationTargetException e) { |
|
619 |
throw new InitializeException(e); |
|
620 |
} |
|
621 |
} |
|
595 | 622 |
|
596 |
public List getFeatureIndexProviders() { |
|
597 |
return ToolsLocator.getExtensionPointManager().get(DATA_MANAGER_INDEX) |
|
598 |
.getNames(); |
|
599 |
} |
|
623 |
public void registerDefaultEvaluator(Class evaluatorClass) { |
|
624 |
if (!Evaluator.class.isAssignableFrom(evaluatorClass)) { |
|
625 |
throw new ClassCastException(); |
|
626 |
} |
|
627 |
ToolsLocator |
|
628 |
.getExtensionPointManager() |
|
629 |
.add(DATA_MANAGER_EXPRESION_EVALUATOR, |
|
630 |
DATA_MANAGER_EXPRESION_EVALUATOR_DESCRIPTION) |
|
631 |
.append(DATA_MANAGER_EXPRESION_EVALUATOR_DEFAULT, |
|
632 |
"Default expresion evaluator for use in DAL", evaluatorClass); |
|
633 |
} |
|
600 | 634 |
|
601 |
public void setDefaultFeatureIndexProviderName(int dataType, String name) { |
|
602 |
defaultDataIndexProviders.put(new Integer(dataType), name); |
|
603 |
} |
|
635 |
/* |
|
636 |
* ==================================================================== |
|
637 |
* |
|
638 |
* Index related services |
|
639 |
*/ |
|
604 | 640 |
|
605 |
public String getDefaultFeatureIndexProviderName(int dataType) { |
|
606 |
return (String) defaultDataIndexProviders.get(new Integer(dataType)); |
|
607 |
} |
|
641 |
public List getFeatureIndexProviders() { |
|
642 |
return ToolsLocator.getExtensionPointManager().get(DATA_MANAGER_INDEX) |
|
643 |
.getNames(); |
|
644 |
} |
|
608 | 645 |
|
609 |
public FeatureIndexProviderServices createFeatureIndexProvider(String name, |
|
610 |
FeatureStore store, FeatureType type, String indexName, |
|
611 |
FeatureAttributeDescriptor attr) throws InitializeException, |
|
612 |
ProviderNotRegisteredException { |
|
646 |
public void setDefaultFeatureIndexProviderName(int dataType, String name) { |
|
647 |
defaultDataIndexProviders.put(new Integer(dataType), name); |
|
648 |
} |
|
613 | 649 |
|
614 |
if (name == null) {
|
|
615 |
name = getDefaultFeatureIndexProviderName(attr.getType());
|
|
616 |
}
|
|
650 |
public String getDefaultFeatureIndexProviderName(int dataType) {
|
|
651 |
return (String) defaultDataIndexProviders.get(new Integer(dataType));
|
|
652 |
}
|
|
617 | 653 |
|
618 |
if (name == null) {
|
|
619 |
throw new InitializeException(
|
|
620 |
"There not any index provider registered.", null);
|
|
621 |
}
|
|
654 |
public FeatureIndexProviderServices createFeatureIndexProvider(String name,
|
|
655 |
FeatureStore store, FeatureType type, String indexName,
|
|
656 |
FeatureAttributeDescriptor attr) throws InitializeException,
|
|
657 |
ProviderNotRegisteredException {
|
|
622 | 658 |
|
623 |
try { |
|
624 |
FeatureIndexProvider provider = (FeatureIndexProvider) ToolsLocator |
|
625 |
.getExtensionPointManager().get(DATA_MANAGER_INDEX) |
|
626 |
.create(name); |
|
627 |
if (provider == null) { |
|
628 |
throw new ProviderNotRegisteredException(name); |
|
629 |
} |
|
630 |
FeatureIndexProviderServices services = new DefaultFeatureIndex( |
|
631 |
(FeatureStoreProviderServices) store, type, provider, |
|
632 |
attr.getName(), indexName); |
|
633 |
services.initialize(); |
|
634 |
return services; |
|
635 |
} catch (InstantiationException e) { |
|
636 |
throw new InitializeException(e); |
|
637 |
} catch (IllegalAccessException e) { |
|
638 |
throw new InitializeException(e); |
|
639 |
} catch (SecurityException e) { |
|
640 |
throw new InitializeException(e); |
|
641 |
} catch (IllegalArgumentException e) { |
|
642 |
throw new InitializeException(e); |
|
643 |
} |
|
644 |
} |
|
659 |
if (name == null) { |
|
660 |
name = getDefaultFeatureIndexProviderName(attr.getType()); |
|
661 |
} |
|
645 | 662 |
|
646 |
public void registerFeatureIndexProvider(String name, String description, |
|
647 |
Class clazz, int dataType) { |
|
648 |
ToolsLocator.getExtensionPointManager() |
|
649 |
.add(DATA_MANAGER_INDEX, DATA_MANAGER_INDEX_DESCRIPTION) |
|
650 |
.append(name, null, clazz); |
|
663 |
if (name == null) { |
|
664 |
throw new InitializeException( |
|
665 |
"There not any index provider registered.", null); |
|
666 |
} |
|
651 | 667 |
|
652 |
if (getDefaultFeatureIndexProviderName(dataType) == null) { |
|
653 |
setDefaultFeatureIndexProviderName(dataType, name); |
|
654 |
} |
|
655 |
} |
|
668 |
try { |
|
669 |
FeatureIndexProvider provider = |
|
670 |
(FeatureIndexProvider) ToolsLocator.getExtensionPointManager() |
|
671 |
.get(DATA_MANAGER_INDEX).create(name); |
|
672 |
if (provider == null) { |
|
673 |
throw new ProviderNotRegisteredException(name); |
|
674 |
} |
|
675 |
FeatureIndexProviderServices services = |
|
676 |
new DefaultFeatureIndex((FeatureStoreProviderServices) store, |
|
677 |
type, provider, attr.getName(), indexName); |
|
678 |
services.initialize(); |
|
679 |
return services; |
|
680 |
} catch (InstantiationException e) { |
|
681 |
throw new InitializeException(e); |
|
682 |
} catch (IllegalAccessException e) { |
|
683 |
throw new InitializeException(e); |
|
684 |
} catch (SecurityException e) { |
|
685 |
throw new InitializeException(e); |
|
686 |
} catch (IllegalArgumentException e) { |
|
687 |
throw new InitializeException(e); |
|
688 |
} |
|
689 |
} |
|
656 | 690 |
|
657 |
private void initializeIndexes() { |
|
658 |
this.defaultDataIndexProviders = new HashMap(); |
|
659 |
} |
|
691 |
public void registerFeatureIndexProvider(String name, String description, |
|
692 |
Class clazz, int dataType) { |
|
693 |
ToolsLocator.getExtensionPointManager() |
|
694 |
.add(DATA_MANAGER_INDEX, DATA_MANAGER_INDEX_DESCRIPTION) |
|
695 |
.append(name, null, clazz); |
|
660 | 696 |
|
661 |
public void intializeDataStore(DataStore store, |
|
662 |
DataStoreParameters parameters) throws InitializeException, |
|
663 |
ProviderNotRegisteredException { |
|
697 |
if (getDefaultFeatureIndexProviderName(dataType) == null) { |
|
698 |
setDefaultFeatureIndexProviderName(dataType, name); |
|
699 |
} |
|
700 |
} |
|
664 | 701 |
|
665 |
((DataStoreInitializer) store).intializePhase1(this, parameters); |
|
666 |
DataStoreProvider provider = this.createProvider( |
|
667 |
(DataStoreProviderServices) store, parameters); |
|
668 |
((DataStoreInitializer) store).intializePhase2(provider); |
|
702 |
private void initializeIndexes() { |
|
703 |
this.defaultDataIndexProviders = new HashMap(); |
|
704 |
} |
|
669 | 705 |
|
670 |
} |
|
706 |
public void intializeDataStore(DataStore store, |
|
707 |
DataStoreParameters parameters) throws InitializeException, |
|
708 |
ProviderNotRegisteredException { |
|
671 | 709 |
|
672 |
public DataStoreProvider createProvider( |
|
673 |
DataStoreProviderServices providerServices, |
|
674 |
DataStoreParameters parameters) throws InitializeException, |
|
675 |
ProviderNotRegisteredException { |
|
676 |
String name = parameters.getDataStoreName(); |
|
677 |
DataStoreProvider provider = null; |
|
678 |
boolean retry = true; |
|
679 |
while (retry) { |
|
680 |
try { |
|
681 |
DataStoreProviderFactory providerFactory = (DataStoreProviderFactory) ToolsLocator |
|
682 |
.getExtensionPointManager() |
|
683 |
.get(DATA_MANAGER_STORE_PROVIDER_FACTORY).create(name); |
|
684 |
if( providerFactory!=null ) { |
|
685 |
provider = (DataStoreProvider) providerFactory.createProvider(parameters, providerServices); |
|
686 |
} else { |
|
687 |
provider = (DataStoreProvider) ToolsLocator |
|
688 |
.getExtensionPointManager() |
|
689 |
.get(DATA_MANAGER_STORE) |
|
690 |
.create(name, |
|
691 |
new Object[] { parameters, providerServices }); |
|
692 |
} |
|
693 |
retry = false; |
|
694 |
} catch (Exception e) { |
|
695 |
if (openErrorHandler != null) { |
|
696 |
retry = openErrorHandler.canRetryOpen(e, parameters); |
|
697 |
} else { |
|
698 |
retry = false; |
|
699 |
} |
|
700 |
if (!retry) { |
|
701 |
throw new InitializeException( |
|
702 |
parameters.getDataStoreName(), e); |
|
703 |
} |
|
704 |
} |
|
705 |
} |
|
706 |
if (provider == null) { |
|
707 |
throw new ProviderNotRegisteredException(name); |
|
708 |
} |
|
709 |
return provider; |
|
710 |
} |
|
710 |
((DataStoreInitializer) store).intializePhase1(this, parameters); |
|
711 |
DataStoreProvider provider = |
|
712 |
this.createProvider((DataStoreProviderServices) store, parameters); |
|
713 |
((DataStoreInitializer) store).intializePhase2(provider); |
|
711 | 714 |
|
712 |
public void registerFeatureCacheProvider( |
|
713 |
FeatureCacheProviderFactory providerFactory) { |
|
714 |
ToolsLocator.getExtensionPointManager() |
|
715 |
.add(DATA_MANAGER_CACHE, DATA_MANAGER_CACHE_DESCRIPTION) |
|
716 |
.append(providerFactory.getName(), "", providerFactory); |
|
717 |
} |
|
715 |
} |
|
718 | 716 |
|
719 |
public FeatureCacheProvider createFeatureCacheProvider(String name, |
|
720 |
DynObject parameters) throws DataException { |
|
721 |
if (name == null) { |
|
722 |
throw new InitializeException( |
|
723 |
"It is necessary to provide a cache name", null); |
|
724 |
} |
|
725 |
if (parameters == null) { |
|
726 |
throw new InitializeException( |
|
727 |
"It is necessary to provide parameters to create the explorer", |
|
728 |
null); |
|
729 |
} |
|
730 |
FeatureCacheProviderFactory featureCacheProviderFactory; |
|
731 |
try { |
|
732 |
featureCacheProviderFactory = (FeatureCacheProviderFactory) ToolsLocator |
|
733 |
.getExtensionPointManager().get(DATA_MANAGER_CACHE) |
|
734 |
.create(name); |
|
735 |
if (featureCacheProviderFactory == null) { |
|
736 |
throw new ProviderNotRegisteredException(name); |
|
737 |
} |
|
738 |
return featureCacheProviderFactory.createCacheProvider(parameters); |
|
739 |
} catch (InstantiationException e) { |
|
740 |
throw new InitializeException(e); |
|
741 |
} catch (IllegalAccessException e) { |
|
742 |
throw new InitializeException(e); |
|
743 |
} |
|
744 |
} |
|
717 |
public DataStoreProvider createProvider( |
|
718 |
DataStoreProviderServices providerServices, |
|
719 |
DataStoreParameters parameters) throws InitializeException, |
|
720 |
ProviderNotRegisteredException { |
|
721 |
String name = parameters.getDataStoreName(); |
|
722 |
DataStoreProvider provider = null; |
|
723 |
boolean retry = true; |
|
724 |
while (retry) { |
|
725 |
try { |
|
726 |
DataStoreProviderFactory providerFactory = |
|
727 |
(DataStoreProviderFactory) ToolsLocator |
|
728 |
.getExtensionPointManager() |
|
729 |
.get(DATA_MANAGER_STORE_PROVIDER_FACTORY).create(name); |
|
730 |
if (providerFactory != null) { |
|
731 |
provider = |
|
732 |
(DataStoreProvider) providerFactory.createProvider( |
|
733 |
parameters, providerServices); |
|
734 |
} else { |
|
735 |
provider = |
|
736 |
(DataStoreProvider) ToolsLocator |
|
737 |
.getExtensionPointManager() |
|
738 |
.get(DATA_MANAGER_STORE) |
|
739 |
.create(name, |
|
740 |
new Object[] { parameters, providerServices }); |
|
741 |
} |
|
742 |
retry = false; |
|
743 |
} catch (Exception e) { |
|
744 |
if (openErrorHandler != null) { |
|
745 |
retry = openErrorHandler.canRetryOpen(e, parameters); |
|
746 |
} else { |
|
747 |
retry = false; |
|
748 |
} |
|
749 |
if (!retry) { |
|
750 |
throw new InitializeException( |
|
751 |
parameters.getDataStoreName(), e); |
|
752 |
} |
|
753 |
} |
|
754 |
} |
|
755 |
if (provider == null) { |
|
756 |
throw new ProviderNotRegisteredException(name); |
|
757 |
} |
|
758 |
return provider; |
|
759 |
} |
|
745 | 760 |
|
746 |
public List getFeatureCacheProviders() { |
|
747 |
ExtensionPoint extensionPoint = ToolsLocator.getExtensionPointManager() |
|
748 |
.get(DATA_MANAGER_CACHE); |
|
749 |
if (extensionPoint != null) { |
|
750 |
return ToolsLocator.getExtensionPointManager() |
|
751 |
.get(DATA_MANAGER_CACHE).getNames(); |
|
752 |
} else { |
|
753 |
return new ArrayList(); |
|
754 |
} |
|
755 |
} |
|
761 |
public void registerFeatureCacheProvider( |
|
762 |
FeatureCacheProviderFactory providerFactory) { |
|
763 |
ToolsLocator.getExtensionPointManager() |
|
764 |
.add(DATA_MANAGER_CACHE, DATA_MANAGER_CACHE_DESCRIPTION) |
|
765 |
.append(providerFactory.getName(), "", providerFactory); |
|
766 |
} |
|
756 | 767 |
|
757 |
public DynObject createCacheParameters(String name) |
|
758 |
throws InitializeException, ProviderNotRegisteredException { |
|
759 |
if (name == null) { |
|
760 |
throw new InitializeException( |
|
761 |
"It is necessary to provide a cache name", null); |
|
762 |
} |
|
763 |
FeatureCacheProviderFactory featureCacheProviderFactory; |
|
764 |
try { |
|
765 |
featureCacheProviderFactory = (FeatureCacheProviderFactory) ToolsLocator |
|
766 |
.getExtensionPointManager().get(DATA_MANAGER_CACHE) |
|
767 |
.create(name); |
|
768 |
if (featureCacheProviderFactory == null) { |
|
769 |
throw new ProviderNotRegisteredException(name); |
|
770 |
} |
|
771 |
return featureCacheProviderFactory.createParameters(); |
|
772 |
} catch (InstantiationException e) { |
|
773 |
throw new InitializeException(e); |
|
774 |
} catch (IllegalAccessException e) { |
|
775 |
throw new InitializeException(e); |
|
776 |
} |
|
777 |
} |
|
768 |
public FeatureCacheProvider createFeatureCacheProvider(String name, |
|
769 |
DynObject parameters) throws DataException { |
|
770 |
if (name == null) { |
|
771 |
throw new InitializeException( |
|
772 |
"It is necessary to provide a cache name", null); |
|
773 |
} |
|
774 |
if (parameters == null) { |
|
775 |
throw new InitializeException( |
|
776 |
"It is necessary to provide parameters to create the explorer", |
|
777 |
null); |
|
778 |
} |
|
779 |
FeatureCacheProviderFactory featureCacheProviderFactory; |
|
780 |
try { |
|
781 |
featureCacheProviderFactory = |
|
782 |
(FeatureCacheProviderFactory) ToolsLocator |
|
783 |
.getExtensionPointManager().get(DATA_MANAGER_CACHE) |
|
784 |
.create(name); |
|
785 |
if (featureCacheProviderFactory == null) { |
|
786 |
throw new ProviderNotRegisteredException(name); |
|
787 |
} |
|
788 |
return featureCacheProviderFactory.createCacheProvider(parameters); |
|
789 |
} catch (InstantiationException e) { |
|
790 |
throw new InitializeException(e); |
|
791 |
} catch (IllegalAccessException e) { |
|
792 |
throw new InitializeException(e); |
|
793 |
} |
|
794 |
} |
|
778 | 795 |
|
779 |
public DataStoreParameters createMemoryStoreParameters( |
|
780 |
String autoOrderAttributeName) throws InitializeException { |
|
796 |
public List getFeatureCacheProviders() { |
|
797 |
ExtensionPoint extensionPoint = |
|
798 |
ToolsLocator.getExtensionPointManager().get(DATA_MANAGER_CACHE); |
|
799 |
if (extensionPoint != null) { |
|
800 |
return ToolsLocator.getExtensionPointManager() |
|
801 |
.get(DATA_MANAGER_CACHE).getNames(); |
|
802 |
} else { |
|
803 |
return new ArrayList(); |
|
804 |
} |
|
805 |
} |
|
781 | 806 |
|
782 |
DataStoreParameters parameters; |
|
783 |
try { |
|
784 |
parameters = createStoreParameters(MemoryStoreProvider.NAME); |
|
785 |
if (autoOrderAttributeName != null) { |
|
786 |
parameters.setDynValue( |
|
787 |
MemoryStoreParameters.ORDER_PARAMETER_NAME, |
|
788 |
autoOrderAttributeName); |
|
789 |
} |
|
790 |
return parameters; |
|
791 |
} catch (ProviderNotRegisteredException e) { |
|
792 |
throw new InitializeException("MemoryStoreProvider", e); |
|
793 |
} |
|
794 |
} |
|
807 |
public DynObject createCacheParameters(String name) |
|
808 |
throws InitializeException, ProviderNotRegisteredException { |
|
809 |
if (name == null) { |
|
810 |
throw new InitializeException( |
|
811 |
"It is necessary to provide a cache name", null); |
|
812 |
} |
|
813 |
FeatureCacheProviderFactory featureCacheProviderFactory; |
|
814 |
try { |
|
815 |
featureCacheProviderFactory = |
|
816 |
(FeatureCacheProviderFactory) ToolsLocator |
|
817 |
.getExtensionPointManager().get(DATA_MANAGER_CACHE) |
|
818 |
.create(name); |
|
819 |
if (featureCacheProviderFactory == null) { |
|
820 |
throw new ProviderNotRegisteredException(name); |
|
821 |
} |
|
822 |
return featureCacheProviderFactory.createParameters(); |
|
823 |
} catch (InstantiationException e) { |
|
824 |
throw new InitializeException(e); |
|
825 |
} catch (IllegalAccessException e) { |
|
826 |
throw new InitializeException(e); |
|
827 |
} |
|
828 |
} |
|
795 | 829 |
|
796 |
public FeatureStore createMemoryStore(String autoOrderAttributeName)
|
|
797 |
throws InitializeException {
|
|
830 |
public DataStoreParameters createMemoryStoreParameters(
|
|
831 |
String autoOrderAttributeName) throws InitializeException {
|
|
798 | 832 |
|
799 |
DataStoreParameters parameters = createMemoryStoreParameters(autoOrderAttributeName); |
|
800 |
try { |
|
801 |
return (FeatureStore) createStore(parameters); |
|
802 |
} catch (ValidateDataParametersException e) { |
|
803 |
throw new InitializeException("MemoryStoreProvider", e); |
|
804 |
} catch (ProviderNotRegisteredException e) { |
|
805 |
throw new InitializeException("MemoryStoreProvider", e); |
|
806 |
} |
|
807 |
} |
|
833 |
DataStoreParameters parameters; |
|
834 |
try { |
|
835 |
parameters = createStoreParameters(MemoryStoreProvider.NAME); |
|
836 |
if (autoOrderAttributeName != null) { |
|
837 |
parameters.setDynValue( |
|
838 |
MemoryStoreParameters.ORDER_PARAMETER_NAME, |
|
839 |
autoOrderAttributeName); |
|
840 |
} |
|
841 |
return parameters; |
|
842 |
} catch (ProviderNotRegisteredException e) { |
|
843 |
throw new InitializeException("MemoryStoreProvider", e); |
|
844 |
} |
|
845 |
} |
|
808 | 846 |
|
809 |
public FeaturePagingHelper createFeaturePagingHelper( |
|
810 |
FeatureStore featureStore, int pageSize) throws BaseException { |
|
811 |
return new FeaturePagingHelperImpl(featureStore, pageSize); |
|
812 |
} |
|
847 |
public FeatureStore createMemoryStore(String autoOrderAttributeName) |
|
848 |
throws InitializeException { |
|
813 | 849 |
|
814 |
public FeaturePagingHelper createFeaturePagingHelper( |
|
815 |
FeatureStore featureStore, FeatureQuery featureQuery, int pageSize) |
|
816 |
throws BaseException { |
|
817 |
return new FeaturePagingHelperImpl(featureStore, featureQuery, pageSize); |
|
818 |
} |
|
850 |
DataStoreParameters parameters = |
|
851 |
createMemoryStoreParameters(autoOrderAttributeName); |
|
852 |
try { |
|
853 |
return (FeatureStore) createStore(parameters); |
|
854 |
} catch (ValidateDataParametersException e) { |
|
855 |
throw new InitializeException("MemoryStoreProvider", e); |
|
856 |
} catch (ProviderNotRegisteredException e) { |
|
857 |
throw new InitializeException("MemoryStoreProvider", e); |
|
858 |
} |
|
859 |
} |
|
819 | 860 |
|
820 |
public void setOpenErrorHandler(OpenErrorHandler handler) { |
|
821 |
openErrorHandler = handler; |
|
861 |
public FeaturePagingHelper createFeaturePagingHelper( |
|
862 |
FeatureStore featureStore, int pageSize) throws BaseException { |
|
863 |
return new FeaturePagingHelperImpl(featureStore, pageSize); |
|
864 |
} |
|
822 | 865 |
|
823 |
} |
|
866 |
public FeaturePagingHelper createFeaturePagingHelper( |
|
867 |
FeatureStore featureStore, FeatureQuery featureQuery, int pageSize) |
|
868 |
throws BaseException { |
|
869 |
return new FeaturePagingHelperImpl(featureStore, featureQuery, pageSize); |
|
870 |
} |
|
824 | 871 |
|
825 |
public EditableFeatureType createFeatureType() { |
|
826 |
return new DefaultEditableFeatureType(); |
|
827 |
} |
|
872 |
public void setOpenErrorHandler(OpenErrorHandler handler) { |
|
873 |
openErrorHandler = handler; |
|
828 | 874 |
|
829 |
public List getDataTypes() { |
|
830 |
if (dataTypes == null){ |
|
831 |
DataTypesManager manager = ToolsLocator.getDataTypesManager(); |
|
832 |
dataTypes = new ArrayList(); |
|
833 |
dataTypes.add(manager.get(DataTypes.STRING)); |
|
834 |
dataTypes.add(manager.get(DataTypes.BOOLEAN)); |
|
835 |
dataTypes.add(manager.get(DataTypes.INT)); |
Also available in: Unified diff