Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.plugin / org.gvsig.downloader / org.gvsig.downloader.lib / org.gvsig.downloader.lib.api / src / main / java / org / gvsig / downloader / DownloaderLocator.java @ 47821

History | View | Annotate | Download (3.48 KB)

1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright ? 2007-2014 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 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
 * 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
package org.gvsig.downloader;
26

    
27
import org.gvsig.compat.CompatLocator;
28
import org.gvsig.tools.locator.BaseLocator;
29
import org.gvsig.tools.locator.Locator;
30
import org.gvsig.tools.locator.LocatorException;
31

    
32
/**
33
 * This locator is the entry point for the XML library, providing
34
 * access to all XML services through the {@link DownloaderManager}
35
 * 
36
 */
37
public class DownloaderLocator extends BaseLocator {
38

    
39
    /**
40
     * XML locator name
41
     */
42
    private static final String LOCATOR_NAME = "DownloaderLocator";
43

    
44
    /**
45
     * XML manager name
46
     */
47
    public static final String MANAGER_NAME = "Downloader.manager";
48

    
49
    /**
50
     * XML manager description
51
     */
52
    private static final String MANAGER_DESCRIPTION =
53
        "Downloader Manager of gvSIG";
54
    
55
    /**
56
     * Unique instance
57
     */
58
    private static final DownloaderLocator instance = new DownloaderLocator();
59

    
60
    /**
61
     * Returns the singleton instance.
62
     *
63
     * @return the singleton instance
64
     */
65
    public static DownloaderLocator getInstance() {
66
        return instance;
67
    }
68

    
69
    /**
70
     * Returns the Locator's name
71
     * 
72
     * @return a String with the Locator's name
73
     */
74
    @Override
75
    public String getLocatorName() {
76
        return LOCATOR_NAME;
77
    }
78

    
79
    /**
80
     * Return a reference to DownloaderLocator.
81
     *
82
     * @return a reference to DownloaderLocator
83
     * @throws LocatorException
84
     *             if there is no access to the class or the class
85
     *             cannot be instantiated
86
     * @see Locator#get(String)
87
     */
88
    public static DownloaderManager getManager() throws LocatorException {
89
        return getDownloaderManager();
90
    }
91

    
92
    public static DownloaderManager getDownloaderManager() throws LocatorException {
93
        return (DownloaderManager) CompatLocator.getDownloader();
94
    }
95

    
96
    /**
97
     * Registers the Class implementing the DownloaderLocator interface.
98
     *
99
     * @param clazz
100
     *            implementing the DownloaderLocator interface
101
     */
102
    public static void registerDownloaderManager(Class clazz) {
103
        CompatLocator.registerDownloader(clazz);
104
//        getInstance().register(MANAGER_NAME, MANAGER_DESCRIPTION, clazz);
105
    }
106

    
107
    /**
108
     * Registers the default Class implementing the DownloaderLocator interface
109
     * 
110
     * @param clazz
111
     *            implementing the DownloaderLocator interface
112
     */
113
    public static void registerDefaultDownloaderManager(Class clazz) {
114
        CompatLocator.registerDownloader(clazz);
115
//        getInstance().registerDefault(MANAGER_NAME, MANAGER_DESCRIPTION, clazz);
116
    }
117

    
118
}