Class DownloadBlocker

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  DownloadBlocker.Stage  
    • Constructor Summary

      Constructors 
      Constructor Description
      DownloadBlocker​(aQute.service.reporter.Reporter reporter)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void failure​(java.io.File file, java.lang.String reason)
      Called when the file could not be downloaded from a remote repository.
      java.util.Map<java.lang.String,​java.lang.String> getAttributes()  
      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.
      void success​(java.io.File file, java.util.Map<java.lang.String,​java.lang.String> attrs)
      Called when the file is successfully downloaded from a remote repository.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • DownloadBlocker

        public DownloadBlocker​(aQute.service.reporter.Reporter reporter)
    • Method Detail

      • success

        public void success​(java.io.File file)
                     throws java.lang.Exception
        Description copied from interface: RepositoryPlugin.DownloadListener
        Called when the file is successfully downloaded from a remote repository.
        Specified by:
        success in interface RepositoryPlugin.DownloadListener
        Parameters:
        file - The file that was downloaded
        Throws:
        java.lang.Exception - , are logged and ignored
      • success

        public void success​(java.io.File file,
                            java.util.Map<java.lang.String,​java.lang.String> attrs)
                     throws java.lang.Exception
        Description copied from interface: RepositoryPlugin.DownloadListener
        Called when the file is successfully downloaded from a remote repository.
        Specified by:
        success in interface RepositoryPlugin.DownloadListener
        Parameters:
        file - The file that was downloaded
        attrs - Additional attributes about the file. This may include maven coordinates.
        Throws:
        java.lang.Exception - , are logged and ignored
      • failure

        public void failure​(java.io.File file,
                            java.lang.String reason)
                     throws java.lang.Exception
        Description copied from interface: RepositoryPlugin.DownloadListener
        Called when the file could not be downloaded from a remote repository.
        Specified by:
        failure in interface RepositoryPlugin.DownloadListener
        Parameters:
        file - The file that was intended to be downloaded.
        Throws:
        java.lang.Exception - , are logged and ignored
      • progress

        public boolean progress​(java.io.File file,
                                int percentage)
                         throws java.lang.Exception
        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 interface RepositoryPlugin.DownloadListener
        Parameters:
        file - The file that was intended to be downloaded
        percentage - Percentage of file downloaded (can go down)
        Returns:
        true if the download should continue, fails if it should be canceled (and fail)
        Throws:
        java.lang.Exception - , are logged and ignored
      • getReason

        public java.lang.String getReason()
        Return a failure reason or null. This method will block until either success(File) or failure(File, String) has been called. It can be called many times.
        Returns:
        null or a reason for a failure
      • getStage

        public DownloadBlocker.Stage getStage()
        Return the stage we're in
        Returns:
        the current stage
      • getFile

        public java.io.File getFile()
      • getAttributes

        public java.util.Map<java.lang.String,​java.lang.String> getAttributes()
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object