root / branches / v2_0_0_prep / libraries / libFMap_dal / src / org / gvsig / fmap / dal / DALLibrary.java @ 24496
History | View | Annotate | Download (1.38 KB)
1 | 24496 | jmvivo | package org.gvsig.fmap.dal; |
---|---|---|---|
2 | 23754 | jjdelcerro | |
3 | 24496 | jmvivo | import org.gvsig.fmap.dal.impl.DefaultDataManager; |
4 | import org.gvsig.fmap.dal.resource.ResourceManager; |
||
5 | import org.gvsig.fmap.dal.resource.impl.DefaultResourceManager; |
||
6 | 24454 | jmvivo | import org.gvsig.tools.ToolsLibrary; |
7 | 23754 | jjdelcerro | import org.gvsig.tools.locator.BaseLibrary; |
8 | import org.gvsig.tools.locator.ReferenceNotRegisteredException; |
||
9 | |||
10 | 24366 | jiyarza | /**
|
11 | * Initializes gvSIG's desktop DAL by registering the default implementation for {@link DataManager}
|
||
12 | * and {@link ResourceManager}.
|
||
13 | *
|
||
14 | */
|
||
15 | 23754 | jjdelcerro | public class DALLibrary extends BaseLibrary { |
16 | |||
17 | public void initialize() throws ReferenceNotRegisteredException { |
||
18 | super.initialize();
|
||
19 | 24454 | jmvivo | ToolsLibrary toolsLib = new ToolsLibrary();
|
20 | |||
21 | toolsLib.initialize(); |
||
22 | toolsLib.postInitialize(); |
||
23 | |||
24 | 24130 | jiyarza | DALLocator.registerDefaultDataManager(DefaultDataManager.class); |
25 | 23754 | jjdelcerro | DALLocator.registerResourceManager(DefaultResourceManager.class); |
26 | } |
||
27 | |||
28 | public void postInitialize() { |
||
29 | super.postInitialize();
|
||
30 | |||
31 | // Validate there is any implementation registered.
|
||
32 | DataManager dataManager = DALLocator.getDataManager(); |
||
33 | if (dataManager == null) { |
||
34 | throw new ReferenceNotRegisteredException( |
||
35 | DALLocator.DATA_MANAGER_NAME, DALLocator.getInstance()); |
||
36 | } |
||
37 | |||
38 | ResourceManager resourceManager = DALLocator.getResourceManager(); |
||
39 | if (resourceManager == null) { |
||
40 | throw new ReferenceNotRegisteredException( |
||
41 | DALLocator.RESOURCE_MANAGER_NAME, DALLocator.getInstance()); |
||
42 | } |
||
43 | } |
||
44 | |||
45 | } |