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 -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Called when the file could not be downloaded from a remote repository.getFile()
Return a failure reason or null.getStage()
Return the stage we're inboolean
Can be called back regularly before success/failure but never after.void
Called when the file is successfully downloaded from a remote repository.void
Called when the file is successfully downloaded from a remote repository.toString()
-
Field Details
-
logger
private static final org.slf4j.Logger logger -
stage
-
failure
-
file
-
attrs
-
reporter
-
resolved
-
-
Constructor Details
-
DownloadBlocker
-
-
Method Details
-
success
Description copied from interface:RepositoryPlugin.DownloadListener
Called when the file is successfully downloaded from a remote repository.- Specified by:
success
in interfaceRepositoryPlugin.DownloadListener
- Parameters:
file
- The file that was downloaded- Throws:
Exception
- , are logged and ignored
-
success
Description copied from interface:RepositoryPlugin.DownloadListener
Called when the file is successfully downloaded from a remote repository.- Specified by:
success
in 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.DownloadListener
Called when the file could not be downloaded from a remote repository.- Specified by:
failure
in interfaceRepositoryPlugin.DownloadListener
- Parameters:
file
- The file that was intended to be downloaded.- Throws:
Exception
- , are logged and ignored
-
progress
Description copied from interface:RepositoryPlugin.DownloadListener
Can 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:
progress
in 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
-