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 @ 47845
History | View | Annotate | Download (3.68 KB)
1 | 47092 | jjdelcerro | /**
|
---|---|---|---|
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 | 47821 | jjdelcerro | package org.gvsig.downloader; |
26 | 47092 | jjdelcerro | |
27 | 47821 | jjdelcerro | import org.gvsig.compat.CompatLocator; |
28 | 47092 | jjdelcerro | 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 | 47821 | jjdelcerro | * access to all XML services through the {@link DownloaderManager}
|
35 | 47092 | jjdelcerro | *
|
36 | */
|
||
37 | 47821 | jjdelcerro | public class DownloaderLocator extends BaseLocator { |
38 | 47092 | jjdelcerro | |
39 | /**
|
||
40 | * XML locator name
|
||
41 | */
|
||
42 | 47821 | jjdelcerro | private static final String LOCATOR_NAME = "DownloaderLocator"; |
43 | 47092 | jjdelcerro | |
44 | /**
|
||
45 | * XML manager name
|
||
46 | */
|
||
47 | 47821 | jjdelcerro | public static final String MANAGER_NAME = "Downloader.manager"; |
48 | 47092 | jjdelcerro | |
49 | /**
|
||
50 | * XML manager description
|
||
51 | */
|
||
52 | private static final String MANAGER_DESCRIPTION = |
||
53 | 47821 | jjdelcerro | "Downloader Manager of gvSIG";
|
54 | 47092 | jjdelcerro | |
55 | /**
|
||
56 | * Unique instance
|
||
57 | */
|
||
58 | 47821 | jjdelcerro | private static final DownloaderLocator instance = new DownloaderLocator(); |
59 | 47092 | jjdelcerro | |
60 | /**
|
||
61 | * Returns the singleton instance.
|
||
62 | *
|
||
63 | * @return the singleton instance
|
||
64 | */
|
||
65 | 47821 | jjdelcerro | public static DownloaderLocator getInstance() { |
66 | 47092 | jjdelcerro | return instance;
|
67 | } |
||
68 | |||
69 | 47828 | jjdelcerro | public static DownloaderManager getOnlineManager() { |
70 | throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. |
||
71 | } |
||
72 | |||
73 | 47092 | jjdelcerro | /**
|
74 | * Returns the Locator's name
|
||
75 | *
|
||
76 | * @return a String with the Locator's name
|
||
77 | */
|
||
78 | @Override
|
||
79 | public String getLocatorName() { |
||
80 | return LOCATOR_NAME;
|
||
81 | } |
||
82 | |||
83 | /**
|
||
84 | 47821 | jjdelcerro | * Return a reference to DownloaderLocator.
|
85 | 47092 | jjdelcerro | *
|
86 | 47821 | jjdelcerro | * @return a reference to DownloaderLocator
|
87 | 47092 | jjdelcerro | * @throws LocatorException
|
88 | * if there is no access to the class or the class
|
||
89 | * cannot be instantiated
|
||
90 | * @see Locator#get(String)
|
||
91 | */
|
||
92 | 47821 | jjdelcerro | public static DownloaderManager getManager() throws LocatorException { |
93 | return getDownloaderManager();
|
||
94 | 47092 | jjdelcerro | } |
95 | |||
96 | 47821 | jjdelcerro | public static DownloaderManager getDownloaderManager() throws LocatorException { |
97 | return (DownloaderManager) CompatLocator.getDownloader();
|
||
98 | 47092 | jjdelcerro | } |
99 | |||
100 | /**
|
||
101 | 47821 | jjdelcerro | * Registers the Class implementing the DownloaderLocator interface.
|
102 | 47092 | jjdelcerro | *
|
103 | * @param clazz
|
||
104 | 47821 | jjdelcerro | * implementing the DownloaderLocator interface
|
105 | 47092 | jjdelcerro | */
|
106 | 47821 | jjdelcerro | public static void registerDownloaderManager(Class clazz) { |
107 | CompatLocator.registerDownloader(clazz); |
||
108 | // getInstance().register(MANAGER_NAME, MANAGER_DESCRIPTION, clazz);
|
||
109 | 47092 | jjdelcerro | } |
110 | |||
111 | /**
|
||
112 | 47821 | jjdelcerro | * Registers the default Class implementing the DownloaderLocator interface
|
113 | 47092 | jjdelcerro | *
|
114 | * @param clazz
|
||
115 | 47821 | jjdelcerro | * implementing the DownloaderLocator interface
|
116 | 47092 | jjdelcerro | */
|
117 | 47821 | jjdelcerro | public static void registerDefaultDownloaderManager(Class clazz) { |
118 | CompatLocator.registerDownloader(clazz); |
||
119 | // getInstance().registerDefault(MANAGER_NAME, MANAGER_DESCRIPTION, clazz);
|
||
120 | 47092 | jjdelcerro | } |
121 | |||
122 | } |