Revision 43205 trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/fmap/dal/impl/DefaultDataManager.java
DefaultDataManager.java | ||
---|---|---|
1 | 1 |
package org.gvsig.fmap.dal.impl; |
2 | 2 |
|
3 |
import org.gvsig.fmap.dal.feature.spi.ExpressionEvaluatorBase; |
|
4 | 3 |
import java.io.File; |
5 | 4 |
import java.io.InputStream; |
6 | 5 |
import java.net.URL; |
... | ... | |
9 | 8 |
import java.util.HashMap; |
10 | 9 |
import java.util.List; |
11 | 10 |
import java.util.Map; |
11 |
|
|
12 | 12 |
import org.gvsig.fmap.dal.DataFactory; |
13 | 13 |
import org.gvsig.fmap.dal.DataManager; |
14 |
import static org.gvsig.fmap.dal.DataManager.READ_STORE_AUTHORIZATION; |
|
15 | 14 |
import org.gvsig.fmap.dal.DataServerExplorer; |
16 | 15 |
import org.gvsig.fmap.dal.DataServerExplorerFactory; |
17 | 16 |
import org.gvsig.fmap.dal.DataServerExplorerParameters; |
... | ... | |
28 | 27 |
import org.gvsig.fmap.dal.Register; |
29 | 28 |
import org.gvsig.fmap.dal.exception.DataException; |
30 | 29 |
import org.gvsig.fmap.dal.exception.InitializeException; |
30 |
import org.gvsig.fmap.dal.exception.OpenException; |
|
31 | 31 |
import org.gvsig.fmap.dal.exception.ProviderNotRegisteredException; |
32 |
import org.gvsig.fmap.dal.exception.CreateFileStoreException; |
|
32 | 33 |
import org.gvsig.fmap.dal.exception.ValidateDataParametersException; |
33 | 34 |
import org.gvsig.fmap.dal.feature.EditableFeatureType; |
34 | 35 |
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor; |
... | ... | |
41 | 42 |
import org.gvsig.fmap.dal.feature.paging.FeaturePagingHelper; |
42 | 43 |
import org.gvsig.fmap.dal.feature.paging.impl.FeaturePagingHelperImpl; |
43 | 44 |
import org.gvsig.fmap.dal.feature.spi.ExpressionBuilderBase; |
45 |
import org.gvsig.fmap.dal.feature.spi.ExpressionEvaluatorBase; |
|
44 | 46 |
import org.gvsig.fmap.dal.feature.spi.FeatureStoreProvider; |
45 | 47 |
import org.gvsig.fmap.dal.feature.spi.FeatureStoreProviderServices; |
46 | 48 |
import org.gvsig.fmap.dal.feature.spi.cache.FeatureCacheProvider; |
47 | 49 |
import org.gvsig.fmap.dal.feature.spi.cache.FeatureCacheProviderFactory; |
48 | 50 |
import org.gvsig.fmap.dal.feature.spi.index.FeatureIndexProvider; |
49 | 51 |
import org.gvsig.fmap.dal.feature.spi.index.FeatureIndexProviderServices; |
52 |
import org.gvsig.fmap.dal.raster.NewRasterStoreParameters; |
|
53 |
import org.gvsig.fmap.dal.raster.impl.RasterStoreFactory; |
|
50 | 54 |
import org.gvsig.fmap.dal.raster.impl.RasterStoreOldFactory; |
51 |
import org.gvsig.fmap.dal.raster.impl.RasterStoreFactory; |
|
52 | 55 |
import org.gvsig.fmap.dal.raster.spi.CoverageStoreProvider; |
56 |
import org.gvsig.fmap.dal.spi.DALSPILocator; |
|
53 | 57 |
import org.gvsig.fmap.dal.spi.DataManagerProviderServices; |
54 | 58 |
import org.gvsig.fmap.dal.spi.DataStoreProvider; |
55 | 59 |
import org.gvsig.fmap.dal.spi.DataStoreProviderServices; |
... | ... | |
71 | 75 |
|
72 | 76 |
public class DefaultDataManager |
73 | 77 |
implements DataManager, DataManagerProviderServices, Services { |
74 |
|
|
78 |
|
|
75 | 79 |
final static private String DATA_MANAGER_CACHE = "Data.manager.caches"; |
76 | 80 |
final static private String DATA_MANAGER_CACHE_DESCRIPTION = |
77 | 81 |
"DAL cache providers"; |
78 |
|
|
82 |
|
|
83 |
public static final String FILESYSTEM_EXPLORER_NAME = "FilesystemExplorer"; |
|
84 |
|
|
85 |
|
|
79 | 86 |
private class Registers { |
80 | 87 |
|
81 | 88 |
private final Register store; |
... | ... | |
305 | 312 |
); |
306 | 313 |
return explorer; |
307 | 314 |
} |
308 |
|
|
315 |
|
|
309 | 316 |
@Override |
310 | 317 |
public DataServerExplorer openServerExplorer(String explorerName, Object... arguments) throws InitializeException, ProviderNotRegisteredException, ValidateDataParametersException { |
311 | 318 |
if( (arguments.length % 2)!= 0 ) { |
... | ... | |
319 | 326 |
parameters.setDynValue(name, value); |
320 | 327 |
} |
321 | 328 |
return this.openServerExplorer(explorerName, parameters); |
322 |
|
|
329 |
|
|
323 | 330 |
} |
324 |
|
|
331 |
|
|
325 | 332 |
/** |
326 | 333 |
* @param parameters |
327 | 334 |
* @return |
... | ... | |
343 | 350 |
* @return |
344 | 351 |
* @throws InitializeException |
345 | 352 |
* @throws ProviderNotRegisteredException |
346 |
* @throws ValidateDataParametersException
|
|
353 |
* @throws ValidateDataParametersException |
|
347 | 354 |
*/ |
348 | 355 |
@Override |
349 | 356 |
public DataStore createStore(DataStoreParameters parameters) |
... | ... | |
351 | 358 |
ValidateDataParametersException { |
352 | 359 |
return openStore(parameters.getDataStoreName(), parameters); |
353 | 360 |
} |
354 |
|
|
361 |
|
|
355 | 362 |
@Override |
356 | 363 |
public DataStore openStore(String providerName, DataStoreParameters parameters) throws InitializeException, ProviderNotRegisteredException, ValidateDataParametersException { |
357 | 364 |
|
... | ... | |
361 | 368 |
} |
362 | 369 |
|
363 | 370 |
parameters.validate(); |
364 |
|
|
371 |
|
|
365 | 372 |
String storeName = this.getStoreName(parameters); |
366 | 373 |
|
367 | 374 |
DataStoreFactory_v2_4 storeFactory = (DataStoreFactory_v2_4) this.getStoreRegister().getFactory(storeName); |
... | ... | |
395 | 402 |
} |
396 | 403 |
return this.openStore(providerName, parameters); |
397 | 404 |
} |
398 |
|
|
405 |
|
|
399 | 406 |
@Override |
400 | 407 |
public FeatureStore createMemoryStore(String autoOrderAttributeName) throws InitializeException { |
401 | 408 |
try { |
... | ... | |
608 | 615 |
public ExpressionEvaluator createExpresion() { |
609 | 616 |
return new ExpressionEvaluatorBase(); |
610 | 617 |
} |
611 |
|
|
618 |
|
|
612 | 619 |
@Override |
613 | 620 |
public FeaturePagingHelper createFeaturePagingHelper( |
614 | 621 |
FeatureStore featureStore, int pageSize) throws BaseException { |
... | ... | |
724 | 731 |
x = reourceLoader.getClass().getResourceAsStream(name); |
725 | 732 |
return x; |
726 | 733 |
} |
727 |
|
|
734 |
|
|
728 | 735 |
@Override |
729 | 736 |
public ExpressionBuilder createExpressionBuilder() { |
730 | 737 |
return new ExpressionBuilderBase(); |
... | ... | |
801 | 808 |
} |
802 | 809 |
} |
803 | 810 |
|
811 |
@Override |
|
812 |
public void createFileStore(String providerName, NewRasterStoreParameters params, boolean overwrite) throws DataException { |
|
813 |
DataManagerProviderServices dataManager = DALSPILocator.getDataManagerProviderServices(); |
|
814 |
DataServerExplorerParameters eparams = null; |
|
815 |
DataServerExplorer serverExplorer; |
|
816 |
try { |
|
817 |
serverExplorer = dataManager.openServerExplorer(FILESYSTEM_EXPLORER_NAME, eparams); |
|
818 |
} catch (ValidateDataParametersException | InitializeException | ProviderNotRegisteredException e) { |
|
819 |
throw new OpenException(FILESYSTEM_EXPLORER_NAME, e); |
|
820 |
} |
|
804 | 821 |
|
822 |
try { |
|
823 |
serverExplorer.add(providerName, params, overwrite); |
|
824 |
} catch (DataException e) { |
|
825 |
throw new CreateFileStoreException(e, providerName); |
|
826 |
} |
|
827 |
} |
|
805 | 828 |
|
829 |
|
|
806 | 830 |
} |
Also available in: Unified diff