Revision 43056
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/feature/impl/DefaultFeatureStore.java | ||
---|---|---|
2153 | 2153 |
return this; |
2154 | 2154 |
} |
2155 | 2155 |
|
2156 |
// public void createCache(String name, DynObject parameters) |
|
2157 |
// throws DataException { |
|
2158 |
// cache = dataManager.createFeatureCacheProvider(name, parameters); |
|
2159 |
// if (cache == null) { |
|
2160 |
// throw new CreateException("FeaureCacheProvider", null); |
|
2161 |
// } |
|
2162 |
// cache.apply(this, provider); |
|
2163 |
// provider = cache; |
|
2164 |
// |
|
2165 |
// featureCount = null; |
|
2166 |
// } |
|
2167 |
// |
|
2168 |
// public FeatureCache getCache() { |
|
2169 |
// return cache; |
|
2170 |
// } |
|
2156 |
public void createCache(String name, DynObject parameters) |
|
2157 |
throws DataException { |
|
2158 |
cache = dataManager.createFeatureCacheProvider(name, parameters); |
|
2159 |
if (cache == null) { |
|
2160 |
throw new CreateException("FeaureCacheProvider", null); |
|
2161 |
} |
|
2162 |
cache.apply(this, provider); |
|
2163 |
provider = cache; |
|
2171 | 2164 |
|
2165 |
featureCount = null; |
|
2166 |
} |
|
2167 |
|
|
2168 |
public FeatureCache getCache() { |
|
2169 |
return cache; |
|
2170 |
} |
|
2171 |
|
|
2172 | 2172 |
public void clear() { |
2173 | 2173 |
if (metadata != null) { |
2174 | 2174 |
metadata.clear(); |
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 | ||
---|---|---|
24 | 24 |
import org.gvsig.fmap.dal.NewDataStoreParameters; |
25 | 25 |
import org.gvsig.fmap.dal.OpenErrorHandler; |
26 | 26 |
import org.gvsig.fmap.dal.Register; |
27 |
import org.gvsig.fmap.dal.exception.DataException; |
|
27 | 28 |
import org.gvsig.fmap.dal.exception.InitializeException; |
28 | 29 |
import org.gvsig.fmap.dal.exception.ProviderNotRegisteredException; |
29 | 30 |
import org.gvsig.fmap.dal.exception.ValidateDataParametersException; |
... | ... | |
40 | 41 |
import org.gvsig.fmap.dal.feature.spi.ExpressionBuilderBase; |
41 | 42 |
import org.gvsig.fmap.dal.feature.spi.FeatureStoreProvider; |
42 | 43 |
import org.gvsig.fmap.dal.feature.spi.FeatureStoreProviderServices; |
44 |
import org.gvsig.fmap.dal.feature.spi.cache.FeatureCacheProvider; |
|
45 |
import org.gvsig.fmap.dal.feature.spi.cache.FeatureCacheProviderFactory; |
|
43 | 46 |
import org.gvsig.fmap.dal.feature.spi.index.FeatureIndexProvider; |
44 | 47 |
import org.gvsig.fmap.dal.feature.spi.index.FeatureIndexProviderServices; |
45 | 48 |
import org.gvsig.fmap.dal.raster.impl.RasterStoreOldFactory; |
... | ... | |
59 | 62 |
import org.gvsig.tools.dynobject.Tags; |
60 | 63 |
import org.gvsig.tools.evaluator.Evaluator; |
61 | 64 |
import org.gvsig.tools.exception.BaseException; |
65 |
import org.gvsig.tools.extensionpoint.ExtensionPoint; |
|
62 | 66 |
import org.gvsig.tools.identitymanagement.SimpleIdentityManager; |
63 | 67 |
import org.gvsig.tools.identitymanagement.UnauthorizedException; |
64 | 68 |
import org.gvsig.tools.service.spi.Services; |
65 | 69 |
|
66 | 70 |
public class DefaultDataManager |
67 | 71 |
implements DataManager, DataManagerProviderServices, Services { |
68 |
|
|
72 |
|
|
73 |
final static private String DATA_MANAGER_CACHE = "Data.manager.caches"; |
|
74 |
final static private String DATA_MANAGER_CACHE_DESCRIPTION = |
|
75 |
"DAL cache providers"; |
|
76 |
|
|
69 | 77 |
private class Registers { |
70 | 78 |
|
71 | 79 |
private final Register store; |
... | ... | |
681 | 689 |
public ExpressionBuilder createExpressionBuilder() { |
682 | 690 |
return new ExpressionBuilderBase(); |
683 | 691 |
} |
692 |
|
|
693 |
public void registerFeatureCacheProvider( |
|
694 |
FeatureCacheProviderFactory providerFactory) { |
|
695 |
ToolsLocator.getExtensionPointManager() |
|
696 |
.add(DATA_MANAGER_CACHE, DATA_MANAGER_CACHE_DESCRIPTION) |
|
697 |
.append(providerFactory.getName(), "", providerFactory); |
|
698 |
} |
|
699 |
|
|
700 |
public FeatureCacheProvider createFeatureCacheProvider(String name, |
|
701 |
DynObject parameters) throws DataException { |
|
702 |
if (name == null) { |
|
703 |
throw new InitializeException( |
|
704 |
"It is necessary to provide a cache name", null); |
|
705 |
} |
|
706 |
if (parameters == null) { |
|
707 |
throw new InitializeException( |
|
708 |
"It is necessary to provide parameters to create the explorer", |
|
709 |
null); |
|
710 |
} |
|
711 |
FeatureCacheProviderFactory featureCacheProviderFactory; |
|
712 |
try { |
|
713 |
featureCacheProviderFactory = |
|
714 |
(FeatureCacheProviderFactory) ToolsLocator |
|
715 |
.getExtensionPointManager().get(DATA_MANAGER_CACHE) |
|
716 |
.create(name); |
|
717 |
if (featureCacheProviderFactory == null) { |
|
718 |
throw new ProviderNotRegisteredException(name); |
|
719 |
} |
|
720 |
return featureCacheProviderFactory.createCacheProvider(parameters); |
|
721 |
} catch (InstantiationException e) { |
|
722 |
throw new InitializeException(e); |
|
723 |
} catch (IllegalAccessException e) { |
|
724 |
throw new InitializeException(e); |
|
725 |
} |
|
726 |
} |
|
727 |
|
|
728 |
public List getFeatureCacheProviders() { |
|
729 |
ExtensionPoint extensionPoint = |
|
730 |
ToolsLocator.getExtensionPointManager().get(DATA_MANAGER_CACHE); |
|
731 |
if (extensionPoint != null) { |
|
732 |
return ToolsLocator.getExtensionPointManager() |
|
733 |
.get(DATA_MANAGER_CACHE).getNames(); |
|
734 |
} else { |
|
735 |
return new ArrayList(); |
|
736 |
} |
|
737 |
} |
|
738 |
|
|
739 |
public DynObject createCacheParameters(String name) |
|
740 |
throws InitializeException, ProviderNotRegisteredException { |
|
741 |
if (name == null) { |
|
742 |
throw new InitializeException( |
|
743 |
"It is necessary to provide a cache name", null); |
|
744 |
} |
|
745 |
FeatureCacheProviderFactory featureCacheProviderFactory; |
|
746 |
try { |
|
747 |
featureCacheProviderFactory = |
|
748 |
(FeatureCacheProviderFactory) ToolsLocator |
|
749 |
.getExtensionPointManager().get(DATA_MANAGER_CACHE) |
|
750 |
.create(name); |
|
751 |
if (featureCacheProviderFactory == null) { |
|
752 |
throw new ProviderNotRegisteredException(name); |
|
753 |
} |
|
754 |
return featureCacheProviderFactory.createParameters(); |
|
755 |
} catch (InstantiationException e) { |
|
756 |
throw new InitializeException(e); |
|
757 |
} catch (IllegalAccessException e) { |
|
758 |
throw new InitializeException(e); |
|
759 |
} |
|
760 |
} |
|
761 |
|
|
762 |
|
|
763 |
|
|
684 | 764 |
} |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.api/src/main/java/org/gvsig/fmap/dal/DataManager.java | ||
---|---|---|
409 | 409 |
* @return the ExpressionBuilder |
410 | 410 |
*/ |
411 | 411 |
public ExpressionBuilder createExpressionBuilder(); |
412 |
|
|
413 |
/** |
|
414 |
* Returns a list of String containing the names of the available cache providers. |
|
415 |
* |
|
416 |
* @return |
|
417 |
* list of strings with the names of the available cache providers |
|
418 |
*/ |
|
419 |
public List getFeatureCacheProviders(); |
|
420 |
|
|
421 |
/** |
|
422 |
* Returns an instance of {@link DataServerExplorerParameters} corresponding |
|
423 |
* to the given name used by the cache to create a store to save the |
|
424 |
* retrieved data. |
|
425 |
* |
|
426 |
* @param name |
|
427 |
* name of a registered feature cache provider |
|
428 |
* |
|
429 |
* @throws InitializeException |
|
430 |
* if parameter initialization causes an error. |
|
431 |
* |
|
432 |
* @throws ProviderNotRegisteredException |
|
433 |
* if could not find a cache provider by the given name. |
|
434 |
* |
|
435 |
*/ |
|
436 |
public DynObject createCacheParameters(String name) |
|
437 |
throws InitializeException, ProviderNotRegisteredException; |
|
438 |
|
|
412 | 439 |
} |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.api/src/main/java/org/gvsig/fmap/dal/feature/FeatureStore.java | ||
---|---|---|
32 | 32 |
import org.gvsig.fmap.dal.DataStore; |
33 | 33 |
import org.gvsig.fmap.dal.DataStoreParameters; |
34 | 34 |
import org.gvsig.fmap.dal.ExpressionBuilder; |
35 |
import org.gvsig.fmap.dal.exception.CreateException; |
|
35 | 36 |
import org.gvsig.fmap.dal.exception.DataException; |
36 | 37 |
import org.gvsig.fmap.dal.exception.ReadException; |
37 | 38 |
import org.gvsig.fmap.dal.feature.exception.FeatureIndexException; |
... | ... | |
845 | 846 |
public Iterator iterator(); |
846 | 847 |
|
847 | 848 |
public ExpressionBuilder createExpressionBuilder(); |
849 |
|
|
850 |
public void createCache(String name, DynObject parameters) |
|
851 |
throws DataException; |
|
852 |
|
|
853 |
public FeatureCache getCache(); |
|
848 | 854 |
} |
Also available in: Unified diff