root / branches / v2_0_0_prep / applications / appgvSIG / src / org / gvsig / app / ApplicationLocator.java @ 38605
History | View | Annotate | Download (2.64 KB)
1 | 26919 | jmvivo | /* gvSIG. Geographic Information System of the Valencian Government
|
---|---|---|---|
2 | *
|
||
3 | * Copyright (C) 2007-2008 Infrastructures and Transports Department
|
||
4 | * of the Valencian Government (CIT)
|
||
5 | *
|
||
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 IVER T.I {{Task}}
|
||
26 | */
|
||
27 | |||
28 | 29596 | jpiera | package org.gvsig.app; |
29 | 26919 | jmvivo | |
30 | import org.gvsig.tools.locator.BaseLocator; |
||
31 | import org.gvsig.tools.locator.Locator; |
||
32 | import org.gvsig.tools.locator.LocatorException; |
||
33 | |||
34 | 31496 | jjdelcerro | public class ApplicationLocator extends BaseLocator { |
35 | 26919 | jmvivo | |
36 | private static final String LOCATOR_NAME = "appgsigLocator"; |
||
37 | |||
38 | public static final String APPGVSIG_MANAGER_NAME = "appgsigLocator.manager.persistence"; |
||
39 | |||
40 | private static final String APPGVSIG_MANAGER_DESCRIPTION = "Manager of appgvSIG"; |
||
41 | 28666 | jpiera | |
42 | 26919 | jmvivo | /**
|
43 | * Unique instance.
|
||
44 | */
|
||
45 | 31701 | cordinyana | private static final ApplicationLocator instance = new ApplicationLocator(); |
46 | 26919 | jmvivo | |
47 | /**
|
||
48 | * Return the singleton instance.
|
||
49 | *
|
||
50 | * @return the singleton instance
|
||
51 | */
|
||
52 | 31701 | cordinyana | public static ApplicationLocator getInstance() { |
53 | 26919 | jmvivo | return instance;
|
54 | } |
||
55 | |||
56 | public String getLocatorName() { |
||
57 | return LOCATOR_NAME;
|
||
58 | } |
||
59 | |||
60 | /**
|
||
61 | * Return a reference to PersistenceManager.
|
||
62 | *
|
||
63 | * @return a reference to PersistenceManager
|
||
64 | * @throws LocatorException
|
||
65 | * if there is no access to the class or the class cannot be
|
||
66 | * instantiated
|
||
67 | * @see Locator#get(String)
|
||
68 | */
|
||
69 | 31496 | jjdelcerro | public static ApplicationManager getManager() |
70 | 26919 | jmvivo | throws LocatorException {
|
71 | 31496 | jjdelcerro | return (ApplicationManager) getInstance().get(APPGVSIG_MANAGER_NAME);
|
72 | 26919 | jmvivo | } |
73 | |||
74 | /**
|
||
75 | * Registers the Class implementing the PersistenceManager interface.
|
||
76 | *
|
||
77 | * @param clazz
|
||
78 | * implementing the PersistenceManager interface
|
||
79 | */
|
||
80 | 31496 | jjdelcerro | @SuppressWarnings("unchecked") |
81 | public static void registerAppgvSIGManager(Class clazz) { |
||
82 | 26919 | jmvivo | getInstance().register(APPGVSIG_MANAGER_NAME, |
83 | APPGVSIG_MANAGER_DESCRIPTION, clazz); |
||
84 | } |
||
85 | |||
86 | 31496 | jjdelcerro | @SuppressWarnings("unchecked") |
87 | public static void registerDefaultAppgvSIGManager(Class clazz) { |
||
88 | 26919 | jmvivo | getInstance().registerDefault(APPGVSIG_MANAGER_NAME, |
89 | APPGVSIG_MANAGER_DESCRIPTION, clazz); |
||
90 | 28890 | jpiera | } |
91 | 26919 | jmvivo | } |