Package aQute.bnd.build
Class DownloadBlocker
java.lang.Object
aQute.bnd.build.DownloadBlocker
- All Implemented Interfaces:
RepositoryPlugin.DownloadListener
This class is intended to be used by the users of a
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.-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidCalled when the file could not be downloaded from a remote repository.getFile()Return a failure reason or null.getStage()Return the stage we're inbooleanCan be called back regularly before success/failure but never after.voidCalled when the file is successfully downloaded from a remote repository.voidCalled when the file is successfully downloaded from a remote repository.toString()
-
Constructor Details
-
DownloadBlocker
public DownloadBlocker(aQute.service.reporter.Reporter reporter)
-
-
Method Details
-
success
Description copied from interface:RepositoryPlugin.DownloadListenerCalled when the file is successfully downloaded from a remote repository.- Specified by:
successin interfaceRepositoryPlugin.DownloadListener- Parameters:
file- The file that was downloaded- Throws:
Exception- , are logged and ignored
-
success
Description copied from interface:RepositoryPlugin.DownloadListenerCalled when the file is successfully downloaded from a remote repository.- Specified by:
successin interfaceRepositoryPlugin.DownloadListener- Parameters:
file- The file that was downloadedattrs- Additional attributes about the file. This may include maven coordinates.- Throws:
Exception- , are logged and ignored
-
failure
Description copied from interface:RepositoryPlugin.DownloadListenerCalled when the file could not be downloaded from a remote repository.- Specified by:
failurein interfaceRepositoryPlugin.DownloadListener- Parameters:
file- The file that was intended to be downloaded.- Throws:
Exception- , are logged and ignored
-
progress
Description copied from interface:RepositoryPlugin.DownloadListenerCan be called back regularly before success/failure but never after. Indicates how far the download has progressed in percents. Since downloads can be restarted, it is possible that the percentage decreases.- Specified by:
progressin interfaceRepositoryPlugin.DownloadListener- Parameters:
file- The file that was intended to be downloadedpercentage- Percentage of file downloaded (can go down)- Returns:
- true if the download should continue, fails if it should be canceled (and fail)
- Throws:
Exception- , are logged and ignored
-
getReason
Return a failure reason or null. This method will block until eithersuccess(File)orfailure(File, String)has been called. It can be called many times.- Returns:
- null or a reason for a failure
-
getStage
Return the stage we're in- Returns:
- the current stage
-
getFile
-
getAttributes
-
toString
-