use of org.eclipse.equinox.p2.core.ProvisionException in project tycho by eclipse.
the class RemoteMetadataRepositoryManager method loadRepository.
@Override
public IMetadataRepository loadRepository(URI location, int flags, IProgressMonitor monitor) throws ProvisionException, OperationCanceledException {
URI effectiveLocation = translateAndPrepareLoad(location);
IMetadataRepository loadedRepository = delegate.loadRepository(effectiveLocation, flags, monitor);
failIfRepositoryContainsPartialIUs(loadedRepository, effectiveLocation);
return loadedRepository;
}
use of org.eclipse.equinox.p2.core.ProvisionException in project tycho by eclipse.
the class RemoteMetadataRepositoryManager method failIfRepositoryContainsPartialIUs.
private void failIfRepositoryContainsPartialIUs(IMetadataRepository repository, URI effectiveLocation) throws ProvisionException {
IQueryResult<IInstallableUnit> allUnits = repository.query(QueryUtil.ALL_UNITS, null);
boolean hasPartialIUs = false;
for (IInstallableUnit unit : allUnits.toUnmodifiableSet()) {
if (Boolean.valueOf(unit.getProperty(IInstallableUnit.PROP_PARTIAL_IU))) {
hasPartialIUs = true;
logger.error("Partial IU: " + unit.getId());
}
}
if (hasPartialIUs) {
String message = "The p2 repository at " + effectiveLocation + " contains partial IUs (see above) from an old style update site which cannot be used for dependency resolution";
throw new ProvisionException(message);
}
}
use of org.eclipse.equinox.p2.core.ProvisionException in project tycho by eclipse.
the class VerifierServiceImpl method verify.
@Override
public boolean verify(URI metadataRepositoryUri, URI artifactRepositoryUri, BuildOutputDirectory tempDirectory) throws FacadeException {
MavenLogger logger = mavenContext.getLogger();
logger.debug("Checking metadata from '" + metadataRepositoryUri + "' and artifacts from '" + artifactRepositoryUri + "'");
IProvisioningAgent agent = Activator.createProvisioningAgent(tempDirectory);
try {
try {
final IMetadataRepository metadata = loadMetadataRepository(metadataRepositoryUri, agent);
final IArtifactRepository artifactRepository = loadArtifactRepository(artifactRepositoryUri, agent);
boolean valid = true;
valid &= verifyReferencedArtifactsExist(metadata, artifactRepository, logger);
valid &= verifyAllArtifactContent(artifactRepository, logger);
if (valid) {
logger.info("The integrity of the metadata repository '" + metadataRepositoryUri + "' and artifact repository '" + artifactRepositoryUri + "' has been verified successfully");
}
return valid;
} catch (ProvisionException e) {
throw new FacadeException(e);
}
} finally {
agent.stop();
}
}
use of org.eclipse.equinox.p2.core.ProvisionException in project tycho by eclipse.
the class Activator method createProvisioningAgent.
public static IProvisioningAgent createProvisioningAgent(final URI targetLocation) throws ProvisionException {
ServiceReference<IProvisioningAgentProvider> serviceReference = context.getServiceReference(IProvisioningAgentProvider.class);
IProvisioningAgentProvider agentFactory = context.getService(serviceReference);
try {
return agentFactory.createAgent(targetLocation);
} finally {
context.ungetService(serviceReference);
}
}
Aggregations