svn-gvsig-desktop / branches / v2_0_0_prep / libraries / libFMap_mapcontext / src / org / gvsig / fmap / mapcontext / MapContextLocator.java @ 35753
History | View | Annotate | Download (3.42 KB)
1 | 28882 | cordinyana | /* gvSIG. Geographic Information System of the Valencian Government
|
---|---|---|---|
2 | *
|
||
3 | * Copyright (C) 2007-2008 Infrastructures and Transports Department
|
||
4 | 31544 | cordinyana | * of the Valencian Government (CIT)
|
5 | 28882 | cordinyana | *
|
6 | * This program is free software; you can redistribute it and/or
|
||
7 | * modify it under the terms of the GNU General Public License
|
||
8 | * as published by the Free Software Foundation; either version 2
|
||
9 | * of the License, or (at your option) any later version.
|
||
10 | *
|
||
11 | * This program is distributed in the hope that it will be useful,
|
||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
14 | * GNU General Public License for more details.
|
||
15 | *
|
||
16 | * You should have received a copy of the GNU General Public License
|
||
17 | * along with this program; if not, write to the Free Software
|
||
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||
19 | * MA 02110-1301, USA.
|
||
20 | *
|
||
21 | */
|
||
22 | |||
23 | /*
|
||
24 | * AUTHORS (In addition to CIT):
|
||
25 | * 2009 {DiSiD Technologies} {{Task}}
|
||
26 | */
|
||
27 | package org.gvsig.fmap.mapcontext; |
||
28 | |||
29 | 30838 | cordinyana | import org.gvsig.fmap.mapcontext.rendering.symbols.SymbolManager; |
30 | 28882 | cordinyana | import org.gvsig.tools.locator.BaseLocator; |
31 | import org.gvsig.tools.locator.Locator; |
||
32 | import org.gvsig.tools.locator.LocatorException; |
||
33 | |||
34 | /**
|
||
35 | * Locator for the MapContext library.
|
||
36 | *
|
||
37 | * @author <a href="mailto:cordinyana@gvsig.org">C?sar Ordi?ana</a>
|
||
38 | */
|
||
39 | public class MapContextLocator extends BaseLocator { |
||
40 | |||
41 | 30838 | cordinyana | public static final String MAPCONTEXT_MANAGER_NAME = "mapcontextlocator.manager"; |
42 | 28882 | cordinyana | |
43 | 30838 | cordinyana | private static final String MAPCONTEXT_MANAGER_DESCRIPTION = "MapContext Library manager"; |
44 | 28882 | cordinyana | |
45 | 30838 | cordinyana | public static final String SYMBOL_MANAGER_NAME = "symbol.manager"; |
46 | 28882 | cordinyana | |
47 | 30838 | cordinyana | private static final String SYMBOL_MANAGER_DESCRIPTION = "Symbols manager"; |
48 | 28882 | cordinyana | |
49 | 30838 | cordinyana | private static final MapContextLocator instance = new MapContextLocator(); |
50 | 28882 | cordinyana | |
51 | 30838 | cordinyana | /**
|
52 | * Private constructor, we don't want it to be able to be instantiated
|
||
53 | * outside this class.
|
||
54 | */
|
||
55 | private MapContextLocator() {
|
||
56 | // Nothing to do
|
||
57 | } |
||
58 | |||
59 | public static MapContextLocator getInstance() { |
||
60 | return instance;
|
||
61 | } |
||
62 | |||
63 | /**
|
||
64 | * Return a reference to MapContextManager.
|
||
65 | *
|
||
66 | * @return a reference to MapContextManager
|
||
67 | * @throws LocatorException
|
||
68 | * if there is no access to the class or the class cannot be
|
||
69 | * instantiated
|
||
70 | * @see Locator#get(String)
|
||
71 | */
|
||
72 | public static MapContextManager getMapContextManager() |
||
73 | throws LocatorException {
|
||
74 | return (MapContextManager) getInstance().get(MAPCONTEXT_MANAGER_NAME);
|
||
75 | } |
||
76 | |||
77 | /**
|
||
78 | * Registers the Class implementing the MapContextManager interface.
|
||
79 | *
|
||
80 | * @param clazz
|
||
81 | * implementing the MapContextManager interface
|
||
82 | */
|
||
83 | public static void registerMapContextManager(Class clazz) { |
||
84 | getInstance().register(MAPCONTEXT_MANAGER_NAME, |
||
85 | MAPCONTEXT_MANAGER_DESCRIPTION, clazz); |
||
86 | } |
||
87 | |||
88 | /**
|
||
89 | * Return a reference to the {@link SymbolManager}.
|
||
90 | *
|
||
91 | * @return a reference to the SymbolManager.
|
||
92 | * @throws LocatorException
|
||
93 | * if there is no access to the class or the class cannot be
|
||
94 | * instantiated
|
||
95 | * @see Locator#get(String)
|
||
96 | */
|
||
97 | public static SymbolManager getSymbolManager() throws LocatorException { |
||
98 | return (SymbolManager) getInstance().get(SYMBOL_MANAGER_NAME);
|
||
99 | } |
||
100 | |||
101 | /**
|
||
102 | * Registers the Class implementing the SymbolManager interface.
|
||
103 | *
|
||
104 | * @param clazz
|
||
105 | * implementing the SymbolManager interface
|
||
106 | */
|
||
107 | public static void registerSymbolManager(Class clazz) { |
||
108 | getInstance().register(SYMBOL_MANAGER_NAME, SYMBOL_MANAGER_DESCRIPTION, |
||
109 | clazz); |
||
110 | } |
||
111 | 28882 | cordinyana | } |