Package org.artifactory.search
Interface Searches
-
public interface Searches
Public API for executing searches- Author:
- Yoav Landman
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
aql(String aqlQuery, AqlResultHandler handler)
Perform a search using Artifactory Query Language (AQL).List<RepoPath>
archiveEntriesByName(String query, String... repositories)
Search the content of jar/zip archivesList<RepoPath>
artifactsByGavc(String groupId, String artifactId, String version, String classifier, String... repositories)
List<RepoPath>
artifactsByName(String query, String... repositories)
Find artifacts by nameSet<RepoPath>
artifactsBySha1(String sha1, String... repositories)
Find artifacts by their checksum valuesSet<RepoPath>
artifactsBySha256(String sha256, String... repositories)
Find artifacts by their checksum valuesList<RepoPath>
artifactsCreatedOrModifiedInRange(Calendar from, Calendar to, String... repositories)
Find artifacts created or modified within a date rangeList<RepoPath>
artifactsNotDownloadedSince(Calendar since, Calendar createdBefore, String... repositories)
Find artifacts not downloaded since the specified date, searches for both locally and remotely downloaded stats, using smart remote repository stats where applicable.Set<BuildRun>
buildsByArtifactSha1(String sha1)
Find all build runs that produced the artifact with the provided sha1 checksumSet<BuildRun>
buildsByArtifactSha1(String sha1, String buildRepo)
Find all build runs that produced the artifact with the provided sha1 checksumSet<BuildRun>
buildsByDependencySha1(String sha1)
Find all build runs that used a dependency with the provided sha1 checksumSet<BuildRun>
buildsByDependencySha1(String sha1, String buildRepo)
Find all build runs that used a dependency with the provided sha1 checksumList<RepoPath>
itemsByProperties(com.google.common.collect.SetMultimap<String,String> properties, String... repositories)
Find artifacts by properties
-
-
-
Method Detail
-
artifactsByName
List<RepoPath> artifactsByName(String query, String... repositories)
Find artifacts by name- Parameters:
query
- The search query term for the artifact namerepositories
- A list of repositories to search in. Can be null to search all repositories- Returns:
- Artifacts found by the search, empty list if nothing was found
-
itemsByProperties
List<RepoPath> itemsByProperties(com.google.common.collect.SetMultimap<String,String> properties, String... repositories)
Find artifacts by properties- Parameters:
properties
- A set of key-value properties to search for on artifacts or folders. All specified properties need to exist on found items. If multiple values are used a contains() semantic is appliedrepositories
- A list of repositories to search in. Can be null to search all repositories.- Returns:
- Artifacts matching the criteria
-
archiveEntriesByName
List<RepoPath> archiveEntriesByName(String query, String... repositories)
Search the content of jar/zip archives- Parameters:
query
- The search term for the archive of the entryrepositories
- A list of repositories to search in. Can be null to search all repositories.- Returns:
- List of zip resources repo path matching the criteria
-
artifactsByGavc
List<RepoPath> artifactsByGavc(@Nullable String groupId, @Nullable String artifactId, @Nullable String version, @Nullable String classifier, String... repositories)
-
artifactsBySha1
Set<RepoPath> artifactsBySha1(String sha1, String... repositories)
Find artifacts by their checksum values- Parameters:
sha1
- The sha1 checksum of the artifactrepositories
- A list of repositories to search in. Can be null to search all repositories- Returns:
- Set of repo paths that comply with the given checksums
-
artifactsBySha256
Set<RepoPath> artifactsBySha256(String sha256, String... repositories)
Find artifacts by their checksum values- Parameters:
sha256
- The sha256 checksum of the artifactrepositories
- A list of repositories to search in. Can be null to search all repositories- Returns:
- Set of repo paths that comply with the given checksums
-
artifactsCreatedOrModifiedInRange
List<RepoPath> artifactsCreatedOrModifiedInRange(@Nullable Calendar from, @Nullable Calendar to, String... repositories)
Find artifacts created or modified within a date range- Parameters:
from
- The time to start the search exclusive (eg, >). If empty will start from 1st Jan 1970to
- The time to end search inclusive (eg, <=), If null, will not use current time as the limitrepositories
- A list of repositories to search in. Can be null to search all repositories.- Returns:
- List of file repo paths that were created or modified between the input time range and the date the file was modified.
-
artifactsNotDownloadedSince
List<RepoPath> artifactsNotDownloadedSince(@Nullable Calendar since, @Nullable Calendar createdBefore, String... repositories)
Find artifacts not downloaded since the specified date, searches for both locally and remotely downloaded stats, using smart remote repository stats where applicable.- Parameters:
since
- The time to start the search exclusive (eg, >). If null will start from 1st Jan 1970createdBefore
- Only include artifacts created before the specified time. If null will default to the value of since.repositories
- A list of repositories to search in. Can be null to search all repositories- Returns:
- List of file repo paths that were not downloaded since the specified date
-
buildsByArtifactSha1
Set<BuildRun> buildsByArtifactSha1(String sha1)
Find all build runs that produced the artifact with the provided sha1 checksum- Parameters:
sha1
- The sha1 checksum of the build dependency to search- Returns:
- A list of BuildRuns (may be empty)
-
buildsByArtifactSha1
Set<BuildRun> buildsByArtifactSha1(String sha1, @Nonnull String buildRepo)
Find all build runs that produced the artifact with the provided sha1 checksum- Parameters:
sha1
- The sha1 checksum of the build dependency to searchbuildRepo
- The build info repository- Returns:
- A list of BuildRuns (may be empty)
-
buildsByDependencySha1
Set<BuildRun> buildsByDependencySha1(String sha1)
Find all build runs that used a dependency with the provided sha1 checksum- Parameters:
sha1
- The sha1 cheksum of the build dependency to search- Returns:
- A list of BuildRuns (may be empty)
-
buildsByDependencySha1
Set<BuildRun> buildsByDependencySha1(String sha1, @Nonnull String buildRepo)
Find all build runs that used a dependency with the provided sha1 checksum- Parameters:
sha1
- The sha1 cheksum of the build dependency to searchbuildRepo
- The build info repository- Returns:
- A list of BuildRuns (may be empty)
-
aql
void aql(String aqlQuery, AqlResultHandler handler)
Perform a search using Artifactory Query Language (AQL). This can be used to stream AQL results from Artifactory as map objects. This method accepts a String param with the AQL query, and an AqlResultHandler object (can be a closure).Usage example 1:
Usage example 2:String aqlQuery = "items.find..." searches.aql(aqlQuery) { AqlResult result -> result.each { Map item -> String itemPath = item.path + "/" + item.name //do something } }
AqlResultHandler handler = new AqlResultHandler() { void handle(AqlResult result) { for (Map<String, Object> item : result) { String name = item.name //do something } } } searches.aql(aqlQuery, handler)
- Parameters:
aqlQuery
- The AQL query to performhandler
- The handler (can be a closure)
-
-