Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.library / org.gvsig.installer / org.gvsig.installer.lib / org.gvsig.installer.lib.spi / src / main / java / org / gvsig / installer / lib / spi / InstallerProviderLocator.java @ 40560

History | View | Annotate | Download (2.89 KB)

1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
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 3
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
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
/*
25
 * AUTHORS (In addition to CIT):
26
 * 2010 {Prodevelop}   {Task}
27
 */
28

    
29
package org.gvsig.installer.lib.spi;
30

    
31
import org.gvsig.tools.locator.BaseLocator;
32
import org.gvsig.tools.locator.Locator;
33
import org.gvsig.tools.locator.LocatorException;
34

    
35
/**
36
 * This Locator provides the entry point for the gvSIG
37
 * {@link InstallerProviderManager}
38
 * 
39
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodr&aacute;</a>
40
 */
41
public class InstallerProviderLocator extends BaseLocator {
42

    
43
        private static final String LOCATOR_NAME = "Installer.provider.locator";
44
        public static final String PROVIDER_MANAGER_NAME = "Installer.provider.manager";
45
        public static final String PROVIDER_MANAGER_DESCRIPTION = "Installer Manager";
46

    
47
        /**
48
         * Unique instance.
49
         */
50
        private static final InstallerProviderLocator instance = new InstallerProviderLocator();
51

    
52
        /**
53
         * Return the singleton instance.
54
         * 
55
         * @return the singleton instance
56
         */
57
        public static InstallerProviderLocator getInstance() {
58
                return instance;
59
        }
60

    
61
        /**
62
         * Return the Locator's name
63
         * 
64
         * @return a String with the Locator's name
65
         */
66
        @Override
67
        public String getLocatorName() {
68
                return LOCATOR_NAME;
69
        }
70

    
71
        /**
72
         * Return a reference to InstallerProviderManager.
73
         * 
74
         * @return a reference to InstallerProviderManager
75
         * @throws LocatorException
76
         *             if there is no access to the class or the class cannot be
77
         *             instantiated
78
         * @see Locator#get(String)
79
         */
80
        public static InstallerProviderManager getProviderManager()
81
                        throws LocatorException {
82
                return (InstallerProviderManager) getInstance().get(
83
                                PROVIDER_MANAGER_NAME);
84
        }
85

    
86
        /**
87
         * Registers the Class implementing the InstallerProviderManager interface.
88
         * 
89
         * @param clazz
90
         *            implementing the InstallerProviderManager interface
91
         */
92
        public static void registerInstallerProviderManager(
93
                        Class<? extends InstallerProviderManager> clazz) {
94
                getInstance().register(PROVIDER_MANAGER_NAME,
95
                                PROVIDER_MANAGER_DESCRIPTION, clazz);
96
        }
97

    
98
}