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 |
/**
|
---|---|
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 |
public static DownloaderManager getOnlineManager() { |
70 |
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. |
71 |
} |
72 |
|
73 |
/**
|
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 |
* Return a reference to DownloaderLocator.
|
85 |
*
|
86 |
* @return a reference to DownloaderLocator
|
87 |
* @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 |
public static DownloaderManager getManager() throws LocatorException { |
93 |
return getDownloaderManager();
|
94 |
} |
95 |
|
96 |
public static DownloaderManager getDownloaderManager() throws LocatorException { |
97 |
return (DownloaderManager) CompatLocator.getDownloader();
|
98 |
} |
99 |
|
100 |
/**
|
101 |
* Registers the Class implementing the DownloaderLocator interface.
|
102 |
*
|
103 |
* @param clazz
|
104 |
* implementing the DownloaderLocator interface
|
105 |
*/
|
106 |
public static void registerDownloaderManager(Class clazz) { |
107 |
CompatLocator.registerDownloader(clazz); |
108 |
// getInstance().register(MANAGER_NAME, MANAGER_DESCRIPTION, clazz);
|
109 |
} |
110 |
|
111 |
/**
|
112 |
* Registers the default Class implementing the DownloaderLocator interface
|
113 |
*
|
114 |
* @param clazz
|
115 |
* implementing the DownloaderLocator interface
|
116 |
*/
|
117 |
public static void registerDefaultDownloaderManager(Class clazz) { |
118 |
CompatLocator.registerDownloader(clazz); |
119 |
// getInstance().registerDefault(MANAGER_NAME, MANAGER_DESCRIPTION, clazz);
|
120 |
} |
121 |
|
122 |
} |