Class ArtifactorySearch


  • @ThreadSafe
    public class ArtifactorySearch
    extends java.lang.Object
    Class of methods to search Artifactory for hashes and determine Maven GAV from there. Data classes copied from JFrog's artifactory-client-java project.
    Author:
    nhenneaux
    • Constructor Summary

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

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected boolean init​(com.fasterxml.jackson.core.JsonParser parser)  
      boolean preflightRequest()
      Performs a pre-flight request to ensure the Artifactory service is reachable.
      protected java.util.List<MavenArtifact> processResponse​(Dependency dependency, java.net.HttpURLConnection conn)
      Process the Artifactory response.
      java.util.List<MavenArtifact> search​(Dependency dependency)
      Searches the configured Central URL for the given hash (MD5, SHA1 and SHA256).
      • Methods inherited from class java.lang.Object

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

      • ArtifactorySearch

        public ArtifactorySearch​(Settings settings)
        Creates a NexusSearch for the given repository URL.
        Parameters:
        settings - the configured settings
    • Method Detail

      • search

        public java.util.List<MavenArtifact> search​(Dependency dependency)
                                             throws java.io.IOException
        Searches the configured Central URL for the given hash (MD5, SHA1 and SHA256). If the artifact is found, a MavenArtifact is populated with the GAV.
        Parameters:
        dependency - the dependency for which to search (search is based on hashes)
        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
      • processResponse

        protected java.util.List<MavenArtifact> processResponse​(Dependency dependency,
                                                                java.net.HttpURLConnection conn)
                                                         throws java.io.IOException
        Process the Artifactory response.
        Parameters:
        dependency - the dependency
        conn - the HTTP URL Connection
        Returns:
        a list of the Maven Artifact information
        Throws:
        java.io.IOException - thrown if there is an I/O error
      • init

        protected boolean init​(com.fasterxml.jackson.core.JsonParser parser)
                        throws java.io.IOException
        Throws:
        java.io.IOException
      • preflightRequest

        public boolean preflightRequest()
        Performs a pre-flight request to ensure the Artifactory service is reachable.
        Returns:
        true if Artifactory could be reached; otherwise false.