Search in sources :

Example 1 with PropertySearchResult

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

the class ArtifactoryDependenciesClient method searchArtifactsByProperties.

public PropertySearchResult searchArtifactsByProperties(String properties) throws IOException {
    PreemptiveHttpClient client = httpClient.getHttpClient();
    String replacedProperties = StringUtils.replaceEach(properties, new String[] { ";", "+" }, new String[] { "&", "" });
    String url = artifactoryUrl + "/api/search/prop?" + replacedProperties;
    PropertySearchResult result = readResponse(client.execute(new HttpGet(url)), new TypeReference<PropertySearchResult>() {
    }, "Failed to search artifact by the properties '" + properties + "'", false);
    return result;
}
Also used : PreemptiveHttpClient(org.jfrog.build.client.PreemptiveHttpClient) HttpGet(org.apache.http.client.methods.HttpGet) PropertySearchResult(org.jfrog.build.api.dependency.PropertySearchResult)

Example 2 with PropertySearchResult

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

the class AntPatternsDependenciesHelper method performPropertySearch.

private Set<DownloadableArtifact> performPropertySearch(DependencyPattern dependencyPattern) throws IOException {
    Set<DownloadableArtifact> downloadableArtifacts = Sets.newHashSet();
    String pattern = dependencyPattern.getPattern();
    String matrixParams = dependencyPattern.getMatrixParams();
    PropertySearchResult propertySearchResult = downloader.getClient().searchArtifactsByProperties(matrixParams);
    List<PropertySearchResult.SearchEntry> filteredEntries = filterResultEntries(propertySearchResult.getResults(), pattern);
    log.info("Found " + filteredEntries.size() + " dependencies by doing a property search.");
    for (PropertySearchResult.SearchEntry searchEntry : filteredEntries) {
        downloadableArtifacts.add(new DownloadableArtifact(searchEntry.getRepoUri(), dependencyPattern.getTargetDirectory(), searchEntry.getFilePath(), matrixParams, pattern, dependencyPattern.getPatternType()));
    }
    return downloadableArtifacts;
}
Also used : DownloadableArtifact(org.jfrog.build.api.dependency.DownloadableArtifact) PropertySearchResult(org.jfrog.build.api.dependency.PropertySearchResult)

Aggregations

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