public class DownloadBlocker extends java.lang.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(aQute.service.reporter.Reporter reporter) |
| Modifier and Type | Method and Description |
|---|---|
void |
failure(java.io.File file,
java.lang.String reason)
Called when the file could not be downloaded from a remote
repository.
|
java.io.File |
getFile() |
java.lang.String |
getReason()
Return a failure reason or null.
|
DownloadBlocker.Stage |
getStage()
Return the stage we're in
|
boolean |
progress(java.io.File file,
int percentage)
Can be called back regularly before success/failure but never after.
|
void |
success(java.io.File file)
Called when the file is successfully downloaded from a remote
repository.
|
java.lang.String |
toString() |
public void success(java.io.File file)
throws java.lang.Exception
RepositoryPlugin.DownloadListenersuccess in interface RepositoryPlugin.DownloadListenerfile - The file that was downloadedjava.lang.Exception - , are logged and ignoredpublic void failure(java.io.File file,
java.lang.String reason)
throws java.lang.Exception
RepositoryPlugin.DownloadListenerfailure in interface RepositoryPlugin.DownloadListenerfile - The file that was intended to be downloaded.java.lang.Exception - , are logged and ignoredpublic boolean progress(java.io.File file,
int percentage)
throws java.lang.Exception
RepositoryPlugin.DownloadListenerprogress in interface RepositoryPlugin.DownloadListenerfile - The file that was intended to be downloadedpercentage - Percentage of file downloaded (can go down)java.lang.Exception - , are logged and ignoredpublic java.lang.String getReason()
success(File) or failure(File, String) has been called.
It can be called many times.public DownloadBlocker.Stage getStage()
public java.io.File getFile()
public java.lang.String toString()
toString in class java.lang.Object