public class ReadRemotePluginInformationTask extends PleaseWaitRunnable
Modifier and Type | Field and Description |
---|---|
private java.util.List<PluginInformation> |
availablePlugins |
private boolean |
canceled |
private HttpClient |
connection |
private boolean |
displayErrMsg |
private java.util.Collection<java.lang.String> |
sites |
progressMonitor
Constructor and Description |
---|
ReadRemotePluginInformationTask(java.util.Collection<java.lang.String> sites)
Constructs a new
ReadRemotePluginInformationTask . |
ReadRemotePluginInformationTask(ProgressMonitor monitor,
java.util.Collection<java.lang.String> sites,
boolean displayErrMsg)
Constructs a new
ReadRemotePluginInformationTask . |
Modifier and Type | Method and Description |
---|---|
protected void |
cachePluginList(java.lang.String site,
java.lang.String list)
Writes the list of plugins to a cache file
|
protected void |
cancel()
User pressed cancel button.
|
protected java.io.File |
createSiteCacheFile(java.io.File pluginDir,
java.lang.String site)
Creates the file name for the cached plugin list and the icon cache file.
|
private static void |
displayErrorMessage(ProgressMonitor monitor,
java.lang.String msg,
java.lang.String details,
java.lang.String title,
java.lang.String firstMessage) |
protected java.lang.String |
downloadPluginList(java.lang.String site,
ProgressMonitor monitor)
Downloads the list from a remote location
|
protected java.util.List<PluginInformation> |
filterDeprecatedPlugins(java.util.List<PluginInformation> plugins)
Filter information about deprecated plugins from the list of downloaded
plugins
|
protected void |
finish()
Finish up the data work.
|
java.util.List<PluginInformation> |
getAvailablePlugins()
Replies the list of plugins described in the downloaded plugin lists
|
private void |
handleIOException(ProgressMonitor monitor,
java.io.IOException e,
java.lang.String details) |
protected void |
init(java.util.Collection<java.lang.String> sites,
boolean displayErrMsg) |
boolean |
isCanceled()
Replies true if the task was canceled
|
protected void |
parsePluginListDocument(java.lang.String site,
java.lang.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 java.util.Collection<java.lang.String> sites
private boolean canceled
private HttpClient connection
private java.util.List<PluginInformation> availablePlugins
private boolean displayErrMsg
public ReadRemotePluginInformationTask(java.util.Collection<java.lang.String> sites)
ReadRemotePluginInformationTask
.sites
- the collection of download sites. Defaults to the empty collection if null.public ReadRemotePluginInformationTask(ProgressMonitor monitor, java.util.Collection<java.lang.String> sites, boolean displayErrMsg)
ReadRemotePluginInformationTask
.monitor
- the progress monitor. Defaults to NullProgressMonitor.INSTANCE
if nullsites
- the collection of download sites. Defaults to the empty collection if null.displayErrMsg
- if true
, a blocking error message is displayed in case of I/O exception.protected final void init(java.util.Collection<java.lang.String> sites, boolean displayErrMsg)
protected void cancel()
PleaseWaitRunnable
cancel
in class PleaseWaitRunnable
protected void finish()
PleaseWaitRunnable
finish
in class PleaseWaitRunnable
protected java.io.File createSiteCacheFile(java.io.File pluginDir, java.lang.String site)
pluginDir
- directory of plugin for data storagesite
- the name of the siteprotected java.lang.String downloadPluginList(java.lang.String site, ProgressMonitor monitor)
site
- the site URLmonitor
- a progress monitorprivate void handleIOException(ProgressMonitor monitor, java.io.IOException e, java.lang.String details)
private static void displayErrorMessage(ProgressMonitor monitor, java.lang.String msg, java.lang.String details, java.lang.String title, java.lang.String firstMessage)
protected void cachePluginList(java.lang.String site, java.lang.String list)
site
- the site from where the list was downloadedlist
- the downloaded listprotected java.util.List<PluginInformation> filterDeprecatedPlugins(java.util.List<PluginInformation> plugins)
plugins
- the plugin informationsprotected void parsePluginListDocument(java.lang.String site, java.lang.String doc)
site
- the site from where the list was downloadeddoc
- the document with the plugin listprotected void realRun() throws org.xml.sax.SAXException, java.io.IOException, OsmTransferException
PleaseWaitRunnable
realRun
in class PleaseWaitRunnable
org.xml.sax.SAXException
- if a SAX error occursjava.io.IOException
- if an I/O error occursOsmTransferException
- if a communication error with the OSM server occurspublic boolean isCanceled()
true
if the task was stopped by the userpublic java.util.List<PluginInformation> getAvailablePlugins()