Statistics
| Revision:

svn-gvsig-desktop / branches / v2_0_0_prep / extensions / org.gvsig.installer / org.gvsig.installer.lib / org.gvsig.installer.lib.api / src / main / java / org / gvsig / installer / lib / api / InstallerLocator.java @ 37857

History | View | Annotate | Download (2.8 KB)

1 32269 jpiera
/* gvSIG. Geographic Information System of the Valencian Government
2 33692 cordinyana
 *
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 32269 jpiera
23
/*
24 33692 cordinyana
 * AUTHORS (In addition to CIT):
25
 * 2010 {Prodevelop}   {Task}
26
 */
27
28 32269 jpiera
package org.gvsig.installer.lib.api;
29
30
import org.gvsig.tools.locator.AbstractLocator;
31
import org.gvsig.tools.locator.Locator;
32
import org.gvsig.tools.locator.LocatorException;
33
34
/**
35 32333 jpiera
 * This Locator provides the entry point for the gvSIG {@link InstallerManager}
36
 *
37
 * @see {@link Locator}
38 32269 jpiera
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodr&aacute;</a>
39
 */
40
public class InstallerLocator extends AbstractLocator {
41
42 37599 nfrancisco
        private static final String LOCATOR_NAME = "InstallerLocator";
43
        /**
44
         * InstallerManager name used by the locator to access the instance
45
         */
46
        public static final String INSTALLER_MANAGER_NAME = "InstallerManager";
47
        private static final String INSTALLER_MANAGER_DESCRIPTION = "InstallerManager of gvSIG";
48 32269 jpiera
49 37599 nfrancisco
        /**
50
         * Unique instance.
51
         */
52
        private static final InstallerLocator instance = new InstallerLocator();
53 33692 cordinyana
54 37599 nfrancisco
        /**
55
         * @see Locator#getLocatorName()
56
         */
57
        public String getLocatorName() {
58
                return LOCATOR_NAME;
59
        }
60 33692 cordinyana
61 37599 nfrancisco
        /**
62
         * Return a reference to {@link InstallerManager}.
63
         *
64
         * @return a reference to InstallerManager
65
         * @throws LocatorException
66
         *             if there is no access to the class or the class cannot be
67
         *             instantiated
68
         * @see Locator#get(String)
69
         */
70
        public static InstallerManager getInstallerManager()
71
                        throws LocatorException {
72
                return (InstallerManager) getInstance().get(INSTALLER_MANAGER_NAME);
73
        }
74 33692 cordinyana
75 37599 nfrancisco
        /**
76
         * Return the singleton instance.
77
         *
78
         * @return the singleton instance
79
         */
80
        public static InstallerLocator getInstance() {
81
                return instance;
82
        }
83 33692 cordinyana
84 37599 nfrancisco
        /**
85
         * Registers the Class implementing the {@link InstallerManager} interface.
86
         *
87
         * @param clazz
88
         *            implementing the InstallerManager interface
89
         */
90
        public static void registerInstallerManager(
91
                        Class<? extends InstallerManager> clazz) {
92 33692 cordinyana
93 37599 nfrancisco
                getInstance().register(INSTALLER_MANAGER_NAME,
94
                                INSTALLER_MANAGER_DESCRIPTION, clazz);
95
        }
96 32269 jpiera
}