public class ReadRemotePluginInformationTask extends PleaseWaitRunnable
Modifier and Type | Field and Description |
---|---|
private List<PluginInformation> |
availablePlugins |
private boolean |
canceled |
private HttpClient |
connection |
private boolean |
displayErrMsg |
private Collection<String> |
sites |
progressMonitor
Constructor and Description |
---|
ReadRemotePluginInformationTask(Collection<String> sites)
Constructs a new
ReadRemotePluginInformationTask . |
ReadRemotePluginInformationTask(ProgressMonitor monitor,
Collection<String> sites,
boolean displayErrMsg)
Constructs a new
ReadRemotePluginInformationTask . |
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)
Creates the file name for the cached plugin list and the icon cache file.
|
private void |
displayErrorMessage(ProgressMonitor monitor,
String msg,
String details,
String title,
String firstMessage) |
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 details) |
protected void |
init(Collection<String> sites,
boolean displayErrMsg) |
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 HttpClient connection
private List<PluginInformation> availablePlugins
private boolean displayErrMsg
public ReadRemotePluginInformationTask(Collection<String> sites)
ReadRemotePluginInformationTask
.sites
- the collection of download sites. Defaults to the empty collection if null.public ReadRemotePluginInformationTask(ProgressMonitor monitor, Collection<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(Collection<String> sites, boolean displayErrMsg)
protected void cancel()
PleaseWaitRunnable
cancel
in class PleaseWaitRunnable
protected void finish()
PleaseWaitRunnable
finish
in class PleaseWaitRunnable
protected File createSiteCacheFile(File pluginDir, String site)
pluginDir
- directory of plugin for data storagesite
- the name of the siteprotected String downloadPluginList(String site, ProgressMonitor monitor)
site
- the site URLmonitor
- a progress monitorprivate void handleIOException(ProgressMonitor monitor, IOException e, String details)
private void displayErrorMessage(ProgressMonitor monitor, String msg, String details, String title, String firstMessage)
protected 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
- if a SAX error occursIOException
- 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 List<PluginInformation> getAvailablePlugins()