Class CentralSearch


  • @ThreadSafe
    public class CentralSearch
    extends java.lang.Object
    Class of methods to search Maven Central via Central.
    Author:
    colezlaw
    • Constructor Summary

      Constructors 
      Constructor Description
      CentralSearch​(Settings settings)
      Creates a NexusSearch for the given repository URL.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.List<MavenArtifact> searchSha1​(java.lang.String sha1)
      Searches the configured Central URL for the given SHA1 hash.
      • Methods inherited from class java.lang.Object

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

      • CentralSearch

        public CentralSearch​(Settings settings)
                      throws java.net.MalformedURLException
        Creates a NexusSearch for the given repository URL.
        Parameters:
        settings - the configured settings
        Throws:
        java.net.MalformedURLException - thrown if the configured URL is invalid
    • Method Detail

      • searchSha1

        public java.util.List<MavenArtifact> searchSha1​(java.lang.String sha1)
                                                 throws java.io.IOException,
                                                        TooManyRequestsException
        Searches the configured Central URL for the given SHA1 hash. If the artifact is found, a MavenArtifact is populated with the GAV.
        Parameters:
        sha1 - the SHA-1 hash string for which to search
        Returns:
        the populated Maven GAV.
        Throws:
        java.io.FileNotFoundException - if the specified artifact is not found
        java.io.IOException - if it's unable to connect to the specified repository
        TooManyRequestsException - if Central has received too many requests.