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 |
package org.gvsig.fmap.dal; |
---|---|
2 |
|
3 |
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 |
import org.gvsig.tools.ToolsLibrary; |
7 |
import org.gvsig.tools.locator.BaseLibrary; |
8 |
import org.gvsig.tools.locator.ReferenceNotRegisteredException; |
9 |
|
10 |
/**
|
11 |
* Initializes gvSIG's desktop DAL by registering the default implementation for {@link DataManager}
|
12 |
* and {@link ResourceManager}.
|
13 |
*
|
14 |
*/
|
15 |
public class DALLibrary extends BaseLibrary { |
16 |
|
17 |
public void initialize() throws ReferenceNotRegisteredException { |
18 |
super.initialize();
|
19 |
ToolsLibrary toolsLib = new ToolsLibrary();
|
20 |
|
21 |
toolsLib.initialize(); |
22 |
toolsLib.postInitialize(); |
23 |
|
24 |
DALLocator.registerDefaultDataManager(DefaultDataManager.class); |
25 |
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 |
} |