Search in sources :

Example 1 with PatternResultFileSet

use of org.jfrog.build.api.dependency.PatternResultFileSet in project build-info by JFrogDev.

the class AntPatternsDependenciesHelper method performPatternSearch.

private Set<DownloadableArtifact> performPatternSearch(DependencyPattern dependencyPattern) throws IOException {
    Set<DownloadableArtifact> downloadableArtifacts = Sets.newHashSet();
    String pattern = dependencyPattern.getPattern();
    PatternResultFileSet fileSet = downloader.getClient().searchArtifactsByPattern(pattern);
    Set<String> filesToDownload = fileSet.getFiles();
    log.info("Found " + filesToDownload.size() + " dependencies by doing a pattern search.");
    for (String fileToDownload : filesToDownload) {
        downloadableArtifacts.add(new DownloadableArtifact(fileSet.getRepoUri(), dependencyPattern.getTargetDirectory(), fileToDownload, dependencyPattern.getMatrixParams(), pattern, dependencyPattern.getPatternType()));
    }
    return downloadableArtifacts;
}
Also used : PatternResultFileSet(org.jfrog.build.api.dependency.PatternResultFileSet) DownloadableArtifact(org.jfrog.build.api.dependency.DownloadableArtifact)

Example 2 with PatternResultFileSet

use of org.jfrog.build.api.dependency.PatternResultFileSet in project build-info by JFrogDev.

the class ArtifactoryDependenciesClient method searchArtifactsByPattern.

public PatternResultFileSet searchArtifactsByPattern(String pattern) throws IOException {
    PreemptiveHttpClient client = httpClient.getHttpClient();
    String url = artifactoryUrl + "/api/search/pattern?pattern=" + pattern;
    PatternResultFileSet result = readResponse(client.execute(new HttpGet(url)), new TypeReference<PatternResultFileSet>() {
    }, "Failed to search artifact by the pattern '" + pattern + "'", false);
    return result;
}
Also used : PreemptiveHttpClient(org.jfrog.build.client.PreemptiveHttpClient) PatternResultFileSet(org.jfrog.build.api.dependency.PatternResultFileSet) HttpGet(org.apache.http.client.methods.HttpGet)

Aggregations

PatternResultFileSet (org.jfrog.build.api.dependency.PatternResultFileSet)2 HttpGet (org.apache.http.client.methods.HttpGet)1 DownloadableArtifact (org.jfrog.build.api.dependency.DownloadableArtifact)1 PreemptiveHttpClient (org.jfrog.build.client.PreemptiveHttpClient)1