public class DownloadBlocker extends Object implements RepositoryPlugin.DownloadListener
RepositoryPlugin.
The
RepositoryPlugin.get(String, aQute.bnd.version.Version, java.util.Map, aQute.bnd.service.RepositoryPlugin.DownloadListener...)
method takes one or more Download Listeners. These are called back with the
success or failure of a download. This class is a simple implementation of
this model, just call getReason() and it blocks until success or
failure is called.| Modifier and Type | Class and Description |
|---|---|
static class |
DownloadBlocker.Stage |
| Constructor and Description |
|---|
DownloadBlocker(Reporter reporter) |
| Modifier and Type | Method and Description |
|---|---|
void |
failure(File file,
String reason)
Called when the file could not be downloaded from a remote
repository.
|
File |
getFile() |
String |
getReason()
Return a failure reason or null.
|
DownloadBlocker.Stage |
getStage()
Return the stage we're in
|
boolean |
progress(File file,
int percentage)
Can be called back regularly before success/failure but never after.
|
void |
success(File file)
Called when the file is successfully downloaded from a remote
repository.
|
String |
toString() |
public DownloadBlocker(Reporter reporter)
public void success(File file) throws Exception
RepositoryPlugin.DownloadListenersuccess in interface RepositoryPlugin.DownloadListenerfile - The file that was downloadedException - , are logged and ignoredpublic void failure(File file, String reason) throws Exception
RepositoryPlugin.DownloadListenerfailure in interface RepositoryPlugin.DownloadListenerfile - The file that was intended to be downloaded.Exception - , are logged and ignoredpublic boolean progress(File file, int percentage) throws Exception
RepositoryPlugin.DownloadListenerprogress in interface RepositoryPlugin.DownloadListenerfile - The file that was intended to be downloadedpercentage - Percentage of file downloaded (can go down)Exception - , are logged and ignoredpublic String getReason()
success(File) or failure(File, String) has been called.
It can be called many times.public DownloadBlocker.Stage getStage()
public File getFile()
Copyright © 2019 aQute SARL. All rights reserved.