svn-gvsig-desktop / 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 / FeatureStoreFactory.java @ 47049
History | View | Annotate | Download (1.6 KB)
1 | 43020 | jjdelcerro | |
---|---|---|---|
2 | package org.gvsig.fmap.dal.feature.impl; |
||
3 | |||
4 | import org.gvsig.fmap.dal.DataParameters; |
||
5 | import org.gvsig.fmap.dal.DataStore; |
||
6 | import org.gvsig.fmap.dal.DataStoreParameters; |
||
7 | |||
8 | import org.gvsig.fmap.dal.exception.InitializeException; |
||
9 | import org.gvsig.fmap.dal.impl.AbstractDataStoreFactory; |
||
10 | import org.gvsig.fmap.dal.impl.DefaultDataManager; |
||
11 | import org.gvsig.fmap.dal.spi.DataStoreInitializer2; |
||
12 | import org.gvsig.fmap.dal.DataStoreProvider; |
||
13 | 43088 | jjdelcerro | import org.gvsig.fmap.dal.feature.OpenFeatureStoreParameters; |
14 | 43020 | jjdelcerro | import org.gvsig.tools.dynobject.DynObject; |
15 | import org.gvsig.tools.service.spi.Services; |
||
16 | |||
17 | |||
18 | public class FeatureStoreFactory extends AbstractDataStoreFactory { |
||
19 | |||
20 | public static final String NAME = "FeatureStore"; |
||
21 | |||
22 | public FeatureStoreFactory() {
|
||
23 | super(NAME, ""); |
||
24 | } |
||
25 | |||
26 | @Override
|
||
27 | public DynObject createParameters() {
|
||
28 | return null; |
||
29 | } |
||
30 | |||
31 | @Override
|
||
32 | public DataStore create(DynObject parameters, Services services) {
|
||
33 | try {
|
||
34 | DataStoreInitializer2 store = new DefaultFeatureStore();
|
||
35 | store.intialize( |
||
36 | (DefaultDataManager)services, |
||
37 | (DataStoreParameters)parameters |
||
38 | ); |
||
39 | return store;
|
||
40 | 45717 | fdiaz | } catch (Exception ex) { |
41 | 43020 | jjdelcerro | throw new RuntimeException(ex); |
42 | } |
||
43 | } |
||
44 | |||
45 | @Override
|
||
46 | public void setProvider(DataStore store, DataStoreProvider provider) { |
||
47 | ((DataStoreInitializer2)store).setProvider(provider); |
||
48 | } |
||
49 | |||
50 | @Override
|
||
51 | public boolean canUse(DataParameters parameters) { |
||
52 | 43088 | jjdelcerro | boolean use = parameters instanceof OpenFeatureStoreParameters; |
53 | 43020 | jjdelcerro | return use;
|
54 | } |
||
55 | |||
56 | } |