public class ReadRemotePluginInformationTask extends PleaseWaitRunnable
Modifier and Type | Class and Description |
---|---|
protected static class |
ReadRemotePluginInformationTask.CacheType |
Modifier and Type | Field and Description |
---|---|
private List<PluginInformation> |
availablePlugins |
private boolean |
canceled |
private HttpURLConnection |
connection |
private Collection<String> |
sites |
progressMonitor
Constructor and Description |
---|
ReadRemotePluginInformationTask(Collection<String> sites)
Creates the task
|
ReadRemotePluginInformationTask(ProgressMonitor monitor,
Collection<String> sites)
Creates the task
|
Modifier and Type | Method and Description |
---|---|
protected void |
cachePluginList(String site,
String list)
Writes the list of plugins to a cache file
|
protected void |
cancel()
User pressed cancel button.
|
protected File |
createSiteCacheFile(File pluginDir,
String site,
ReadRemotePluginInformationTask.CacheType type)
Creates the file name for the cached plugin list and the icon cache
file.
|
protected void |
downloadPluginIcons(String site,
File destFile,
ProgressMonitor monitor)
Downloads the icon archive from a remote location
|
protected String |
downloadPluginList(String site,
ProgressMonitor monitor)
Downloads the list from a remote location
|
protected List<PluginInformation> |
filterDeprecatedPlugins(List<PluginInformation> plugins)
Filter information about deprecated plugins from the list of downloaded
plugins
|
protected void |
finish()
Finish up the data work.
|
List<PluginInformation> |
getAvailablePlugins()
Replies the list of plugins described in the downloaded plugin lists
|
private void |
handleIOException(ProgressMonitor monitor,
IOException e,
String title,
String firstMessage) |
protected void |
init(Collection<String> sites) |
boolean |
isCanceled()
Replies true if the task was canceled
|
protected void |
parsePluginListDocument(String site,
String doc)
Parses the plugin list
|
protected void |
realRun()
Called in the worker thread to do the actual work.
|
afterFinish, canRunInBackground, getProgressMonitor, operationCanceled, run
private Collection<String> sites
private boolean canceled
private HttpURLConnection connection
private List<PluginInformation> availablePlugins
public ReadRemotePluginInformationTask(Collection<String> sites)
sites
- the collection of download sites. Defaults to the empty collection if null.public ReadRemotePluginInformationTask(ProgressMonitor monitor, Collection<String> sites)
monitor
- the progress monitor. Defaults to NullProgressMonitor.INSTANCE
if nullsites
- the collection of download sites. Defaults to the empty collection if null.protected void init(Collection<String> sites)
protected void cancel()
PleaseWaitRunnable
cancel
in class PleaseWaitRunnable
protected void finish()
PleaseWaitRunnable
finish
in class PleaseWaitRunnable
protected File createSiteCacheFile(File pluginDir, String site, ReadRemotePluginInformationTask.CacheType type)
site
- the name of the sitetype
- icon cache or plugin list cacheprotected String downloadPluginList(String site, ProgressMonitor monitor)
site
- the site URLmonitor
- a progress monitorprivate void handleIOException(ProgressMonitor monitor, IOException e, String title, String firstMessage)
protected void downloadPluginIcons(String site, File destFile, ProgressMonitor monitor)
site
- the site URLmonitor
- a progress monitorprotected void cachePluginList(String site, String list)
site
- the site from where the list was downloadedlist
- the downloaded listprotected List<PluginInformation> filterDeprecatedPlugins(List<PluginInformation> plugins)
plugins
- the plugin informationsprotected void parsePluginListDocument(String site, String doc)
site
- the site from where the list was downloadeddoc
- the document with the plugin listprotected void realRun() throws SAXException, IOException, OsmTransferException
PleaseWaitRunnable
realRun
in class PleaseWaitRunnable
SAXException
IOException
OsmTransferException
public boolean isCanceled()
true
if the task was stopped by the userpublic List<PluginInformation> getAvailablePlugins()