svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.library / org.gvsig.personaldb / org.gvsig.personaldb.lib / org.gvsig.personaldb.lib.api / src / main / java / org / gvsig / personaldb / PersonalDBLocator.java @ 40560
History | View | Annotate | Download (2.93 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.personaldb; |
||
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 PersonalDB library, providing
|
||
32 | * access to all PersonalDB services through the {@link PersonalDBManager}
|
||
33 | * .
|
||
34 | *
|
||
35 | * @author gvSIG team
|
||
36 | * @version $Id$
|
||
37 | */
|
||
38 | public class PersonalDBLocator extends BaseLocator { |
||
39 | |||
40 | /**
|
||
41 | * PersonalDB manager name.
|
||
42 | */
|
||
43 | public static final String MANAGER_NAME = "PersonalDB.manager"; |
||
44 | |||
45 | /**
|
||
46 | * PersonalDB manager description.
|
||
47 | */
|
||
48 | public static final String MANAGER_DESCRIPTION = "PersonalDB Manager"; |
||
49 | |||
50 | private static final String LOCATOR_NAME = "PersonalDB.locator"; |
||
51 | |||
52 | /**
|
||
53 | * Unique instance.
|
||
54 | */
|
||
55 | private static final PersonalDBLocator INSTANCE = |
||
56 | new PersonalDBLocator();
|
||
57 | |||
58 | /**
|
||
59 | * Return the singleton instance.
|
||
60 | *
|
||
61 | * @return the singleton instance
|
||
62 | */
|
||
63 | public static PersonalDBLocator 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 PersonalDBManager.
|
||
78 | *
|
||
79 | * @return a reference to the PersonalDBManager
|
||
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 PersonalDBManager getManager() throws LocatorException { |
||
86 | return (PersonalDBManager) getInstance().get(MANAGER_NAME);
|
||
87 | } |
||
88 | |||
89 | /**
|
||
90 | * Registers the Class implementing the PersonalDBManager interface.
|
||
91 | *
|
||
92 | * @param clazz
|
||
93 | * implementing the PersonalDBManager interface
|
||
94 | */
|
||
95 | public static void registerManager( |
||
96 | Class<? extends PersonalDBManager> clazz) { |
||
97 | getInstance().register(MANAGER_NAME, MANAGER_DESCRIPTION, clazz); |
||
98 | } |
||
99 | |||
100 | } |