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/impl/DefaultDataManager.java
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 |
} |
Also available in: Unified diff