use of org.eclipse.equinox.p2.query.IQueryResult in project tycho by eclipse.
the class ArtifactMatcher method resolveReference.
public static IInstallableUnit resolveReference(String type, String id, Version version, LinkedHashSet<IInstallableUnit> candidateUnits) throws IllegalArtifactReferenceException {
if (id == null) {
throw new IllegalArtifactReferenceException("ID is required");
}
VersionRange versionRange = getVersionRangeFromReference(version);
IQuery<IInstallableUnit> query = QueryUtil.createLatestQuery(ArtifactTypeHelper.createQueryFor(type, id, versionRange));
IQueryResult<IInstallableUnit> matchingIUs = query.perform(candidateUnits.iterator());
if (matchingIUs.isEmpty()) {
return null;
} else {
return matchingIUs.iterator().next();
}
}
use of org.eclipse.equinox.p2.query.IQueryResult in project tycho by eclipse.
the class VerifierServiceImpl method verifyReferencedArtifactsExist.
private boolean verifyReferencedArtifactsExist(final IMetadataRepository metadata, final IArtifactRepository artifactRepository, MavenLogger logger) {
final IQueryResult<IInstallableUnit> collector = metadata.query(QueryUtil.ALL_UNITS, monitor);
boolean valid = true;
for (Iterator<IInstallableUnit> iterator = collector.iterator(); iterator.hasNext(); ) {
IInstallableUnit iu = iterator.next();
final Collection<IArtifactKey> artifacts = iu.getArtifacts();
for (IArtifactKey key : artifacts) {
valid &= verifyArtifactExists(key, artifactRepository, logger);
}
}
return valid;
}
use of org.eclipse.equinox.p2.query.IQueryResult in project tycho by eclipse.
the class ResolutionDataImpl method setAvailableIUsAndFilter.
/**
* Sets the available installable units, removing all non-applicable execution environment
* units.
*
* @see #setAvailableIUs(Collection)
*/
public void setAvailableIUsAndFilter(IQueryable<IInstallableUnit> unfilteredAvailableUnits) {
this.availableIUs = new LinkedHashSet<>();
IQueryResult<IInstallableUnit> allUnits = unfilteredAvailableUnits.query(QueryUtil.ALL_UNITS, new NullProgressMonitor());
copyApplyingEEFilter(allUnits.iterator(), this.availableIUs, eeResolutionHints);
}
Aggregations