root / branches / v2_0_0_prep / frameworks / _fwAndami / src / org / gvsig / andami / PluginsLocator.java @ 38615
History | View | Annotate | Download (2.69 KB)
1 | 34114 | fdiaz | package org.gvsig.andami; |
---|---|---|---|
2 | |||
3 | 38564 | jjdelcerro | import org.gvsig.andami.actioninfo.ActionInfoManager; |
4 | 34114 | fdiaz | import org.gvsig.tools.locator.AbstractLocator; |
5 | import org.gvsig.tools.locator.Locator; |
||
6 | import org.gvsig.tools.locator.LocatorException; |
||
7 | |||
8 | |||
9 | public class PluginsLocator extends AbstractLocator { |
||
10 | |||
11 | private static final String LOCATOR_NAME = "PluginsLocator"; |
||
12 | |||
13 | /**
|
||
14 | * PluginsManager name used by the locator to access the instance
|
||
15 | */
|
||
16 | public static final String PLUGINS_MANAGER_NAME = "PluginsManager"; |
||
17 | 38564 | jjdelcerro | public static final String PLUGINS_ACTIONINFO_MANAGER_NAME = "PluginsActionInfoManager"; |
18 | 34114 | fdiaz | |
19 | private static final String PLUGINS_MANAGER_DESCRIPTION = "PluginsManager of Andami framework"; |
||
20 | 38564 | jjdelcerro | private static final String PLUGINS_ACTIONINFO_MANAGER_DESCRIPTION = "PluginsActionInfoManager"; |
21 | 34114 | fdiaz | |
22 | /**
|
||
23 | * Unique instance.
|
||
24 | */
|
||
25 | private static final PluginsLocator instance = new PluginsLocator(); |
||
26 | |||
27 | /**
|
||
28 | * Return the singleton instance.
|
||
29 | *
|
||
30 | * @return the singleton instance
|
||
31 | */
|
||
32 | public static PluginsLocator getInstance() { |
||
33 | return instance;
|
||
34 | } |
||
35 | |||
36 | /**
|
||
37 | * Returns the Locator name.
|
||
38 | *
|
||
39 | * @return String containing the locator name.
|
||
40 | */
|
||
41 | public String getLocatorName() { |
||
42 | return LOCATOR_NAME;
|
||
43 | } |
||
44 | |||
45 | /**
|
||
46 | * Return a reference to DataManager.
|
||
47 | *
|
||
48 | * @return a reference to DataManager
|
||
49 | * @throws LocatorException
|
||
50 | * if there is no access to the class or the class cannot be
|
||
51 | * instantiated
|
||
52 | * @see Locator#get(String)
|
||
53 | */
|
||
54 | public static PluginsManager getManager() throws LocatorException { |
||
55 | return (PluginsManager) getInstance().get(PLUGINS_MANAGER_NAME);
|
||
56 | } |
||
57 | 38564 | jjdelcerro | |
58 | 34114 | fdiaz | /**
|
59 | * Registers the Class implementing the DataManager interface.
|
||
60 | *
|
||
61 | * @param clazz
|
||
62 | * implementing the DataManager interface
|
||
63 | */
|
||
64 | public static void registerManager(Class clazz) { |
||
65 | getInstance().register(PLUGINS_MANAGER_NAME, PLUGINS_MANAGER_DESCRIPTION, |
||
66 | clazz); |
||
67 | } |
||
68 | |||
69 | /**
|
||
70 | * Registers a class as the default DataManager.
|
||
71 | *
|
||
72 | * @param clazz
|
||
73 | * implementing the DataManager interface
|
||
74 | */
|
||
75 | public static void registerDefaultManager(Class clazz) { |
||
76 | getInstance().registerDefault(PLUGINS_MANAGER_NAME, PLUGINS_MANAGER_DESCRIPTION, |
||
77 | clazz); |
||
78 | } |
||
79 | |||
80 | 38564 | jjdelcerro | |
81 | public static ActionInfoManager getActionInfoManager() throws LocatorException { |
||
82 | return (ActionInfoManager) getInstance().get(PLUGINS_ACTIONINFO_MANAGER_NAME);
|
||
83 | } |
||
84 | |||
85 | public static void registerActionInfoManager(Class clazz) { |
||
86 | getInstance().register(PLUGINS_ACTIONINFO_MANAGER_NAME, PLUGINS_ACTIONINFO_MANAGER_DESCRIPTION, |
||
87 | clazz); |
||
88 | } |
||
89 | |||
90 | 34114 | fdiaz | } |