svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.library / org.gvsig.newlayer / org.gvsig.newlayer.lib / org.gvsig.newlayer.lib.api / src / main / java / org / gvsig / newlayer / NewLayerLocator.java @ 40560
History | View | Annotate | Download (2.89 KB)
1 | 40560 | jjdelcerro | /**
|
---|---|---|---|
2 | * gvSIG. Desktop Geographic Information System.
|
||
3 | 40435 | jjdelcerro | *
|
4 | 40560 | jjdelcerro | * Copyright (C) 2007-2013 gvSIG Association.
|
5 | 40435 | jjdelcerro | *
|
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 | 40560 | jjdelcerro | * as published by the Free Software Foundation; either version 3
|
9 | 40435 | jjdelcerro | * 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 | 40560 | jjdelcerro | * For any additional information, do not hesitate to contact us
|
22 | * at info AT gvsig.com, or visit our website www.gvsig.com.
|
||
23 | 40435 | jjdelcerro | */
|
24 | package org.gvsig.newlayer; |
||
25 | |||
26 | import org.gvsig.tools.locator.BaseLocator; |
||
27 | import org.gvsig.tools.locator.Locator; |
||
28 | import org.gvsig.tools.locator.LocatorException; |
||
29 | |||
30 | /**
|
||
31 | * This locator is the entry point for the NewLayer library, providing
|
||
32 | * access to all NewLayer services through the {@link NewLayerManager}
|
||
33 | * .
|
||
34 | *
|
||
35 | * @author gvSIG team
|
||
36 | * @version $Id$
|
||
37 | */
|
||
38 | public class NewLayerLocator extends BaseLocator { |
||
39 | |||
40 | /**
|
||
41 | * NewLayer manager name.
|
||
42 | */
|
||
43 | public static final String MANAGER_NAME = "NewLayer.manager"; |
||
44 | |||
45 | /**
|
||
46 | * NewLayer manager description.
|
||
47 | */
|
||
48 | public static final String MANAGER_DESCRIPTION = "NewLayer Manager"; |
||
49 | |||
50 | private static final String LOCATOR_NAME = "NewLayer.locator"; |
||
51 | |||
52 | /**
|
||
53 | * Unique instance.
|
||
54 | */
|
||
55 | private static final NewLayerLocator INSTANCE = |
||
56 | new NewLayerLocator();
|
||
57 | |||
58 | /**
|
||
59 | * Return the singleton instance.
|
||
60 | *
|
||
61 | * @return the singleton instance
|
||
62 | */
|
||
63 | public static NewLayerLocator getInstance() { |
||
64 | return INSTANCE;
|
||
65 | } |
||
66 | |||
67 | /**
|
||
68 | * Return the Locator's name.
|
||
69 | *
|
||
70 | * @return a String with the Locator's name
|
||
71 | */
|
||
72 | public final String getLocatorName() { |
||
73 | return LOCATOR_NAME;
|
||
74 | } |
||
75 | |||
76 | /**
|
||
77 | * Return a reference to the NewLayerManager.
|
||
78 | *
|
||
79 | * @return a reference to the NewLayerManager
|
||
80 | * @throws LocatorException
|
||
81 | * if there is no access to the class or the class cannot be
|
||
82 | * instantiated
|
||
83 | * @see Locator#get(String)
|
||
84 | */
|
||
85 | public static NewLayerManager getManager() throws LocatorException { |
||
86 | return (NewLayerManager) getInstance().get(MANAGER_NAME);
|
||
87 | } |
||
88 | |||
89 | /**
|
||
90 | * Registers the Class implementing the NewLayerManager interface.
|
||
91 | *
|
||
92 | * @param clazz
|
||
93 | * implementing the NewLayerManager interface
|
||
94 | */
|
||
95 | public static void registerManager( |
||
96 | Class<? extends NewLayerManager> clazz) { |
||
97 | getInstance().register(MANAGER_NAME, MANAGER_DESCRIPTION, clazz); |
||
98 | } |
||
99 | |||
100 | } |